You don't seem to have registered your events in the onEnable(), or even have an onEnable() for that matter. Unless, of course, that's not the entire class, in which case the best advice I can give you is to debug.
Just making sure. It's actually quite a common mistake. Anyway, like I said, try debugging. Also, what exactly is your issue with this?
Fixed.. Code: public int cooldown2 = 30; public String PhantomCooldownMessage = ChatColor.RED + "Aguarde outros %s segundos para usar a habilidade novamente!"; public int PhantomItemId = Material.FEATHER.getId(); HashMap<String, Long> Phantom = new HashMap<String, Long>(); @EventHandler public void onRightClick(PlayerInteractEvent event) { final Player player = event.getPlayer(); if((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)){ ItemStack item = event.getPlayer().getItemInHand(); if (item.getTypeId() == PhantomItemId) { long lastUsed = 0; if (Phantom.containsKey(player.getName())) lastUsed = Phantom.get(player.getName()); if (lastUsed + (1000 * cooldown2) > System.currentTimeMillis()) { event.getPlayer().sendMessage( String.format(PhantomCooldownMessage, (-((System.currentTimeMillis() - (lastUsed + (1000 * cooldown2))) / 1000)))); } else { player.setAllowFlight(true); player.setFlying(true); player.sendMessage(ChatColor.GREEN + ChatColor.ITALIC.toString() + "Modo de voo ativado por 5 segundos!"); player.playSound(player.getLocation(), Sound.NOTE_PIANO, 10, 0); Phantom.put(player.getName(), System.currentTimeMillis()); getServer().getScheduler().scheduleSyncDelayedTask(this, new Thread(new Runnable() { public void run() { player.setAllowFlight(false); player.setFlying(false); } }), 100L); } } } }
The only case in coding bukkit plugins that ive had to use the transient modifier is when working with merchants.