Guest User

OnMove.java

a guest
May 30th, 2016
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main.dartanman.ce.events;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Material;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.player.PlayerMoveEvent;
  11. import org.bukkit.inventory.ItemStack;
  12. import org.bukkit.inventory.PlayerInventory;
  13. import org.bukkit.inventory.meta.ItemMeta;
  14. import org.bukkit.potion.PotionEffectType;
  15.  
  16. import net.md_5.bungee.api.ChatColor;
  17.  
  18. public class OnMove implements Listener{
  19.  
  20. @EventHandler
  21. public void onMove(PlayerMoveEvent event){
  22. Player player = event.getPlayer();
  23. PlayerInventory inv = player.getInventory();
  24. ItemStack dHelmet = new ItemStack(Material.DIAMOND_HELMET);
  25. ItemMeta im = dHelmet.getItemMeta();
  26. List<String> loreList = new ArrayList<String>();
  27.  
  28. if(inv.getHelmet() == dHelmet){
  29. if(im.getLore().contains(ChatColor.RED + "Fish 1")){
  30.  
  31. player.addPotionEffect(PotionEffectType.WATER_BREATHING, 100, 10);
  32. return;
  33. }
  34.  
  35. }
  36. }
  37. }
RAW Paste Data