From 3d88f355fb3da8a6b59ab053f069fc832835c275 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 2 Dec 2016 22:33:03 -0500 Subject: [PATCH] Got rid of some static... that might help? --- .../FlairColouringComponent.java | 4 ---- .../flaircolouring/letterdyes/LetterDye.java | 3 --- .../letterdyes/LetterDyeListener.java | 21 +++++++++++-------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/alisolarflare/components/flaircolouring/FlairColouringComponent.java b/src/alisolarflare/components/flaircolouring/FlairColouringComponent.java index 5b07a57..fe7f149 100644 --- a/src/alisolarflare/components/flaircolouring/FlairColouringComponent.java +++ b/src/alisolarflare/components/flaircolouring/FlairColouringComponent.java @@ -3,15 +3,11 @@ package alisolarflare.components.flaircolouring; import java.util.ArrayList; import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; -import com.earth2me.essentials.Essentials; - import alisolarflare.architecture.Component; import alisolarflare.components.flaircolouring.letterdyes.GetLetterDye; -import alisolarflare.components.flaircolouring.letterdyes.LetterDyeListener; import alisolarflare.components.flaircolouring.portals.FlairMe; import alisolarflare.components.flaircolouring.portals.PlayerProximityLoop; import alisolarflare.components.flaircolouring.portals.PortalListener; diff --git a/src/alisolarflare/components/flaircolouring/letterdyes/LetterDye.java b/src/alisolarflare/components/flaircolouring/letterdyes/LetterDye.java index 3b90335..9c9e5df 100644 --- a/src/alisolarflare/components/flaircolouring/letterdyes/LetterDye.java +++ b/src/alisolarflare/components/flaircolouring/letterdyes/LetterDye.java @@ -6,9 +6,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; public class LetterDye { - public static boolean isLetterDye(ItemStack item){ - return true; - } public static ItemStack getLetterDye(){ ItemStack item = new ItemStack(Material.INK_SACK); item.addUnsafeEnchantment(Enchantment.LUCK, 10); diff --git a/src/alisolarflare/components/flaircolouring/letterdyes/LetterDyeListener.java b/src/alisolarflare/components/flaircolouring/letterdyes/LetterDyeListener.java index 8bb5aa8..be65de6 100644 --- a/src/alisolarflare/components/flaircolouring/letterdyes/LetterDyeListener.java +++ b/src/alisolarflare/components/flaircolouring/letterdyes/LetterDyeListener.java @@ -21,16 +21,19 @@ public class LetterDyeListener implements Listener{ } @EventHandler public void onLetterDye(PlayerInteractEvent event){ - if((event.getAction() == Action.PHYSICAL)) return; - if (LetterDye.isLetterDye(event.getItem())) return; - ItemStack item = event.getItem(); - if(item.getType() != Material.INK_SACK) return; - if(item.getItemMeta().hasEnchant(Enchantment.LUCK) && (item.getItemMeta().getEnchantLevel(Enchantment.LUCK) == 10)) return; - if(item.getItemMeta().getDisplayName() == "LetterDye") return; + try{ + if((event.getAction() != Action.RIGHT_CLICK_AIR)) return; + ItemStack item = event.getItem(); + if(item.getType() != Material.INK_SACK) return; + if(item.getItemMeta().hasEnchant(Enchantment.LUCK) && (item.getItemMeta().getEnchantLevel(Enchantment.LUCK) == 10)) return; + if(item.getItemMeta().getDisplayName() == "LetterDye") return; - Dye dye = (Dye) event.getItem().getData(); - User user = essentials.getUser(event.getPlayer()); - user.setNickname(FlairColouringAPI.colourShiftRight(user._getNickname(), dye.getColor())); + Dye dye = (Dye) event.getItem().getData(); + User user = essentials.getUser(event.getPlayer()); + user.setNickname(FlairColouringAPI.colourShiftRight(user._getNickname(), dye.getColor())); + }catch(Exception e){ + event.getPlayer().sendMessage(e.getStackTrace().toString()); + } } }