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;
/**
* 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

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) {
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();
}
}

View File

@ -92,26 +92,25 @@ public class LocaleQuery {
player.sendMessage(message.replace("<mob>", 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() {