I am creating a simple drug plugin (Private use) and i am making a "shift-click" option to use the drugs and for some reason when i shift and right click on an item nothing happens. I'm not too great with events yet, so can anyone help me? Event Code: Code:java package net.imphantom.drugs.event; import org.bukkit.Material;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;import org.bukkit.inventory.ItemStack;import org.bukkit.potion.PotionEffect;import org.bukkit.potion.PotionEffectType; public class Consume implements Listener{ @EventHandler public void onPlayerInteract(PlayerInteractEvent e) { Player p = e.getPlayer(); ItemStack green = p.getItemInHand(); if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { if(p.getItemInHand().equals(Material.SUGAR)) { p.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 240, 10)); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 15, 4)); p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 6, 1)); } if(p.getItemInHand().equals(Material.WHEAT) || green.getDurability() == 2) { p.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 120, 1)); p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 25, 2)); p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 15, 1)); } } } } Registering the Event in my onEnable: Code:java this.getServer().getPluginManager().registerEvents(new Consume(), this); Note: My consume class is in a separate package.
Change line 22 into: and line 29 into: Note: You know your cheking for: Item is Wheat OR Durability is 2, right?
2MBKindiegames I am still having issues. When i right click nothing happens. And with the durability thing. I thought that was how you got access to the Cactus Green item, since theres no material for it.