Night Vision

Discussion in 'Plugin Development' started by Nathan674329, Oct 7, 2016.

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

    Nathan674329

    I'm trying to make a night vision plugin but make it a special command just because i like commands that don't start with a slash.


    Code:
    http://pastebin.com/Kcr1G6Vn


    Error:
    http://pastebin.com/Q0qDT6RV




    If i have night vision then >nv will disable it but >nv wont enable night vision for some reason.
     
  2. @Nathan674329
    I'd assume you're doing this on the AsyncPlayerChatEvent, which is asyncronous, meaning you cannot change anything on the actual minecraft server in a thread-safe way. What you should do is schedule a synchronous BukkitRunnable and in that add the potion effect.
     
  3. Offline

    Nathan674329

    How do i schedule a synchronous BukkitRunnable?
     
  4. @Nathan674329
    Basically just a normal BukkitRunnable. Like this:
    Code:java
    1. new BukkitRunnable() {
    2. @Override
    3. public void run() {
    4. // Your code here
    5. }
    6. }.runTask(mainClass)
     
  5. Offline

    Nathan674329

    thanks
     
  6. Offline

    Zombie_Striker

    @Nathan674329
    If your problem has been solved, mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page