Show Bukkit version if improperly detected

This commit is contained in:
BuildTools 2018-11-19 23:51:31 -05:00
parent 71b0adfb4e
commit f2fc09d0bc
3 changed files with 48 additions and 39 deletions

View File

@ -76,7 +76,7 @@ public enum Eff_1_13_R2 {
private final Particle particleEnum; 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. * to be sent.
* *
* @param particleEnum * @param particleEnum

View File

@ -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) { private void showEffect(Player player, NPC npc, String effectType) {
if (Quests.bukkitVersion >= 1132) { try {
showEffect_1_13_R2(player, npc, effectType); if (Quests.bukkitVersion >= 1132) {
} else if (Quests.bukkitVersion >= 113) { showEffect_1_13_R2(player, npc, effectType);
showEffect_1_13_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 113) {
} else if (Quests.bukkitVersion >= 112 ) { showEffect_1_13_R1(player, npc, effectType);
showEffect_1_12_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 112 ) {
} else if (Quests.bukkitVersion >= 111) { showEffect_1_12_R1(player, npc, effectType);
showEffect_1_11_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 111) {
} else if (Quests.bukkitVersion >= 110) { showEffect_1_11_R1(player, npc, effectType);
showEffect_1_10_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 110) {
} else if (Quests.bukkitVersion >= 194) { showEffect_1_10_R1(player, npc, effectType);
showEffect_1_9_R2(player, npc, effectType); } else if (Quests.bukkitVersion >= 194) {
} else if (Quests.bukkitVersion >= 19) { showEffect_1_9_R2(player, npc, effectType);
showEffect_1_9_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 19) {
} else if (Quests.bukkitVersion >= 184) { showEffect_1_9_R1(player, npc, effectType);
showEffect_1_8_R3(player, npc, effectType); } else if (Quests.bukkitVersion >= 184) {
} else if (Quests.bukkitVersion >= 183) { showEffect_1_8_R3(player, npc, effectType);
showEffect_1_8_R2(player, npc, effectType); } else if (Quests.bukkitVersion >= 183) {
} else if (Quests.bukkitVersion >= 18) { showEffect_1_8_R2(player, npc, effectType);
showEffect_1_8_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 18) {
} else if (Quests.bukkitVersion >= 1710) { showEffect_1_8_R1(player, npc, effectType);
showEffect_R4(player, npc, effectType); } else if (Quests.bukkitVersion >= 1710) {
} else if (Quests.bukkitVersion >= 179) { showEffect_R4(player, npc, effectType);
showEffect_R3(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();
} }
} }

View File

@ -92,26 +92,25 @@ public class LocaleQuery {
player.sendMessage(message.replace("<mob>", Quester.prettyMobString(type))); player.sendMessage(message.replace("<mob>", Quester.prettyMobString(type)));
} }
/** /**
* Creates a new LocaleQuery of the specified material * Creates a new LocaleQuery of the specified material
* @param material the item with the material * @param material the item with the material
* @return the new LocaleQuery * @return the new LocaleQuery
* @throws IllegalArgumentException if an item with that material could not be found * @throws IllegalArgumentException if an item with that material could not be found
*/ */
public String queryByType(Material material) throws IllegalArgumentException{ public String queryByType(Material material) throws IllegalArgumentException{
try { try {
Object item = MethodUtils.invokeExactStaticMethod(craftMagicNumbers,"getItem", material); Object item = MethodUtils.invokeExactStaticMethod(craftMagicNumbers,"getItem", material);
if (item == null) {
if (item == null) { throw new IllegalArgumentException("An item with that material could not be found! (Perhaps you have specified a block?)");
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");
String name = (String) MethodUtils.invokeExactMethod(item, "getName"); return name;
return name;
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
public void setup() { public void setup() {