SHARE
TWEET

Untitled

a guest Aug 13th, 2019 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.icoldbear.coldweed;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Material;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.EventPriority;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.block.Action;
  10. import org.bukkit.event.player.PlayerInteractEvent;
  11. import org.bukkit.inventory.ItemStack;
  12. import org.bukkit.potion.PotionEffectType;
  13.  
  14. public class WeedListener implements Listener {
  15.    
  16.     @EventHandler(priority=EventPriority.HIGH)
  17.     public void onWeedRightClick(PlayerInteractEvent e) {
  18.         Player p = (Player) e.getPlayer();
  19.         ItemStack item = e.getItem();
  20.        
  21.         if (e.getAction() == Action.RIGHT_CLICK_AIR) {
  22.             if (item != null && item.getType() == Material.SUGAR_CANE) {
  23.                 p.sendMessage(ChatColor.LIGHT_PURPLE + "I feel light headed...");
  24.                 p.addPotionEffect(PotionEffectType.SPEED.createEffect(40, 10));
  25.             }
  26.         }
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top