Remove entities onDisable

Discussion in 'Plugin Development' started by elementalgodz11, May 17, 2014.

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

    elementalgodz11

    I am trying to remove entities onDisable() with the following, if I do it with a command it will work fine, but not with this. The problem is that the entities don't get removed, as you can see I've tried scheduling a tick delay to see if that would help

    Code:
    public void onDisable() {
     
        getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
         
            public void run() {
                 
                for (Entity entities: Bukkit.getServer().getWorld("world").getEntities()) {
     
                    entities.remove();
                 
                }
         
            }
     
        });
     
    }
    
     
  2. Offline

    rsod

    After onDisable called, there will be no ticks anymore.
    Might be that world is unloaded before your plugin trying to work with it.
     
Thread Status:
Not open for further replies.

Share This Page