Hidden Player Code

Discussion in 'Plugin Development' started by PuppersRbae, Aug 7, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    PuppersRbae

    Can someone write me a snippet of code so when the player is in hide.Player it will display no particle effect, but when they are out of hide.Player it will show the particle effect WITCH_MAGIC
     
  2. Offline

    Zombie_Striker

    @PuppersRbae
    We are not here to write code for you. Please read the stickie if you had not already, as this was already covered there:
    https://bukkit.org/threads/read-me-first-how-to-make-a-plugin-development-thread.395844/
    To do what you want, do the following:
    1. Create a Hashmap. The keys are UUIDs and the values are Integers. This represents all the uuids of players who are staying still, and for how long.
    2. Listen to player move event
    3. If the player's getTo is different than the getFrom, they moved, so remove them from the arraylist if they are in it.
    4. In the onEnable
    5. Create a new BukkitRunnable. Loop every second.
    6. In it, check if the hashmap does contain the player. If it does, add +1 to the number in the hashmap. If not, add the player to the hashmap with value 0.
    7. After this, now you can spawn the particles if the integer values is greater than some value.
    There are quite a few particle libs/utils/methods that you can use, which one you use depends on the server version you need to support.
     
Thread Status:
Not open for further replies.

Share This Page