mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-14 15:26:54 +01:00
More work, vaguely remember fixing a bug
This commit is contained in:
parent
fc8efdd00c
commit
82435b7067
@ -78,8 +78,6 @@ public class LibsDisguises extends JavaPlugin {
|
||||
|
||||
PacketsManager.addPacketListeners();
|
||||
|
||||
TranslateType.MESSAGES.name(); // Call the static loader
|
||||
|
||||
listener = new DisguiseListener(this);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(listener, this);
|
||||
@ -322,30 +320,30 @@ public class LibsDisguises extends JavaPlugin {
|
||||
MetaIndex flagType = MetaIndex.getFlag(watcherClass, watch.getIndex());
|
||||
|
||||
if (flagType == null) {
|
||||
System.err.println(
|
||||
"Error finding the FlagType for " + disguiseType.name() + "! Index " + watch.getIndex() + " can't be found!");
|
||||
System.err.println(
|
||||
"Value is " + watch.getRawValue() + " (" + watch.getRawValue().getClass() + ") (" + nmsEntity.getClass() + ") & " + watcherClass.getSimpleName());
|
||||
System.err.println("Error finding the FlagType for " + disguiseType.name() + "! Index " + watch
|
||||
.getIndex() + " can't be found!");
|
||||
System.err.println("Value is " + watch.getRawValue() + " (" + watch.getRawValue()
|
||||
.getClass() + ") (" + nmsEntity.getClass() + ") & " + watcherClass.getSimpleName());
|
||||
System.err.println("Lib's Disguises will continue to load, but this will not work properly!");
|
||||
continue;
|
||||
}
|
||||
|
||||
indexes.remove(flagType);
|
||||
|
||||
if (ReflectionManager.convertInvalidItem(
|
||||
flagType.getDefault()).getClass() != ReflectionManager.convertInvalidItem(
|
||||
watch.getValue()).getClass()) {
|
||||
System.err.println(
|
||||
"Mismatch of FlagType's for " + disguiseType.name() + "! Index " + watch.getIndex() + " has the wrong classtype!");
|
||||
System.err.println(
|
||||
"Value is " + watch.getRawValue() + " (" + watch.getRawValue().getClass() + ") (" + nmsEntity.getClass() + ") & " + watcherClass.getSimpleName() + " which doesn't match up with " + flagType.getDefault().getClass());
|
||||
if (ReflectionManager.convertInvalidItem(flagType.getDefault()).getClass() != ReflectionManager
|
||||
.convertInvalidItem(watch.getValue()).getClass()) {
|
||||
System.err.println("Mismatch of FlagType's for " + disguiseType.name() + "! Index " + watch
|
||||
.getIndex() + " has the wrong classtype!");
|
||||
System.err.println("Value is " + watch.getRawValue() + " (" + watch.getRawValue()
|
||||
.getClass() + ") (" + nmsEntity.getClass() + ") & " + watcherClass
|
||||
.getSimpleName() + " which doesn't match up with " + flagType.getDefault().getClass());
|
||||
System.err.println("Lib's Disguises will continue to load, but this will not work properly!");
|
||||
}
|
||||
}
|
||||
|
||||
for (MetaIndex index : indexes) {
|
||||
System.out.println(
|
||||
disguiseType + " has MetaIndex remaining! " + index.getFlagWatcher().getSimpleName() + " at index " + index.getIndex());
|
||||
System.out.println(disguiseType + " has MetaIndex remaining! " + index.getFlagWatcher()
|
||||
.getSimpleName() + " at index " + index.getIndex());
|
||||
}
|
||||
|
||||
DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
|
||||
@ -374,12 +372,12 @@ public class LibsDisguises extends JavaPlugin {
|
||||
disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));
|
||||
}
|
||||
catch (SecurityException | IllegalArgumentException | IllegalAccessException | FieldAccessException ex) {
|
||||
System.out.print(
|
||||
"[LibsDisguises] Uh oh! Trouble while making values for the disguise " + disguiseType.name() + "!");
|
||||
System.out.print(
|
||||
"[LibsDisguises] Before reporting this error, " + "please make sure you are using the latest version of LibsDisguises and ProtocolLib.");
|
||||
System.out.print(
|
||||
"[LibsDisguises] Development builds are available at (ProtocolLib) " + "http://ci.dmulloy2.net/job/ProtocolLib/ and (LibsDisguises) http://server.o2gaming.com:8080/job/LibsDisguises%201.9+/");
|
||||
System.out.print("[LibsDisguises] Uh oh! Trouble while making values for the disguise " + disguiseType
|
||||
.name() + "!");
|
||||
System.out
|
||||
.print("[LibsDisguises] Before reporting this error, " + "please make sure you are using the latest version of LibsDisguises and ProtocolLib.");
|
||||
System.out
|
||||
.print("[LibsDisguises] Development builds are available at (ProtocolLib) " + "http://ci.dmulloy2.net/job/ProtocolLib/ and (LibsDisguises) http://server.o2gaming.com:8080/job/LibsDisguises%201.9+/");
|
||||
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
@ -57,11 +57,12 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("entitytype") || args[0].equalsIgnoreCase("entitytypes")) {
|
||||
if (args[0].equalsIgnoreCase(TranslateType.DISGUISES.get("EntityType")) || args[0]
|
||||
.equalsIgnoreCase(TranslateType.DISGUISES.get("EntityType") + "s")) {
|
||||
ArrayList<String> classes = new ArrayList<>();
|
||||
|
||||
for (Class c : validClasses) {
|
||||
classes.add(c.getSimpleName());
|
||||
classes.add(TranslateType.DISGUISES.get(c.getSimpleName()));
|
||||
}
|
||||
|
||||
Collections.sort(classes);
|
||||
@ -77,7 +78,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (!isNumeric(args[0])) {
|
||||
for (Class c : validClasses) {
|
||||
if (c.getSimpleName().equalsIgnoreCase(args[0])) {
|
||||
if (TranslateType.DISGUISES.get(c.getSimpleName()).equalsIgnoreCase(args[0])) {
|
||||
entityClass = c;
|
||||
starting = 1;
|
||||
break;
|
||||
@ -208,7 +209,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (args.length == 0) {
|
||||
for (Class<? extends Entity> entityClass : validClasses) {
|
||||
tabs.add(entityClass.getSimpleName());
|
||||
tabs.add(TranslateType.DISGUISES.get(entityClass.getSimpleName()));
|
||||
}
|
||||
|
||||
return filterTabs(tabs, origArgs);
|
||||
@ -218,7 +219,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (!isNumeric(args[0])) {
|
||||
for (Class c : validClasses) {
|
||||
if (!c.getSimpleName().equalsIgnoreCase(args[0]))
|
||||
if (!TranslateType.DISGUISES.get(c.getSimpleName()).equalsIgnoreCase(args[0]))
|
||||
continue;
|
||||
|
||||
starting = 2;
|
||||
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -27,6 +28,7 @@ import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MobDisguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.RabbitType;
|
||||
import sun.reflect.Reflection;
|
||||
|
||||
public class DisguiseParser {
|
||||
public static class DisguiseParseException extends Exception {
|
||||
@ -125,14 +127,14 @@ public class DisguiseParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static Object callValueOf(Class<?> param, String valueString, String methodName,
|
||||
String description) throws DisguiseParseException {
|
||||
private static Object callValueOf(Class<?> param, String valueString,
|
||||
String methodName) throws DisguiseParseException {
|
||||
Object value;
|
||||
try {
|
||||
value = param.getMethod("valueOf", String.class).invoke(null, valueString.toUpperCase());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException(description, valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -189,7 +191,7 @@ public class DisguiseParser {
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("p"))
|
||||
return getDisguisePerm("player");
|
||||
return getDisguisePerm(DisguiseType.PLAYER.toReadable());
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -530,10 +532,11 @@ public class DisguiseParser {
|
||||
boolean adult = true;
|
||||
|
||||
if (args.length > 1) {
|
||||
if (args[1].equalsIgnoreCase("baby") || args[1].equalsIgnoreCase("adult")) {
|
||||
if (args[1].equalsIgnoreCase(TranslateType.DISGUISE_OPTIONS.get("baby")) || args[1]
|
||||
.equalsIgnoreCase(TranslateType.DISGUISE_OPTIONS.get("adult"))) {
|
||||
usedOptions.add("setbaby");
|
||||
doCheck(sender, optionPermissions, usedOptions);
|
||||
adult = args[1].equalsIgnoreCase("adult");
|
||||
adult = args[1].equalsIgnoreCase(TranslateType.DISGUISE_OPTIONS.get("adult"));
|
||||
|
||||
toSkip++;
|
||||
}
|
||||
@ -660,7 +663,8 @@ public class DisguiseParser {
|
||||
Method[] methods = ReflectionFlagWatchers.getDisguiseWatcherMethods(disguise.getWatcher().getClass());
|
||||
|
||||
for (int i = 0; i < args.length; i += 2) {
|
||||
String methodName = TranslateType.DISGUISE_OPTIONS.reverseGet(args[i]);
|
||||
String methodNameRaw;
|
||||
String methodName = TranslateType.DISGUISE_OPTIONS.reverseGet(methodNameRaw = args[i]);
|
||||
String valueString = TranslateType.DISGUISE_OPTIONS_PARAMETERS
|
||||
.reverseGet(args.length - 1 == i ? null : args[i + 1]);
|
||||
Method methodToUse = null;
|
||||
@ -678,7 +682,7 @@ public class DisguiseParser {
|
||||
|
||||
methodToUse = entry.getKey();
|
||||
c = entry.getValue();
|
||||
methodName = methodToUse.getName();
|
||||
methodName = TranslateType.DISGUISE_OPTIONS.reverseGet(methodNameRaw = methodToUse.getName());
|
||||
Class<?>[] types = methodToUse.getParameterTypes();
|
||||
Class param = types[0];
|
||||
|
||||
@ -688,14 +692,14 @@ public class DisguiseParser {
|
||||
if (isInteger(valueString)) {
|
||||
value = Integer.parseInt(valueString);
|
||||
} else {
|
||||
throw parseToException("number", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (WrappedGameProfile.class == param && valueString.length() > 20) {
|
||||
try {
|
||||
value = ReflectionManager.parseGameProfile(valueString);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("gameprofile", valueString, methodName);
|
||||
throw parseToException(GameProfile.class, valueString, methodName);
|
||||
}
|
||||
} else if (float.class == param || double.class == param) {
|
||||
// Parse to number
|
||||
@ -707,10 +711,10 @@ public class DisguiseParser {
|
||||
value = (double) obj;
|
||||
}
|
||||
} else {
|
||||
throw parseToException("number.0", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param == String.class) {
|
||||
if (methodName.equalsIgnoreCase("setskin") && valueString.length() > 20) {
|
||||
if (methodNameRaw.equalsIgnoreCase("setskin") && valueString.length() > 20) {
|
||||
value = valueString;
|
||||
} else {
|
||||
// Parse to string
|
||||
@ -722,18 +726,18 @@ public class DisguiseParser {
|
||||
value = AnimalColor.valueOf(valueString.toUpperCase());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("animal color", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param == Llama.Color.class) {
|
||||
try {
|
||||
value = Llama.Color.valueOf(valueString.toUpperCase());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("llama color", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param == ItemStack.class) {
|
||||
// Parse to itemstack
|
||||
value = parseToItemstack(methodName, valueString);
|
||||
value = parseToItemstack(param, methodName, valueString);
|
||||
} else if (param == ItemStack[].class) {
|
||||
// Parse to itemstack array
|
||||
ItemStack[] items = new ItemStack[4];
|
||||
@ -743,39 +747,35 @@ public class DisguiseParser {
|
||||
if (split.length == 4) {
|
||||
for (int a = 0; a < 4; a++) {
|
||||
try {
|
||||
items[a] = parseToItemstack(methodName, split[a]);
|
||||
items[a] = parseToItemstack(param, methodName, split[a]);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException(
|
||||
"item ID,ID,ID,ID" + ChatColor.RED + " or " + ChatColor.GREEN + "ID:Data,ID:Data,ID:Data,ID:Data combo",
|
||||
valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw parseToException(
|
||||
"item ID,ID,ID,ID" + ChatColor.RED + " or " + ChatColor.GREEN + "ID:Data,ID:Data,ID:Data,ID:Data combo",
|
||||
valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
|
||||
value = items;
|
||||
} else if (param.getSimpleName().equals("Color")) {
|
||||
// Parse to horse color
|
||||
value = callValueOf(param, valueString, methodName, "a horse color");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Style")) {
|
||||
// Parse to horse style
|
||||
value = callValueOf(param, valueString, methodName, "a horse style");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Profession")) {
|
||||
// Parse to villager profession
|
||||
value = callValueOf(param, valueString, methodName, "a villager profession");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Art")) {
|
||||
// Parse to art type
|
||||
value = callValueOf(param, valueString, methodName, "a painting art");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Type")) {
|
||||
// Parse to ocelot type
|
||||
value = callValueOf(param, valueString, methodName, "a ocelot type");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("TreeSpecies")) {
|
||||
// Parse to ocelot type
|
||||
value = callValueOf(param, valueString, methodName, "a tree species");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param == PotionEffectType.class) {
|
||||
// Parse to potion effect
|
||||
try {
|
||||
@ -792,7 +792,7 @@ public class DisguiseParser {
|
||||
value = potionType;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("a potioneffect type", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param == int[].class) {
|
||||
String[] split = valueString.split(",");
|
||||
@ -804,7 +804,7 @@ public class DisguiseParser {
|
||||
values[b] = Integer.parseInt(split[b]);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw parseToException("Number,Number,Number...", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -820,8 +820,7 @@ public class DisguiseParser {
|
||||
value = face;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("a direction (north, east, south, west, up, down)", valueString,
|
||||
methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param == RabbitType.class) {
|
||||
try {
|
||||
@ -838,8 +837,7 @@ public class DisguiseParser {
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("rabbit type (white, brown, patches...)", valueString,
|
||||
methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param == BlockPosition.class) {
|
||||
try {
|
||||
@ -851,10 +849,10 @@ public class DisguiseParser {
|
||||
Integer.parseInt(split[2]));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw parseToException("three numbers Number,Number,Number", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
}
|
||||
} else if (param.getName().equals("org.bukkit.entity.Parrot$Variant")) {
|
||||
value = callValueOf(param, valueString, methodName, "a parrot color");
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -862,13 +860,15 @@ public class DisguiseParser {
|
||||
if (valueString == null) {
|
||||
value = true;
|
||||
i--;
|
||||
} else if (valueString.equalsIgnoreCase("true")) {
|
||||
} else if (valueString
|
||||
.equalsIgnoreCase(TranslateType.DISGUISE_OPTIONS_PARAMETERS.get("true"))) {
|
||||
value = true;
|
||||
} else if (valueString.equalsIgnoreCase("false")) {
|
||||
} else if (valueString
|
||||
.equalsIgnoreCase(TranslateType.DISGUISE_OPTIONS_PARAMETERS.get("false"))) {
|
||||
value = false;
|
||||
} else {
|
||||
if (getMethod(methods, valueString, 0) == null) {
|
||||
throw parseToException("true/false", valueString, methodName);
|
||||
throw parseToException(param, valueString, methodName);
|
||||
} else {
|
||||
value = true;
|
||||
i--;
|
||||
@ -901,8 +901,8 @@ public class DisguiseParser {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_NO_OPTION_VALUE, methodName);
|
||||
}
|
||||
|
||||
if (!usedOptions.contains(methodName.toLowerCase())) {
|
||||
usedOptions.add(methodName.toLowerCase());
|
||||
if (!usedOptions.contains(methodNameRaw.toLowerCase())) {
|
||||
usedOptions.add(methodNameRaw.toLowerCase());
|
||||
}
|
||||
|
||||
doCheck(sender, optionPermissions, usedOptions);
|
||||
@ -915,12 +915,12 @@ public class DisguiseParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static DisguiseParseException parseToException(String expectedValue, String receivedInstead,
|
||||
String methodName) {
|
||||
return new DisguiseParseException(LibsMsg.PARSE_EXPECTED_RECEIVED, expectedValue, receivedInstead, methodName);
|
||||
private static DisguiseParseException parseToException(Class paramType, String receivedInstead, String methodName) {
|
||||
return new DisguiseParseException(LibsMsg.PARSE_EXPECTED_RECEIVED,
|
||||
ReflectionFlagWatchers.getParamInfo(paramType).getName(), receivedInstead, methodName);
|
||||
}
|
||||
|
||||
private static ItemStack parseToItemstack(String method, String string) throws DisguiseParseException {
|
||||
private static ItemStack parseToItemstack(Class param, String method, String string) throws DisguiseParseException {
|
||||
String[] split = string.split(":", -1);
|
||||
|
||||
int itemId = -1;
|
||||
@ -942,16 +942,16 @@ public class DisguiseParser {
|
||||
if (isInteger(split[1])) {
|
||||
itemDura = Short.parseShort(split[1]);
|
||||
} else {
|
||||
throw parseToException("item ID:Durability combo", string, "%s");
|
||||
throw parseToException(param, string, "%s");
|
||||
}
|
||||
}
|
||||
|
||||
return new ItemStack(itemId, 1, itemDura);
|
||||
} else {
|
||||
if (split.length == 1) {
|
||||
throw parseToException("item ID", string, "%s");
|
||||
throw parseToException(param, string, "%s");
|
||||
} else {
|
||||
throw parseToException("item ID:Durability combo", string, "%s");
|
||||
throw parseToException(param, string, "%s");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,8 @@ public class ReflectionFlagWatchers {
|
||||
new ParamInfo(Ocelot.Type.class, "Ocelot Type", "View all the ocelot types you can use for ocelots");
|
||||
new ParamInfo(Villager.Profession.class, "Villager Profession",
|
||||
"View all the professions you can set on a villager");
|
||||
new ParamInfo(BlockFace.class, Arrays.copyOf(BlockFace.values(), 4), "Direction",
|
||||
new ParamInfo(BlockFace.class, Arrays.copyOf(BlockFace.values(), 6), "Direction (North, East, South, West, " +
|
||||
"Up, Down)",
|
||||
"View the four directions usable on player setSleeping disguise");
|
||||
new ParamInfo(RabbitType.class, "Rabbit Type", "View the kinds of rabbits you can turn into");
|
||||
new ParamInfo(TreeSpecies.class, "Tree Species", "View the different types of tree species");
|
||||
@ -177,9 +178,10 @@ public class ReflectionFlagWatchers {
|
||||
materials[i] = Material.values()[i].name();
|
||||
}
|
||||
|
||||
new ParamInfo(ItemStack.class, "Item (id:damage)", "An ItemStack compromised of ID:Durability", materials);
|
||||
new ParamInfo(ItemStack.class, "Item (id:damage), damage optional", "An ItemStack compromised of " +
|
||||
"ID:Durability", materials);
|
||||
|
||||
new ParamInfo(ItemStack[].class, "Four ItemStacks (id:damage,id:damage..)", "Four ItemStacks separated by an ,",
|
||||
new ParamInfo(ItemStack[].class, "Four ItemStacks (id:damage,id:damage..), damage optional", "Four ItemStacks separated by an ,",
|
||||
materials) {
|
||||
@Override
|
||||
public String[] getEnums(String tabComplete) {
|
||||
@ -205,8 +207,8 @@ public class ReflectionFlagWatchers {
|
||||
new ParamInfo(String.class, "Text", "A line of text");
|
||||
new ParamInfo(boolean.class, "True/False", "True or False", new String[]{"true", "false"});
|
||||
new ParamInfo(int.class, "Number", "A whole number, no decimals");
|
||||
new ParamInfo(double.class, "Number", "A number which can have decimals");
|
||||
new ParamInfo(float.class, "Number", "A number which can have decimals");
|
||||
new ParamInfo(double.class, "Number.0", "A number which can have decimals");
|
||||
new ParamInfo(float.class, "Number.0", "A number which can have decimals");
|
||||
|
||||
new ParamInfo(Horse.Style.class, "Horse Style", "Horse style which is the patterns on the horse");
|
||||
new ParamInfo(int[].class, "number,number,number..", "Numbers separated by an ,");
|
||||
|
@ -3,6 +3,7 @@ package me.libraryaddict.disguise.utilities;
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@ -57,6 +58,18 @@ public class TranslateFiller {
|
||||
}
|
||||
}
|
||||
|
||||
TranslateType.DISGUISE_OPTIONS.save("baby", "Used as a shortcut for setBaby when disguising an entity");
|
||||
TranslateType.DISGUISE_OPTIONS.save("adult", "Used as a shortcut for setBaby(false) when disguising an entity");
|
||||
|
||||
for (Class c : ClassGetter.getClassesForPackage("org.bukkit.entity")) {
|
||||
if (c != Entity.class && Entity.class.isAssignableFrom(c) && c.getAnnotation(Deprecated.class) == null) {
|
||||
TranslateType.DISGUISES.save(c.getSimpleName(),
|
||||
"Name for the " + c.getSimpleName() + " EntityType, " + "this is used in radius commands");
|
||||
}
|
||||
}
|
||||
|
||||
TranslateType.DISGUISES.save("EntityType", "Used for the disgiuse radius command to list all entitytypes");
|
||||
|
||||
for (LibsMsg msg : LibsMsg.values()) {
|
||||
TranslateType.MESSAGES.save(msg.getRaw());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public enum TranslateType {
|
||||
|
||||
if (value == null)
|
||||
System.err.println("Translation for " + name() + " has a null value for the key '" + key + "'");
|
||||
else
|
||||
else if (!Objects.equals(key, value)) // Don't store useless information
|
||||
translated.put(ChatColor.translateAlternateColorCodes('&', key),
|
||||
ChatColor.translateAlternateColorCodes('&', value));
|
||||
}
|
||||
@ -89,8 +89,6 @@ public enum TranslateType {
|
||||
translated.put(message, message);
|
||||
|
||||
message = StringEscapeUtils.escapeJava(message.replaceAll(ChatColor.COLOR_CHAR + "", "&"));
|
||||
// String message1 = StringEscapeUtils.escapeJava(
|
||||
// StringUtils.reverse(message).replaceAll("s%", "%s").replaceAll(ChatColor.COLOR_CHAR + "", "&"));
|
||||
|
||||
try {
|
||||
boolean exists = file.exists();
|
||||
|
Loading…
Reference in New Issue
Block a user