I am making a plugin where you can use an item like a fire charge and it shoots out a fireball when you right click. It works but spamming it is op so is there a way I could temp make it a different item for like 5 Seconds it becomes dirt for 5 Seconds then goes back. Essentially it is a way to cooldown the item for 5 Seconds This is my main class Code: package me.snake4212.MapCrashers; import me.snake4212.MapCrashers.MapCrashersListener; import org.bukkit.plugin.java.JavaPlugin; public class MapCrashersMain extends JavaPlugin{ public void onEnable(){ getServer().getPluginManager().registerEvents(new MapCrashersListener(), this); } public void onDisable(){ } } This is my listener Code: package me.snake4212.MapCrashers; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Fireball; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; public class MapCrashersListener implements Listener { public MapCrashersListener() { } @EventHandler public void onPowerActivation(PlayerInteractEvent event) { Player player = event.getPlayer(); if (((event.getAction() == Action.RIGHT_CLICK_AIR) || (event.getAction() == Action.RIGHT_CLICK_BLOCK)) && (player.getItemInHand().getEnchantmentLevel(Enchantment.ARROW_FIRE) == 5)) { player.launchProjectile(Fireball.class); }else { event.setCancelled(true); } } }
just set the item to a stick or something, then use schedulers to set it back later T3h Cr33p3r that's an even cooler idea! EDIT by Moderator: merged posts, please use the edit button instead of double posting.
That seems good problem im stupid and don't know what to do from that lol I wish I could understand please add me on skype I will pm u it lolk -_- nothing but breaking the plugin EDIT by Moderator: merged posts, please use the edit button instead of double posting.