Suggested name: Phantom What I want: I would like it to have a feather and when you right click the feather you get fly for 5 seconds, but it has a 60 second cooldown. Ideas for commands: No commands needed for this plugin. Ideas for permissions: Phantom.fly When I'd like it by: Soon as possible
I like this idea, the amount of time you should be able to fly and cooldown should be changeable in the config.
easy: Code: public Map<Player, Long> flycd = new HashMap<Player, Long>(); public void onPlayerInteractBlock(PlayerInteractEvent event){ if(event.getPlayer().getItemInHand().getTypeId() == Material._FEATHER.getId()){ final Player player = event.getPlayer(); long temp = System.currentTimeMillis(); if(flycd.containsKey(event.getPlayer())){ if (((this.plugin.getConfig().getInt("Fly-Cooldown"))*1000)<(temp-(flycd.get(event.getPlayer())))) { player.setAllowFlight(true); player.setFlying(true); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { player.setFlying(false); player.setAllowFlight(false); } }, 60*20); flycd.put(event.getPlayer(), temp); } else { if (!player.isFlying()||!player.getAllowFlight()){ event.getPlayer().sendMessage(ChatColor.DARK_RED+"Fly is not ready"); } } } else { player.setAllowFlight(true); player.setFlying(true); player.sendMessage(ChatColor.GOLD+"Fly is activated"); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { player.setFlying(false); player.setAllowFlight(false); } }, 60*20); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { player.sendMessage(ChatColor.GOLD+"Remaining time to fly: 10 seconds"); } }, (60*20)-200); flycd.put(event.getPlayer(), temp); } } } } } } Feel free to compile i t
Keyboard I have made the plugin you requested. I can be downloaded here: https://www.dropbox.com/s/rb9si544o1gyz05/Phantom.jar or by clicking this