Solved Constantly checking if a player is in an arraylist

Discussion in 'Plugin Development' started by ThatGuyWhoDied13, Dec 15, 2013.

Thread Status:
Not open for further replies.
  1. Hey, so in my plugin I've got a double coins bonus if a player steps on a redstone_block after finishing the parkour, when checking for coins to add I check if the player is in the arraylist and apply the 2x coins. Now heres the tricky part I want to always check if a player is in an array list because those who are in te arraylist get some special particle effects.

    I tried PlayerMoveEvent but that just made a large area of the effect and failed
    I kicked the player and when they rejoined I told them that they finished the parkour and they ave 2x coins for 2hrs, but I don't want to kick people for not doing bad things.

    Any help??

  2. Offline


    Make a runnable.
  3. sgavster Inside which method though
  4. Offline


    KevyPorter A new class
    1. public class MyRunnable implements Runnable {
    2. private final YOUR_MAIN_CLASS plugin;
    3. public MyRunnable(YOUR_MAIN_CLASS plugin) {
    4. this.plugin = plugin;
    5. }
    6. public void run() {
    7. for(Player p : Bukkit.getOnlinePlayers()) {
    8. if(plugin.arrayListName.contains(p.getName()) {
    9. //code
    10. }
    11. }
    12. }
    13. }

  5. sgavster Ah, Thanks now it works fine
Thread Status:
Not open for further replies.

Share This Page