Add backwards compatibility for 1.14

This commit is contained in:
libraryaddict 2020-02-06 12:15:20 +13:00
parent 7661635eb9
commit 9656ed4249
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
15 changed files with 283 additions and 65 deletions

View File

@ -6,6 +6,7 @@ import me.libraryaddict.disguise.utilities.LibsPremium;
import me.libraryaddict.disguise.utilities.metrics.MetricsInitalizer;
import me.libraryaddict.disguise.utilities.packets.PacketsManager;
import me.libraryaddict.disguise.utilities.parser.DisguiseParser;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
@ -54,7 +55,8 @@ public class LibsDisguises extends JavaPlugin {
YamlConfiguration pluginYml = ReflectionManager.getPluginYaml(getClassLoader());
buildNumber = StringUtils.stripToNull(pluginYml.getString("build-number"));
getLogger().info("Discovered nms version: " + ReflectionManager.getBukkitVersion());
getLogger().info("Discovered nms version: " + ReflectionManager.getBukkitVersion() + " | " +
ReflectionManager.getVersion());
getLogger().info("Jenkins Build: " + (isNumberedBuild() ? "#" : "") + getBuildNo());
@ -68,9 +70,9 @@ public class LibsDisguises extends JavaPlugin {
" Command " + "Blocks, Admins)");
}
if (!ReflectionManager.getMinecraftVersion().startsWith("1.15")) {
if (ReflectionManager.getVersion() == null) {
getLogger().severe("You're using the wrong version of Lib's Disguises for your server! This is " +
"intended for 1.15!");
"intended for 1.14 & 1.15!");
getPluginLoader().disablePlugin(this);
return;
}
@ -90,6 +92,8 @@ public class LibsDisguises extends JavaPlugin {
listener = new DisguiseListener(this);
registerCommand("libsdisguises", new LibsDisguisesCommand());
if (!DisguiseConfig.isDisableCommands()) {
registerCommand("disguise", new DisguiseCommand());
registerCommand("undisguise", new UndisguiseCommand());
@ -101,7 +105,6 @@ public class LibsDisguises extends JavaPlugin {
registerCommand("undisguiseradius", new UndisguiseRadiusCommand(getConfig().getInt("UndisguiseRadiusMax")));
registerCommand("disguisehelp", new DisguiseHelpCommand());
registerCommand("disguiseclone", new DisguiseCloneCommand());
registerCommand("libsdisguises", new LibsDisguisesCommand());
registerCommand("disguiseviewself", new DisguiseViewSelfCommand());
registerCommand("disguisemodify", new DisguiseModifyCommand());
registerCommand("disguisemodifyentity", new DisguiseModifyEntityCommand());

View File

@ -64,6 +64,10 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
ArrayList<String> classes = new ArrayList<>();
for (DisguiseType type : DisguiseType.values()) {
if (type.getEntityType() == null) {
continue;
}
classes.add(type.toReadable());
}
@ -79,6 +83,10 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
if (!isInteger(args[0])) {
for (DisguiseType t : DisguiseType.values()) {
if (t.getEntityType() == null) {
continue;
}
if (t.toReadable().replaceAll(" ", "").equalsIgnoreCase(args[0].replaceAll("_", ""))) {
baseType = t;
starting = 1;
@ -193,6 +201,10 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
if (args.length == 0) {
for (DisguiseType type : DisguiseType.values()) {
if (type.getEntityType() == null) {
continue;
}
tabs.add(type.toReadable().replaceAll(" ", "_"));
}
@ -203,6 +215,10 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
if (!isInteger(args[0])) {
for (DisguiseType t : DisguiseType.values()) {
if (t.getEntityType() == null) {
continue;
}
if (t.toReadable().replaceAll(" ", "").equalsIgnoreCase(args[0].replaceAll("_", ""))) {
starting = 2;
break;

View File

@ -1,10 +1,11 @@
package me.libraryaddict.disguise.disguisetypes;
import me.libraryaddict.disguise.utilities.reflection.NmsAdded;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.translations.TranslateType;
import org.apache.commons.lang.StringUtils;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.omg.CORBA.UNKNOWN;
public enum DisguiseType {
AREA_EFFECT_CLOUD(3, 0),
@ -15,7 +16,7 @@ public enum DisguiseType {
BAT,
BEE,
@NmsAdded(added = NmsVersion.v1_15) BEE,
BLAZE,
@ -256,8 +257,12 @@ public enum DisguiseType {
}
}
try {
setEntityType(EntityType.valueOf(name()));
}
catch (Exception ex) {
}
}
public int getDefaultData() {
return defaultData;
@ -275,6 +280,10 @@ public enum DisguiseType {
return entityType;
}
private void setEntityType(EntityType entityType) {
this.entityType = entityType;
}
/**
* The object type send in packets when spawning a misc entity. Otherwise, -1.
*
@ -301,6 +310,10 @@ public enum DisguiseType {
return watcherClass;
}
public void setWatcherClass(Class<? extends FlagWatcher> c) {
watcherClass = c;
}
public boolean isMisc() {
return getEntityType() != null && !getEntityType().isAlive();
}
@ -317,14 +330,6 @@ public enum DisguiseType {
return this == DisguiseType.UNKNOWN;
}
private void setEntityType(EntityType entityType) {
this.entityType = entityType;
}
public void setWatcherClass(Class<? extends FlagWatcher> c) {
watcherClass = c;
}
public String toReadable() {
String[] split = name().split("_");

View File

@ -7,6 +7,10 @@ import com.comphenix.protocol.wrappers.nbt.NbtFactory;
import com.comphenix.protocol.wrappers.nbt.NbtType;
import me.libraryaddict.disguise.disguisetypes.watchers.*;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.reflection.NmsAdded;
import me.libraryaddict.disguise.utilities.reflection.NmsRemoved;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import org.bukkit.Color;
import org.bukkit.Material;
@ -108,8 +112,10 @@ public class MetaIndex<Y> {
*/
public static MetaIndex<Byte> BAT_HANGING = new MetaIndex<>(BatWatcher.class, 0, (byte) 1);
@NmsAdded(added = NmsVersion.v1_15)
public static MetaIndex<Byte> BEE_META = new MetaIndex<>(BeeWatcher.class, 0, (byte) 0);
@NmsAdded(added = NmsVersion.v1_15)
public static MetaIndex<Integer> BEE_ANGER = new MetaIndex<>(BeeWatcher.class, 1, 0);
/**
@ -199,6 +205,7 @@ public class MetaIndex<Y> {
*/
public static MetaIndex<Boolean> ENDERMAN_AGRESSIVE = new MetaIndex<>(EndermanWatcher.class, 1, false);
@NmsAdded(added = NmsVersion.v1_15)
public static MetaIndex<Boolean> ENDERMAN_UNKNOWN = new MetaIndex<>(EndermanWatcher.class, 2, false);
/**
@ -351,6 +358,7 @@ public class MetaIndex<Y> {
/**
* How many bee stings does the entity have
*/
@NmsAdded(added = NmsVersion.v1_15)
public static MetaIndex<Integer> LIVING_STINGS = new MetaIndex<>(LivingWatcher.class, 5, 0);
public static MetaIndex<Optional<BlockPosition>> LIVING_BED_POSITION = new MetaIndex<>(LivingWatcher.class, 6,
@ -488,6 +496,7 @@ public class MetaIndex<Y> {
public static MetaIndex<Byte> TRIDENT_ENCHANTS = new MetaIndex<>(TridentWatcher.class, 0, (byte) 0);
@NmsAdded(added = NmsVersion.v1_15)
public static MetaIndex<Boolean> TRIDENT_ENCHANTED = new MetaIndex<>(TridentWatcher.class, 1, false);
public static MetaIndex<Integer> TROPICAL_FISH_VARIANT = new MetaIndex<>(TropicalFishWatcher.class, 0, 0);
@ -525,9 +534,12 @@ public class MetaIndex<Y> {
public static MetaIndex<Boolean> WITHER_SKULL_BLUE = new MetaIndex<>(WitherSkullWatcher.class, 0, false);
public static MetaIndex<Boolean> WOLF_BEGGING = new MetaIndex<>(WolfWatcher.class, 0, false);
public static MetaIndex<Boolean> WOLF_BEGGING = new MetaIndex<>(WolfWatcher.class, 1, false);
public static MetaIndex<Integer> WOLF_COLLAR = new MetaIndex<>(WolfWatcher.class, 1, 14);
@NmsRemoved(removed = NmsVersion.v1_15)
public static MetaIndex<Float> WOLF_DAMAGE = new MetaIndex<>(WolfWatcher.class, 0, 1F);
public static MetaIndex<Integer> WOLF_COLLAR = new MetaIndex<>(WolfWatcher.class, 2, 14);
public static MetaIndex<Boolean> ZOMBIE_BABY = new MetaIndex<>(ZombieWatcher.class, 0, false);
@ -545,6 +557,7 @@ public class MetaIndex<Y> {
static {
setValues();
eliminateBlankIndexes();
orderMetaIndexes();
}
@ -826,6 +839,10 @@ public class MetaIndex<Y> {
if (field.getType() != MetaIndex.class)
continue;
if (!ReflectionManager.isSupported(field)) {
continue;
}
MetaIndex index = (MetaIndex) field.get(null);
if (index == null)

View File

@ -2,6 +2,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.reflection.NmsAdded;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
/**
* Created by libraryaddict on 6/08/2018.
@ -11,12 +13,14 @@ public class TridentWatcher extends ArrowWatcher {
super(disguise);
}
@NmsAdded(added = NmsVersion.v1_15)
public boolean isEnchanted() {
return getData(MetaIndex.TRIDENT_ENCHANTED);
}
@NmsAdded(added = NmsVersion.v1_15)
public void setEnchanted(boolean enchanted) {
setData(MetaIndex.TRIDENT_ENCHANTED, enchanted);
sendData(MetaIndex.TRIDENT_ENCHANTED);
}
public boolean isEnchanted() {
return getData(MetaIndex.TRIDENT_ENCHANTED);
}
}

View File

@ -3,6 +3,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.reflection.NmsRemoved;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import org.bukkit.DyeColor;
public class WolfWatcher extends TameableWatcher {
@ -15,23 +17,6 @@ public class WolfWatcher extends TameableWatcher {
return AnimalColor.getColorByWool(getData(MetaIndex.WOLF_COLLAR)).getDyeColor();
}
public boolean isBegging() {
return getData(MetaIndex.WOLF_BEGGING);
}
public void setBegging(boolean begging) {
setData(MetaIndex.WOLF_BEGGING, begging);
sendData(MetaIndex.WOLF_BEGGING);
}
public boolean isAngry() {
return isTameableFlag(2);
}
public void setAngry(boolean angry) {
setTameableFlag(2, angry);
}
@Deprecated
public void setCollarColor(AnimalColor color) {
setCollarColor(color.getDyeColor());
@ -49,4 +34,42 @@ public class WolfWatcher extends TameableWatcher {
setData(MetaIndex.WOLF_COLLAR, (int) newColor.getWoolData());
sendData(MetaIndex.WOLF_COLLAR);
}
public boolean isBegging() {
return getData(MetaIndex.WOLF_BEGGING);
}
public void setBegging(boolean begging) {
setData(MetaIndex.WOLF_BEGGING, begging);
sendData(MetaIndex.WOLF_BEGGING);
}
public boolean isAngry() {
return isTameableFlag(2);
}
public void setAngry(boolean angry) {
setTameableFlag(2, angry);
}
/**
* Used for tail rotation.
*
* @return
*/
@NmsRemoved(removed = NmsVersion.v1_15)
public float getDamageTaken() {
return getData(MetaIndex.WOLF_DAMAGE);
}
/**
* Used for tail rotation.
*
* @param damage
*/
@NmsRemoved(removed = NmsVersion.v1_15)
public void setDamageTaken(float damage) {
setData(MetaIndex.WOLF_DAMAGE, damage);
sendData(MetaIndex.WOLF_DAMAGE);
}
}

View File

@ -19,8 +19,8 @@ public enum DisguiseSound {
BAT(Sound.ENTITY_BAT_HURT, null, Sound.ENTITY_BAT_DEATH, Sound.ENTITY_BAT_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
Sound.ENTITY_BAT_LOOP, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BAT_TAKEOFF),
BEE(Sound.ENTITY_BEE_HURT, null, Sound.ENTITY_BEE_DEATH, null, Sound.ENTITY_BEE_LOOP,
Sound.ENTITY_BEE_LOOP_AGGRESSIVE, Sound.ENTITY_BEE_POLLINATE, Sound.ENTITY_BEE_STING),
BEE("ENTITY_BEE_HURT", null, "ENTITY_BEE_DEATH", null, "ENTITY_BEE_LOOP", "ENTITY_BEE_LOOP_AGGRESSIVE",
"ENTITY_BEE_POLLINATE", "ENTITY_BEE_STING"),
BLAZE(Sound.ENTITY_BLAZE_HURT, null, Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_AMBIENT,
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BLAZE_BURN,
@ -249,28 +249,60 @@ public enum DisguiseSound {
private float damageSoundVolume = 1F;
private LinkedHashMap<Object, SoundType> disguiseSounds = new LinkedHashMap<>();
DisguiseSound(Object hurt, Object step, Object death, Object idle, Sound... sounds) {
DisguiseSound(Object hurt, Object step, Object death, Object idle, Object... sounds) {
addSound(hurt, SoundType.HURT);
addSound(step, SoundType.STEP);
addSound(death, SoundType.DEATH);
addSound(idle, SoundType.IDLE);
for (Sound obj : sounds) {
for (Object obj : sounds) {
addSound(obj, SoundType.CANCEL);
}
}
private Sound parseSound(String name) {
try {
return Sound.valueOf(name);
}
catch (Exception ex) {
}
return null;
}
private void addSound(Object sound, SoundType type) {
if (sound == null) {
return;
}
if (sound instanceof Sound) {
addSound((Sound) sound, type);
if (sound instanceof String[]) {
for (String s : (String[]) sound) {
Sound so = parseSound(s);
if (so == null) {
continue;
}
addSound(so, type);
}
} else if (sound instanceof String) {
Sound so = parseSound((String) sound);
if (so == null) {
return;
}
addSound(so, type);
} else if (sound instanceof Sound[]) {
for (Sound s : (Sound[]) sound) {
if (s == null) {
continue;
}
addSound(s, type);
}
} else if (sound instanceof Sound) {
addSound((Sound) sound, type);
} else {
throw new IllegalArgumentException("Was given an unknown object " + sound);
}
@ -290,6 +322,10 @@ public enum DisguiseSound {
return damageSoundVolume;
}
public void setDamageAndIdleSoundVolume(float strength) {
this.damageSoundVolume = strength;
}
public Object getSound(SoundType type) {
if (type == null) {
return null;
@ -334,8 +370,4 @@ public enum DisguiseSound {
public boolean isCancelSound(String sound) {
return getSound(sound) == SoundType.CANCEL;
}
public void setDamageAndIdleSoundVolume(float strength) {
this.damageSoundVolume = strength;
}
}

View File

@ -17,6 +17,7 @@ import me.libraryaddict.disguise.utilities.packets.IPacketHandler;
import me.libraryaddict.disguise.utilities.packets.LibsPackets;
import me.libraryaddict.disguise.utilities.packets.PacketsHandler;
import me.libraryaddict.disguise.utilities.reflection.DisguiseValues;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import org.bukkit.Art;
import org.bukkit.Location;
@ -224,11 +225,15 @@ public class PacketHandlerSpawn implements IPacketHandler {
packets.addPacket(spawnPlayer);
if (ReflectionManager.isSupported(NmsVersion.v1_15)) {
PacketContainer metaPacket = ProtocolLibrary.getProtocolManager()
.createPacketConstructor(PacketType.Play.Server.ENTITY_METADATA, entityId, newWatcher, true)
.createPacket(entityId, newWatcher, true);
packets.addPacket(metaPacket);
} else {
spawnPlayer.getDataWatcherModifier().write(0, newWatcher);
}
if (!selfDisguise) {
// Teleport the player back to where he's supposed to be
@ -248,7 +253,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
packets.addDelayedPacket(teleportPacket, 3);
// Send a metadata packet
metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
PacketContainer metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
newWatcher = DisguiseUtilities
.createSanitizedDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity),
@ -309,11 +314,15 @@ public class PacketHandlerSpawn implements IPacketHandler {
.createSanitizedDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity),
disguise.getWatcher());
if (ReflectionManager.isSupported(NmsVersion.v1_15)) {
PacketContainer metaPacket = ProtocolLibrary.getProtocolManager()
.createPacketConstructor(PacketType.Play.Server.ENTITY_METADATA, disguisedEntity.getEntityId(),
newWatcher, true).createPacket(disguisedEntity.getEntityId(), newWatcher, true);
packets.addPacket(metaPacket);
} else {
spawnEntity.getDataWatcherModifier().write(0, newWatcher);
}
} else if (disguise.getType().isMisc()) {
int data = ((MiscDisguise) disguise).getData();
double x = loc.getX();

View File

@ -37,6 +37,10 @@ public class DisguiseParser {
public static void createDefaultMethods() {
try {
for (DisguiseType type : DisguiseType.values()) {
if (type.getEntityType() == null) {
continue;
}
Disguise disguise;
if (type.isMisc()) {
@ -284,19 +288,21 @@ public class DisguiseParser {
}
public static DisguisePerm[] getDisguisePerms() {
DisguisePerm[] perms = new DisguisePerm[DisguiseType.values().length +
DisguiseConfig.getCustomDisguises().size()];
int i = 0;
ArrayList<DisguisePerm> perms = new ArrayList<>();
for (DisguiseType disguiseType : DisguiseType.values()) {
perms[i++] = new DisguisePerm(disguiseType);
if (disguiseType.getEntityType() == null) {
continue;
}
perms.add(new DisguisePerm(disguiseType));
}
for (Entry<DisguisePerm, String> entry : DisguiseConfig.getCustomDisguises().entrySet()) {
perms[i++] = entry.getKey();
perms.add(entry.getKey());
}
return perms;
return perms.toArray(new DisguisePerm[0]);
}
/**

View File

@ -9,6 +9,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.utilities.parser.DisguisePerm;
import me.libraryaddict.disguise.utilities.parser.params.ParamInfo;
import me.libraryaddict.disguise.utilities.parser.params.ParamInfoTypes;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import org.bukkit.ChatColor;
import javax.annotation.Nullable;
@ -90,7 +91,9 @@ public class ParamInfoManager {
while (itel.hasNext()) {
Method method = itel.next();
if (method.getParameterTypes().length != 1) {
if (!ReflectionManager.isSupported(method)) {
itel.remove();
} else if (method.getParameterTypes().length != 1) {
itel.remove();
} else if (method.getName().startsWith("get")) {
itel.remove();

View File

@ -0,0 +1,12 @@
package me.libraryaddict.disguise.utilities.reflection;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Created by libraryaddict on 6/02/2020.
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface NmsAdded {
NmsVersion added();
}

View File

@ -0,0 +1,12 @@
package me.libraryaddict.disguise.utilities.reflection;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Created by libraryaddict on 6/02/2020.
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface NmsRemoved {
NmsVersion removed();
}

View File

@ -0,0 +1,9 @@
package me.libraryaddict.disguise.utilities.reflection;
/**
* Created by libraryaddict on 6/02/2020.
*/
public enum NmsVersion {
v1_14,
v1_15;
}

View File

@ -5,6 +5,7 @@ import com.comphenix.protocol.wrappers.*;
import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
import com.comphenix.protocol.wrappers.nbt.NbtWrapper;
import lombok.Getter;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.*;
@ -47,6 +48,12 @@ public class ReflectionManager {
private static Field chunkProviderField;
private static Field entityTrackerField;
private static Field trackedEntitiesField;
@Getter
private static NmsVersion version;
public static boolean isSupported(NmsVersion version) {
return getVersion().ordinal() >= version.ordinal();
}
public static void init() {
try {
@ -96,6 +103,52 @@ public class ReflectionManager {
entityCountField.setAccessible(true);
}
public static boolean isSupported(AccessibleObject obj) {
if (obj.isAnnotationPresent(NmsAdded.class)) {
NmsAdded added = obj.getAnnotation(NmsAdded.class);
// If it was added after/on this version
if (!isSupported(added.added())) {
return false;
}
}
if (obj.isAnnotationPresent(NmsRemoved.class)) {
NmsRemoved removed = obj.getAnnotation(NmsRemoved.class);
if (isSupported(removed.removed())) {
return false;
}
}
return true;
}
public static boolean isSupported(Class cl, String name) {
try {
for (Field field : cl.getFields()) {
if (!field.getName().equals(name)) {
continue;
}
return isSupported(field);
}
for (Method method : cl.getMethods()) {
if (!method.getName().equals(name)) {
continue;
}
return isSupported(method);
}
}
catch (Exception ex) {
ex.printStackTrace();
}
return true;
}
public static YamlConfiguration getPluginYaml(ClassLoader loader) {
try (InputStream stream = loader.getResourceAsStream("plugin.yml")) {
YamlConfiguration config = new YamlConfiguration();
@ -286,6 +339,15 @@ public class ReflectionManager {
public static String getBukkitVersion() {
if (bukkitVersion == null) {
bukkitVersion = Bukkit.getServer().getClass().getName().split("\\.")[3];
for (NmsVersion v : NmsVersion.values()) {
if (!getBukkitVersion().startsWith(v.name())) {
continue;
}
version = v;
break;
}
}
return bukkitVersion;

View File

@ -17,7 +17,8 @@ public class TranslateFiller {
// Fill the configs
for (ParamInfo info : ParamInfoManager.getParamInfos()) {
TranslateType.DISGUISE_OPTIONS_PARAMETERS.save(info.getRawName(), "A disguise option name, has description " + info.getDescription());
TranslateType.DISGUISE_OPTIONS_PARAMETERS
.save(info.getRawName(), "A disguise option name, has description " + info.getDescription());
if (!info.getRawName().equals(info.getRawDescriptiveName())) {
TranslateType.DISGUISE_OPTIONS_PARAMETERS
@ -51,6 +52,10 @@ public class TranslateFiller {
TranslateType.DISGUISES.save(StringUtils.join(split, " "), "Name for the " + type.name() + " disguise");
if (type.getEntityType() == null) {
continue;
}
for (Method method : ParamInfoManager.getDisguiseWatcherMethods(type.getWatcherClass())) {
Class para = method.getParameterTypes()[0];
String className = method.getDeclaringClass().getSimpleName().replace("Watcher", "");