Code: @EventHandler public void onInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); if(event.getPlayer().getItemInHand().getType() == Material.FEATHER) { if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30, 7)); } } } I am having a problem with the duration of the speed. I set it to 30 but it only seems to last a couple of seconds. I cannot tell why this is happening.
30 ticks is only 1.5 seconds. If you want it to last 30 second then set it to 600 rather than 30. To find this sort of info you can read the documentation that states the duration is in the unit time of ticks: http://jd.bukkit.org/dev/apidocs/org/bukkit/potion/PotionEffectType.html#createEffect