Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onInteract(final PlayerInteractEvent e) {
- // This code isn't the current one in the plugin, but it's a much more simplfied version.
- Player player = e.getPlayer();
- final PlayerInventory inventory = player.getInventory();
- if(e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK){
- if(inventory.contains(Material.GLOWSTONE_DUST, 1)) {
- if (e.getPlayer().getItemInHand().getType()==Material.WOOD_HOE) {
- Arrow arrow = (Arrow)player.launchProjectile(Arrow.class);
- arrow.setShooter(player);
- inventory.removeItem(new ItemStack(Material.GLOWSTONE_DUST, 1));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment