I just did an test code. But, it does not work. Eclipse and the console don't throw an error. I hope u can help me Here is my code: PHP: import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.event.Listener; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @SuppressWarnings("unused") public class test implements CommandExecutor { private main plugin; public test(main instance) { this.plugin = instance; } @Override public boolean onCommand(CommandSender s, Command cmd, String label, String[] args) { if(cmd.getName().equalsIgnoreCase("test")) { Player p = (Player)s; plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { Bukkit.broadcastMessage("This message should be sent after 3 seconds"); } }, 20L); } return true; } }
PHP: package main; import org.bukkit.plugin.java.JavaPlugin; public class main extends JavaPlugin{ public void onEnable() { new test(this); } }
You need to add setExecutor on (onEnable) add this "getCommand("test").setExecutor(new test(this));" It should work Edit: And remove newtest(this); <-- You don't need this , replace this one with the method.