Solved A little problem in my code :/

Discussion in 'Plugin Development' started by xFoundation, Apr 22, 2017.

Thread Status:
Not open for further replies.
  1. Hello guys,

    Today I have a problem in my code.

    So when the game has enough player, the countdown starts, and there is a message (The game is starting..)
    And i'm trying to give Speed II to everyone in the server.
    Don't pay attention to 240L , i wrote this to have this task 1 sec after the previous one.


    Code:
    getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
            public void run() {
    
                for(Player pls : Bukkit.getServer().getOnlinePlayers()) {
                pls.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2, 100)); // It doesn't works
                }
            }
        }, 240L);
        }

    [​IMG]

    Thanks for the help!
     
    Last edited: Apr 22, 2017
  2. Offline

    Horsey

    Change Async to Sync. I believe that should work.
     
  3. Offline

    Zombie_Striker

  4. Thanksss!!!!!

    (Maybe i will upgrade the version, but not now)
     
  5. Offline

    Horsey

    Haha you're welcome! I suggest that you Google your error, plenty of people have the same error as you, and you could just view an old topic instead of creating a new one.
     
Thread Status:
Not open for further replies.

Share This Page