diff --git a/src/main/java/me/blackvein/particles/Eff_1_13_R2.java b/src/main/java/me/blackvein/particles/Eff_1_13_R2.java index bc7eb4c28..0f7d277ea 100644 --- a/src/main/java/me/blackvein/particles/Eff_1_13_R2.java +++ b/src/main/java/me/blackvein/particles/Eff_1_13_R2.java @@ -76,7 +76,7 @@ public enum Eff_1_13_R2 { private final Particle particleEnum; /** - * Create a new instance of the Eff_1_13_R1 enum with the given particle type + * Create a new instance of the Eff_1_13_R2 enum with the given particle type * to be sent. * * @param particleEnum diff --git a/src/main/java/me/blackvein/quests/NpcEffectThread.java b/src/main/java/me/blackvein/quests/NpcEffectThread.java index d368d0fa8..cdabba4b7 100644 --- a/src/main/java/me/blackvein/quests/NpcEffectThread.java +++ b/src/main/java/me/blackvein/quests/NpcEffectThread.java @@ -61,33 +61,43 @@ public class NpcEffectThread implements Runnable { } } } - - // effectType is either effectType or Quests.repeatEffect + + /** + * Display a particle effect above an NPC one time + * @param player Target player to let view the effect + * @param npc Target NPC to place the effect above + * @param effectType Value of EnumParticle such as NOTE or SMOKE + */ private void showEffect(Player player, NPC npc, String effectType) { - if (Quests.bukkitVersion >= 1132) { - showEffect_1_13_R2(player, npc, effectType); - } else if (Quests.bukkitVersion >= 113) { - showEffect_1_13_R1(player, npc, effectType); - } else if (Quests.bukkitVersion >= 112 ) { - showEffect_1_12_R1(player, npc, effectType); - } else if (Quests.bukkitVersion >= 111) { - showEffect_1_11_R1(player, npc, effectType); - } else if (Quests.bukkitVersion >= 110) { - showEffect_1_10_R1(player, npc, effectType); - } else if (Quests.bukkitVersion >= 194) { - showEffect_1_9_R2(player, npc, effectType); - } else if (Quests.bukkitVersion >= 19) { - showEffect_1_9_R1(player, npc, effectType); - } else if (Quests.bukkitVersion >= 184) { - showEffect_1_8_R3(player, npc, effectType); - } else if (Quests.bukkitVersion >= 183) { - showEffect_1_8_R2(player, npc, effectType); - } else if (Quests.bukkitVersion >= 18) { - showEffect_1_8_R1(player, npc, effectType); - } else if (Quests.bukkitVersion >= 1710) { - showEffect_R4(player, npc, effectType); - } else if (Quests.bukkitVersion >= 179) { - showEffect_R3(player, npc, effectType); + try { + if (Quests.bukkitVersion >= 1132) { + showEffect_1_13_R2(player, npc, effectType); + } else if (Quests.bukkitVersion >= 113) { + showEffect_1_13_R1(player, npc, effectType); + } else if (Quests.bukkitVersion >= 112 ) { + showEffect_1_12_R1(player, npc, effectType); + } else if (Quests.bukkitVersion >= 111) { + showEffect_1_11_R1(player, npc, effectType); + } else if (Quests.bukkitVersion >= 110) { + showEffect_1_10_R1(player, npc, effectType); + } else if (Quests.bukkitVersion >= 194) { + showEffect_1_9_R2(player, npc, effectType); + } else if (Quests.bukkitVersion >= 19) { + showEffect_1_9_R1(player, npc, effectType); + } else if (Quests.bukkitVersion >= 184) { + showEffect_1_8_R3(player, npc, effectType); + } else if (Quests.bukkitVersion >= 183) { + showEffect_1_8_R2(player, npc, effectType); + } else if (Quests.bukkitVersion >= 18) { + showEffect_1_8_R1(player, npc, effectType); + } else if (Quests.bukkitVersion >= 1710) { + showEffect_R4(player, npc, effectType); + } else if (Quests.bukkitVersion >= 179) { + showEffect_R3(player, npc, effectType); + } + } catch (Exception e) { + plugin.getLogger().severe("Bukkit version detected as " + Quests.bukkitVersion); + e.printStackTrace(); } } diff --git a/src/main/java/me/blackvein/quests/util/LocaleQuery.java b/src/main/java/me/blackvein/quests/util/LocaleQuery.java index e019746ee..47f9a9a29 100644 --- a/src/main/java/me/blackvein/quests/util/LocaleQuery.java +++ b/src/main/java/me/blackvein/quests/util/LocaleQuery.java @@ -92,26 +92,25 @@ public class LocaleQuery { player.sendMessage(message.replace("", Quester.prettyMobString(type))); } - /** + /** * Creates a new LocaleQuery of the specified material * @param material the item with the material * @return the new LocaleQuery * @throws IllegalArgumentException if an item with that material could not be found */ public String queryByType(Material material) throws IllegalArgumentException{ - try { - Object item = MethodUtils.invokeExactStaticMethod(craftMagicNumbers,"getItem", material); - - if (item == null) { - throw new IllegalArgumentException("An item with that material could not be found! (Perhaps you have specified a block?)"); - } - - String name = (String) MethodUtils.invokeExactMethod(item, "getName"); - return name; + try { + Object item = MethodUtils.invokeExactStaticMethod(craftMagicNumbers,"getItem", material); + if (item == null) { + throw new IllegalArgumentException("An item with that material could not be found! (Perhaps you have specified a block?)"); + } + + String name = (String) MethodUtils.invokeExactMethod(item, "getName"); + return name; } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { - e.printStackTrace(); + e.printStackTrace(); } - return null; + return null; } public void setup() {