Skip to content

Instantly share code, notes, and snippets.

@keepoff07
Last active August 29, 2015 14:07
Show Gist options
  • Save keepoff07/7cd05a6e38eacd9388d8 to your computer and use it in GitHub Desktop.
Save keepoff07/7cd05a6e38eacd9388d8 to your computer and use it in GitHub Desktop.
Schedulerのサンプル
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
final Player p = e.getPlayer();
ItemStack item = p.getItemInHand();
if(e.getAction().equals(Action.RIGHT_CLICK_AIR)||e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
if(item.getType().equals(Material.SUGAR)){
Bukkit.getScheduler().runTaskLater(this, new Runnable(){
public void run(){
Bukkit.broadcastMessage("Delay:"+p.getName());
}
}, 20);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment