Particle Effects

Discussion in 'Plugin Development' started by PeterXonwiiXx, Nov 23, 2015.

Thread Status:
Not open for further replies.
  1. how can i add unlimited time to a Particle Effect?
    tried searching everywhere but :(

    Thanks in advance
     
  2. Offline

    mcdorli

    ??? Like it lives forever?
     
  3. i made command and i want when they type command it enables,,that works (but its not unlimited)

    2.and i want if they type the same command it will else{ disble particle effect and unlimited
     
  4. Offline

    mcdorli

    Start a bukkitRunnable, and if they type the command again, cancel it.
     
  5. can i make a bukkit runable in a command? never knew that anyway :/
     
  6. Offline

    mcdorli

    Yes, why couldn't you? It is like creating a new thread, except it is only one thread
     
  7. ahhhh ok,,but is it possible to have the particle effect unlimited until they type command again?
     
  8. Offline

    mcdorli

    Yes, I said, use a BukkitRunnable
     
  9. Offline

    q8minecraft

    @mcdorli why don't you create a new Boolean true at first and disable it after executing that command again?
     
  10. Offline

    mcdorli

    Yeah, you're right, you need a hashmap with player uuids as keys and booleans for value, and set the boolean to true if the player entered the command. Then just create one runnable, go trough all players, and spawn particles, if the boolean for their uuids are true.
     
  11. Offline

    RoboticPlayer

    I don't understand why people use HashMaps with a boolean as a value... just use an ArrayList and check if they are in it.
     
  12. Offline

    mcdorli

    Because it is easier? Instead of looping trough an arraylist, you can use .get()
     
  13. Offline

    Scimiguy

    @mcdorli
    Use a HashSet, and contains().

    More efficient, and easier
     
  14. Offline

    RoboticPlayer

    No need to loop through an ArrayList... ArrayList#contains()
     
  15. Offline

    Scimiguy

    @henderry2019
    Or HashSet contains -.-
    If you're not keeping an ordered list and not drawing players in any specific order, you should be using a HashSet.
     
  16. Offline

    RoboticPlayer

  17. Offline

    Scimiguy

    @henderry2019
    Good time to start ;)
    They're not hard at all to pick up
     
  18. Offline

    Xerox262

    They're really just ArrayLists, just you can't have the same thing added more than once (HashSet.add(Value) will return if it was added, false if it's already there, so in your command you could do something like if(!HashSet.add(uuid)) {remove from set because they're already in it}) and you can't use .get() because it does not keep the original order. @Scimiguy is right, it's the best thing to use in this case.
     
Thread Status:
Not open for further replies.

Share This Page