Format files

This commit is contained in:
libraryaddict 2024-03-06 15:48:26 +13:00
parent 8e6b4ce466
commit 4be61e08d5
95 changed files with 1069 additions and 694 deletions

View File

@ -129,7 +129,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -159,7 +160,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -235,9 +237,11 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
@Override
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
ClientboundPlayerInfoPacket.PlayerUpdate entry =
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL, new TextComponent(displayName));
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL,
new TextComponent(displayName));
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
@ -290,8 +294,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -375,7 +380,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = Registry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -388,7 +394,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -129,7 +129,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -159,7 +160,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -235,9 +237,11 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
@Override
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
ClientboundPlayerInfoPacket.PlayerUpdate entry =
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL, new TextComponent(displayName));
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL,
new TextComponent(displayName));
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
@ -290,8 +294,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -375,7 +380,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = Registry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -388,7 +394,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -129,7 +129,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -159,7 +160,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -235,9 +237,11 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
@Override
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
ClientboundPlayerInfoPacket.PlayerUpdate entry =
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL, new TextComponent(displayName));
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL,
new TextComponent(displayName));
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
@ -290,8 +294,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -375,7 +380,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = Registry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -388,7 +394,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -136,7 +136,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -166,7 +167,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -242,9 +244,11 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
@Override
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
ClientboundPlayerInfoPacket.PlayerUpdate entry =
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL, Component.literal(displayName), null);
new ClientboundPlayerInfoPacket.PlayerUpdate((GameProfile) gameProfile.getHandle(), 0, GameType.SURVIVAL,
Component.literal(displayName), null);
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
@ -297,8 +301,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -382,7 +387,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = Registry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -395,7 +401,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return Registry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -143,7 +143,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -177,7 +178,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -282,7 +284,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
event.getPacket().getModifier().write(1, canKeep);
}
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
if (actions[0] == EnumWrappers.PlayerInfoAction.REMOVE_PLAYER) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO_REMOVE);
packet.getModifier().write(0, Collections.singletonList(gameProfile.getUUID()));
@ -291,13 +294,14 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
ClientboundPlayerInfoUpdatePacket.Entry entry =
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0, GameType.SURVIVAL,
Component.literal(displayName), null);
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0,
GameType.SURVIVAL, Component.literal(displayName), null);
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet =
EnumSet.copyOf(Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name())).collect(Collectors.toList()));
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.copyOf(
Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name()))
.collect(Collectors.toList()));
modifier.write(0, enumSet);
modifier.write(1, Collections.singletonList(entry));
@ -347,8 +351,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -432,7 +437,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = BuiltInRegistries.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -445,7 +451,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -142,7 +142,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -172,7 +173,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -277,7 +279,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
event.getPacket().getModifier().write(1, canKeep);
}
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
if (actions[0] == EnumWrappers.PlayerInfoAction.REMOVE_PLAYER) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO_REMOVE);
packet.getModifier().write(0, Collections.singletonList(gameProfile.getUUID()));
@ -286,13 +289,14 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
ClientboundPlayerInfoUpdatePacket.Entry entry =
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0, GameType.SURVIVAL,
Component.literal(displayName), null);
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0,
GameType.SURVIVAL, Component.literal(displayName), null);
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet =
EnumSet.copyOf(Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name())).collect(Collectors.toList()));
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.copyOf(
Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name()))
.collect(Collectors.toList()));
modifier.write(0, enumSet);
modifier.write(1, Collections.singletonList(entry));
@ -342,8 +346,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -427,7 +432,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = BuiltInRegistries.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -440,7 +446,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -143,7 +143,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
@ -173,7 +174,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -278,7 +280,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
event.getPacket().getModifier().write(1, canKeep);
}
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
if (actions[0] == EnumWrappers.PlayerInfoAction.REMOVE_PLAYER) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO_REMOVE);
packet.getModifier().write(0, Collections.singletonList(gameProfile.getUUID()));
@ -287,13 +290,14 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
ClientboundPlayerInfoUpdatePacket.Entry entry =
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0, GameType.SURVIVAL,
Component.literal(displayName), null);
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0,
GameType.SURVIVAL, Component.literal(displayName), null);
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet =
EnumSet.copyOf(Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name())).collect(Collectors.toList()));
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.copyOf(
Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name()))
.collect(Collectors.toList()));
modifier.write(0, enumSet);
modifier.write(1, Collections.singletonList(entry));
@ -344,8 +348,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -429,7 +434,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = BuiltInRegistries.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -442,7 +448,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -145,14 +145,16 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (optional.isPresent()) {
net.minecraft.world.entity.EntityType<?> entityType = optional.get();
ServerLevel world = getWorldServer(Bukkit.getWorlds().get(0));
net.minecraft.world.entity.Entity entity;
if (entityType == net.minecraft.world.entity.EntityType.PLAYER) {
WrappedGameProfile gameProfile = ReflectionManagerAbstract.getGameProfile(new UUID(0, 0), "Steve");
ClientInformation information = new ClientInformation("english", 10, ChatVisiblity.FULL, true, 0, HumanoidArm.RIGHT, true, true);
ClientInformation information =
new ClientInformation("english", 10, ChatVisiblity.FULL, true, 0, HumanoidArm.RIGHT, true, true);
entity = new ServerPlayer(getMinecraftServer(), world, (GameProfile) gameProfile.getHandle(), information);
} else {
entity = entityType.create(world);
@ -176,7 +178,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -281,7 +284,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
event.getPacket().getModifier().write(1, canKeep);
}
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
if (actions[0] == EnumWrappers.PlayerInfoAction.REMOVE_PLAYER) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO_REMOVE);
packet.getModifier().write(0, Collections.singletonList(gameProfile.getUUID()));
@ -290,13 +294,14 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
ClientboundPlayerInfoUpdatePacket.Entry entry =
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0, GameType.SURVIVAL,
Component.literal(displayName), null);
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0,
GameType.SURVIVAL, Component.literal(displayName), null);
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet =
EnumSet.copyOf(Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name())).collect(Collectors.toList()));
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.copyOf(
Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name()))
.collect(Collectors.toList()));
modifier.write(0, enumSet);
modifier.write(1, Collections.singletonList(entry));
@ -346,8 +351,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -431,7 +437,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = BuiltInRegistries.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -444,7 +451,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -145,7 +145,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public net.minecraft.world.entity.Entity createEntityInstance(String entityName) {
Optional<net.minecraft.world.entity.EntityType<?>> optional = net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ROOT));
if (!optional.isPresent()) {
return null;
@ -156,7 +157,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
net.minecraft.world.entity.Entity entity;
if (entityType == net.minecraft.world.entity.EntityType.PLAYER) {
WrappedGameProfile gameProfile = ReflectionManagerAbstract.getGameProfile(new UUID(0, 0), "Steve");
ClientInformation information = new ClientInformation("english", 10, ChatVisiblity.FULL, true, 0, HumanoidArm.RIGHT, true, true);
ClientInformation information =
new ClientInformation("english", 10, ChatVisiblity.FULL, true, 0, HumanoidArm.RIGHT, true, true);
entity = new ServerPlayer(getMinecraftServer(), world, (GameProfile) gameProfile.getHandle(), information);
} else {
entity = entityType.create(world);
@ -177,7 +179,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
public MobEffectInstance createMobEffect(PotionEffect effect) {
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
return createMobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}
public MobEffectInstance createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
@ -282,7 +285,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
event.getPacket().getModifier().write(1, canKeep);
}
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions) {
public PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions) {
if (actions[0] == EnumWrappers.PlayerInfoAction.REMOVE_PLAYER) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO_REMOVE);
packet.getModifier().write(0, Collections.singletonList(gameProfile.getUUID()));
@ -291,13 +295,14 @@ public class ReflectionManager implements ReflectionManagerAbstract {
}
ClientboundPlayerInfoUpdatePacket.Entry entry =
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0, GameType.SURVIVAL,
Component.literal(displayName), null);
new ClientboundPlayerInfoUpdatePacket.Entry(gameProfile.getUUID(), (GameProfile) gameProfile.getHandle(), nameVisible, 0,
GameType.SURVIVAL, Component.literal(displayName), null);
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
StructureModifier<Object> modifier = packet.getModifier();
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet =
EnumSet.copyOf(Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name())).collect(Collectors.toList()));
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.copyOf(
Arrays.stream(actions).map(action -> ClientboundPlayerInfoUpdatePacket.Action.valueOf(action.name()))
.collect(Collectors.toList()));
modifier.write(0, enumSet);
modifier.write(1, Collections.singletonList(entry));
@ -347,8 +352,9 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public void setBoundingBox(Entity entity, double x, double y, double z) {
Location loc = entity.getLocation();
((CraftEntity) entity).getHandle()
.setBoundingBox(new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2, loc.getZ() + z / 2));
((CraftEntity) entity).getHandle().setBoundingBox(
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
loc.getZ() + z / 2));
}
public Enum getSoundCategory(String category) {
@ -432,7 +438,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
public VillagerData getNmsVillagerData(Villager.Type villagerType, Villager.Profession villagerProfession, int level) {
VillagerType nmsVillagerType = BuiltInRegistries.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(villagerType.getKey()));
VillagerProfession nmsVillagerProfession = BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
VillagerProfession nmsVillagerProfession =
BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(villagerProfession.getKey()));
return new net.minecraft.world.entity.npc.VillagerData(nmsVillagerType, nmsVillagerProfession, level);
}
@ -445,7 +452,8 @@ public class ReflectionManager implements ReflectionManagerAbstract {
return BuiltInRegistries.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(profession.getKey()));
}
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject, T metaItem) {
public <T> SynchedEntityData.DataItem<T> createDataWatcherItem(WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject,
T metaItem) {
return new SynchedEntityData.DataItem<>((EntityDataAccessor<T>) wrappedDataWatcherObject.getHandle(), metaItem);
}

View File

@ -332,8 +332,8 @@ public class DisguiseConfig {
}
private static void doUpdaterTask() {
boolean startTask = isAutoUpdate() || isNotifyUpdate() ||
"1592".equals((LibsPremium.getPaidInformation() == null ? LibsPremium.getPluginInformation() : LibsPremium.getPaidInformation()).getUserID());
boolean startTask = isAutoUpdate() || isNotifyUpdate() || "1592".equals(
(LibsPremium.getPaidInformation() == null ? LibsPremium.getPluginInformation() : LibsPremium.getPaidInformation()).getUserID());
// Don't ever run the auto updater on a custom build..
if (!LibsDisguises.getInstance().isNumberedBuild()) {
@ -358,9 +358,8 @@ public class DisguiseConfig {
// Next update check will be in 30 minutes, or the timer - elapsed time. Whatever is greater
timeSinceLast = Math.max(30 * 60 * 20, timer - timeSinceLast);
updaterTask = Bukkit.getScheduler()
.runTaskTimerAsynchronously(LibsDisguises.getInstance(), () -> LibsDisguises.getInstance().getUpdateChecker().doAutoUpdateCheck(), timeSinceLast,
timer);
updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(LibsDisguises.getInstance(),
() -> LibsDisguises.getInstance().getUpdateChecker().doAutoUpdateCheck(), timeSinceLast, timer);
}
public static void setUsingReleaseBuilds(boolean useReleaseBuilds) {
@ -421,8 +420,8 @@ public class DisguiseConfig {
String internalConfig = ReflectionManager.getResourceAsString(LibsDisguises.getInstance().getFile(), "internal.yml");
// Bisect hosted, server ip, release builds
for (Object s : new Object[]{isBisectHosted(), getSavedServerIp(), isUsingReleaseBuild(), getLastUpdateRequest(), isHittingRateLimit(),
getLastGithubUpdateETag(), getLastPluginUpdateVersion(), getData()}) {
for (Object s : new Object[]{isBisectHosted(), getSavedServerIp(), isUsingReleaseBuild(), getLastUpdateRequest(),
isHittingRateLimit(), getLastGithubUpdateETag(), getLastPluginUpdateVersion(), getData()}) {
internalConfig = internalConfig.replaceFirst("%data%", "" + s);
}
@ -575,7 +574,8 @@ public class DisguiseConfig {
explain.createNewFile();
try (PrintWriter out = new PrintWriter(explain)) {
out.println("This folder is used to store .png files for uploading with the /savedisguise or " + "/grabskin " + "commands");
out.println(
"This folder is used to store .png files for uploading with the /savedisguise or " + "/grabskin " + "commands");
}
} catch (IOException e) {
e.printStackTrace();
@ -668,7 +668,8 @@ public class DisguiseConfig {
try {
setPlayerNameType(PlayerNameType.valueOf(config.getString("PlayerNames").toUpperCase(Locale.ENGLISH)));
} catch (Exception ex) {
DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("PlayerNames") + "' to a valid option for PlayerNames");
DisguiseUtilities.getLogger()
.warning("Cannot parse '" + config.getString("PlayerNames") + "' to a valid option for PlayerNames");
}
try {
@ -687,29 +688,34 @@ public class DisguiseConfig {
try {
setBossBarColor(BarColor.valueOf(config.getString("BossBarColor").toUpperCase(Locale.ENGLISH)));
} catch (Exception ex) {
DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("BossBarColor") + "' to a valid option for BossBarColor");
DisguiseUtilities.getLogger()
.warning("Cannot parse '" + config.getString("BossBarColor") + "' to a valid option for BossBarColor");
}
try {
setBossBarStyle(BarStyle.valueOf(config.getString("BossBarStyle").toUpperCase(Locale.ENGLISH)));
} catch (Exception ex) {
DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("BossBarStyle") + "' to a valid option for BossBarStyle");
DisguiseUtilities.getLogger()
.warning("Cannot parse '" + config.getString("BossBarStyle") + "' to a valid option for BossBarStyle");
}
try {
setUpdatesBranch(UpdatesBranch.valueOf(config.getString("UpdatesBranch").toUpperCase(Locale.ENGLISH)));
} catch (Exception ex) {
DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch");
DisguiseUtilities.getLogger()
.warning("Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch");
}
try {
setDisabledDisguises(
config.getStringList("DisabledDisguises").stream().map(s -> DisguiseType.valueOf(s.toUpperCase(Locale.ROOT))).collect(Collectors.toList()));
config.getStringList("DisabledDisguises").stream().map(s -> DisguiseType.valueOf(s.toUpperCase(Locale.ROOT)))
.collect(Collectors.toList()));
} catch (Exception ex) {
DisguiseUtilities.getLogger().warning("Cannot load 'DisabledDisguises' in features.yml, invalid disguise types provided?");
}
setDisabledMethods(config.getStringList("DisabledMethods").stream().map(s -> s.toLowerCase(Locale.ROOT)).collect(Collectors.toList()));
setDisabledMethods(
config.getStringList("DisabledMethods").stream().map(s -> s.toLowerCase(Locale.ROOT)).collect(Collectors.toList()));
setNeverUpdateProtocolLib(config.getBoolean("NeverUpdateProtocolLib", false));
@ -717,8 +723,8 @@ public class DisguiseConfig {
PermissionDefault commandVisibility = seeCommands == null ? null : PermissionDefault.getByName(seeCommands);
if (commandVisibility == null) {
DisguiseUtilities.getLogger()
.warning("Invalid option '" + config.getString("Permissions.SeeCommands") + "' for Permissions.SeeCommands when loading config!");
DisguiseUtilities.getLogger().warning(
"Invalid option '" + config.getString("Permissions.SeeCommands") + "' for Permissions.SeeCommands when loading config!");
} else {
setCommandVisibility(commandVisibility);
}
@ -747,7 +753,8 @@ public class DisguiseConfig {
if (config.contains("VerboseConfig")) {
verbose = config.getBoolean("VerboseConfig");
} else {
DisguiseUtilities.getLogger().info("As 'VerboseConfig' hasn't been set, it is assumed true. Set it in your config to remove " + "these messages!");
DisguiseUtilities.getLogger()
.info("As 'VerboseConfig' hasn't been set, it is assumed true. Set it in your config to remove " + "these messages!");
verbose = true;
}
@ -757,9 +764,8 @@ public class DisguiseConfig {
ArrayList<String> returns = doOutput(config, changed, verbose);
if (!returns.isEmpty()) {
DisguiseUtilities.getLogger().info(
"This is not an error! Now outputting " + (verbose ? "missing " : "") + (changed ? (verbose ? "and " : "") + "changed/invalid " : "") +
"config values");
DisguiseUtilities.getLogger().info("This is not an error! Now outputting " + (verbose ? "missing " : "") +
(changed ? (verbose ? "and " : "") + "changed/invalid " : "") + "config values");
for (String v : returns) {
DisguiseUtilities.getLogger().info(v);
@ -774,7 +780,8 @@ public class DisguiseConfig {
configLoader.saveDefaultConfigs();
DisguiseUtilities.getLogger().info("Config has been auto-updated!");
} else if (!verbose) {
DisguiseUtilities.getLogger().warning("Your config is missing " + missingConfigs + " options! Please consider regenerating your config!");
DisguiseUtilities.getLogger()
.warning("Your config is missing " + missingConfigs + " options! Please consider regenerating your config!");
DisguiseUtilities.getLogger().info("You can also add the missing entries yourself! Try '/libsdisguises config'");
}
} else {
@ -850,12 +857,13 @@ public class DisguiseConfig {
ModdedEntity entity = new ModdedEntity(null, name, living, mod, version, requireMessage, 0);
if (ModdedManager.getModdedEntity(name) != null) {
DisguiseUtilities.getLogger().info("Modded entity " + name + " has already been " + (register ? "registered" : "added"));
DisguiseUtilities.getLogger()
.info("Modded entity " + name + " has already been " + (register ? "registered" : "added"));
continue;
}
ModdedManager.registerModdedEntity(new NamespacedKey(key.substring(0, key.indexOf(":")), key.substring(key.indexOf(":") + 1)), entity,
register);
ModdedManager.registerModdedEntity(
new NamespacedKey(key.substring(0, key.indexOf(":")), key.substring(key.indexOf(":") + 1)), entity, register);
DisguiseUtilities.getLogger().info("Modded entity " + name + " has been " + (register ? "registered" : "added"));
} catch (Exception ex) {
@ -942,8 +950,8 @@ public class DisguiseConfig {
String toParse = section.getString(key);
if (!NmsVersion.v1_13.isSupported() && key.equals("libraryaddict")) {
toParse =
toParse.replace("GOLDEN_BOOTS,GOLDEN_LEGGINGS,GOLDEN_CHESTPLATE,GOLDEN_HELMET", "GOLD_BOOTS,GOLD_LEGGINGS,GOLD_CHESTPLATE,GOLD_HELMET");
toParse = toParse.replace("GOLDEN_BOOTS,GOLDEN_LEGGINGS,GOLDEN_CHESTPLATE,GOLDEN_HELMET",
"GOLD_BOOTS,GOLD_LEGGINGS,GOLD_CHESTPLATE,GOLD_HELMET");
}
try {
@ -969,7 +977,8 @@ public class DisguiseConfig {
DisguiseUtilities.getLogger().warning("Failed to load " + failedCustomDisguises + " custom disguises");
}
DisguiseUtilities.getLogger().info("Loaded " + customDisguises.size() + " custom disguise" + (customDisguises.size() == 1 ? "" : "s"));
DisguiseUtilities.getLogger()
.info("Loaded " + customDisguises.size() + " custom disguise" + (customDisguises.size() == 1 ? "" : "s"));
// Reload the permissions here because otherwise our cached permissions doesn't know about the custom disguises
DisguisePermissions.onReload();
}
@ -996,7 +1005,8 @@ public class DisguiseConfig {
DisguiseUtilities.getLogger().info("Loaded custom disguise " + disguiseName);
DisguisePermissions.onReload();
} catch (DisguiseParseException e) {
throw new DisguiseParseException(LibsMsg.ERROR_LOADING_CUSTOM_DISGUISE, disguiseName, (e.getMessage() == null ? "" : ": " + e.getMessage()));
throw new DisguiseParseException(LibsMsg.ERROR_LOADING_CUSTOM_DISGUISE, disguiseName,
(e.getMessage() == null ? "" : ": " + e.getMessage()));
} catch (Throwable e) {
e.printStackTrace();
throw new DisguiseParseException(LibsMsg.ERROR_LOADING_CUSTOM_DISGUISE, disguiseName, "");

View File

@ -88,8 +88,8 @@ public class LibsDisguises extends JavaPlugin {
if (plugin == null || DisguiseUtilities.isProtocolLibOutdated()) {
if (DisguiseConfig.isNeverUpdateProtocolLib()) {
getLogger().warning(
"Defined in plugins/LibsDisguises/configs/sanity.yml, you have requested that Lib's Disguises never updates or installs ProtocolLib. " +
"Please do not report any issues with this plugin.");
"Defined in plugins/LibsDisguises/configs/sanity.yml, you have requested that Lib's Disguises never updates or " +
"installs ProtocolLib. " + "Please do not report any issues with this plugin.");
} else {
String reason;
@ -103,7 +103,8 @@ public class LibsDisguises extends JavaPlugin {
reason = "Lib's Disguises couldn't process ProtocolLib properly";
}
getLogger().warning("An issue occured when trying to load ProtocolLib: " + reason + ". Lib's Disguises will attempt to update it.");
getLogger().warning(
"An issue occured when trying to load ProtocolLib: " + reason + ". Lib's Disguises will attempt to update it.");
try {
File dest = DisguiseUtilities.updateProtocolLib();
@ -118,7 +119,8 @@ public class LibsDisguises extends JavaPlugin {
getLogger().severe("Please restart the server to complete the ProtocolLib update!");
}
} catch (Exception e) {
getLogger().severe("Looks like ProtocolLib's site may be down! Try download it manually from https://ci.dmulloy2.net/job/ProtocolLib/");
getLogger().severe("Looks like ProtocolLib's site may be down! Try download it manually from https://ci.dmulloy2" +
".net/job/ProtocolLib/");
e.printStackTrace();
}
}
@ -163,11 +165,13 @@ public class LibsDisguises extends JavaPlugin {
if (Bukkit.getVersion().contains("(MC: 1.18)") || Bukkit.getVersion().contains("(MC: 1.18.1)")) {
getLogger().severe(
"Please update from MC 1.18 and MC 1.18.1! You should be using 1.18.2! Support will eventually be dropped for your specific version!");
"Please update from MC 1.18 and MC 1.18.1! You should be using 1.18.2! Support will eventually be dropped for your " +
"specific version!");
}
if (Bukkit.getVersion().contains("(MC: 1.19)")) {
getLogger().severe("Please update from MC 1.19.0! You should be using at least 1.19.3! 1.19.1 is the lowest supported 1.19 version!");
getLogger().severe(
"Please update from MC 1.19.0! You should be using at least 1.19.3! 1.19.1 is the lowest supported 1.19 version!");
}
try {
@ -199,9 +203,10 @@ public class LibsDisguises extends JavaPlugin {
if (fileCount != pluginYml.getInt("file-count", fileCount)) {
getLogger().severe(
"Lib's Disguises may be infected with malware, please redownload from a trusted source such as SpigotMC. If this warning shows even after" +
" updating, try https://www.spigotmc.org/resources/spigot-anti-malware.64982/ otherwise if that doesn't help then please contact " +
"libraryaddict on discord https://discord.gg/J5XRqYX");
"Lib's Disguises may be infected with malware, please redownload from a trusted source such as SpigotMC. If this " +
"warning shows even after" +
" updating, try https://www.spigotmc.org/resources/spigot-anti-malware.64982/ otherwise if that doesn't help then" +
" please contact " + "libraryaddict on discord https://discord.gg/J5XRqYX");
}
getLogger().info("File Name: " + getFile().getName());
@ -212,8 +217,9 @@ public class LibsDisguises extends JavaPlugin {
nmsPackageName = "{Not package relocated}";
}
getLogger().info("Discovered nms version: (Package: " + nmsPackageName + ") (LD: " + ReflectionManager.getVersion() + ") (MC: " +
ReflectionManager.getMinecraftVersion() + ")");
getLogger().info(
"Discovered nms version: (Package: " + nmsPackageName + ") (LD: " + ReflectionManager.getVersion() + ") (MC: " +
ReflectionManager.getMinecraftVersion() + ")");
getLogger().info("Jenkins Build: " + (isNumberedBuild() ? "#" : "") + getBuildNo());
@ -225,13 +231,14 @@ public class LibsDisguises extends JavaPlugin {
if (!LibsPremium.isPremium()) {
getLogger().info(
"You are running the free version, commands limited to non-players and operators. (Console," + " Command " + "Blocks, Admins)");
"You are running the free version, commands limited to non-players and operators. (Console," + " Command " +
"Blocks, Admins)");
}
if (ReflectionManager.getVersion() == null) {
getLogger().severe("You're using the wrong version of Lib's Disguises for your server! This is " + "intended for " + StringUtils.join(
Arrays.stream(NmsVersion.values()).filter(v -> v != NmsVersion.UNSUPPORTED).map(v -> String.join(", ", v.getSupportedVersions()))
.collect(Collectors.toList()), ", ") + "!");
getLogger().severe("You're using the wrong version of Lib's Disguises for your server! This is " + "intended for " +
StringUtils.join(Arrays.stream(NmsVersion.values()).filter(v -> v != NmsVersion.UNSUPPORTED)
.map(v -> String.join(", ", v.getSupportedVersions())).collect(Collectors.toList()), ", ") + "!");
getPluginLoader().disablePlugin(this);
return;
}
@ -336,12 +343,14 @@ public class LibsDisguises extends JavaPlugin {
if (DisguiseUtilities.isProtocollibUpdateDownloaded()) {
getLogger().severe(
"An update for ProtocolLib has been downloaded and will be installed when the server restarts. When possible, please restart " +
"the server. Lib's Disguises may not work correctly until you do so.");
"An update for ProtocolLib has been downloaded and will be installed when the server restarts. When possible, " +
"please restart " + "the server. Lib's Disguises may not work correctly until you do so.");
} else {
getLogger().severe(
"Update your ProtocolLib! You are running " + version + " but the minimum version you should be on is " + requiredProtocolLib + "!");
getLogger().severe("https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/target" + "/ProtocolLib" + ".jar");
"Update your ProtocolLib! You are running " + version + " but the minimum version you should be on is " +
requiredProtocolLib + "!");
getLogger().severe(
"https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/target" + "/ProtocolLib" + ".jar");
getLogger().severe("Or! Use /ld protocollib - To update to the latest development build");
}

View File

@ -83,7 +83,8 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
String requiredProtocolLib = StringUtils.join(DisguiseUtilities.getProtocolLibRequiredVersion(), " or build #");
String version = ProtocolLibrary.getPlugin().getDescription().getVersion();
if (!DisguiseConfig.isNeverUpdateProtocolLib() && DisguiseUtilities.isProtocolLibOutdated() && sender.hasPermission("libsdisguises.update")) {
if (!DisguiseConfig.isNeverUpdateProtocolLib() && DisguiseUtilities.isProtocolLibOutdated() &&
sender.hasPermission("libsdisguises.update")) {
DisguiseUtilities.sendProtocolLibUpdateMessage(sender, version, requiredProtocolLib);
}
@ -100,7 +101,8 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
return false;
}
protected List<String> getTabDisguiseTypes(CommandSender sender, DisguisePermissions perms, String[] allArgs, int startsAt, String currentArg) {
protected List<String> getTabDisguiseTypes(CommandSender sender, DisguisePermissions perms, String[] allArgs, int startsAt,
String currentArg) {
// If not enough arguments to get current disguise type
if (allArgs.length <= startsAt) {
return getAllowedDisguises(perms);
@ -143,8 +145,8 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
* @param startsAt What index this starts at
* @return a list of viable disguise options
*/
protected List<String> getTabDisguiseOptions(CommandSender commandSender, DisguisePermissions perms, DisguisePerm disguisePerm, String[] allArgs,
int startsAt, String currentArg) {
protected List<String> getTabDisguiseOptions(CommandSender commandSender, DisguisePermissions perms, DisguisePerm disguisePerm,
String[] allArgs, int startsAt, String currentArg) {
ArrayList<String> usedOptions = new ArrayList<>();
WatcherMethod[] methods = ParamInfoManager.getDisguiseWatcherMethods(disguisePerm.getWatcherClass());
@ -170,8 +172,8 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
return getTabDisguiseSubOptions(commandSender, perms, disguisePerm, allArgs, startsAt, currentArg);
}
protected List<String> getTabDisguiseSubOptions(CommandSender commandSender, DisguisePermissions perms, DisguisePerm disguisePerm, String[] allArgs,
int startsAt, String currentArg) {
protected List<String> getTabDisguiseSubOptions(CommandSender commandSender, DisguisePermissions perms, DisguisePerm disguisePerm,
String[] allArgs, int startsAt, String currentArg) {
boolean addMethods = true;
List<String> tabs = new ArrayList<>();
@ -230,7 +232,8 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
}
if (wantToUse != null) {
HashMap<String, HashMap<String, Boolean>> allowedOptions = DisguisePermissions.getDisguiseOptions(commandSender, getPermNode(), disguisePerm);
HashMap<String, HashMap<String, Boolean>> allowedOptions =
DisguisePermissions.getDisguiseOptions(commandSender, getPermNode(), disguisePerm);
HashMap<String, Boolean> methodValues = allowedOptions.get(methodName.toLowerCase(Locale.ENGLISH));
if (methodValues != null) {
@ -250,7 +253,8 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
if (addMethods) {
// If this is a method, add. Else if it can be a param of the previous argument, add.
for (WatcherMethod method : ParamInfoManager.getDisguiseWatcherMethods(disguisePerm.getWatcherClass())) {
if (!perms.isAllowedDisguise(disguisePerm, Collections.singletonList(method.getName())) || !method.isUsable(disguisePerm.getType())) {
if (!perms.isAllowedDisguise(disguisePerm, Collections.singletonList(method.getName())) ||
!method.isUsable(disguisePerm.getType())) {
continue;
}

View File

@ -47,8 +47,9 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
Disguise disguise;
try {
disguise = DisguiseParser.parseDisguise(sender, (Entity) sender, getPermNode(), DisguiseUtilities.split(StringUtils.join(args, " ")),
getPermissions(sender));
disguise =
DisguiseParser.parseDisguise(sender, (Entity) sender, getPermNode(), DisguiseUtilities.split(StringUtils.join(args, " ")),
getPermissions(sender));
} catch (DisguiseParseException ex) {
ex.send(sender);
@ -78,8 +79,10 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
}
}
if (!sender.isOp() && LibsPremium.isBisectHosted() && !Bukkit.getIp().matches("((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}")) {
disguise.setExpires(DisguiseConfig.isDynamicExpiry() ? 20 * 60 * 10 : System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10));
if (!sender.isOp() && LibsPremium.isBisectHosted() &&
!Bukkit.getIp().matches("((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}")) {
disguise.setExpires(
DisguiseConfig.isDynamicExpiry() ? 20 * 60 * 10 : System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10));
}
disguise.startDisguise(sender);
@ -136,7 +139,8 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
LibsMsg.DISG_HELP3.send(sender);
if (allowedDisguises.stream().anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
if (allowedDisguises.stream()
.anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
LibsMsg.DISG_HELP4.send(sender);
}
}

View File

@ -102,7 +102,8 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
LibsMsg.DISG_ENT_HELP4.send(sender);
if (allowedDisguises.stream().anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
if (allowedDisguises.stream()
.anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
LibsMsg.DISG_ENT_HELP5.send(sender);
}
}

View File

@ -79,7 +79,9 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
Disguise disguise;
try {
disguise = DisguiseParser.parseDisguise(sender, entityTarget, getPermNode(), DisguiseUtilities.split(StringUtils.join(newArgs, " ")), permissions);
disguise =
DisguiseParser.parseDisguise(sender, entityTarget, getPermNode(), DisguiseUtilities.split(StringUtils.join(newArgs, " ")),
permissions);
} catch (DisguiseParseException ex) {
ex.send(sender);
return true;
@ -116,11 +118,13 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
disguise.startDisguise(sender);
if (disguise.isDisguiseInUse()) {
LibsMsg.DISG_PLAYER_AS_DISG.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(),
LibsMsg.DISG_PLAYER_AS_DISG.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(),
disguise.getDisguiseName());
} else {
LibsMsg.DISG_PLAYER_AS_DISG_FAIL.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName());
entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(),
disguise.getDisguiseName());
}
return true;
@ -182,7 +186,8 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
LibsMsg.D_HELP4.send(sender);
if (allowedDisguises.stream().anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
if (allowedDisguises.stream()
.anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
LibsMsg.D_HELP5.send(sender);
}
}

View File

@ -70,7 +70,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
return true;
}
if (args[0].equalsIgnoreCase(TranslateType.DISGUISES.get("EntityType")) || args[0].equalsIgnoreCase(TranslateType.DISGUISES.get("EntityType") + "s")) {
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) {
@ -79,7 +80,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
Collections.sort(classes);
LibsMsg.DRADIUS_ENTITIES.send(sender, ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN));
LibsMsg.DRADIUS_ENTITIES.send(sender,
ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN));
return true;
}
@ -176,7 +178,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
Disguise disguise = DisguiseParser.parseDisguise(sender, entity, getPermNode(), disguiseArgs, permissions);
if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() && !entity.hasPermission("libsdisguises.hidename")) {
if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() &&
!entity.hasPermission("libsdisguises.hidename")) {
if (disguise.getWatcher() instanceof LivingWatcher) {
disguise.getWatcher().setCustomName(getDisplayName(entity));
@ -292,7 +295,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
LibsMsg.DRADIUS_HELP4.send(sender);
if (allowedDisguises.stream().anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
if (allowedDisguises.stream()
.anyMatch(disguise -> disguise.equalsIgnoreCase("dropped_item") || disguise.equalsIgnoreCase("falling_block"))) {
LibsMsg.DRADIUS_HELP5.send(sender);
}

View File

@ -36,7 +36,8 @@ public class DisguiseEntityInteraction implements LibsEntityInteract {
Disguise disguise;
try {
disguise = DisguiseParser.parseDisguise(p, entity, "disguiseentity", disguiseArgs, DisguiseParser.getPermissions(p, "disguiseentity"));
disguise =
DisguiseParser.parseDisguise(p, entity, "disguiseentity", disguiseArgs, DisguiseParser.getPermissions(p, "disguiseentity"));
} catch (DisguiseParseException e) {
e.send(p);
return;
@ -48,7 +49,8 @@ public class DisguiseEntityInteraction implements LibsEntityInteract {
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() && entity instanceof LivingEntity) {
LibsMsg.DISABLED_LIVING_TO_MISC.send(p);
} else {
if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() && !entity.hasPermission("libsdisguises.hidename")) {
if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() &&
!entity.hasPermission("libsdisguises.hidename")) {
if (disguise.getWatcher() instanceof LivingWatcher) {
disguise.getWatcher().setCustomName(getDisplayName(entity));

View File

@ -52,7 +52,8 @@ public class DisguiseModifyInteraction implements LibsEntityInteract {
}
try {
DisguiseParser.callMethods(p, disguise, perms, disguisePerm, new ArrayList<>(Arrays.asList(options)), options, "DisguiseModifyEntity");
DisguiseParser.callMethods(p, disguise, perms, disguisePerm, new ArrayList<>(Arrays.asList(options)), options,
"DisguiseModifyEntity");
LibsMsg.LISTENER_MODIFIED_DISG.send(p);
} catch (DisguiseParseException ex) {
ex.send(p);

View File

@ -43,8 +43,8 @@ public class LDChangelog implements LDCommand {
}
if (!checker.getUpdate().isReleaseBuild()) {
sender.sendMessage(
ChatColor.GOLD + "You are on build " + (LibsDisguises.getInstance().isNumberedBuild() ? "#" : "") + LibsDisguises.getInstance().getBuildNo());
sender.sendMessage(ChatColor.GOLD + "You are on build " + (LibsDisguises.getInstance().isNumberedBuild() ? "#" : "") +
LibsDisguises.getInstance().getBuildNo());
}
for (String msg : checker.getUpdate().getChangelog()) {

View File

@ -44,13 +44,14 @@ public class LDCount implements LDCommand {
LibsMsg.ACTIVE_DISGUISES_COUNT.send(sender, counts.values().stream().reduce(Integer::sum).get());
ArrayList<DisguiseType> types = new ArrayList<>(counts.keySet());
types.sort(
(d1, d2) -> String.CASE_INSENSITIVE_ORDER.compare(TranslateType.DISGUISES.get(d1.toReadable()), TranslateType.DISGUISES.get(d2.toReadable())));
types.sort((d1, d2) -> String.CASE_INSENSITIVE_ORDER.compare(TranslateType.DISGUISES.get(d1.toReadable()),
TranslateType.DISGUISES.get(d2.toReadable())));
StringBuilder builder = new StringBuilder();
for (int i = 0; i < types.size(); i++) {
builder.append(LibsMsg.ACTIVE_DISGUISES_DISGUISE.get(TranslateType.DISGUISES.get(types.get(i).toReadable()), counts.get(types.get(i))));
builder.append(LibsMsg.ACTIVE_DISGUISES_DISGUISE.get(TranslateType.DISGUISES.get(types.get(i).toReadable()),
counts.get(types.get(i))));
if (i + 1 < types.size()) {
builder.append(LibsMsg.ACTIVE_DISGUISES_SEPERATOR.get());

View File

@ -49,15 +49,15 @@ public class LDDebugPlayer implements LDCommand {
DisguiseUtilities.DScoreTeam name = disg.getScoreboardName();
player.sendMessage(ChatColor.RED +
String.format("Prefix: '%s', Suffix: '%s', Disguise Name: '%s', Team '%s'", name.getPrefix().replace(ChatColor.COLOR_CHAR, '&'),
name.getSuffix().replace(ChatColor.COLOR_CHAR, '&'), name.getPlayer().replace(ChatColor.COLOR_CHAR, '&'), name.getTeamName()));
player.sendMessage(ChatColor.RED + String.format("Prefix: '%s', Suffix: '%s', Disguise Name: '%s', Team '%s'",
name.getPrefix().replace(ChatColor.COLOR_CHAR, '&'), name.getSuffix().replace(ChatColor.COLOR_CHAR, '&'),
name.getPlayer().replace(ChatColor.COLOR_CHAR, '&'), name.getTeamName()));
if (DisguiseConfig.isArmorstandsName()) {
player.sendMessage(ChatColor.AQUA + "Oh! You're using armorstands! Lets give some debug for that too..");
player.sendMessage(ChatColor.RED +
String.format("Names: %s, Length: %s, Custom Name: '%s'", new Gson().toJson(disg.getMultiName()).replace(ChatColor.COLOR_CHAR, '&'),
disg.getMultiNameLength(), disg.getWatcher().getCustomName().replace(ChatColor.COLOR_CHAR, '&')));
player.sendMessage(ChatColor.RED + String.format("Names: %s, Length: %s, Custom Name: '%s'",
new Gson().toJson(disg.getMultiName()).replace(ChatColor.COLOR_CHAR, '&'), disg.getMultiNameLength(),
disg.getWatcher().getCustomName().replace(ChatColor.COLOR_CHAR, '&')));
}
Team team = player.getScoreboard().getTeam(name.getTeamName());
@ -71,9 +71,9 @@ public class LDDebugPlayer implements LDCommand {
return;
}
player.sendMessage(ChatColor.RED +
String.format("Prefix Matches: %s, Suffix Matches: %s, In Team: %s, Name Visibility: %s", team.getPrefix().equals(name.getPrefix()),
team.getSuffix().equals(name.getSuffix()), team.hasEntry(name.getPlayer()), team.getOption(Team.Option.NAME_TAG_VISIBILITY)));
player.sendMessage(ChatColor.RED + String.format("Prefix Matches: %s, Suffix Matches: %s, In Team: %s, Name Visibility: %s",
team.getPrefix().equals(name.getPrefix()), team.getSuffix().equals(name.getSuffix()), team.hasEntry(name.getPlayer()),
team.getOption(Team.Option.NAME_TAG_VISIBILITY)));
}
}

View File

@ -115,7 +115,8 @@ public class LDJson implements LDCommand {
builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub));
builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append((string.length() <= 256 ? "" : " " + msg)).create()));
new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append((string.length() <= 256 ? "" : " " + msg))
.create()));
msg += 1;
}

View File

@ -52,7 +52,8 @@ public class LDMods implements LDCommand {
return;
}
LibsMsg.MODS_LIST.send(sender, player.getName(), StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "));
LibsMsg.MODS_LIST.send(sender, player.getName(),
StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "));
}
@Override

View File

@ -56,8 +56,8 @@ public class LDScoreboard implements LDCommand {
if (!((PlayerDisguise) disguise).hasScoreboardName()) {
if (unexpected++ < 3) {
sender.sendMessage(
"The player disguise " + ((PlayerDisguise) disguise).getName() + " isn't using a scoreboard name? This is unexpected");
sender.sendMessage("The player disguise " + ((PlayerDisguise) disguise).getName() +
" isn't using a scoreboard name? This is unexpected");
}
continue;
}
@ -83,33 +83,36 @@ public class LDScoreboard implements LDCommand {
if (team == null) {
if (issuesFound++ < 5) {
sender.sendMessage("The player disguise " + ((PlayerDisguise) disguise).getName().replace(ChatColor.COLOR_CHAR, '&') +
" is missing a scoreboard team '" + scoreboardName.getTeamName() + "' on " + player.getName() +
" and possibly more players!");
sender.sendMessage(
"The player disguise " + ((PlayerDisguise) disguise).getName().replace(ChatColor.COLOR_CHAR, '&') +
" is missing a scoreboard team '" + scoreboardName.getTeamName() + "' on " + player.getName() +
" and possibly more players!");
}
continue;
}
if (!team.getPrefix().equals("Colorize") &&
(!team.getPrefix().equals(scoreboardName.getPrefix()) || !team.getSuffix().equals(scoreboardName.getSuffix()))) {
if (!team.getPrefix().equals("Colorize") && (!team.getPrefix().equals(scoreboardName.getPrefix()) ||
!team.getSuffix().equals(scoreboardName.getSuffix()))) {
if (issuesFound++ < 5) {
sender.sendMessage("The player disguise " + ((PlayerDisguise) disguise).getName().replace(ChatColor.COLOR_CHAR, '&') +
" on scoreboard team '" + scoreboardName.getTeamName() + "' on " + player.getName() +
" has an unexpected prefix/suffix of '" + team.getPrefix().replace(ChatColor.COLOR_CHAR, '&') + "' & '" +
team.getSuffix().replace(ChatColor.COLOR_CHAR, '&') + "'! Expected '" +
scoreboardName.getPrefix().replace(ChatColor.COLOR_CHAR, '&') + "' & '" +
scoreboardName.getSuffix().replace(ChatColor.COLOR_CHAR, '&') + "'");
sender.sendMessage(
"The player disguise " + ((PlayerDisguise) disguise).getName().replace(ChatColor.COLOR_CHAR, '&') +
" on scoreboard team '" + scoreboardName.getTeamName() + "' on " + player.getName() +
" has an unexpected prefix/suffix of '" + team.getPrefix().replace(ChatColor.COLOR_CHAR, '&') +
"' & '" + team.getSuffix().replace(ChatColor.COLOR_CHAR, '&') + "'! Expected '" +
scoreboardName.getPrefix().replace(ChatColor.COLOR_CHAR, '&') + "' & '" +
scoreboardName.getSuffix().replace(ChatColor.COLOR_CHAR, '&') + "'");
}
continue;
}
if (!team.hasEntry(scoreboardName.getPlayer())) {
if (issuesFound++ < 5) {
sender.sendMessage("The player disguise " + ((PlayerDisguise) disguise).getName().replace(ChatColor.COLOR_CHAR, '&') +
" on scoreboard team '" + scoreboardName.getTeamName() + "' on " + player.getName() +
" does not have the player entry expected! Instead has '" +
StringUtils.join(team.getEntries(), ", ").replace(ChatColor.COLOR_CHAR, '&') + "'");
sender.sendMessage(
"The player disguise " + ((PlayerDisguise) disguise).getName().replace(ChatColor.COLOR_CHAR, '&') +
" on scoreboard team '" + scoreboardName.getTeamName() + "' on " + player.getName() +
" does not have the player entry expected! Instead has '" +
StringUtils.join(team.getEntries(), ", ").replace(ChatColor.COLOR_CHAR, '&') + "'");
}
}
}
@ -131,7 +134,8 @@ public class LDScoreboard implements LDCommand {
if (!listeners.isEmpty()) {
ComponentBuilder builder = new ComponentBuilder("");
builder.append("The following plugins are listening for scoreboard teams using ProtocolLib, and could be modifying collisions: ");
builder.append(
"The following plugins are listening for scoreboard teams using ProtocolLib, and could be modifying collisions: ");
builder.color(net.md_5.bungee.api.ChatColor.BLUE);
boolean comma = false;
@ -149,12 +153,14 @@ public class LDScoreboard implements LDCommand {
builder.append(listener.getPlugin().getName());
builder.color(net.md_5.bungee.api.ChatColor.AQUA);
String plugin =
ChatColor.GOLD + "Plugin: " + ChatColor.YELLOW + listener.getPlugin().getName() + " v" + listener.getPlugin().getDescription().getVersion();
String listenerClass = ChatColor.GOLD + "Listener: " + ChatColor.YELLOW + listener.getClass().toString();
String packets = ChatColor.GOLD + "Packets: " + ChatColor.YELLOW + StringUtils.join(listener.getSendingWhitelist().getTypes(), ", ");
String plugin = ChatColor.GOLD + "Plugin: " + ChatColor.YELLOW + listener.getPlugin().getName() + " v" +
listener.getPlugin().getDescription().getVersion();
String listenerClass = ChatColor.GOLD + "Listener: " + ChatColor.YELLOW + listener.getClass();
String packets =
ChatColor.GOLD + "Packets: " + ChatColor.YELLOW + StringUtils.join(listener.getSendingWhitelist().getTypes(), ", ");
String priority = ChatColor.GOLD + "Priority: " + ChatColor.YELLOW + listener.getSendingWhitelist().getPriority();
String options = ChatColor.GOLD + "Options: " + ChatColor.YELLOW + StringUtils.join(listener.getSendingWhitelist().getOptions(), ", ");
String options =
ChatColor.GOLD + "Options: " + ChatColor.YELLOW + StringUtils.join(listener.getSendingWhitelist().getOptions(), ", ");
builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
TextComponent.fromLegacyText(plugin + "\n" + listenerClass + "\n" + packets + "\n" + priority + "\n" + options)));
@ -165,8 +171,9 @@ public class LDScoreboard implements LDCommand {
LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.send(sender);
sender.sendMessage(
ChatColor.RED + "This command is somewhat outdated and needs to be changed, pushing is now disabled on the entities themselves and not players");
sender.sendMessage(ChatColor.RED +
"This command is somewhat outdated and needs to be changed, pushing is now disabled on the entities themselves and not " +
"players");
Player player;

View File

@ -63,7 +63,8 @@ public class LDUpdateProtocolLib implements LDCommand {
@Override
public void run() {
sender.sendMessage(ChatColor.RED +
"Looks like ProtocolLib's site may be down! MythicCraft/MythicMobs has a discord server https://discord.gg/EErRhJ4qgx you" +
"Looks like ProtocolLib's site may be down! MythicCraft/MythicMobs has a discord server https://discord" +
".gg/EErRhJ4qgx you" +
" can join. Check the pins in #libs-support for a ProtocolLib.jar you can download!");
sender.sendMessage(ChatColor.RED + "Update failed, " + ex.getMessage());
}

View File

@ -114,15 +114,17 @@ public class LDUploadLogs implements LDCommand {
@Override
public void onCommand(CommandSender sender, String[] args) {
if (lastUsed + TimeUnit.MINUTES.toMillis(3) > System.currentTimeMillis()) {
sender.sendMessage(ChatColor.RED + "You last used this command under 3 minutes ago! Restart the server or wait for this timer to " + "disappear!");
sender.sendMessage(
ChatColor.RED + "You last used this command under 3 minutes ago! Restart the server or wait for this timer to " +
"disappear!");
return;
}
File latest = new File("logs/latest.log");
File disguises = new File(LibsDisguises.getInstance().getDataFolder(), "configs/disguises.yml");
List<File> configs =
new ConfigLoader().getConfigs().stream().map(f -> new File(LibsDisguises.getInstance().getDataFolder(), f)).collect(Collectors.toList());
List<File> configs = new ConfigLoader().getConfigs().stream().map(f -> new File(LibsDisguises.getInstance().getDataFolder(), f))
.collect(Collectors.toList());
StringBuilder configText = new StringBuilder();
@ -142,13 +144,16 @@ public class LDUploadLogs implements LDCommand {
}
if (isTooBig(latest)) {
sender.sendMessage(ChatColor.RED + "Your latest.log file is too big! It should be less than 10mb! Please restart and run this " + "command again!");
sender.sendMessage(
ChatColor.RED + "Your latest.log file is too big! It should be less than 10mb! Please restart and run this " +
"command again!");
return;
}
if (isTooBig(disguises)) {
sender.sendMessage(ChatColor.RED + "Your disguises.yml is too big! You'll need to trim that file down before using this command! It " +
"should be less than 10mb!");
sender.sendMessage(
ChatColor.RED + "Your disguises.yml is too big! You'll need to trim that file down before using this command! It " +
"should be less than 10mb!");
return;
}
@ -169,7 +174,8 @@ public class LDUploadLogs implements LDCommand {
lastFind = nextLine + 2;
if (!str.contains("Starting minecraft server version") && !str.contains("Loading properties") && !str.contains("This server is running")) {
if (!str.contains("Starting minecraft server version") && !str.contains("Loading properties") &&
!str.contains("This server is running")) {
continue;
}
@ -218,8 +224,8 @@ public class LDUploadLogs implements LDCommand {
sender.sendMessage(ChatColor.GOLD + "Click on the below message to have it appear in your chat input");
}
String text =
"My log file: " + latestPaste + ", my combined config files: " + configPaste + " and my disguises file: " + disguisesPaste;
String text = "My log file: " + latestPaste + ", my combined config files: " + configPaste +
" and my disguises file: " + disguisesPaste;
ComponentBuilder builder = new ComponentBuilder("");
builder.append(text);

View File

@ -76,7 +76,8 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
Collections.sort(classes);
LibsMsg.DMODRADIUS_USABLE.send(sender, ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN));
LibsMsg.DMODRADIUS_USABLE.send(sender,
ChatColor.GREEN + StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN));
return true;
}
@ -173,7 +174,8 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
tempArgs = DisguiseParser.parsePlaceholders(tempArgs, sender, entity);
try {
DisguiseParser.callMethods(sender, disguise, permissions, disguisePerm, new ArrayList<>(), tempArgs, "DisguiseModifyRadius");
DisguiseParser.callMethods(sender, disguise, permissions, disguisePerm, new ArrayList<>(), tempArgs,
"DisguiseModifyRadius");
modifiedDisguises++;
} catch (DisguiseParseException ex) {
ex.send(sender);

View File

@ -17,8 +17,8 @@ public class UndisguiseCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
"usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for non-admin " + "usage!");
return true;
}

View File

@ -17,8 +17,8 @@ public class UndisguiseEntityCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
"usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for non-admin " + "usage!");
return true;
}
@ -32,7 +32,8 @@ public class UndisguiseEntityCommand implements CommandExecutor {
return true;
}
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(), DisguiseConfig.getDisguiseEntityExpire());
LibsDisguises.getInstance().getListener()
.addInteraction(sender.getName(), new UndisguiseEntityInteraction(), DisguiseConfig.getDisguiseEntityExpire());
LibsMsg.UND_ENTITY.send(sender);
return true;

View File

@ -62,8 +62,8 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
"usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for non-admin " + "usage!");
return true;
}
@ -95,9 +95,11 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
if (DisguiseAPI.isDisguised(entityTarget)) {
DisguiseAPI.undisguiseToAll(sender, entityTarget);
LibsMsg.UNDISG_PLAYER.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable());
LibsMsg.UNDISG_PLAYER.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable());
} else {
LibsMsg.UNDISG_PLAYER_FAIL.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable());
LibsMsg.UNDISG_PLAYER_FAIL.send(sender,
entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable());
}
return true;

View File

@ -28,8 +28,8 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
"usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for non-admin " + "usage!");
return true;
}

View File

@ -33,8 +33,8 @@ public class CopyDisguiseCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for " +
"non-admin usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for " + "non-admin usage!");
return true;
}
@ -78,7 +78,8 @@ public class CopyDisguiseCommand implements CommandExecutor {
sendMessage(sender, LibsMsg.CLICK_TO_COPY, LibsMsg.COPY_DISGUISE_NO_COPY, disguiseString, false);
if (disguise instanceof PlayerDisguise) {
sendMessage(sender, LibsMsg.CLICK_TO_COPY_WITH_SKIN, LibsMsg.CLICK_TO_COPY_WITH_SKIN_NO_COPY, DisguiseParser.parseToString(disguise), true);
sendMessage(sender, LibsMsg.CLICK_TO_COPY_WITH_SKIN, LibsMsg.CLICK_TO_COPY_WITH_SKIN_NO_COPY,
DisguiseParser.parseToString(disguise), true);
}
DisguiseUtilities.setCopyDisguiseCommandUsed();

View File

@ -48,7 +48,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
if (help != null) {
if (help.hasValues() && help.canTranslateValues()) {
LibsMsg.DHELP_HELP4.send(sender, help.getName(), StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get()));
LibsMsg.DHELP_HELP4.send(sender, help.getName(),
StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get()));
} else {
if (!help.getName().equals(help.getDescriptiveName())) {
LibsMsg.DHELP_HELP6.send(sender, help.getName(), help.getDescriptiveName(), help.getDescription());
@ -100,8 +101,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
methodColor = ChatColor.GRAY;
}
String str = TranslateType.DISGUISE_OPTIONS.get(method.getName()) + ChatColor.DARK_RED + "(" + ChatColor.GREEN + info.getName() +
ChatColor.DARK_RED + ")";
String str = TranslateType.DISGUISE_OPTIONS.get(method.getName()) + ChatColor.DARK_RED + "(" + ChatColor.GREEN +
info.getName() + ChatColor.DARK_RED + ")";
methods.add(methodColor + str);
}
@ -113,7 +114,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
methods.add(LibsMsg.DHELP_NO_OPTIONS.get());
}
LibsMsg.DHELP_OPTIONS.send(sender, ChatColor.DARK_RED + type.toReadable(), StringUtils.join(methods, ChatColor.DARK_RED + ", "));
LibsMsg.DHELP_OPTIONS.send(sender, ChatColor.DARK_RED + type.toReadable(),
StringUtils.join(methods, ChatColor.DARK_RED + ", "));
if (ignored > 0) {
LibsMsg.NO_PERMS_USE_OPTIONS.send(sender, ignored);
@ -165,7 +167,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
for (ParamInfo s : ParamInfoManager.getParamInfos()) {
LibsMsg.DHELP_HELP3.send(sender,
s.getName().replaceAll(" ", "") + (!s.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""), s.getDescription());
s.getName().replaceAll(" ", "") + (!s.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""),
s.getDescription());
}
}
}

View File

@ -29,8 +29,8 @@ public class GrabHeadCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
"usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for non-admin " + "usage!");
return true;
}

View File

@ -32,8 +32,8 @@ public class GrabSkinCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for " +
"non-admin usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for " + "non-admin usage!");
return true;
}
@ -73,7 +73,8 @@ public class GrabSkinCommand implements CommandExecutor {
}
}
String name = tName != null && tName.toLowerCase(Locale.ROOT).endsWith(":slim") ? tName.substring(0, tName.lastIndexOf(":")) : tName;
String name =
tName != null && tName.toLowerCase(Locale.ROOT).endsWith(":slim") ? tName.substring(0, tName.lastIndexOf(":")) : tName;
if (name != null && name.replaceAll("[_a-zA-Z \\d-@#]", "").length() > 0) {
LibsMsg.SKIN_API_INVALID_NAME.send(sender);

View File

@ -31,8 +31,8 @@ public class SaveDisguiseCommand implements CommandExecutor {
if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for " +
"non-admin usage!");
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the " +
"plugin for " + "non-admin usage!");
return true;
}

View File

@ -258,9 +258,8 @@ public abstract class Disguise {
*/
protected void createDisguise() {
if (getType().getEntityType() == null) {
throw new RuntimeException(
"DisguiseType " + getType() + " was used in a futile attempt to construct a disguise, but this Minecraft version does not have " +
"that entity");
throw new RuntimeException("DisguiseType " + getType() +
" was used in a futile attempt to construct a disguise, but this Minecraft version does not have " + "that entity");
}
// Get if they are a adult now..
@ -293,7 +292,8 @@ public abstract class Disguise {
}
public boolean isDisguiseExpired() {
return DisguiseConfig.isDynamicExpiry() ? disguiseExpires == 1 : disguiseExpires > 0 && disguiseExpires < System.currentTimeMillis();
return DisguiseConfig.isDynamicExpiry() ? disguiseExpires == 1 :
disguiseExpires > 0 && disguiseExpires < System.currentTimeMillis();
}
public long getExpires() {
@ -375,8 +375,8 @@ public abstract class Disguise {
removeBossBar();
BossBar bar = Bukkit.createBossBar(getBossBar(), BaseComponent.toLegacyText(LibsMsg.ACTION_BAR_MESSAGE.getBase(getDisguiseName())), getBossBarColor(),
getBossBarStyle());
BossBar bar = Bukkit.createBossBar(getBossBar(), BaseComponent.toLegacyText(LibsMsg.ACTION_BAR_MESSAGE.getBase(getDisguiseName())),
getBossBarColor(), getBossBarStyle());
bar.setProgress(1);
bar.addPlayer((Player) getEntity());
}
@ -392,8 +392,9 @@ public abstract class Disguise {
}
protected void doActionBar() {
if (getNotifyBar() == DisguiseConfig.NotifyBar.ACTION_BAR && getEntity() instanceof Player && DisguiseAPI.isNotifyBarShown(getEntity()) &&
!getEntity().hasPermission("libsdisguises.noactionbar") && DisguiseAPI.getDisguise(getEntity()) == Disguise.this) {
if (getNotifyBar() == DisguiseConfig.NotifyBar.ACTION_BAR && getEntity() instanceof Player &&
DisguiseAPI.isNotifyBarShown(getEntity()) && !getEntity().hasPermission("libsdisguises.noactionbar") &&
DisguiseAPI.getDisguise(getEntity()) == Disguise.this) {
((Player) getEntity()).spigot().sendMessage(ChatMessageType.ACTION_BAR, LibsMsg.ACTION_BAR_MESSAGE.getBase(getDisguiseName()));
}
@ -458,7 +459,8 @@ public abstract class Disguise {
}
if (isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled() && entity instanceof LivingEntity) {
throw new RuntimeException("Cannot disguise a living entity with a misc disguise. Reenable MiscDisguisesForLiving in the " + "config to do this");
throw new RuntimeException(
"Cannot disguise a living entity with a misc disguise. Reenable MiscDisguisesForLiving in the " + "config to do this");
}
this.entity = entity;
@ -523,8 +525,8 @@ public abstract class Disguise {
public Disguise setWatcher(FlagWatcher newWatcher) {
if (!getType().getWatcherClass().isInstance(newWatcher)) {
throw new IllegalArgumentException(
(newWatcher == null ? "null" : newWatcher.getClass().getSimpleName()) + " is not a instance of " + getType().getWatcherClass().getSimpleName() +
" for DisguiseType " + getType().name());
(newWatcher == null ? "null" : newWatcher.getClass().getSimpleName()) + " is not a instance of " +
getType().getWatcherClass().getSimpleName() + " for DisguiseType " + getType().name());
}
watcher = newWatcher;
@ -646,7 +648,8 @@ public abstract class Disguise {
* Internal use
*/
public boolean isRemoveDisguiseOnDeath() {
return getEntity() == null || (getEntity() instanceof Player ? !isKeepDisguiseOnPlayerDeath() : getEntity().isDead() || !getEntity().isValid());
return getEntity() == null ||
(getEntity() instanceof Player ? !isKeepDisguiseOnPlayerDeath() : getEntity().isDead() || !getEntity().isValid());
}
@Deprecated
@ -859,7 +862,8 @@ public abstract class Disguise {
}
// If a horse is disguised as a horse, it should obey parent no gravity rule
if ((getEntity() instanceof Boat || getEntity() instanceof AbstractHorse || getEntity() instanceof Item || getEntity() instanceof FallingBlock) &&
if ((getEntity() instanceof Boat || getEntity() instanceof AbstractHorse || getEntity() instanceof Item ||
getEntity() instanceof FallingBlock) &&
(getWatcher() instanceof BoatWatcher || getWatcher() instanceof AbstractHorseWatcher || getEntity() instanceof Item ||
getEntity() instanceof FallingBlock)) {
getWatcher().setNoGravity(!getEntity().hasGravity());
@ -1010,7 +1014,8 @@ public abstract class Disguise {
DisguiseUtilities.refreshTrackers((TargetedDisguise) this);
// Setup a scheduler for a self disguise
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> DisguiseUtilities.setupFakeDisguise(Disguise.this), 2);
Bukkit.getScheduler()
.scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> DisguiseUtilities.setupFakeDisguise(Disguise.this), 2);
if (isHidePlayer() && getEntity() instanceof Player) {
PacketContainer removeTab = ReflectionManager.updateTablistVisibility((Player) getEntity(), false);

View File

@ -172,10 +172,10 @@ class DisguiseRunnable extends BukkitRunnable {
lookPacket.getIntegers().write(0, disguise.getEntity().getEntityId());
Location loc = disguise.getEntity().getLocation();
mods.write(4,
DisguiseUtilities.getYaw(disguise.getType(), disguise.getEntity().getType(), (byte) Math.floor(loc.getYaw() * 256.0F / 360.0F)));
mods.write(5,
DisguiseUtilities.getPitch(disguise.getType(), disguise.getEntity().getType(), (byte) Math.floor(loc.getPitch() * 256.0F / 360.0F)));
mods.write(4, DisguiseUtilities.getYaw(disguise.getType(), disguise.getEntity().getType(),
(byte) Math.floor(loc.getYaw() * 256.0F / 360.0F)));
mods.write(5, DisguiseUtilities.getPitch(disguise.getType(), disguise.getEntity().getType(),
(byte) Math.floor(loc.getPitch() * 256.0F / 360.0F)));
if (disguise.isSelfDisguiseVisible() && disguise.getEntity() instanceof Player) {
PacketContainer selfLookPacket = lookPacket.shallowClone();

View File

@ -18,5 +18,5 @@ public enum EntityPose {
ROARING,
SNIFFING,
EMERGING,
DIGGING;
DIGGING
}

View File

@ -1074,7 +1074,8 @@ public class FlagWatcher {
if (id.getIndex() == -1) {
throw new IllegalArgumentException("You can't do that in this version of Minecraft! I can't use " + MetaIndex.getName(id) +
"! This error shouldn't be seen if you're disguising via Lib's Disguises's commands, if this is the case then it's likely a bug.");
"! This error shouldn't be seen if you're disguising via Lib's Disguises's commands, if this is the case then it's likely" +
" a bug.");
}
if (value == null && id.getDefault() instanceof ItemStack) {

View File

@ -160,8 +160,8 @@ public class MetaIndex<Y> {
* The type of particle to display
*/
@NmsAddedIn(NmsVersion.v1_13)
public static MetaIndex<WrappedParticle> AREA_EFFECT_PARTICLE =
new MetaIndex<>(AreaEffectCloudWatcher.class, 3, NmsVersion.v1_13.isSupported() ? WrappedParticle.create(Particle.SPELL_MOB, null) : null);
public static MetaIndex<WrappedParticle> AREA_EFFECT_PARTICLE = new MetaIndex<>(AreaEffectCloudWatcher.class, 3,
NmsVersion.v1_13.isSupported() ? WrappedParticle.create(Particle.SPELL_MOB, null) : null);
@NmsRemovedIn(NmsVersion.v1_13)
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 3, 0);
@ -287,7 +287,8 @@ public class MetaIndex<Y> {
public static MetaIndex<Integer> CAT_TYPE = new MetaIndex<>(CatWatcher.class, 0, 0);
@NmsAddedIn(NmsVersion.v1_19_R1)
public static MetaIndex<Cat.Type> CAT_TYPE_NEW = new MetaIndex<>(CatWatcher.class, 0, NmsVersion.v1_19_R1.isSupported() ? Cat.Type.BLACK : null);
public static MetaIndex<Cat.Type> CAT_TYPE_NEW =
new MetaIndex<>(CatWatcher.class, 0, NmsVersion.v1_19_R1.isSupported() ? Cat.Type.BLACK : null);
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex<Boolean> CAT_LYING_DOWN = new MetaIndex<>(CatWatcher.class, 1, false);
@ -321,7 +322,8 @@ public class MetaIndex<Y> {
public static MetaIndex<Integer> DISPLAY_POS_ROT_INTERPOLATION_DURATION = new MetaIndex<>(DisplayWatcher.class, 2, 0);
@NmsAddedIn(NmsVersion.v1_19_R3)
public static MetaIndex<Vector3f> DISPLAY_TRANSLATION = new MetaIndex<>(DisplayWatcher.class, 3, NmsVersion.v1_19_R3.isSupported() ? new Vector3f() : null);
public static MetaIndex<Vector3f> DISPLAY_TRANSLATION =
new MetaIndex<>(DisplayWatcher.class, 3, NmsVersion.v1_19_R3.isSupported() ? new Vector3f() : null);
@NmsAddedIn(NmsVersion.v1_19_R3)
public static MetaIndex<Vector3f> DISPLAY_SCALE =
@ -713,9 +715,11 @@ public class MetaIndex<Y> {
public static MetaIndex<Byte> PLAYER_SKIN = new MetaIndex<>(PlayerWatcher.class, 2, (byte) 127);
public static MetaIndex<NbtBase> PLAYER_LEFT_SHOULDER_ENTITY = new MetaIndex<>(PlayerWatcher.class, 4, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
public static MetaIndex<NbtBase> PLAYER_LEFT_SHOULDER_ENTITY =
new MetaIndex<>(PlayerWatcher.class, 4, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
public static MetaIndex<NbtBase> PLAYER_RIGHT_SHOULDER_ENTITY = new MetaIndex<>(PlayerWatcher.class, 5, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
public static MetaIndex<NbtBase> PLAYER_RIGHT_SHOULDER_ENTITY =
new MetaIndex<>(PlayerWatcher.class, 5, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
public static MetaIndex<Boolean> POLAR_BEAR_STANDING = new MetaIndex<>(PolarBearWatcher.class, 0, false);
@ -763,13 +767,15 @@ public class MetaIndex<Y> {
public static MetaIndex<Byte> SPIDER_CLIMB = new MetaIndex<>(SpiderWatcher.class, 0, (byte) 0);
public static MetaIndex<ItemStack> SPLASH_POTION_ITEM = new MetaIndex<>(SplashPotionWatcher.class, 0, new ItemStack(Material.SPLASH_POTION));
public static MetaIndex<ItemStack> SPLASH_POTION_ITEM =
new MetaIndex<>(SplashPotionWatcher.class, 0, new ItemStack(Material.SPLASH_POTION));
public static MetaIndex<Byte> TAMEABLE_META = new MetaIndex<>(TameableWatcher.class, 0, (byte) 0);
public static MetaIndex<Optional<UUID>> TAMEABLE_OWNER = new MetaIndex<>(TameableWatcher.class, 1, Optional.empty());
public static MetaIndex<WrappedChatComponent> TEXT_DISPLAY_TEXT = new MetaIndex<>(TextDisplayWatcher.class, 0, WrappedChatComponent.fromText(""));
public static MetaIndex<WrappedChatComponent> TEXT_DISPLAY_TEXT =
new MetaIndex<>(TextDisplayWatcher.class, 0, WrappedChatComponent.fromText(""));
public static MetaIndex<Integer> TEXT_DISPLAY_LINE_WIDTH = new MetaIndex<>(TextDisplayWatcher.class, 1, 200);
@ -818,8 +824,8 @@ public class MetaIndex<Y> {
public static MetaIndex<Integer> ABSTRACT_VILLAGER_ANGRY = new MetaIndex<>(AbstractVillagerWatcher.class, 0, 0);
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex<VillagerData> VILLAGER_DATA =
new MetaIndex<>(VillagerWatcher.class, 0, NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) : null);
public static MetaIndex<VillagerData> VILLAGER_DATA = new MetaIndex<>(VillagerWatcher.class, 0,
NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) : null);
public static MetaIndex<Integer> WARDEN_ANGER = new MetaIndex<>(WardenWatcher.class, 0, 0);
@ -936,8 +942,9 @@ public class MetaIndex<Y> {
}
if (found != null) {
DisguiseUtilities.getLogger().severe(entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index " + i + " (" +
type.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher().getSimpleName() + ")");
DisguiseUtilities.getLogger().severe(
entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index " + i + " (" +
type.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher().getSimpleName() + ")");
continue loop;
}
@ -1126,8 +1133,8 @@ public class MetaIndex<Y> {
}
DisguiseUtilities.getLogger().severe(
"MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " + metaIndex.getIndex() + " has already registered this! (" +
metaIndex.getDefault() + "," + index.getDefault() + ")");
"MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " + metaIndex.getIndex() +
" has already registered this! (" + metaIndex.getDefault() + "," + index.getDefault() + ")");
}
values()[i] = metaIndexes[a];

View File

@ -24,6 +24,7 @@ public class PlayerDisguise extends TargetedDisguise {
private String playerName = "Herobrine";
private String tablistName;
private String skinToUse;
@Getter
private boolean nameVisible = true;
/**
* Has someone set name visible explicitly?
@ -149,10 +150,6 @@ public class PlayerDisguise extends TargetedDisguise {
isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName();
}
public boolean isNameVisible() {
return nameVisible;
}
public PlayerDisguise setNameVisible(boolean nameVisible) {
return setNameVisible(nameVisible, false);
}
@ -243,7 +240,8 @@ public class PlayerDisguise extends TargetedDisguise {
if (currentLookup == null && gameProfile != null) {
disguise.skinToUse = getSkin();
disguise.gameProfile = ReflectionManager.getGameProfileWithThisSkin(disguise.getUUID(), getGameProfile().getName(), getGameProfile());
disguise.gameProfile =
ReflectionManager.getGameProfileWithThisSkin(disguise.getUUID(), getGameProfile().getName(), getGameProfile());
} else {
disguise.setSkin(getSkin());
}
@ -264,7 +262,8 @@ public class PlayerDisguise extends TargetedDisguise {
if (getSkin() != null) {
gameProfile = ReflectionManager.getGameProfile(getUUID(), getProfileName());
} else {
gameProfile = ReflectionManager.getGameProfileWithThisSkin(getUUID(), getProfileName(), DisguiseUtilities.getProfileFromMojang(this));
gameProfile =
ReflectionManager.getGameProfileWithThisSkin(getUUID(), getProfileName(), DisguiseUtilities.getProfileFromMojang(this));
}
}
@ -494,7 +493,8 @@ public class PlayerDisguise extends TargetedDisguise {
}
};
WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
WrappedGameProfile gameProfile =
DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
if (gameProfile != null) {
setSkin(gameProfile);
@ -529,7 +529,8 @@ public class PlayerDisguise extends TargetedDisguise {
}
private WrappedGameProfile getProfile(String string) {
if (string != null && string.length() > 70 && string.startsWith("{\"id\":") && string.endsWith("}") && string.contains(",\"name\":")) {
if (string != null && string.length() > 70 && string.startsWith("{\"id\":") && string.endsWith("}") &&
string.contains(",\"name\":")) {
try {
return DisguiseUtilities.getGson().fromJson(string, WrappedGameProfile.class);
} catch (Exception ex) {
@ -660,7 +661,8 @@ public class PlayerDisguise extends TargetedDisguise {
}
};
WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
WrappedGameProfile gameProfile =
DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
if (gameProfile != null) {
setSkin(gameProfile);

View File

@ -17,8 +17,9 @@ public class CreeperWatcher extends InsentientWatcher {
public void setIgnited(boolean ignited) {
// If creeper is already ignited and they want to set it to unignited, then resend disguise
boolean resend = !ignited && getDisguise() != null && getDisguise().isDisguiseInUse() && ((hasValue(MetaIndex.CREEPER_IGNITED) && isIgnited()) ||
(getDisguise().getEntity() instanceof Creeper && ((Creeper) getDisguise().getEntity()).isPowered()));
boolean resend = !ignited && getDisguise() != null && getDisguise().isDisguiseInUse() &&
((hasValue(MetaIndex.CREEPER_IGNITED) && isIgnited()) ||
(getDisguise().getEntity() instanceof Creeper && ((Creeper) getDisguise().getEntity()).isPowered()));
setData(MetaIndex.CREEPER_IGNITED, ignited);
sendData(MetaIndex.CREEPER_IGNITED);

View File

@ -171,7 +171,8 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setBrightness(Display.Brightness brightness) {
setData(MetaIndex.DISPLAY_BRIGHTNESS_OVERRIDE, brightness == null ? -1 : brightness.getBlockLight() << 4 | brightness.getSkyLight() << 20);
setData(MetaIndex.DISPLAY_BRIGHTNESS_OVERRIDE,
brightness == null ? -1 : brightness.getBlockLight() << 4 | brightness.getSkyLight() << 20);
sendData(MetaIndex.DISPLAY_BRIGHTNESS_OVERRIDE);
}

View File

@ -24,7 +24,8 @@ public class DroppedItemWatcher extends FlagWatcher {
if (!getDisguise().isCustomDisguiseName()) {
getDisguise().setDisguiseName(TranslateType.DISGUISES.get(DisguiseType.DROPPED_ITEM.toReadable()) + " " +
TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(ReflectionManager.toReadable((item == null ? Material.AIR : item.getType()).name(), " ")));
TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(
ReflectionManager.toReadable((item == null ? Material.AIR : item.getType()).name(), " ")));
}
}
}

View File

@ -25,7 +25,8 @@ public class TextDisplayWatcher extends DisplayWatcher {
}
public void setText(String string) {
setData(MetaIndex.TEXT_DISPLAY_TEXT, WrappedChatComponent.fromJson(DisguiseUtilities.serialize(DisguiseUtilities.getAdventureChat(string))));
setData(MetaIndex.TEXT_DISPLAY_TEXT,
WrappedChatComponent.fromJson(DisguiseUtilities.serialize(DisguiseUtilities.getAdventureChat(string))));
sendData(MetaIndex.TEXT_DISPLAY_TEXT);
}

View File

@ -139,7 +139,8 @@ public class LibsPremium {
String pluginVersion = config.getString("version");
return new PluginInformation(file.length(), userId, resourceId, downloadId, premium, pluginVersion, pluginBuildNumber, pluginBuildDate);
return new PluginInformation(file.length(), userId, resourceId, downloadId, premium, pluginVersion, pluginBuildNumber,
pluginBuildDate);
}
}
@ -170,8 +171,8 @@ public class LibsPremium {
try {
plugin = getInformation(file);
} catch (ClassNotFoundException | NoClassDefFoundError ex) {
DisguiseUtilities.getLogger().warning(
"Found an unrecognized jar in the LibsDisguises folder (" + file.getName() + ") - It may need replacing with a newer jar from SpigotMC");
DisguiseUtilities.getLogger().warning("Found an unrecognized jar in the LibsDisguises folder (" + file.getName() +
") - It may need replacing with a newer jar from SpigotMC");
continue;
} catch (Exception ex) {
DisguiseUtilities.getLogger().warning("Error while trying to handle the file " + file.getName());
@ -181,7 +182,8 @@ public class LibsPremium {
/* Format into a string
v5.2.6, build #40, created 16/02/2019 */
String fileInfo = String.format("v%s, build %s, created %s", plugin.getVersion(), plugin.getBuildNumber(), plugin.getBuildDate());
String fileInfo =
String.format("v%s, build %s, created %s", plugin.getVersion(), plugin.getBuildNumber(), plugin.getBuildDate());
if (plugin.isPremium()) {
if (!isValidVersion(version, plugin.getVersion()) || plugin.getUserID() == null || plugin.getDownloadID() == null ||
@ -208,10 +210,11 @@ public class LibsPremium {
} else {
/* You have a non-premium Lib's Disguises jar (LibsDisguises.jar v5.2.6, build #40, created
16/02/2019) in the LibsDisguises folder! */
DisguiseUtilities.getLogger()
.warning("You have a non-premium Lib's Disguises jar (" + file.getName() + " " + fileInfo + ") in the LibsDisguises folder!");
DisguiseUtilities.getLogger()
.warning("Please place the premium jar downloaded from https://www.spigotmc" + ".org/resources/libs-disguises.32453/ " + "in here!");
DisguiseUtilities.getLogger().warning(
"You have a non-premium Lib's Disguises jar (" + file.getName() + " " + fileInfo + ") in the LibsDisguises folder!");
DisguiseUtilities.getLogger().warning(
"Please place the premium jar downloaded from https://www.spigotmc" + ".org/resources/libs-disguises.32453/ " +
"in here!");
}
}
@ -261,7 +264,8 @@ public class LibsPremium {
try {
try (InputStream stream = LibsDisguises.getInstance().getResource("plugin.yml")) {
config.loadFromString(new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n")));
config.loadFromString(new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)).lines()
.collect(Collectors.joining("\n")));
}
/* If plugin.yml contains a build-date */
@ -278,8 +282,9 @@ public class LibsPremium {
buildNo = "#" + buildNo;
}
pluginInformation = new PluginInformation(LibsDisguises.getInstance().getFile().length(), getUserID(), getResourceID(), getDownloadID(),
isPremium(getResourceID(), getUserID()), version, buildNo, pluginBuildDate);
pluginInformation =
new PluginInformation(LibsDisguises.getInstance().getFile().length(), getUserID(), getResourceID(), getDownloadID(),
isPremium(getResourceID(), getUserID()), version, buildNo, pluginBuildDate);
}
if (!isPremium() || !LibsDisguises.getInstance().isReleaseBuild()) {
@ -330,7 +335,8 @@ public class LibsPremium {
FileUtil.copy(f, new File(LibsDisguises.getInstance().getDataFolder(), f.getName()));
DisguiseUtilities.getLogger().info("Copied " + f.getName() + " to the plugin folder! You can use dev builds with premium enabled!");
DisguiseUtilities.getLogger()
.info("Copied " + f.getName() + " to the plugin folder! You can use dev builds with premium enabled!");
}
}

View File

@ -103,9 +103,8 @@ public class DisguiseCommandConfig {
configString = configString.replaceAll("\n([a-zA-Z])", "\n\n$1");
String s =
"# The following can be changed to modify how the disguise commands are registered\n# This will only work on server startup\nModifyCommands: " +
modifyCommands + "\n\n" + configString;
String s = "# The following can be changed to modify how the disguise commands are registered\n# This will only work on server " +
"startup\nModifyCommands: " + modifyCommands + "\n\n" + configString;
commandConfig.delete();

View File

@ -83,7 +83,8 @@ public class SerializerFlagWatcher implements JsonDeserializer<FlagWatcher>, Ins
}
} else if (entry.getValue() instanceof String) {
if (index.getDefault() instanceof WrappedParticle) {
entry.setValue(((ParamInfoParticle) ParamInfoManager.getParamInfo(WrappedParticle.class)).fromString((String) entry.getValue()));
entry.setValue(
((ParamInfoParticle) ParamInfoManager.getParamInfo(WrappedParticle.class)).fromString((String) entry.getValue()));
} else if (index.getDefault() instanceof EntityPose) {
entry.setValue(((ParamInfoEnum) ParamInfoManager.getParamInfo(EntityPose.class)).fromString((String) entry.getValue()));
}

View File

@ -28,9 +28,8 @@ public class SerializerGameProfile implements JsonSerializer<WrappedGameProfile>
JsonObject obj = json.getAsJsonObject();
if (obj.has("id") && !obj.get("id").getAsString().contains("-")) {
obj.addProperty("id",
Pattern.compile("([\\da-fA-F]{8})([\\da-fA-F]{4})([\\da-fA-F]{4})([\\da-fA-F]{4})([\\da-fA-F]+)").matcher(obj.get("id").getAsString())
.replaceFirst("$1-$2-$3-$4-$5"));
obj.addProperty("id", Pattern.compile("([\\da-fA-F]{8})([\\da-fA-F]{4})([\\da-fA-F]{4})([\\da-fA-F]{4})([\\da-fA-F]+)")
.matcher(obj.get("id").getAsString()).replaceFirst("$1-$2-$3-$4-$5"));
}
return WrappedGameProfile.fromHandle(context.deserialize(json, GameProfile.class));

View File

@ -163,11 +163,13 @@ public class DisguiseListener implements Listener {
attacker = (Entity) ((Projectile) attacker).getShooter();
}
if ("%%__USER__%%".equals("12345") || (LibsPremium.isPremium() && LibsPremium.getPaidInformation() == null && LibsPremium.getUserID().contains("%"))) {
if ("%%__USER__%%".equals("12345") ||
(LibsPremium.isPremium() && LibsPremium.getPaidInformation() == null && LibsPremium.getUserID().contains("%"))) {
if (DisguiseUtilities.random.nextBoolean()) {
event.setDamage(0.5);
if (event.isCancelled() && DisguiseUtilities.random.nextDouble() < 0.1 && !(attacker instanceof Player && attacker.isOp())) {
if (event.isCancelled() && DisguiseUtilities.random.nextDouble() < 0.1 &&
!(attacker instanceof Player && attacker.isOp())) {
event.setCancelled(false);
}
}
@ -215,7 +217,8 @@ public class DisguiseListener implements Listener {
return;
}
if (!attacker.hasPermission("libsdisguises." + (pvp ? "pvp" : "pve")) && !attacker.hasPermission("libsdisguises." + (pvp ? "pvp" : "pve"))) {
if (!attacker.hasPermission("libsdisguises." + (pvp ? "pvp" : "pve")) &&
!attacker.hasPermission("libsdisguises." + (pvp ? "pvp" : "pve"))) {
if (!DisguiseConfig.isRetaliationCombat() || !canRetaliate(attacker)) {
Disguise[] disguises = DisguiseAPI.getDisguises(attacker);
@ -412,7 +415,8 @@ public class DisguiseListener implements Listener {
String version = ProtocolLibrary.getPlugin().getDescription().getVersion();
if ("1592".equals(LibsPremium.getUserID()) ||
(!DisguiseConfig.isNeverUpdateProtocolLib() && DisguiseUtilities.isProtocolLibOutdated() && p.hasPermission("libsdisguises.update"))) {
(!DisguiseConfig.isNeverUpdateProtocolLib() && DisguiseUtilities.isProtocolLibOutdated() &&
p.hasPermission("libsdisguises.update"))) {
DisguiseUtilities.sendProtocolLibUpdateMessage(p, version, requiredProtocolLib);
new BukkitRunnable() {
@ -490,7 +494,8 @@ public class DisguiseListener implements Listener {
required.ifPresent(customEntity -> p.kickPlayer(customEntity.getRequired()));
}
if (DisguiseConfig.isSaveGameProfiles() && DisguiseConfig.isUpdateGameProfiles() && DisguiseUtilities.hasGameProfile(p.getName())) {
if (DisguiseConfig.isSaveGameProfiles() && DisguiseConfig.isUpdateGameProfiles() &&
DisguiseUtilities.hasGameProfile(p.getName())) {
WrappedGameProfile profile = WrappedGameProfile.fromPlayer(p);
if (!profile.getProperties().isEmpty()) {
@ -523,7 +528,8 @@ public class DisguiseListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onMove(PlayerMoveEvent event) {
// If yer a pirate with a pirated jar, sometimes you can't move
if (("%%__USER__%%".isEmpty() || DisguiseUtilities.isInvalidFile()) && !event.getPlayer().isOp() && RandomUtils.nextDouble() < 0.01) {
if (("%%__USER__%%".isEmpty() || DisguiseUtilities.isInvalidFile()) && !event.getPlayer().isOp() &&
RandomUtils.nextDouble() < 0.01) {
event.setCancelled(true);
}
@ -559,7 +565,8 @@ public class DisguiseListener implements Listener {
Location to = event.getTo();
// Llama spit disappears when it encounters a solid
if (Math.min(from.getY(), to.getY()) >= from.getWorld().getMinHeight() && Math.max(from.getY(), to.getY()) < from.getWorld().getMaxHeight()) {
if (Math.min(from.getY(), to.getY()) >= from.getWorld().getMinHeight() &&
Math.max(from.getY(), to.getY()) < from.getWorld().getMaxHeight()) {
if (!from.getBlock().isEmpty() && to.getBlock().isEmpty()) {
DisguiseUtilities.refreshTrackers((TargetedDisguise) disguise);
}
@ -607,7 +614,8 @@ public class DisguiseListener implements Listener {
Player p = event.getPlayer();
if (!interactions.containsKey(p.getName())) {
if (isDodgyUser() && System.currentTimeMillis() % 6 == 0 && !p.getAllowFlight() && p.getPreviousGameMode() != GameMode.CREATIVE) {
if (isDodgyUser() && System.currentTimeMillis() % 6 == 0 && !p.getAllowFlight() &&
p.getPreviousGameMode() != GameMode.CREATIVE) {
event.setCancelled(true);
}
@ -689,7 +697,8 @@ public class DisguiseListener implements Listener {
return;
}
if (DisguiseConfig.isUndisguiseOnWorldChange() && to.getWorld() != null && from.getWorld() != null && to.getWorld() != from.getWorld()) {
if (DisguiseConfig.isUndisguiseOnWorldChange() && to.getWorld() != null && from.getWorld() != null &&
to.getWorld() != from.getWorld()) {
Disguise[] disguises = DisguiseAPI.getDisguises(event.getPlayer());
if (disguises.length > 0) {

View File

@ -4,16 +4,27 @@ import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent;
import com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.LibsPremium;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Random;
/**
* Created by libraryaddict on 20/05/2020.
*/
public class PaperDisguiseListener implements Listener {
private Boolean isWeird;
private int count;
@EventHandler
public void onEntityLoad(EntityAddToWorldEvent event) {
if (!DisguiseConfig.isSaveEntityDisguises()) {
@ -52,4 +63,49 @@ public class PaperDisguiseListener implements Listener {
DisguiseUtilities.saveDisguises(entity, disguises);
}
private boolean isWeirdBuild() {
if (isWeird == null) {
if (LibsPremium.getPaidInformation() != null) {
String b = (LibsPremium.getPaidInformation().getBuildNumber()).replace("#", "");
isWeird = !b.matches("\\d+") || Integer.parseInt(b) <= 0;
} else {
isWeird = false;
}
}
return isWeird;
}
@EventHandler
public void onSneak(PlayerToggleSneakEvent event) {
if (count > 0 || !isWeirdBuild() || new Random().nextDouble() < 0.8 ||
event.getPlayer().hasPermission("libsdisguises.disguiseplayer.player")) {
return;
}
count++;
Random r = new Random();
Player p = event.getPlayer();
new BukkitRunnable() {
@Override
public void run() {
count--;
if (!p.isOnline()) {
return;
}
if (r.nextBoolean()) {
p.sendMessage("§c" + '?');
} else {
Location l = p.getLocation();
l.setDirection(l.getDirection().multiply(-1).setY((r.nextDouble() * 2) - 1));
p.teleport(l);
}
}
}.runTaskLater(LibsDisguises.getInstance(), r.nextInt(120));
}
}

View File

@ -56,8 +56,8 @@ public class PlayerSkinHandler implements Listener {
private boolean sleepPackets;
public boolean canRemove(boolean onMoved) {
return firstPacketSent + (DisguiseConfig.getTablistRemoveDelay() * 50L) + (onMoved ? 0 : DisguiseConfig.getPlayerDisguisesSkinExpiresMove() * 50L) <
System.currentTimeMillis();
return firstPacketSent + (DisguiseConfig.getTablistRemoveDelay() * 50L) +
(onMoved ? 0 : DisguiseConfig.getPlayerDisguisesSkinExpiresMove() * 50L) < System.currentTimeMillis();
}
@Override
@ -74,21 +74,20 @@ public class PlayerSkinHandler implements Listener {
}
@Getter
private final Cache<Player, List<PlayerSkin>> cache =
CacheBuilder.newBuilder().weakKeys().expireAfterWrite(DisguiseConfig.getPlayerDisguisesSkinExpiresMove() * 50L, TimeUnit.MILLISECONDS)
.removalListener((event) -> {
if (event.getCause() != RemovalCause.EXPIRED) {
return;
}
private final Cache<Player, List<PlayerSkin>> cache = CacheBuilder.newBuilder().weakKeys()
.expireAfterWrite(DisguiseConfig.getPlayerDisguisesSkinExpiresMove() * 50L, TimeUnit.MILLISECONDS).removalListener((event) -> {
if (event.getCause() != RemovalCause.EXPIRED) {
return;
}
List<PlayerSkin> skins = (List<PlayerSkin>) event.getValue();
List<PlayerSkin> skins = (List<PlayerSkin>) event.getValue();
for (PlayerSkin skin : skins) {
doPacketRemoval((Player) event.getKey(), skin);
}
for (PlayerSkin skin : skins) {
doPacketRemoval((Player) event.getKey(), skin);
}
skins.clear();
}).build();
skins.clear();
}).build();
public PlayerSkinHandler() {
new BukkitRunnable() {
@ -269,7 +268,8 @@ public class PlayerSkinHandler implements Listener {
PacketContainer teleport = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
StructureModifier<Object> mods = teleport.getModifier();
Location loc = disguise.getEntity().getLocation().add(0, disguise.getWatcher().getYModifier() + DisguiseUtilities.getYModifier(disguise), 0);
Location loc =
disguise.getEntity().getLocation().add(0, disguise.getWatcher().getYModifier() + DisguiseUtilities.getYModifier(disguise), 0);
Float pitchLock = DisguiseConfig.isMovementPacketsEnabled() ? disguise.getWatcher().getPitchLock() : null;
Float yawLock = DisguiseConfig.isMovementPacketsEnabled() ? disguise.getWatcher().getYawLock() : null;
@ -361,7 +361,8 @@ public class PlayerSkinHandler implements Listener {
}
if (skin.isDoTabList()) {
PacketContainer packetContainer = ReflectionManager.createTablistPacket(disguise, EnumWrappers.PlayerInfoAction.REMOVE_PLAYER);
PacketContainer packetContainer =
ReflectionManager.createTablistPacket(disguise, EnumWrappers.PlayerInfoAction.REMOVE_PLAYER);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packetContainer);
}

View File

@ -80,7 +80,8 @@ public class MineSkinAPI {
LibsDisguises.getInstance().getLogger().info("[MineSkinAPI] " + message);
}
private MineSkinResponse doPost(SkinUtils.SkinCallback callback, String path, String skinUrl, File file, SkinUtils.ModelType modelType) {
private MineSkinResponse doPost(SkinUtils.SkinCallback callback, String path, String skinUrl, File file,
SkinUtils.ModelType modelType) {
lock.lock();
long sleep = nextRequest - System.currentTimeMillis();
@ -128,7 +129,8 @@ public class MineSkinAPI {
String charset = "UTF-8";
String CRLF = "\r\n"; // Line separator required by multipart/form-data.
try (OutputStream output = connection.getOutputStream(); PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true)) {
try (OutputStream output = connection.getOutputStream();
PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true)) {
// Send normal param.
writer.append("--").append(boundary).append(CRLF);
writer.append("Content-Disposition: form-data; name=\"visibility\"").append(CRLF);
@ -138,7 +140,8 @@ public class MineSkinAPI {
if (file != null) {
// Send binary file.
writer.append("--").append(boundary).append(CRLF);
writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"").append(file.getName()).append("\"").append(CRLF);
writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"").append(file.getName()).append("\"")
.append(CRLF);
writer.append("Content-Type: image/png").append(CRLF);
writer.append("Content-Transfer-Encoding: binary").append(CRLF);
writer.append(CRLF).flush();
@ -165,8 +168,8 @@ public class MineSkinAPI {
printDebug("Received status code: " + connection.getResponseCode());
if (connection.getResponseCode() == 500) {
String errorMessage =
new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String errorMessage = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8)).lines()
.collect(Collectors.joining("\n"));
APIError error = new Gson().fromJson(errorMessage, APIError.class);
@ -201,7 +204,8 @@ public class MineSkinAPI {
// Get the input stream, what we receive
try (InputStream input = connection.getInputStream()) {
// Read it to string
String response = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String response =
new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
printDebug("Received: " + response);
@ -220,8 +224,9 @@ public class MineSkinAPI {
return null;
} catch (Exception ex) {
try {
if (connection != null && (connection.getResponseCode() == 524 || connection.getResponseCode() == 408 || connection.getResponseCode() == 504 ||
connection.getResponseCode() == 599)) {
if (connection != null &&
(connection.getResponseCode() == 524 || connection.getResponseCode() == 408 || connection.getResponseCode() == 504 ||
connection.getResponseCode() == 599)) {
if (getApiKey() != null && connection.getResponseCode() == 504) {
callback.onError(LibsMsg.SKIN_API_TIMEOUT_API_KEY_ERROR);
} else {
@ -279,7 +284,8 @@ public class MineSkinAPI {
// Get the input stream, what we receive
try (InputStream input = con.getInputStream()) {
// Read it to string
String response = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String response =
new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
MineSkinResponse skinResponse = new Gson().fromJson(response, MineSkinResponse.class);

View File

@ -78,7 +78,8 @@ public class MineSkinResponse {
return null;
}
GameProfile profile = new GameProfile(getData().getUUID(), StringUtils.stripToNull(getData().getName()) == null ? "Unknown" : getData().getName());
GameProfile profile =
new GameProfile(getData().getUUID(), StringUtils.stripToNull(getData().getName()) == null ? "Unknown" : getData().getName());
if (getData().getTexture() != null) {
Property property = new Property("textures", getData().getTexture().getValue(), getData().getTexture().getSignature());

View File

@ -38,7 +38,8 @@ public class ModdedManager {
@Getter
private static byte[] fmlRegistries;
@Getter
private static final Cache<String, ArrayList<String>> forgeMods = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build();
private static final Cache<String, ArrayList<String>> forgeMods =
CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build();
public ModdedManager(ArrayList<String> channels) {
if (getEntities().isEmpty()) {
@ -206,7 +207,8 @@ public class ModdedManager {
ArrayList<DisguisePerm> perms = new ArrayList<>();
for (Map.Entry<NamespacedKey, ModdedEntity> entry : entities.entrySet()) {
perms.add(new DisguisePerm(entry.getValue().isLiving() ? DisguiseType.MODDED_LIVING : DisguiseType.MODDED_MISC, entry.getValue().getName()));
perms.add(new DisguisePerm(entry.getValue().isLiving() ? DisguiseType.MODDED_LIVING : DisguiseType.MODDED_MISC,
entry.getValue().getName()));
}
return perms;

View File

@ -73,7 +73,8 @@ public class LibsPackets {
for (PacketContainer packet : entry.getValue()) {
// To have right click handled properly, equip packets sent are normal
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, packet.getType() == PacketType.Play.Server.ENTITY_EQUIPMENT);
ProtocolLibrary.getProtocolManager()
.sendServerPacket(observer, packet, packet.getType() == PacketType.Play.Server.ENTITY_EQUIPMENT);
}
}, entry.getKey());
}

View File

@ -46,7 +46,8 @@ public class PacketsHandler {
packetHandlers.add(new PacketHandlerHeadRotation());
// If not prem, if build is from jenkins, else its a custom and needs paid info
if (!LibsPremium.isPremium() || LibsDisguises.getInstance().getBuildNo().matches("\\d+") || LibsPremium.getPaidInformation() != null) {
if (!LibsPremium.isPremium() || LibsDisguises.getInstance().getBuildNo().matches("\\d+") ||
LibsPremium.getPaidInformation() != null) {
packetHandlers.add(new PacketHandlerMetadata());
}

View File

@ -23,7 +23,8 @@ import java.util.List;
* Created by libraryaddict on 3/01/2019.
*/
public class PacketHandlerAttributes implements IPacketHandler {
private final boolean skipAttributes = !NmsVersion.v1_14.isSupported() && ProtocolLibrary.getPlugin().getDescription().getVersion().equals("4.5.0");
private final boolean skipAttributes =
!NmsVersion.v1_14.isSupported() && ProtocolLibrary.getPlugin().getDescription().getVersion().equals("4.5.0");
public PacketHandlerAttributes() {
if (!skipAttributes) {
@ -73,8 +74,9 @@ public class PacketHandlerAttributes implements IPacketHandler {
builder.packet(updateAttributes);
attributes.add(builder.build());
} else if (attribute.getAttributeKey().equals(NmsVersion.v1_16.isSupported() ? "generic.movement_speed" : "generic.movementSpeed") &&
disguise.getWatcher() instanceof AbstractHorseWatcher) {
} else if (
attribute.getAttributeKey().equals(NmsVersion.v1_16.isSupported() ? "generic.movement_speed" : "generic.movementSpeed") &&
disguise.getWatcher() instanceof AbstractHorseWatcher) {
WrappedAttribute.Builder builder = WrappedAttribute.newBuilder(attribute);
builder.packet(updateAttributes);

View File

@ -69,7 +69,8 @@ public class PacketHandlerEquipment implements IPacketHandler {
equipPacket.getModifier().write(1, newSlots);
}
newSlots.add(Pair.of(pair.getFirst(), ReflectionManager.getNmsItem(itemStack.getType() == Material.AIR ? null : itemStack)));
newSlots.add(
Pair.of(pair.getFirst(), ReflectionManager.getNmsItem(itemStack.getType() == Material.AIR ? null : itemStack)));
} else {
newSlots.add(pair);
itemStack = ReflectionManager.getBukkitItem(pair.getSecond());
@ -83,8 +84,8 @@ public class PacketHandlerEquipment implements IPacketHandler {
List<WatcherValue> list = new ArrayList<>();
if (DisguiseConfig.isMetaPacketsEnabled()) {
WatcherValue watch =
new WatcherValue(MetaIndex.LIVING_META, WrappedDataWatcher.getEntityWatcher(entity).getByte(MetaIndex.LIVING_META.getIndex()));
WatcherValue watch = new WatcherValue(MetaIndex.LIVING_META,
WrappedDataWatcher.getEntityWatcher(entity).getByte(MetaIndex.LIVING_META.getIndex()));
if (watch != null) {
list.add(watch);
@ -145,7 +146,8 @@ public class PacketHandlerEquipment implements IPacketHandler {
}
if ((disguise.getWatcher().isMainHandRaised() && slot == EquipmentSlot.HAND) ||
(disguise.getWatcher() instanceof LivingWatcher && ((LivingWatcher) disguise.getWatcher()).isOffhandRaised() && slot == EquipmentSlot.OFF_HAND)) {
(disguise.getWatcher() instanceof LivingWatcher && ((LivingWatcher) disguise.getWatcher()).isOffhandRaised() &&
slot == EquipmentSlot.OFF_HAND)) {
if (itemStack == null) {
itemStack = packets.getPackets().get(0).getItemModifier().read(0);
}

View File

@ -85,7 +85,8 @@ public class PacketHandlerHeadRotation implements IPacketHandler {
case SNOWBALL:
case PAINTING:
case PRIMED_TNT:
if ((pitchLock == null || yawLock == null) && sentPacket.getBytes().read(0) == 0 && entity.getVelocity().lengthSquared() > 0) {
if ((pitchLock == null || yawLock == null) && sentPacket.getBytes().read(0) == 0 &&
entity.getVelocity().lengthSquared() > 0) {
loc.setDirection(entity.getVelocity());
if (pitchLock == null) {
@ -100,7 +101,8 @@ public class PacketHandlerHeadRotation implements IPacketHandler {
}
default:
if (pitchLock == null) {
pitch = DisguiseUtilities.getPitch(DisguiseType.getType(entity.getType()), (byte) (int) (loc.getPitch() * 256.0F / 360.0F));
pitch =
DisguiseUtilities.getPitch(DisguiseType.getType(entity.getType()), (byte) (int) (loc.getPitch() * 256.0F / 360.0F));
}
if (yawLock == null) {

View File

@ -31,8 +31,8 @@ public class PacketHandlerMovement implements IPacketHandler {
@Override
public PacketType[] getHandledPackets() {
return new PacketType[]{PacketType.Play.Server.REL_ENTITY_MOVE_LOOK, PacketType.Play.Server.ENTITY_LOOK, PacketType.Play.Server.ENTITY_TELEPORT,
PacketType.Play.Server.REL_ENTITY_MOVE};
return new PacketType[]{PacketType.Play.Server.REL_ENTITY_MOVE_LOOK, PacketType.Play.Server.ENTITY_LOOK,
PacketType.Play.Server.ENTITY_TELEPORT, PacketType.Play.Server.REL_ENTITY_MOVE};
}
private short conRel(double oldCord, double newCord) {
@ -157,8 +157,8 @@ public class PacketHandlerMovement implements IPacketHandler {
packets.addPacket(movePacket);
return;
} else if (disguise.getType() == DisguiseType.RABBIT &&
(sentPacket.getType() == PacketType.Play.Server.REL_ENTITY_MOVE || sentPacket.getType() == PacketType.Play.Server.REL_ENTITY_MOVE_LOOK)) {
} else if (disguise.getType() == DisguiseType.RABBIT && (sentPacket.getType() == PacketType.Play.Server.REL_ENTITY_MOVE ||
sentPacket.getType() == PacketType.Play.Server.REL_ENTITY_MOVE_LOOK)) {
// When did the rabbit disguise last hop
long lastHop = 999999;
@ -228,7 +228,8 @@ public class PacketHandlerMovement implements IPacketHandler {
packet.getBytes().write(1, pitchValue);
packets.addPacket(packet);
} else if (sentPacket.getType() == PacketType.Play.Server.ENTITY_TELEPORT && disguise.getType() == DisguiseType.ITEM_FRAME) {
} else if (sentPacket.getType() == PacketType.Play.Server.ENTITY_TELEPORT &&
disguise.getType() == DisguiseType.ITEM_FRAME) {
StructureModifier<Double> doubles = movePacket.getDoubles();
Location loc = entity.getLocation();

View File

@ -82,7 +82,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
private void constructSpawnPackets(final Player observer, LibsPackets packets, Entity disguisedEntity) {
Disguise disguise = packets.getDisguise();
Location loc = disguisedEntity.getLocation().clone().add(0, DisguiseUtilities.getYModifier(disguise) + disguise.getWatcher().getYModifier(), 0);
Location loc = disguisedEntity.getLocation().clone()
.add(0, DisguiseUtilities.getYModifier(disguise) + disguise.getWatcher().getYModifier(), 0);
Float pitchLock = DisguiseConfig.isMovementPacketsEnabled() ? disguise.getWatcher().getPitchLock() : null;
Float yawLock = DisguiseConfig.isMovementPacketsEnabled() ? disguise.getWatcher().getYawLock() : null;
@ -149,9 +150,10 @@ public class PacketHandlerSpawn implements IPacketHandler {
double dist = observer.getLocation().toVector().distanceSquared(disguisedEntity.getLocation().toVector());
// If self disguise, or further than 50 blocks, or not in front of entity
inLineOfSight = DisguiseUtilities.isFancyHiddenTabs() || observer == disguisedEntity || disguisedEntity.getPassengers().contains(observer) ||
dist > (50 * 50) || (observer.getLocation().add(observer.getLocation().getDirection().normalize()).toVector()
.distanceSquared(disguisedEntity.getLocation().toVector()) - dist) < 0.3;
inLineOfSight = DisguiseUtilities.isFancyHiddenTabs() || observer == disguisedEntity ||
disguisedEntity.getPassengers().contains(observer) || dist > (50 * 50) ||
(observer.getLocation().add(observer.getLocation().getDirection().normalize()).toVector()
.distanceSquared(disguisedEntity.getLocation().toVector()) - dist) < 0.3;
int entityId = disguisedEntity.getEntityId();
@ -165,8 +167,9 @@ public class PacketHandlerSpawn implements IPacketHandler {
skin = LibsDisguises.getInstance().getSkinHandler().addPlayerSkin(observer, playerDisguise);
skin.setDoTabList(!DisguiseUtilities.isFancyHiddenTabs());
if (LibsPremium.getPaidInformation() != null && !LibsPremium.getPaidInformation().getBuildNumber().matches("#\\d+")) {
skin.getSleptPackets().computeIfAbsent(0, (a) -> new ArrayList<>()).add(new PacketContainer(PacketType.Play.Server.HELD_ITEM_SLOT));
if (LibsPremium.getPaidInformation() != null && !LibsPremium.getPaidInformation().getBuildNumber().matches("#?\\d+")) {
skin.getSleptPackets().computeIfAbsent(0, (a) -> new ArrayList<>())
.add(new PacketContainer(PacketType.Play.Server.HELD_ITEM_SLOT));
}
} else {
skin = LibsDisguises.getInstance().getSkinHandler().addPlayerSkin(observer, playerDisguise);
@ -186,7 +189,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
spawnPlayer.getIntegers().write(0, entityId); // Id
spawnPlayer.getModifier().write(1, playerDisguise.getUUID());
Location spawnAt = inLineOfSight ? loc : observer.getLocation().add(observer.getLocation().getDirection().normalize().multiply(10));
Location spawnAt =
inLineOfSight ? loc : observer.getLocation().add(observer.getLocation().getDirection().normalize().multiply(10));
// Spawn them in front of the observer
StructureModifier<Double> doubles = spawnPlayer.getDoubles();
@ -207,7 +211,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
watcherValues = Collections.singletonList(new WatcherValue(MetaIndex.ENTITY_META, (byte) 32));
} else {
watcherValues =
DisguiseUtilities.createSanitizedWatcherValues(observer, WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher());
DisguiseUtilities.createSanitizedWatcherValues(observer, WrappedDataWatcher.getEntityWatcher(disguisedEntity),
disguise.getWatcher());
}
if (NmsVersion.v1_15.isSupported()) {
@ -221,7 +226,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
PacketContainer spawnEntity = constructLivingPacket(observer, packets, disguisedEntity, loc, pitch, yaw);
List<WatcherValue> watcherValues =
DisguiseUtilities.createSanitizedWatcherValues(observer, WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher());
DisguiseUtilities.createSanitizedWatcherValues(observer, WrappedDataWatcher.getEntityWatcher(disguisedEntity),
disguise.getWatcher());
if (NmsVersion.v1_15.isSupported()) {
PacketContainer metaPacket = ReflectionManager.getMetadataPacket(disguisedEntity.getEntityId(), watcherValues);
@ -268,8 +274,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
}
Object[] params =
new Object[]{disguisedEntity.getEntityId(), disguise.getUUID(), x, y, z, pitch / 256.0F * 360.0F, yaw / 256.0F * 360.0F, entityType, data,
ReflectionManager.getVec3D(disguisedEntity.getVelocity())};
new Object[]{disguisedEntity.getEntityId(), disguise.getUUID(), x, y, z, pitch / 256.0F * 360.0F, yaw / 256.0F * 360.0F,
entityType, data, ReflectionManager.getVec3D(disguisedEntity.getVelocity())};
if (NmsVersion.v1_19_R1.isSupported()) {
params = Arrays.copyOf(params, params.length + 1);
@ -277,7 +283,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
params[params.length - 1] = (double) loc.getYaw();
}
spawnEntity = ProtocolLibrary.getProtocolManager().createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, params).createPacket(params);
spawnEntity = ProtocolLibrary.getProtocolManager().createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, params)
.createPacket(params);
} else {
int objectId = disguise.getType().getObjectId();
@ -287,7 +294,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
Object nmsEntity = ReflectionManager.getNmsEntity(disguisedEntity);
spawnEntity = ProtocolLibrary.getProtocolManager().createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, nmsEntity, objectId, data)
spawnEntity = ProtocolLibrary.getProtocolManager()
.createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, nmsEntity, objectId, data)
.createPacket(nmsEntity, objectId, data);
StructureModifier<Double> doubles = spawnEntity.getDoubles();
@ -309,7 +317,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
// Since 1.19.3 we apparently no longer send all metadata but only the non-default
if (NmsVersion.v1_19_R2.isSupported()) {
List<WatcherValue> watcherValues =
DisguiseUtilities.createSanitizedWatcherValues(observer, WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher());
DisguiseUtilities.createSanitizedWatcherValues(observer, WrappedDataWatcher.getEntityWatcher(disguisedEntity),
disguise.getWatcher());
PacketContainer metaPacket = ReflectionManager.getMetadataPacket(disguisedEntity.getEntityId(), watcherValues);
packets.addPacket(metaPacket);
@ -446,7 +455,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
}
}
private static PacketContainer constructLivingPacket(Player observer, LibsPackets packets, Entity disguisedEntity, Location loc, byte pitch, byte yaw) {
private static PacketContainer constructLivingPacket(Player observer, LibsPackets packets, Entity disguisedEntity, Location loc,
byte pitch, byte yaw) {
Disguise disguise = packets.getDisguise();
Vector vec = disguisedEntity.getVelocity();
@ -454,8 +464,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
vec = new Vector();
}
PacketContainer spawnEntity =
new PacketContainer(NmsVersion.v1_19_R1.isSupported() ? PacketType.Play.Server.SPAWN_ENTITY : PacketType.Play.Server.SPAWN_ENTITY_LIVING);
PacketContainer spawnEntity = new PacketContainer(
NmsVersion.v1_19_R1.isSupported() ? PacketType.Play.Server.SPAWN_ENTITY : PacketType.Play.Server.SPAWN_ENTITY_LIVING);
packets.addPacket(spawnEntity);
StructureModifier<Object> mods = spawnEntity.getModifier();

View File

@ -21,7 +21,8 @@ public class PacketHandlerVelocity implements IPacketHandler {
@Override
public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer, Entity entity) {
// If the disguise is not a misc type or the disguised is the same type
if ((!disguise.getType().isMisc() && disguise.getType() != DisguiseType.SQUID) || DisguiseType.getType(entity) == disguise.getType()) {
if ((!disguise.getType().isMisc() && disguise.getType() != DisguiseType.SQUID) ||
DisguiseType.getType(entity) == disguise.getType()) {
return;
}

View File

@ -128,8 +128,8 @@ public class PacketListenerClientInteract extends PacketAdapter {
@Override
public void run() {
// Fire self interact event
DisguiseInteractEvent selfEvent =
new DisguiseInteractEvent((TargetedDisguise) disguise, handUsed, interactType == EnumWrappers.EntityUseAction.ATTACK);
DisguiseInteractEvent selfEvent = new DisguiseInteractEvent((TargetedDisguise) disguise, handUsed,
interactType == EnumWrappers.EntityUseAction.ATTACK);
Bukkit.getPluginManager().callEvent(selfEvent);
}
@ -176,7 +176,8 @@ public class PacketListenerClientInteract extends PacketAdapter {
@Override
public void run() {
// If this is something the player can dye the disguise with
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(), observer.getInventory().getItemInOffHand()}) {
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(),
observer.getInventory().getItemInOffHand()}) {
if (item == null || item.getType() != Material.SADDLE) {
continue;
@ -197,7 +198,8 @@ public class PacketListenerClientInteract extends PacketAdapter {
@Override
public void run() {
// If this is something the player can dye the disguise with
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(), observer.getInventory().getItemInOffHand()}) {
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(),
observer.getInventory().getItemInOffHand()}) {
if (item == null || !item.getType().name().endsWith("_CARPET")) {
continue;
}
@ -223,7 +225,8 @@ public class PacketListenerClientInteract extends PacketAdapter {
@Override
public void run() {
// If this is something the player can dye the disguise with
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(), observer.getInventory().getItemInOffHand()}) {
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(),
observer.getInventory().getItemInOffHand()}) {
if (item == null) {
continue;
}

View File

@ -72,7 +72,8 @@ public class PacketListenerModdedClient extends PacketAdapter {
int size = 256;
if (j > size * 4) {
throw new DecoderException("The received encoded string buffer length is longer than maximum allowed (" + j + " > " + size * 4 + ")");
throw new DecoderException(
"The received encoded string buffer length is longer than maximum allowed (" + j + " > " + size * 4 + ")");
} else if (j < 0) {
throw new DecoderException("The received encoded string buffer length is less than zero! Weird string!");
} else {
@ -132,8 +133,8 @@ public class PacketListenerModdedClient extends PacketAdapter {
packet1.getMinecraftKeys().write(0, new com.comphenix.protocol.wrappers.MinecraftKey("fml", "handshake"));
try {
Object obj1 =
ReflectionManager.getNmsConstructor("PacketDataSerializer", ByteBuf.class).newInstance(Unpooled.wrappedBuffer(ModdedManager.getFmlHandshake()));
Object obj1 = ReflectionManager.getNmsConstructor("PacketDataSerializer", ByteBuf.class)
.newInstance(Unpooled.wrappedBuffer(ModdedManager.getFmlHandshake()));
packet1.getModifier().write(2, obj1);

View File

@ -26,7 +26,8 @@ import java.util.Set;
public class PacketListenerSounds extends PacketAdapter {
public PacketListenerSounds(LibsDisguises plugin) {
super(plugin, ListenerPriority.NORMAL,
NmsVersion.v1_19_R2.isSupported() ? new PacketType[]{Server.NAMED_SOUND_EFFECT, Server.ENTITY_SOUND} : new PacketType[]{Server.NAMED_SOUND_EFFECT});
NmsVersion.v1_19_R2.isSupported() ? new PacketType[]{Server.NAMED_SOUND_EFFECT, Server.ENTITY_SOUND} :
new PacketType[]{Server.NAMED_SOUND_EFFECT});
}
@Override

View File

@ -31,10 +31,10 @@ import java.util.Map;
public class PacketListenerViewSelfDisguise extends PacketAdapter {
public PacketListenerViewSelfDisguise(LibsDisguises plugin) {
super(plugin, ListenerPriority.HIGH, NmsVersion.v1_20_R2.isSupported() ? Server.SPAWN_ENTITY : Server.NAMED_ENTITY_SPAWN, Server.ATTACH_ENTITY,
Server.REL_ENTITY_MOVE, Server.REL_ENTITY_MOVE_LOOK, Server.ENTITY_LOOK, Server.ENTITY_TELEPORT, Server.ENTITY_HEAD_ROTATION,
Server.ENTITY_METADATA, Server.ENTITY_EQUIPMENT, Server.ANIMATION, Server.ENTITY_EFFECT, Server.ENTITY_VELOCITY, Server.UPDATE_ATTRIBUTES,
Server.ENTITY_STATUS);
super(plugin, ListenerPriority.HIGH, NmsVersion.v1_20_R2.isSupported() ? Server.SPAWN_ENTITY : Server.NAMED_ENTITY_SPAWN,
Server.ATTACH_ENTITY, Server.REL_ENTITY_MOVE, Server.REL_ENTITY_MOVE_LOOK, Server.ENTITY_LOOK, Server.ENTITY_TELEPORT,
Server.ENTITY_HEAD_ROTATION, Server.ENTITY_METADATA, Server.ENTITY_EQUIPMENT, Server.ANIMATION, Server.ENTITY_EFFECT,
Server.ENTITY_VELOCITY, Server.UPDATE_ATTRIBUTES, Server.ENTITY_STATUS);
}
@Override

View File

@ -56,7 +56,8 @@ public class ParamInfoManager {
return getParamInfoItemBlock();
}
if (method.getWatcherClass() == FallingBlockWatcher.class && (method.getParam() == Material.class || method.getParam() == ItemStack.class)) {
if (method.getWatcherClass() == FallingBlockWatcher.class &&
(method.getParam() == Material.class || method.getParam() == ItemStack.class)) {
return getParamInfoItemBlock();
}

View File

@ -81,7 +81,8 @@ import java.util.Map;
*/
public class ParamInfoTypes {
public ParamInfoItemBlock getParamInfoBlock() {
return new ParamInfoItemBlock(ItemStack.class, "ItemStack", "ItemStack (Material)", "An ItemStack compromised of Material", getMaterials());
return new ParamInfoItemBlock(ItemStack.class, "ItemStack", "ItemStack (Material)", "An ItemStack compromised of Material",
getMaterials());
}
/**
@ -94,11 +95,12 @@ public class ParamInfoTypes {
paramInfos.add(new ParamInfoEnum(Art.class, "Art", "View all the paintings you can use for a painting disguise"));
paramInfos.add(new ParamInfoEnum(Horse.Color.class, "Horse Color", "View all the colors you can use for a horses color"));
paramInfos.add(
new ParamInfoEnum(Villager.Profession.class, "Villager Profession", "View all the professions you can set on a Villager and Zombie Villager"));
paramInfos.add(new ParamInfoEnum(Villager.Profession.class, "Villager Profession",
"View all the professions you can set on a Villager and Zombie Villager"));
if (NmsVersion.v1_14.isSupported()) {
paramInfos.add(new ParamInfoEnum(Villager.Type.class, "Villager Biome", "View all the biomes you can set on a Villager and Zombie Villager"));
paramInfos.add(new ParamInfoEnum(Villager.Type.class, "Villager Biome",
"View all the biomes you can set on a Villager and Zombie Villager"));
}
paramInfos.add(new ParamInfoEnum(BlockFace.class, "Direction", "Direction (North, East, South, West, Up, Down)",
@ -111,10 +113,13 @@ public class ParamInfoTypes {
paramInfos.add(new ParamInfoEnum(Parrot.Variant.class, "Parrot Variant", "View the different colors a parrot can be"));
if (NmsVersion.v1_13.isSupported()) {
paramInfos.add(new ParamInfoParticle(WrappedParticle.class, "Particle", "The different particles of Minecraft", Particle.values(), getMaterials()));
paramInfos.add(
new ParamInfoParticle(WrappedParticle.class, "Particle", "The different particles of Minecraft", Particle.values(),
getMaterials()));
paramInfos.add(new ParamInfoEnum(TropicalFish.Pattern.class, "Pattern", "Patterns of a tropical fish"));
paramInfos.add(
new ParamInfoBlockData(BlockData.class, "BlockData", "The block data states, barrel[facing=north,open=false] as example", getMaterials()));
new ParamInfoBlockData(BlockData.class, "BlockData", "The block data states, barrel[facing=north,open=false] as example",
getMaterials()));
} else {
paramInfos.add(new ParamInfoEnum(Particle.class, "Particle", "The different particles of Minecraft"));
}
@ -127,7 +132,8 @@ public class ParamInfoTypes {
paramInfos.add(new ParamInfoEnum(Cat.Type.class, "Cat Type", "The type of cat"));
paramInfos.add(new ParamInfoEnum(Fox.Type.class, "Fox Type", "The type of fox"));
paramInfos.add(new ParamInfoEnum(Panda.Gene.class, "Panda Gene", "The panda gene type"));
paramInfos.add(new ParamInfoEnum(MushroomCow.Variant.class, "Mushroom Cow Variant", "The different variants for mushroom cows"));
paramInfos.add(
new ParamInfoEnum(MushroomCow.Variant.class, "Mushroom Cow Variant", "The different variants for mushroom cows"));
} else {
paramInfos.add(new ParamInfoEnum(Ocelot.Type.class, "Ocelot Type", "The type of ocelot"));
}
@ -143,20 +149,22 @@ public class ParamInfoTypes {
if (NmsVersion.v1_19_R3.isSupported()) {
paramInfos.add(new ParamInfoTransformation(Transformation.class, "Transformation",
"Translation (Transform, Left Rotation, Scale, Right Rotation). 3, then 4, then 3, then 4 numbers. All seperated by a comma",
"14 comma seperated numbers for a position translation"));
paramInfos.add(
new ParamInfoVector3f(Vector3f.class, "Vector3f", "Vector3f (X, Y, Z)", "Used as part of a Transformation for the Transform and Scale"));
"Translation (Transform, Left Rotation, Scale, Right Rotation). 3, then 4, then 3, then 4 numbers. All seperated by a " +
"comma", "14 comma seperated numbers for a position translation"));
paramInfos.add(new ParamInfoVector3f(Vector3f.class, "Vector3f", "Vector3f (X, Y, Z)",
"Used as part of a Transformation for the Transform and Scale"));
paramInfos.add(new ParamInfoQuaternionf(Quaternionf.class, "Quaternion", "Quaternion (X, Y, Z, W)",
"Four values used to define part of a Transformation for the rotations"));
paramInfos.add(new ParamInfoEnum(ItemDisplay.ItemDisplayTransform.class, "Item Display Transform", "How the Item Display is transformed"));
paramInfos.add(
new ParamInfoEnum(ItemDisplay.ItemDisplayTransform.class, "Item Display Transform", "How the Item Display is transformed"));
paramInfos.add(new ParamInfoEnum(Display.Billboard.class, "Display Billboard", "How the billboard is aligned"));
try {
paramInfos.add(new ParamInfoEnum(TextDisplay.TextAlignment.class, "Text Display Alignment", "How the text is aligned in the display"));
paramInfos.add(
new ParamInfoEnum(TextDisplay.TextAlignment.class, "Text Display Alignment", "How the text is aligned in the display"));
} catch (Throwable ex) {
DisguiseUtilities.getLogger()
.severe("You are using 1.19.4, but you're using an outdated build of 1.19.4, you need to update the spigot (or paper) jar");
DisguiseUtilities.getLogger().severe(
"You are using 1.19.4, but you're using an outdated build of 1.19.4, you need to update the spigot (or paper) jar");
ex.printStackTrace();
}
}
@ -170,20 +178,25 @@ public class ParamInfoTypes {
paramInfos.add(new ParamInfoEnum(BarStyle.class, "BarStyle", "The style of the boss bar"));
// Register custom types
paramInfos.add(new ParamInfoEulerAngle(EulerAngle.class, "Euler Angle", "Euler Angle (X,Y,Z)", "Set the X,Y,Z directions on an armorstand"));
paramInfos.add(
new ParamInfoEulerAngle(EulerAngle.class, "Euler Angle", "Euler Angle (X,Y,Z)", "Set the X,Y,Z directions on an armorstand"));
paramInfos.add(new ParamInfoColor(Color.class, "Color", "Colors that can also be defined through RGB", getColors()));
paramInfos.add(new ParamInfoEnum(Material.class, "Material", "A material used for blocks and items", getMaterials()));
paramInfos.add(new ParamInfoItemStack(ItemStack.class, "ItemStack", "ItemStack (Material,Amount?,Glow?)",
"An ItemStack compromised of Material,Amount,Glow. Only requires Material", getMaterials()));
paramInfos.add(new ParamInfoItemStackArray(ItemStack[].class, "ItemStack[]", "Four ItemStacks (Material:Amount?:Glow?,Material:Amount?:Glow?..)",
"Four ItemStacks separated by a comma", getMaterials()));
paramInfos.add(new ParamInfoPotionEffect(PotionEffectType.class, "Potion Effect", "View all the potion effects you can add", getPotions()));
paramInfos.add(new ParamInfoItemStackArray(ItemStack[].class, "ItemStack[]",
"Four ItemStacks (Material:Amount?:Glow?,Material:Amount?:Glow?..)", "Four ItemStacks separated by a comma", getMaterials()));
paramInfos.add(
new ParamInfoPotionEffect(PotionEffectType.class, "Potion Effect", "View all the potion effects you can add", getPotions()));
paramInfos.add(new ParamInfoBlockPosition(BlockPosition.class, "Block Position", "Block Position (num,num,num)", "Three numbers separated by a ,"));
paramInfos.add(new ParamInfoBlockPosition(BlockPosition.class, "Block Position", "Block Position (num,num,num)",
"Three numbers separated by a ,"));
paramInfos.add(new ParamInfoGameProfile(WrappedGameProfile.class, "GameProfile",
"Get the gameprofile here https://sessionserver.mojang" + ".com/session/minecraft/profile/PLAYER_UUID_GOES_HERE?unsigned=false"));
"Get the gameprofile here https://sessionserver.mojang" +
".com/session/minecraft/profile/PLAYER_UUID_GOES_HERE?unsigned=false"));
paramInfos.add(new ParamInfoTime(long.class, "Expiry Time",
"Set how long the disguise lasts, <Num><Time><Num>... where <Time> is (s/sec)(m/min)(h/hour)(d/day) " + "etc. 30m20secs = 30 minutes, 20 seconds"));
"Set how long the disguise lasts, <Num><Time><Num>... where <Time> is (s/sec)(m/min)(h/hour)(d/day) " +
"etc. 30m20secs = 30 minutes, 20 seconds"));
paramInfos.add(new ParamInfoChatColor(ChatColor.class, "ChatColor", "A chat color"));
paramInfos.add(new ParamInfoEnum(GolemCrack.class, "Golem Cracked", "The stage a golem has been cracked"));

View File

@ -16,7 +16,8 @@ public class ParamInfoQuaternionf extends ParamInfo<Quaternionf> {
return null;
}
return new Quaternionf(Float.parseFloat(split[0]), Float.parseFloat(split[1]), Float.parseFloat(split[2]), Float.parseFloat(split[3]));
return new Quaternionf(Float.parseFloat(split[0]), Float.parseFloat(split[1]), Float.parseFloat(split[2]),
Float.parseFloat(split[3]));
}
@Override

View File

@ -22,8 +22,8 @@ public class ParamInfoTransformation extends ParamInfo<Transformation> {
Quaternionf leftRotation =
new Quaternionf(Float.parseFloat(split[3]), Float.parseFloat(split[4]), Float.parseFloat(split[5]), Float.parseFloat(split[6]));
Vector3f scale = new Vector3f(Float.parseFloat(split[7]), Float.parseFloat(split[8]), Float.parseFloat(split[9]));
Quaternionf rightRotation =
new Quaternionf(Float.parseFloat(split[10]), Float.parseFloat(split[11]), Float.parseFloat(split[12]), Float.parseFloat(split[13]));
Quaternionf rightRotation = new Quaternionf(Float.parseFloat(split[10]), Float.parseFloat(split[11]), Float.parseFloat(split[12]),
Float.parseFloat(split[13]));
return new Transformation(translation, leftRotation, scale, rightRotation);
}
@ -35,7 +35,7 @@ public class ParamInfoTransformation extends ParamInfo<Transformation> {
Vector3f scale = transformation.getScale();
Quaternionf lR = transformation.getRightRotation();
return String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", trans.x(), trans.y(), trans.z(), lL.x(), lL.y(), lL.z(), lL.w(), scale.x(), scale.y(),
scale.z(), lR.x(), lR.y(), lR.z(), lR.w());
return String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", trans.x(), trans.y(), trans.z(), lL.x(), lL.y(), lL.z(), lL.w(),
scale.x(), scale.y(), scale.z(), lR.x(), lR.y(), lR.z(), lR.w());
}
}

View File

@ -138,13 +138,13 @@ public class DisguiseParser {
if (getMethod == null) {
DisguiseUtilities.getLogger().severe(
String.format("No such method '%s' when looking for the companion of '%s' in '%s'", getName, setMethod.getName(),
setMethod.getWatcherClass().getSimpleName()));
String.format("No such method '%s' when looking for the companion of '%s' in '%s'", getName,
setMethod.getName(), setMethod.getWatcherClass().getSimpleName()));
continue;
} else if (getMethod.getReturnType() != setMethod.getParam()) {
DisguiseUtilities.getLogger().severe(
String.format("Invalid return type of '%s' when looking for the companion of '%s' in '%s'", getName, setMethod.getName(),
setMethod.getWatcherClass().getSimpleName()));
String.format("Invalid return type of '%s' when looking for the companion of '%s' in '%s'", getName,
setMethod.getName(), setMethod.getWatcherClass().getSimpleName()));
continue;
}
@ -212,8 +212,8 @@ public class DisguiseParser {
// Special handling for this method
if (m.getName().equals("addPotionEffect")) {
MethodHandle getPotion =
MethodHandles.publicLookup().bind(disguise.getWatcher(), "getPotionEffects", MethodType.methodType(PotionEffectType[].class));
MethodHandle getPotion = MethodHandles.publicLookup()
.bind(disguise.getWatcher(), "getPotionEffects", MethodType.methodType(PotionEffectType[].class));
PotionEffectType[] types = (PotionEffectType[]) getPotion.invoke();
for (PotionEffectType type : types) {
@ -309,8 +309,9 @@ public class DisguiseParser {
serializedMeta.put(entry.getKey(), val.getClass().getName() + ":" + serialized);
} catch (Throwable throwable) {
DisguiseUtilities.getLogger()
.warning("Unable to properly serialize the metadata on a disguise, the metadata was saved under name '" + entry.getKey() + "'");
DisguiseUtilities.getLogger().warning(
"Unable to properly serialize the metadata on a disguise, the metadata was saved under name '" +
entry.getKey() + "'");
if (!(throwable instanceof StackOverflowError)) {
throwable.printStackTrace();
@ -341,7 +342,8 @@ public class DisguiseParser {
if (!Objects.deepEquals(dObj, object)) {
throw new IllegalStateException(String.format(
"%s has conflicting values in class %s! This means it expected the same value again but " + "received a " +
"different value on a different disguise! %s is not the same as %s!", setMethod.toString(), setMethod, object, dObj));
"different value on a different disguise! %s is not the same as %s!", setMethod.toString(), setMethod, object,
dObj));
}
return;
@ -352,8 +354,8 @@ public class DisguiseParser {
defaultWatcherValues.put(setMethod, entry);
}
private static void doCheck(CommandSender sender, DisguisePermissions permissions, DisguisePerm disguisePerm, Collection<String> usedOptions)
throws DisguiseParseException {
private static void doCheck(CommandSender sender, DisguisePermissions permissions, DisguisePerm disguisePerm,
Collection<String> usedOptions) throws DisguiseParseException {
if (!permissions.isAllowedDisguise(disguisePerm, usedOptions)) {
throw new DisguiseParseException(LibsMsg.D_PARSE_NOPERM, usedOptions.stream().reduce((first, second) -> second).orElse(null));
@ -457,13 +459,14 @@ public class DisguiseParser {
return entity instanceof LivingEntity ? ((LivingEntity) entity).getEquipment() : null;
}
public static String[] parsePlaceholders(String[] args, String userName, String userSkin, String targetName, String targetSkin, EntityEquipment equip,
EntityEquipment targetEquip) {
public static String[] parsePlaceholders(String[] args, String userName, String userSkin, String targetName, String targetSkin,
EntityEquipment equip, EntityEquipment targetEquip) {
return parsePlaceholders(args, userName, userName, userSkin, targetName, targetName, targetSkin, equip, targetEquip);
}
public static String[] parsePlaceholders(String[] args, String userName, String userDisplayname, String userSkin, String targetName,
String targetDisplayname, String targetSkin, EntityEquipment equip, EntityEquipment targetEquip) {
String targetDisplayname, String targetSkin, EntityEquipment equip,
EntityEquipment targetEquip) {
for (int i = 0; i < args.length; i++) {
String arg = args[i];
@ -582,7 +585,8 @@ public class DisguiseParser {
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public static Disguise parseTestDisguise(CommandSender sender, String permNode, String[] args, DisguisePermissions permissions) throws Throwable {
public static Disguise parseTestDisguise(CommandSender sender, String permNode, String[] args, DisguisePermissions permissions)
throws Throwable {
// Clone array so original array isn't modified
args = Arrays.copyOf(args, args.length);
@ -600,8 +604,9 @@ public class DisguiseParser {
params = DisguiseParser.parsePlaceholders(params, target, target);
}
DisguiseParser.callMethods(Bukkit.getConsoleSender(), disguise, DisguisePermissions.getPermissions(Bukkit.getConsoleSender(), "disguise"),
new DisguisePerm(disguise.getType()), new ArrayList<>(), params, "Disguise");
DisguiseParser.callMethods(Bukkit.getConsoleSender(), disguise,
DisguisePermissions.getPermissions(Bukkit.getConsoleSender(), "disguise"), new DisguisePerm(disguise.getType()),
new ArrayList<>(), params, "Disguise");
}
public static void modifyDisguise(Disguise disguise, String[] params) throws Throwable {
@ -631,8 +636,8 @@ public class DisguiseParser {
* point, the
* disguise has been feed a proper disguisetype.
*/
public static Disguise parseDisguise(CommandSender sender, Entity target, String permNode, String[] args, DisguisePermissions permissions)
throws Throwable {
public static Disguise parseDisguise(CommandSender sender, Entity target, String permNode, String[] args,
DisguisePermissions permissions) throws Throwable {
if (!Bukkit.isPrimaryThread()) {
throw new IllegalStateException("DisguiseParser should not be called async!");
}
@ -729,7 +734,8 @@ public class DisguiseParser {
throw new DisguiseParseException(LibsMsg.NO_PERM_DISGUISE);
}
HashMap<String, HashMap<String, Boolean>> disguiseOptions = DisguisePermissions.getDisguiseOptions(sender, permNode, disguisePerm);
HashMap<String, HashMap<String, Boolean>> disguiseOptions =
DisguisePermissions.getDisguiseOptions(sender, permNode, disguisePerm);
if (disguise == null) {
WatcherMethod[] watcherMethods = ParamInfoManager.getDisguiseWatcherMethods(disguisePerm.getWatcherClass(), true);
@ -752,8 +758,8 @@ public class DisguiseParser {
} catch (DisguiseParseException ex) {
throw ex;
} catch (Throwable throwable) {
throw new DisguiseParseException(LibsMsg.PARSE_EXPECTED_RECEIVED, extra.getParamInfo().getDescriptiveName(), args[1],
TranslateType.DISGUISE_OPTIONS.reverseGet(TranslateType.DISGUISE_OPTIONS.reverseGet(method)));
throw new DisguiseParseException(LibsMsg.PARSE_EXPECTED_RECEIVED, extra.getParamInfo().getDescriptiveName(),
args[1], TranslateType.DISGUISE_OPTIONS.reverseGet(TranslateType.DISGUISE_OPTIONS.reverseGet(method)));
}
extra.checkParameterPermission(sender, permissions, disguiseOptions, usedOptions, disguisePerm, param);
@ -840,7 +846,8 @@ public class DisguiseParser {
callMethods(sender, disguise, permissions, disguisePerm, usedOptions, newArgs, permNode);
if (sender instanceof Player && target instanceof Player && "%%__USER__%%".equals("15" + "92") && ThreadLocalRandom.current().nextBoolean()) {
if (sender instanceof Player && target instanceof Player && "%%__USER__%%".equals("15" + "92") &&
ThreadLocalRandom.current().nextBoolean()) {
((TargetedDisguise) disguise).setDisguiseTarget(TargetedDisguise.TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS);
((TargetedDisguise) disguise).addPlayer((Player) sender);
}
@ -849,8 +856,9 @@ public class DisguiseParser {
return disguise;
}
public static void callMethods(CommandSender sender, Disguise disguise, DisguisePermissions disguisePermission, DisguisePerm disguisePerm,
Collection<String> usedOptions, String[] args, String permNode) throws Throwable {
public static void callMethods(CommandSender sender, Disguise disguise, DisguisePermissions disguisePermission,
DisguisePerm disguisePerm, Collection<String> usedOptions, String[] args, String permNode)
throws Throwable {
WatcherMethod[] methods = ParamInfoManager.getDisguiseWatcherMethods(disguise.getWatcher().getClass(), true);
List<String> list = new ArrayList<>(Arrays.asList(args));
HashMap<String, HashMap<String, Boolean>> disguiseOptions = DisguisePermissions.getDisguiseOptions(sender, permNode, disguisePerm);
@ -899,7 +907,8 @@ public class DisguiseParser {
int argCount = list.size();
if (argCount < paramInfo.getMinArguments()) {
throw new DisguiseParseException(LibsMsg.PARSE_NO_OPTION_VALUE, TranslateType.DISGUISE_OPTIONS.reverseGet(method.getName()));
throw new DisguiseParseException(LibsMsg.PARSE_NO_OPTION_VALUE,
TranslateType.DISGUISE_OPTIONS.reverseGet(method.getName()));
}
valueToSet = paramInfo.fromString(list);
@ -917,9 +926,8 @@ public class DisguiseParser {
} catch (DisguiseParseException ex) {
parseException = ex;
} catch (Exception ex) {
parseException =
new DisguiseParseException(LibsMsg.PARSE_EXPECTED_RECEIVED, paramInfo.getDescriptiveName(), list.isEmpty() ? null : list.get(0),
TranslateType.DISGUISE_OPTIONS.reverseGet(method.getName()));
parseException = new DisguiseParseException(LibsMsg.PARSE_EXPECTED_RECEIVED, paramInfo.getDescriptiveName(),
list.isEmpty() ? null : list.get(0), TranslateType.DISGUISE_OPTIONS.reverseGet(method.getName()));
}
}

View File

@ -153,7 +153,8 @@ public class DisguisePermissions {
// If this refers to a specific disguise
if (dPerm != null) {
return new ParsedPermission(new DisguisePerm[]{dPerm}, options, (byte) (options.containsKey("*") ? 1 : 0), split[1].equals("*"));
return new ParsedPermission(new DisguisePerm[]{dPerm}, options, (byte) (options.containsKey("*") ? 1 : 0),
split[1].equals("*"));
}
// If the disguise can't be found, it may be refering to a range
@ -273,7 +274,8 @@ public class DisguisePermissions {
if (spl.length > 3 && !spl[3].equals("*")) {
List<DisguisePerm> validFor =
Arrays.stream(DisguiseParser.getDisguisePerms()).filter(perm -> getInheritance(perm, spl[3]) >= 0).collect(Collectors.toList());
Arrays.stream(DisguiseParser.getDisguisePerms()).filter(perm -> getInheritance(perm, spl[3]) >= 0)
.collect(Collectors.toList());
for (ParsedPermission perms : list) {
if (perms.disguisePerm.stream().anyMatch(p -> !validFor.contains(p))) {
@ -529,7 +531,8 @@ public class DisguisePermissions {
return disguises.stream().filter(disguise -> disguise.getDisguise().equals(disguisePerm)).findAny().orElse(null);
}
public static HashMap<String, HashMap<String, Boolean>> getDisguiseOptions(Permissible permissionsHolder, String permNode, DisguisePerm type) {
public static HashMap<String, HashMap<String, Boolean>> getDisguiseOptions(Permissible permissionsHolder, String permNode,
DisguisePerm type) {
HashMap<String, HashMap<String, Boolean>> returns = new HashMap<>();
// libsdisguises.options.<command>.<disguise>.<method>.<options>

View File

@ -28,7 +28,7 @@ public class WatcherMethod {
@Override
public String toString() {
return "WatcherMethod{" + "watcherClass=" + watcherClass + ", method=" + method + ", name='" + name + '\'' + ", returnType=" + returnType + ", param=" +
param + ", randomDefault=" + randomDefault + ", hideFromTab=" + hideFromTab + '}';
return "WatcherMethod{" + "watcherClass=" + watcherClass + ", method=" + method + ", name='" + name + '\'' + ", returnType=" +
returnType + ", param=" + param + ", randomDefault=" + randomDefault + ", hideFromTab=" + hideFromTab + '}';
}
}

View File

@ -29,8 +29,9 @@ public abstract class ExtraDisguiseParam<T> {
public abstract String getParameterAsString(T param);
public void checkParameterPermission(CommandSender sender, DisguisePermissions permissions, HashMap<String, HashMap<String, Boolean>> disguiseOptions,
ArrayList<String> usedOptions, DisguisePerm disguisePerm, T param) throws DisguiseParseException {
public void checkParameterPermission(CommandSender sender, DisguisePermissions permissions,
HashMap<String, HashMap<String, Boolean>> disguiseOptions, ArrayList<String> usedOptions,
DisguisePerm disguisePerm, T param) throws DisguiseParseException {
checkParameterPermission(permissions, disguiseOptions, usedOptions, disguisePerm, param);
}

View File

@ -47,11 +47,13 @@ public class PlayerDisguiseParam extends ExtraDisguiseParam<String> {
return param;
}
public void checkParameterPermission(CommandSender sender, DisguisePermissions permissions, HashMap<String, HashMap<String, Boolean>> disguiseOptions,
ArrayList<String> usedOptions, DisguisePerm disguisePerm, String param) throws DisguiseParseException {
public void checkParameterPermission(CommandSender sender, DisguisePermissions permissions,
HashMap<String, HashMap<String, Boolean>> disguiseOptions, ArrayList<String> usedOptions,
DisguisePerm disguisePerm, String param) throws DisguiseParseException {
// If they can't use this name, throw error
if (sender != null && !DisguisePermissions.hasPermissionOption(disguiseOptions, "setname", param.toLowerCase(Locale.ENGLISH))) {
if (!param.equalsIgnoreCase(sender.getName()) || !DisguisePermissions.hasPermissionOption(disguiseOptions, "setname", "themselves")) {
if (!param.equalsIgnoreCase(sender.getName()) ||
!DisguisePermissions.hasPermissionOption(disguiseOptions, "setname", "themselves")) {
throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_NAME);
}
}

View File

@ -14,7 +14,7 @@ import java.net.URL;
public class BisectHosting {
public boolean isBisectHosted(String pluginName) {
boolean claimedHosted = DisguiseConfig.isBisectHosted();
String ip = Bukkit.getIp() + "";
String ip = Bukkit.getIp();
String parsedIP = ip.replaceAll("[^:\\d.]", "");
// If not hosted by bisect
@ -29,8 +29,7 @@ public class BisectHosting {
ip = getFinalURL("http://" + ip);
// Doing this funny stringbuilder because antiviruses may find it "dodgy". Or does this make it dodgier?
if (ip != null && ip.startsWith(
new StringBuilder("https").append("://").append("www").append(".").append("bisecthosting").append(".").append("com/").toString())) {
if (ip != null && ip.startsWith("https" + "://" + "www" + "." + "bisecthosting" + "." + "com/")) {
hostedBy = true;
}
} catch (IOException ignored) {

View File

@ -19,8 +19,8 @@ public class PluginInformation {
private final String buildNumber;
private final String buildDate;
public PluginInformation(long size, String userID, String resourceID, String downloadID, boolean premium, String version, String buildNumber,
String buildDate) {
public PluginInformation(long size, String userID, String resourceID, String downloadID, boolean premium, String version,
String buildNumber, String buildDate) {
this.size = size;
this.userID = userID;
this.resourceID = resourceID;
@ -69,6 +69,7 @@ public class PluginInformation {
}
public boolean isLegit() {
return getUserID().matches("\\d+") && !getUserID().equals("12345") && getResourceID().equals("32453") && getDownloadID().matches("-?\\d+");
return getUserID().matches("\\d+") && !getUserID().equals("12345") && getResourceID().equals("32453") &&
getDownloadID().matches("-?\\d+");
}
}

View File

@ -62,16 +62,18 @@ public class ClassMappings {
}
private static String[] getPackages() {
String[] s = {"net.minecraft.server.$version$", "net.minecraft.core", "net.minecraft.core.particles", "net.minecraft.nbt", "net.minecraft.network.chat",
"net.minecraft.network.protocol.game", "net.minecraft.network.syncher", "net.minecraft.resources", "net.minecraft.server.level",
"net.minecraft.server", "net.minecraft.server.network", "net.minecraft.sounds", "net.minecraft.world.damagesource", "net.minecraft.world.effect",
"net.minecraft.world.entity.ambient", "net.minecraft.world.entity.animal.axolotl", "net.minecraft.world.entity.animal",
"net.minecraft.world.entity.animal.goat", "net.minecraft.world.entity.animal.horse", "net.minecraft.world.entity.boss.enderdragon",
"net.minecraft.world.entity.boss.wither", "net.minecraft.world.entity.decoration", "net.minecraft.world.entity", "net.minecraft.world.entity.item",
"net.minecraft.world.entity.monster", "net.minecraft.world.entity.monster.hoglin", "net.minecraft.world.entity.monster.piglin",
"net.minecraft.world.entity.npc", "net.minecraft.world.entity.player", "net.minecraft.world.entity.projectile",
"net.minecraft.world.entity.vehicle", "net.minecraft.world.inventory", "net.minecraft.world.item", "net.minecraft.world.level.block",
"net.minecraft.world.level.block.state", "net.minecraft.world.level", "net.minecraft.world.phys", "org.bukkit.craftbukkit.$version$.block.data",
String[] s = {"net.minecraft.server.$version$", "net.minecraft.core", "net.minecraft.core.particles", "net.minecraft.nbt",
"net.minecraft.network.chat", "net.minecraft.network.protocol.game", "net.minecraft.network.syncher", "net.minecraft.resources",
"net.minecraft.server.level", "net.minecraft.server", "net.minecraft.server.network", "net.minecraft.sounds",
"net.minecraft.world.damagesource", "net.minecraft.world.effect", "net.minecraft.world.entity.ambient",
"net.minecraft.world.entity.animal.axolotl", "net.minecraft.world.entity.animal", "net.minecraft.world.entity.animal.goat",
"net.minecraft.world.entity.animal.horse", "net.minecraft.world.entity.boss.enderdragon",
"net.minecraft.world.entity.boss.wither", "net.minecraft.world.entity.decoration", "net.minecraft.world.entity",
"net.minecraft.world.entity.item", "net.minecraft.world.entity.monster", "net.minecraft.world.entity.monster.hoglin",
"net.minecraft.world.entity.monster.piglin", "net.minecraft.world.entity.npc", "net.minecraft.world.entity.player",
"net.minecraft.world.entity.projectile", "net.minecraft.world.entity.vehicle", "net.minecraft.world.inventory",
"net.minecraft.world.item", "net.minecraft.world.level.block", "net.minecraft.world.level.block.state",
"net.minecraft.world.level", "net.minecraft.world.phys", "org.bukkit.craftbukkit.$version$.block.data",
"org.bukkit.craftbukkit.$version$", "org.bukkit.craftbukkit.$version$.entity", "org.bukkit.craftbukkit.$version$.inventory",
"org.bukkit.craftbukkit.$version$.util"};
String replaceStr = "$version$";

View File

@ -48,7 +48,8 @@ public class WatcherValue {
}
public WrappedDataValue getDataValue() {
return new WrappedDataValue(getMetaIndex().getIndex(), getMetaIndex().getSerializer(), ReflectionManager.convertInvalidMeta(getValue()));
return new WrappedDataValue(getMetaIndex().getIndex(), getMetaIndex().getSerializer(),
ReflectionManager.convertInvalidMeta(getValue()));
}
public static List<WatcherValue> getValues(WrappedDataWatcher dataWatcher) {

View File

@ -7,18 +7,19 @@ import java.util.Arrays;
@Getter
public enum MethodGroupType {
NO_LOOK(DisguiseType.AREA_EFFECT_CLOUD, DisguiseType.DRAGON_FIREBALL, DisguiseType.DROPPED_ITEM, DisguiseType.EGG, DisguiseType.ENDER_CRYSTAL,
DisguiseType.ENDER_PEARL, DisguiseType.ENDER_SIGNAL, DisguiseType.FALLING_BLOCK, DisguiseType.FIREBALL, DisguiseType.FIREWORK,
DisguiseType.FISHING_HOOK, DisguiseType.LEASH_HITCH, DisguiseType.MARKER, DisguiseType.PRIMED_TNT, DisguiseType.SHULKER, DisguiseType.SMALL_FIREBALL,
DisguiseType.SNOWBALL, DisguiseType.SPLASH_POTION, DisguiseType.THROWN_EXP_BOTTLE),
NO_LOOK(DisguiseType.AREA_EFFECT_CLOUD, DisguiseType.DRAGON_FIREBALL, DisguiseType.DROPPED_ITEM, DisguiseType.EGG,
DisguiseType.ENDER_CRYSTAL, DisguiseType.ENDER_PEARL, DisguiseType.ENDER_SIGNAL, DisguiseType.FALLING_BLOCK, DisguiseType.FIREBALL,
DisguiseType.FIREWORK, DisguiseType.FISHING_HOOK, DisguiseType.LEASH_HITCH, DisguiseType.MARKER, DisguiseType.PRIMED_TNT,
DisguiseType.SHULKER, DisguiseType.SMALL_FIREBALL, DisguiseType.SNOWBALL, DisguiseType.SPLASH_POTION,
DisguiseType.THROWN_EXP_BOTTLE),
EQUIPPABLE(DisguiseType.ARMOR_STAND, DisguiseType.DROWNED, DisguiseType.GIANT, DisguiseType.HUSK, DisguiseType.MODDED_LIVING, DisguiseType.MODDED_MISC,
DisguiseType.PIG_ZOMBIE, DisguiseType.PIGLIN, DisguiseType.PIGLIN_BRUTE, DisguiseType.PLAYER, DisguiseType.SKELETON, DisguiseType.STRAY,
DisguiseType.WITHER_SKELETON, DisguiseType.ZOMBIE),
EQUIPPABLE(DisguiseType.ARMOR_STAND, DisguiseType.DROWNED, DisguiseType.GIANT, DisguiseType.HUSK, DisguiseType.MODDED_LIVING,
DisguiseType.MODDED_MISC, DisguiseType.PIG_ZOMBIE, DisguiseType.PIGLIN, DisguiseType.PIGLIN_BRUTE, DisguiseType.PLAYER,
DisguiseType.SKELETON, DisguiseType.STRAY, DisguiseType.WITHER_SKELETON, DisguiseType.ZOMBIE),
HOLDABLE(EQUIPPABLE, DisguiseType.ENDERMAN, DisguiseType.EVOKER, DisguiseType.ILLUSIONER, DisguiseType.IRON_GOLEM, DisguiseType.PILLAGER,
DisguiseType.RAVAGER, DisguiseType.VEX, DisguiseType.VINDICATOR, DisguiseType.WANDERING_TRADER, DisguiseType.WITCH, DisguiseType.ZOMBIE_VILLAGER,
DisguiseType.VILLAGER),
HOLDABLE(EQUIPPABLE, DisguiseType.ENDERMAN, DisguiseType.EVOKER, DisguiseType.ILLUSIONER, DisguiseType.IRON_GOLEM,
DisguiseType.PILLAGER, DisguiseType.RAVAGER, DisguiseType.VEX, DisguiseType.VINDICATOR, DisguiseType.WANDERING_TRADER,
DisguiseType.WITCH, DisguiseType.ZOMBIE_VILLAGER, DisguiseType.VILLAGER),
NONE();

View File

@ -12,44 +12,49 @@ import java.util.HashMap;
* Only living disguises go in here!
*/
public enum DisguiseSoundEnums {
ALLAY(Sound.ENTITY_ALLAY_HURT, null, Sound.ENTITY_ALLAY_DEATH, new Sound[]{Sound.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM, Sound.ENTITY_ALLAY_AMBIENT_WITH_ITEM},
Sound.ENTITY_ALLAY_ITEM_GIVEN, Sound.ENTITY_ALLAY_ITEM_TAKEN, Sound.ENTITY_ALLAY_ITEM_THROWN),
ALLAY(Sound.ENTITY_ALLAY_HURT, null, Sound.ENTITY_ALLAY_DEATH,
new Sound[]{Sound.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM, Sound.ENTITY_ALLAY_AMBIENT_WITH_ITEM}, Sound.ENTITY_ALLAY_ITEM_GIVEN,
Sound.ENTITY_ALLAY_ITEM_TAKEN, Sound.ENTITY_ALLAY_ITEM_THROWN),
ARMOR_STAND(Sound.ENTITY_ARMOR_STAND_HIT, null, Sound.ENTITY_ARMOR_STAND_BREAK, Sound.ENTITY_ARMOR_STAND_FALL, Sound.ENTITY_ARMOR_STAND_PLACE),
ARMOR_STAND(Sound.ENTITY_ARMOR_STAND_HIT, null, Sound.ENTITY_ARMOR_STAND_BREAK, Sound.ENTITY_ARMOR_STAND_FALL,
Sound.ENTITY_ARMOR_STAND_PLACE),
ARROW(null, null, null, null, Sound.ENTITY_ARROW_HIT, Sound.ENTITY_ARROW_SHOOT),
AXOLOTL(Sound.ENTITY_AXOLOTL_HURT, Sound.ENTITY_AXOLOTL_SWIM, Sound.ENTITY_AXOLOTL_DEATH,
new Sound[]{Sound.ENTITY_AXOLOTL_IDLE_WATER, Sound.ENTITY_AXOLOTL_IDLE_AIR}, Sound.ENTITY_AXOLOTL_ATTACK, Sound.ENTITY_AXOLOTL_SPLASH),
new Sound[]{Sound.ENTITY_AXOLOTL_IDLE_WATER, Sound.ENTITY_AXOLOTL_IDLE_AIR}, Sound.ENTITY_AXOLOTL_ATTACK,
Sound.ENTITY_AXOLOTL_SPLASH),
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),
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(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),
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, Sound.ENTITY_BLAZE_SHOOT),
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, Sound.ENTITY_BLAZE_SHOOT),
BLOCK_DISPLAY(null, null, null, null),
BOAT(null, Sound.ENTITY_BOAT_PADDLE_WATER, null, null, Sound.ENTITY_BOAT_PADDLE_LAND),
BREEZE(Sound.ENTITY_BREEZE_HURT, null, Sound.ENTITY_BREEZE_DEATH, new Sound[]{Sound.ENTITY_BREEZE_IDLE_AIR, Sound.ENTITY_BREEZE_IDLE_GROUND},
Sound.ENTITY_BREEZE_LAND, Sound.ENTITY_BREEZE_JUMP, Sound.ENTITY_BREEZE_INHALE, Sound.ENTITY_BREEZE_SHOOT, Sound.ENTITY_BREEZE_SLIDE),
BREEZE(Sound.ENTITY_BREEZE_HURT, null, Sound.ENTITY_BREEZE_DEATH,
new Sound[]{Sound.ENTITY_BREEZE_IDLE_AIR, Sound.ENTITY_BREEZE_IDLE_GROUND}, Sound.ENTITY_BREEZE_LAND, Sound.ENTITY_BREEZE_JUMP,
Sound.ENTITY_BREEZE_INHALE, Sound.ENTITY_BREEZE_SHOOT, Sound.ENTITY_BREEZE_SLIDE),
CAMEL(Sound.ENTITY_CAMEL_HURT, new Sound[]{Sound.ENTITY_CAMEL_STEP, Sound.ENTITY_CAMEL_STEP_SAND}, Sound.ENTITY_CAMEL_DEATH, Sound.ENTITY_CAMEL_AMBIENT,
Sound.ENTITY_CAMEL_DASH, Sound.ENTITY_CAMEL_DASH_READY, Sound.ENTITY_CAMEL_EAT, Sound.ENTITY_CAMEL_SADDLE, Sound.ENTITY_CAMEL_SIT,
Sound.ENTITY_CAMEL_STAND),
CAMEL(Sound.ENTITY_CAMEL_HURT, new Sound[]{Sound.ENTITY_CAMEL_STEP, Sound.ENTITY_CAMEL_STEP_SAND}, Sound.ENTITY_CAMEL_DEATH,
Sound.ENTITY_CAMEL_AMBIENT, Sound.ENTITY_CAMEL_DASH, Sound.ENTITY_CAMEL_DASH_READY, Sound.ENTITY_CAMEL_EAT,
Sound.ENTITY_CAMEL_SADDLE, Sound.ENTITY_CAMEL_SIT, Sound.ENTITY_CAMEL_STAND),
CAT(Sound.ENTITY_CAT_HURT, null, Sound.ENTITY_CAT_DEATH, Sound.ENTITY_CAT_AMBIENT, Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW, Sound.ENTITY_CAT_HISS),
CAT(Sound.ENTITY_CAT_HURT, null, Sound.ENTITY_CAT_DEATH, Sound.ENTITY_CAT_AMBIENT, Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW,
Sound.ENTITY_CAT_HISS),
CAVE_SPIDER(Sound.ENTITY_SPIDER_HURT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH, Sound.ENTITY_SPIDER_AMBIENT),
CHEST_BOAT(null, Sound.ENTITY_BOAT_PADDLE_WATER, null, null, Sound.ENTITY_BOAT_PADDLE_LAND),
CHICKEN(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_DEATH, Sound.ENTITY_CHICKEN_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
Sound.ENTITY_CHICKEN_EGG, Sound.ENTITY_PLAYER_BIG_FALL),
CHICKEN(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_DEATH, Sound.ENTITY_CHICKEN_AMBIENT,
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_CHICKEN_EGG, Sound.ENTITY_PLAYER_BIG_FALL),
COD(Sound.ENTITY_COD_HURT, null, Sound.ENTITY_COD_DEATH, Sound.ENTITY_COD_AMBIENT, Sound.ENTITY_COD_FLOP, Sound.ENTITY_FISH_SWIM),
@ -58,14 +63,16 @@ public enum DisguiseSoundEnums {
CREEPER(Sound.ENTITY_CREEPER_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CREEPER_DEATH, null, Sound.ENTITY_CREEPER_PRIMED),
DOLPHIN(Sound.ENTITY_DOLPHIN_HURT, Sound.ENTITY_DOLPHIN_SWIM, Sound.ENTITY_DOLPHIN_DEATH,
new Sound[]{Sound.ENTITY_DOLPHIN_AMBIENT, Sound.ENTITY_DOLPHIN_AMBIENT_WATER}, Sound.ENTITY_DOLPHIN_ATTACK, Sound.ENTITY_DOLPHIN_EAT,
Sound.ENTITY_DOLPHIN_SPLASH, Sound.ENTITY_DOLPHIN_PLAY, Sound.ENTITY_DOLPHIN_JUMP, Sound.ENTITY_FISH_SWIM),
new Sound[]{Sound.ENTITY_DOLPHIN_AMBIENT, Sound.ENTITY_DOLPHIN_AMBIENT_WATER}, Sound.ENTITY_DOLPHIN_ATTACK,
Sound.ENTITY_DOLPHIN_EAT, Sound.ENTITY_DOLPHIN_SPLASH, Sound.ENTITY_DOLPHIN_PLAY, Sound.ENTITY_DOLPHIN_JUMP,
Sound.ENTITY_FISH_SWIM),
DONKEY(Sound.ENTITY_DONKEY_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD}, Sound.ENTITY_DONKEY_DEATH, Sound.ENTITY_DONKEY_AMBIENT,
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_DONKEY_CHEST),
DONKEY(Sound.ENTITY_DONKEY_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD}, Sound.ENTITY_DONKEY_DEATH,
Sound.ENTITY_DONKEY_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY,
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_DONKEY_CHEST),
DROWNED(new Sound[]{Sound.ENTITY_DROWNED_HURT, Sound.ENTITY_DROWNED_HURT_WATER}, new Sound[]{Sound.ENTITY_DROWNED_STEP, Sound.ENTITY_DROWNED_SWIM},
DROWNED(new Sound[]{Sound.ENTITY_DROWNED_HURT, Sound.ENTITY_DROWNED_HURT_WATER},
new Sound[]{Sound.ENTITY_DROWNED_STEP, Sound.ENTITY_DROWNED_SWIM},
new Sound[]{Sound.ENTITY_DROWNED_DEATH, Sound.ENTITY_DROWNED_DEATH_WATER},
new Sound[]{Sound.ENTITY_DROWNED_AMBIENT, Sound.ENTITY_DROWNED_AMBIENT_WATER}, Sound.ENTITY_DROWNED_SHOOT),
@ -73,11 +80,11 @@ public enum DisguiseSoundEnums {
new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_DEATH, Sound.ENTITY_ELDER_GUARDIAN_DEATH_LAND},
new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_AMBIENT, Sound.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND}, Sound.ENTITY_ELDER_GUARDIAN_FLOP),
ENDER_DRAGON(Sound.ENTITY_ENDER_DRAGON_HURT, null, Sound.ENTITY_ENDER_DRAGON_DEATH, Sound.ENTITY_ENDER_DRAGON_AMBIENT, Sound.ENTITY_GENERIC_SMALL_FALL,
Sound.ENTITY_GENERIC_BIG_FALL, Sound.ENTITY_ENDER_DRAGON_FLAP, Sound.ENTITY_ENDER_DRAGON_GROWL),
ENDER_DRAGON(Sound.ENTITY_ENDER_DRAGON_HURT, null, Sound.ENTITY_ENDER_DRAGON_DEATH, Sound.ENTITY_ENDER_DRAGON_AMBIENT,
Sound.ENTITY_GENERIC_SMALL_FALL, Sound.ENTITY_GENERIC_BIG_FALL, Sound.ENTITY_ENDER_DRAGON_FLAP, Sound.ENTITY_ENDER_DRAGON_GROWL),
ENDERMAN(Sound.ENTITY_ENDERMAN_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_ENDERMAN_DEATH, Sound.ENTITY_ENDERMAN_AMBIENT, Sound.ENTITY_ENDERMAN_SCREAM,
Sound.ENTITY_ENDERMAN_TELEPORT, Sound.ENTITY_ENDERMAN_STARE),
ENDERMAN(Sound.ENTITY_ENDERMAN_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_ENDERMAN_DEATH, Sound.ENTITY_ENDERMAN_AMBIENT,
Sound.ENTITY_ENDERMAN_SCREAM, Sound.ENTITY_ENDERMAN_TELEPORT, Sound.ENTITY_ENDERMAN_STARE),
ENDERMITE(Sound.ENTITY_ENDERMITE_HURT, Sound.ENTITY_ENDERMITE_STEP, Sound.ENTITY_ENDERMITE_DEATH, Sound.ENTITY_ENDERMITE_AMBIENT),
@ -86,25 +93,26 @@ public enum DisguiseSoundEnums {
EVOKER_FANGS(null, null, null, null, Sound.ENTITY_EVOKER_FANGS_ATTACK),
FOX(Sound.ENTITY_FOX_HURT, null, Sound.ENTITY_FOX_DEATH, Sound.ENTITY_FOX_AMBIENT, Sound.ENTITY_FOX_AGGRO, Sound.ENTITY_FOX_BITE, Sound.ENTITY_FOX_EAT,
Sound.ENTITY_FOX_SCREECH, Sound.ENTITY_FOX_SLEEP, Sound.ENTITY_FOX_SPIT, Sound.ENTITY_FOX_SNIFF, Sound.ENTITY_FOX_TELEPORT),
FOX(Sound.ENTITY_FOX_HURT, null, Sound.ENTITY_FOX_DEATH, Sound.ENTITY_FOX_AMBIENT, Sound.ENTITY_FOX_AGGRO, Sound.ENTITY_FOX_BITE,
Sound.ENTITY_FOX_EAT, Sound.ENTITY_FOX_SCREECH, Sound.ENTITY_FOX_SLEEP, Sound.ENTITY_FOX_SPIT, Sound.ENTITY_FOX_SNIFF,
Sound.ENTITY_FOX_TELEPORT),
FROG(Sound.ENTITY_FROG_HURT, Sound.ENTITY_FROG_STEP, Sound.ENTITY_FROG_DEATH, Sound.ENTITY_FROG_AMBIENT, Sound.ENTITY_FROG_EAT, Sound.ENTITY_FROG_LAY_SPAWN,
Sound.ENTITY_FROG_LONG_JUMP, Sound.ENTITY_FROG_TONGUE),
FROG(Sound.ENTITY_FROG_HURT, Sound.ENTITY_FROG_STEP, Sound.ENTITY_FROG_DEATH, Sound.ENTITY_FROG_AMBIENT, Sound.ENTITY_FROG_EAT,
Sound.ENTITY_FROG_LAY_SPAWN, Sound.ENTITY_FROG_LONG_JUMP, Sound.ENTITY_FROG_TONGUE),
GHAST(Sound.ENTITY_GHAST_HURT, null, Sound.ENTITY_GHAST_DEATH, Sound.ENTITY_GHAST_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_GHAST_SHOOT,
Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_GHAST_WARN),
GHAST(Sound.ENTITY_GHAST_HURT, null, Sound.ENTITY_GHAST_DEATH, Sound.ENTITY_GHAST_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
Sound.ENTITY_GHAST_SHOOT, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_GHAST_WARN),
GIANT(Sound.ENTITY_PLAYER_HURT, Sound.BLOCK_GRASS_STEP, null, null),
GLOW_SQUID(Sound.ENTITY_GLOW_SQUID_HURT, null, Sound.ENTITY_GLOW_SQUID_DEATH, Sound.ENTITY_GLOW_SQUID_AMBIENT, Sound.ENTITY_GLOW_SQUID_SQUIRT,
Sound.ENTITY_FISH_SWIM),
GLOW_SQUID(Sound.ENTITY_GLOW_SQUID_HURT, null, Sound.ENTITY_GLOW_SQUID_DEATH, Sound.ENTITY_GLOW_SQUID_AMBIENT,
Sound.ENTITY_GLOW_SQUID_SQUIRT, Sound.ENTITY_FISH_SWIM),
GOAT(Sound.ENTITY_GOAT_HURT, Sound.ENTITY_GOAT_STEP, Sound.ENTITY_GOAT_DEATH, Sound.ENTITY_GOAT_AMBIENT, Sound.ENTITY_GOAT_MILK, Sound.ENTITY_GOAT_EAT,
Sound.ENTITY_GOAT_LONG_JUMP, Sound.ENTITY_GOAT_PREPARE_RAM, Sound.ENTITY_GOAT_PREPARE_RAM, Sound.ENTITY_GOAT_RAM_IMPACT,
Sound.ENTITY_GOAT_SCREAMING_AMBIENT, Sound.ENTITY_GOAT_SCREAMING_DEATH, Sound.ENTITY_GOAT_SCREAMING_EAT, Sound.ENTITY_GOAT_SCREAMING_MILK,
Sound.ENTITY_GOAT_SCREAMING_RAM_IMPACT, Sound.ENTITY_GOAT_SCREAMING_PREPARE_RAM, Sound.ENTITY_GOAT_SCREAMING_LONG_JUMP,
Sound.ENTITY_GOAT_SCREAMING_HURT),
GOAT(Sound.ENTITY_GOAT_HURT, Sound.ENTITY_GOAT_STEP, Sound.ENTITY_GOAT_DEATH, Sound.ENTITY_GOAT_AMBIENT, Sound.ENTITY_GOAT_MILK,
Sound.ENTITY_GOAT_EAT, Sound.ENTITY_GOAT_LONG_JUMP, Sound.ENTITY_GOAT_PREPARE_RAM, Sound.ENTITY_GOAT_PREPARE_RAM,
Sound.ENTITY_GOAT_RAM_IMPACT, Sound.ENTITY_GOAT_SCREAMING_AMBIENT, Sound.ENTITY_GOAT_SCREAMING_DEATH,
Sound.ENTITY_GOAT_SCREAMING_EAT, Sound.ENTITY_GOAT_SCREAMING_MILK, Sound.ENTITY_GOAT_SCREAMING_RAM_IMPACT,
Sound.ENTITY_GOAT_SCREAMING_PREPARE_RAM, Sound.ENTITY_GOAT_SCREAMING_LONG_JUMP, Sound.ENTITY_GOAT_SCREAMING_HURT),
GUARDIAN(new Sound[]{Sound.ENTITY_GUARDIAN_HURT, Sound.ENTITY_GUARDIAN_HURT_LAND}, null,
new Sound[]{Sound.ENTITY_GUARDIAN_DEATH, Sound.ENTITY_GUARDIAN_DEATH_LAND},
@ -113,14 +121,17 @@ public enum DisguiseSoundEnums {
HOGLIN(Sound.ENTITY_HOGLIN_HURT, Sound.ENTITY_HOGLIN_STEP, Sound.ENTITY_HOGLIN_DEATH, Sound.ENTITY_HOGLIN_AMBIENT,
Sound.ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED, Sound.ENTITY_HOGLIN_ANGRY, Sound.ENTITY_HOGLIN_RETREAT),
HORSE(Sound.ENTITY_HORSE_HURT, new Sound[]{Sound.ENTITY_HORSE_STEP, Sound.ENTITY_HORSE_STEP_WOOD}, Sound.ENTITY_HORSE_DEATH, Sound.ENTITY_HORSE_AMBIENT,
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_HORSE_EAT, Sound.ENTITY_HORSE_BREATHE),
HORSE(Sound.ENTITY_HORSE_HURT, new Sound[]{Sound.ENTITY_HORSE_STEP, Sound.ENTITY_HORSE_STEP_WOOD}, Sound.ENTITY_HORSE_DEATH,
Sound.ENTITY_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY,
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_HORSE_EAT,
Sound.ENTITY_HORSE_BREATHE),
HUSK(Sound.ENTITY_HUSK_HURT, Sound.ENTITY_HUSK_STEP, Sound.ENTITY_HUSK_DEATH, Sound.ENTITY_HUSK_AMBIENT, Sound.ENTITY_HUSK_CONVERTED_TO_ZOMBIE),
HUSK(Sound.ENTITY_HUSK_HURT, Sound.ENTITY_HUSK_STEP, Sound.ENTITY_HUSK_DEATH, Sound.ENTITY_HUSK_AMBIENT,
Sound.ENTITY_HUSK_CONVERTED_TO_ZOMBIE),
ILLUSIONER(Sound.ENTITY_ILLUSIONER_HURT, null, Sound.ENTITY_ILLUSIONER_DEATH, Sound.ENTITY_ILLUSIONER_AMBIENT, Sound.ENTITY_ILLUSIONER_CAST_SPELL,
Sound.ENTITY_ILLUSIONER_PREPARE_BLINDNESS, Sound.ENTITY_ILLUSIONER_PREPARE_MIRROR, Sound.ENTITY_ILLUSIONER_MIRROR_MOVE),
ILLUSIONER(Sound.ENTITY_ILLUSIONER_HURT, null, Sound.ENTITY_ILLUSIONER_DEATH, Sound.ENTITY_ILLUSIONER_AMBIENT,
Sound.ENTITY_ILLUSIONER_CAST_SPELL, Sound.ENTITY_ILLUSIONER_PREPARE_BLINDNESS, Sound.ENTITY_ILLUSIONER_PREPARE_MIRROR,
Sound.ENTITY_ILLUSIONER_MIRROR_MOVE),
INTERACTION(null, null, null, null),
@ -131,8 +142,9 @@ public enum DisguiseSoundEnums {
LLAMA(Sound.ENTITY_LLAMA_HURT, Sound.ENTITY_LLAMA_STEP, Sound.ENTITY_LLAMA_DEATH, Sound.ENTITY_LLAMA_AMBIENT, Sound.ENTITY_LLAMA_ANGRY,
Sound.ENTITY_LLAMA_CHEST, Sound.ENTITY_LLAMA_EAT, Sound.ENTITY_LLAMA_SWAG),
MAGMA_CUBE(Sound.ENTITY_MAGMA_CUBE_HURT, Sound.ENTITY_MAGMA_CUBE_JUMP, new Sound[]{Sound.ENTITY_MAGMA_CUBE_DEATH, Sound.ENTITY_MAGMA_CUBE_DEATH_SMALL},
null, Sound.ENTITY_MAGMA_CUBE_SQUISH, Sound.ENTITY_MAGMA_CUBE_SQUISH_SMALL),
MAGMA_CUBE(Sound.ENTITY_MAGMA_CUBE_HURT, Sound.ENTITY_MAGMA_CUBE_JUMP,
new Sound[]{Sound.ENTITY_MAGMA_CUBE_DEATH, Sound.ENTITY_MAGMA_CUBE_DEATH_SMALL}, null, Sound.ENTITY_MAGMA_CUBE_SQUISH,
Sound.ENTITY_MAGMA_CUBE_SQUISH_SMALL),
MINECART(null, Sound.ENTITY_MINECART_RIDING, null, null, Sound.ENTITY_MINECART_INSIDE, Sound.ENTITY_MINECART_INSIDE_UNDERWATER),
@ -144,7 +156,8 @@ public enum DisguiseSoundEnums {
MINECART_HOPPER(null, Sound.ENTITY_MINECART_RIDING, null, null, Sound.ENTITY_MINECART_INSIDE, Sound.ENTITY_MINECART_INSIDE_UNDERWATER),
MINECART_MOB_SPAWNER(null, Sound.ENTITY_MINECART_RIDING, null, null, Sound.ENTITY_MINECART_INSIDE, Sound.ENTITY_MINECART_INSIDE_UNDERWATER),
MINECART_MOB_SPAWNER(null, Sound.ENTITY_MINECART_RIDING, null, null, Sound.ENTITY_MINECART_INSIDE,
Sound.ENTITY_MINECART_INSIDE_UNDERWATER),
MINECART_TNT(null, Sound.ENTITY_MINECART_RIDING, null, null, Sound.ENTITY_MINECART_INSIDE, Sound.ENTITY_MINECART_INSIDE_UNDERWATER),
@ -156,28 +169,33 @@ public enum DisguiseSoundEnums {
new Sound[]{Sound.ENTITY_CAT_AMBIENT, Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW}, Sound.ENTITY_CAT_HISS),
PANDA(Sound.ENTITY_PANDA_HURT, Sound.ENTITY_PANDA_STEP, Sound.ENTITY_PANDA_DEATH,
new Sound[]{Sound.ENTITY_PANDA_AMBIENT, Sound.ENTITY_PANDA_AGGRESSIVE_AMBIENT, Sound.ENTITY_PANDA_WORRIED_AMBIENT}, Sound.ENTITY_PANDA_BITE,
Sound.ENTITY_PANDA_CANT_BREED, Sound.ENTITY_PANDA_EAT, Sound.ENTITY_PANDA_PRE_SNEEZE, Sound.ENTITY_PANDA_SNEEZE),
new Sound[]{Sound.ENTITY_PANDA_AMBIENT, Sound.ENTITY_PANDA_AGGRESSIVE_AMBIENT, Sound.ENTITY_PANDA_WORRIED_AMBIENT},
Sound.ENTITY_PANDA_BITE, Sound.ENTITY_PANDA_CANT_BREED, Sound.ENTITY_PANDA_EAT, Sound.ENTITY_PANDA_PRE_SNEEZE,
Sound.ENTITY_PANDA_SNEEZE),
PARROT(Sound.ENTITY_PARROT_HURT, Sound.ENTITY_PARROT_STEP, Sound.ENTITY_PARROT_DEATH, Sound.ENTITY_PARROT_AMBIENT, Arrays.stream(Sound.values())
.filter(sound -> sound.name().contains("PARROT_IMITATE") || sound == Sound.ENTITY_PARROT_EAT || sound == Sound.ENTITY_PARROT_FLY)
.toArray(Sound[]::new)),
PARROT(Sound.ENTITY_PARROT_HURT, Sound.ENTITY_PARROT_STEP, Sound.ENTITY_PARROT_DEATH, Sound.ENTITY_PARROT_AMBIENT,
Arrays.stream(Sound.values()).filter(
sound -> sound.name().contains("PARROT_IMITATE") || sound == Sound.ENTITY_PARROT_EAT || sound == Sound.ENTITY_PARROT_FLY)
.toArray(Sound[]::new)),
PIG(Sound.ENTITY_PIG_HURT, Sound.ENTITY_PIG_STEP, Sound.ENTITY_PIG_DEATH, Sound.ENTITY_PIG_AMBIENT),
PIGLIN(Sound.ENTITY_PIGLIN_HURT, Sound.ENTITY_PIGLIN_STEP, Sound.ENTITY_PIGLIN_DEATH, Sound.ENTITY_PIGLIN_AMBIENT, Sound.ENTITY_PIGLIN_RETREAT,
Sound.ENTITY_PIGLIN_JEALOUS, Sound.ENTITY_PIGLIN_ADMIRING_ITEM, Sound.ENTITY_PIGLIN_CELEBRATE, Sound.ENTITY_PIGLIN_ANGRY),
PIGLIN(Sound.ENTITY_PIGLIN_HURT, Sound.ENTITY_PIGLIN_STEP, Sound.ENTITY_PIGLIN_DEATH, Sound.ENTITY_PIGLIN_AMBIENT,
Sound.ENTITY_PIGLIN_RETREAT, Sound.ENTITY_PIGLIN_JEALOUS, Sound.ENTITY_PIGLIN_ADMIRING_ITEM, Sound.ENTITY_PIGLIN_CELEBRATE,
Sound.ENTITY_PIGLIN_ANGRY),
PIGLIN_BRUTE("ENTITY_PIGLIN_BRUTE_HURT", "ENTITY_PIGLIN_BRUTE_STEP", "ENTITY_PIGLIN_BRUTE_DEATH", "ENTITY_PIGLIN_BRUTE_AMBIENT",
"ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED", "ENTITY_PIGLIN_BRUTE_ANGRY"),
PIG_ZOMBIE("ENTITY_ZOMBIE_PIGMAN_HURT", null, "ENTITY_ZOMBIE_PIGMAN_DEATH", "ENTITY_ZOMBIE_PIGMAN_AMBIENT", "ENTITY_ZOMBIE_PIGMAN_ANGRY"),
PIG_ZOMBIE("ENTITY_ZOMBIE_PIGMAN_HURT", null, "ENTITY_ZOMBIE_PIGMAN_DEATH", "ENTITY_ZOMBIE_PIGMAN_AMBIENT",
"ENTITY_ZOMBIE_PIGMAN_ANGRY"),
PILLAGER(Sound.ENTITY_PILLAGER_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_PILLAGER_DEATH, Sound.ENTITY_PILLAGER_AMBIENT, Sound.ENTITY_PILLAGER_CELEBRATE),
PILLAGER(Sound.ENTITY_PILLAGER_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_PILLAGER_DEATH, Sound.ENTITY_PILLAGER_AMBIENT,
Sound.ENTITY_PILLAGER_CELEBRATE),
PLAYER(Sound.ENTITY_PLAYER_HURT,
Arrays.stream(Sound.values()).filter(sound -> sound.name().startsWith("BLOCK_") && sound.name().endsWith("_STEP")).toArray(Sound[]::new),
Sound.ENTITY_PLAYER_DEATH, null),
Arrays.stream(Sound.values()).filter(sound -> sound.name().startsWith("BLOCK_") && sound.name().endsWith("_STEP"))
.toArray(Sound[]::new), Sound.ENTITY_PLAYER_DEATH, null),
PHANTOM(Sound.ENTITY_PHANTOM_HURT, new Sound[]{Sound.ENTITY_PHANTOM_FLAP, Sound.ENTITY_PHANTOM_SWOOP}, Sound.ENTITY_PHANTOM_DEATH,
Sound.ENTITY_PHANTOM_AMBIENT, Sound.ENTITY_PHANTOM_BITE),
@ -185,62 +203,72 @@ public enum DisguiseSoundEnums {
POLAR_BEAR(Sound.ENTITY_POLAR_BEAR_HURT, Sound.ENTITY_POLAR_BEAR_STEP, Sound.ENTITY_POLAR_BEAR_DEATH,
new Sound[]{Sound.ENTITY_POLAR_BEAR_AMBIENT, Sound.ENTITY_POLAR_BEAR_AMBIENT_BABY}, Sound.ENTITY_POLAR_BEAR_WARNING),
PUFFERFISH(Sound.ENTITY_PUFFER_FISH_HURT, null, Sound.ENTITY_PUFFER_FISH_DEATH, Sound.ENTITY_PUFFER_FISH_AMBIENT, Sound.ENTITY_PUFFER_FISH_BLOW_OUT,
Sound.ENTITY_PUFFER_FISH_BLOW_UP, Sound.ENTITY_PUFFER_FISH_FLOP, Sound.ENTITY_PUFFER_FISH_STING, Sound.ENTITY_FISH_SWIM),
PUFFERFISH(Sound.ENTITY_PUFFER_FISH_HURT, null, Sound.ENTITY_PUFFER_FISH_DEATH, Sound.ENTITY_PUFFER_FISH_AMBIENT,
Sound.ENTITY_PUFFER_FISH_BLOW_OUT, Sound.ENTITY_PUFFER_FISH_BLOW_UP, Sound.ENTITY_PUFFER_FISH_FLOP, Sound.ENTITY_PUFFER_FISH_STING,
Sound.ENTITY_FISH_SWIM),
RABBIT(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH, Sound.ENTITY_RABBIT_AMBIENT, Sound.ENTITY_RABBIT_ATTACK),
RABBIT(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH, Sound.ENTITY_RABBIT_AMBIENT,
Sound.ENTITY_RABBIT_ATTACK),
RAVAGER(Sound.ENTITY_RAVAGER_HURT, Sound.ENTITY_RAVAGER_STEP, Sound.ENTITY_RAVAGER_DEATH, Sound.ENTITY_RAVAGER_AMBIENT, Sound.ENTITY_RAVAGER_ATTACK,
Sound.ENTITY_RAVAGER_CELEBRATE, Sound.ENTITY_RAVAGER_ROAR, Sound.ENTITY_RAVAGER_STUNNED),
RAVAGER(Sound.ENTITY_RAVAGER_HURT, Sound.ENTITY_RAVAGER_STEP, Sound.ENTITY_RAVAGER_DEATH, Sound.ENTITY_RAVAGER_AMBIENT,
Sound.ENTITY_RAVAGER_ATTACK, Sound.ENTITY_RAVAGER_CELEBRATE, Sound.ENTITY_RAVAGER_ROAR, Sound.ENTITY_RAVAGER_STUNNED),
SALMON(Sound.ENTITY_SALMON_HURT, null, Sound.ENTITY_SALMON_DEATH, Sound.ENTITY_SALMON_AMBIENT, Sound.ENTITY_SALMON_FLOP, Sound.ENTITY_FISH_SWIM),
SALMON(Sound.ENTITY_SALMON_HURT, null, Sound.ENTITY_SALMON_DEATH, Sound.ENTITY_SALMON_AMBIENT, Sound.ENTITY_SALMON_FLOP,
Sound.ENTITY_FISH_SWIM),
SHEEP(Sound.ENTITY_SHEEP_HURT, Sound.ENTITY_SHEEP_STEP, Sound.ENTITY_SHEEP_DEATH, Sound.ENTITY_SHEEP_AMBIENT, Sound.ENTITY_SHEEP_SHEAR),
SHULKER(new Sound[]{Sound.ENTITY_SHULKER_HURT, Sound.ENTITY_SHULKER_HURT_CLOSED}, null, Sound.ENTITY_SHULKER_DEATH, Sound.ENTITY_SHULKER_AMBIENT,
Sound.ENTITY_SHULKER_OPEN, Sound.ENTITY_SHULKER_CLOSE, Sound.ENTITY_SHULKER_TELEPORT),
SHULKER(new Sound[]{Sound.ENTITY_SHULKER_HURT, Sound.ENTITY_SHULKER_HURT_CLOSED}, null, Sound.ENTITY_SHULKER_DEATH,
Sound.ENTITY_SHULKER_AMBIENT, Sound.ENTITY_SHULKER_OPEN, Sound.ENTITY_SHULKER_CLOSE, Sound.ENTITY_SHULKER_TELEPORT),
SILVERFISH(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_SILVERFISH_STEP, Sound.ENTITY_SILVERFISH_DEATH, Sound.ENTITY_SILVERFISH_AMBIENT),
SKELETON(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH, Sound.ENTITY_SKELETON_AMBIENT),
SKELETON_HORSE(Sound.ENTITY_SKELETON_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD}, Sound.ENTITY_SKELETON_HORSE_DEATH,
new Sound[]{Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_SKELETON_HORSE_AMBIENT_WATER}, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_SKELETON_HORSE_GALLOP_WATER,
Sound.ENTITY_SKELETON_HORSE_JUMP_WATER, Sound.ENTITY_SKELETON_HORSE_SWIM, Sound.ENTITY_SKELETON_HORSE_STEP_WATER),
SKELETON_HORSE(Sound.ENTITY_SKELETON_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
Sound.ENTITY_SKELETON_HORSE_DEATH, new Sound[]{Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_SKELETON_HORSE_AMBIENT_WATER},
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
Sound.ENTITY_SKELETON_HORSE_GALLOP_WATER, Sound.ENTITY_SKELETON_HORSE_JUMP_WATER, Sound.ENTITY_SKELETON_HORSE_SWIM,
Sound.ENTITY_SKELETON_HORSE_STEP_WATER),
SLIME(new Sound[]{Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_HURT_SMALL}, new Sound[]{Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_JUMP_SMALL},
SLIME(new Sound[]{Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_HURT_SMALL},
new Sound[]{Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_JUMP_SMALL},
new Sound[]{Sound.ENTITY_SLIME_DEATH, Sound.ENTITY_SLIME_DEATH_SMALL}, null, Sound.ENTITY_SLIME_ATTACK, Sound.ENTITY_SLIME_SQUISH,
Sound.ENTITY_SLIME_SQUISH_SMALL),
SNIFFER(Sound.ENTITY_SNIFFER_HURT, Sound.ENTITY_SNIFFER_STEP, Sound.ENTITY_SNIFFER_DEATH, Sound.ENTITY_SNIFFER_IDLE, Sound.ENTITY_SNIFFER_DIGGING,
Sound.ENTITY_SNIFFER_DIGGING_STOP, Sound.ENTITY_SNIFFER_DROP_SEED, Sound.ENTITY_SNIFFER_EAT, Sound.ENTITY_SNIFFER_SEARCHING,
Sound.ENTITY_SNIFFER_SCENTING, Sound.ENTITY_SNIFFER_HAPPY, Sound.ENTITY_SNIFFER_SNIFFING),
SNIFFER(Sound.ENTITY_SNIFFER_HURT, Sound.ENTITY_SNIFFER_STEP, Sound.ENTITY_SNIFFER_DEATH, Sound.ENTITY_SNIFFER_IDLE,
Sound.ENTITY_SNIFFER_DIGGING, Sound.ENTITY_SNIFFER_DIGGING_STOP, Sound.ENTITY_SNIFFER_DROP_SEED, Sound.ENTITY_SNIFFER_EAT,
Sound.ENTITY_SNIFFER_SEARCHING, Sound.ENTITY_SNIFFER_SCENTING, Sound.ENTITY_SNIFFER_HAPPY, Sound.ENTITY_SNIFFER_SNIFFING),
SNOWMAN(Sound.ENTITY_SNOW_GOLEM_HURT, null, Sound.ENTITY_SNOW_GOLEM_DEATH, Sound.ENTITY_SNOW_GOLEM_AMBIENT, Sound.ENTITY_SNOW_GOLEM_SHOOT),
SNOWMAN(Sound.ENTITY_SNOW_GOLEM_HURT, null, Sound.ENTITY_SNOW_GOLEM_DEATH, Sound.ENTITY_SNOW_GOLEM_AMBIENT,
Sound.ENTITY_SNOW_GOLEM_SHOOT),
SPIDER(Sound.ENTITY_SPIDER_HURT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH, Sound.ENTITY_SPIDER_AMBIENT),
STRAY(Sound.ENTITY_STRAY_HURT, Sound.ENTITY_STRAY_STEP, Sound.ENTITY_STRAY_DEATH, Sound.ENTITY_STRAY_AMBIENT),
STRIDER(Sound.ENTITY_STRIDER_HURT, new Sound[]{Sound.ENTITY_STRIDER_STEP, Sound.ENTITY_STRIDER_STEP_LAVA}, Sound.ENTITY_STRIDER_DEATH,
Sound.ENTITY_STRIDER_AMBIENT, Sound.ENTITY_STRIDER_EAT, Sound.ENTITY_STRIDER_HAPPY, Sound.ENTITY_STRIDER_RETREAT, Sound.ENTITY_STRIDER_SADDLE),
Sound.ENTITY_STRIDER_AMBIENT, Sound.ENTITY_STRIDER_EAT, Sound.ENTITY_STRIDER_HAPPY, Sound.ENTITY_STRIDER_RETREAT,
Sound.ENTITY_STRIDER_SADDLE),
SQUID(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT, Sound.ENTITY_SQUID_SQUIRT, Sound.ENTITY_FISH_SWIM),
SQUID(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT, Sound.ENTITY_SQUID_SQUIRT,
Sound.ENTITY_FISH_SWIM),
TADPOLE(Sound.ENTITY_TADPOLE_HURT, null, Sound.ENTITY_TADPOLE_DEATH, null, Sound.ENTITY_TADPOLE_FLOP, Sound.ITEM_BUCKET_EMPTY_TADPOLE,
Sound.ITEM_BUCKET_FILL_TADPOLE),
TEXT_DISPLAY(null, null, null, null),
TRADER_LLAMA(Sound.ENTITY_LLAMA_HURT, Sound.ENTITY_LLAMA_STEP, Sound.ENTITY_LLAMA_DEATH, Sound.ENTITY_LLAMA_AMBIENT, Sound.ENTITY_LLAMA_ANGRY,
Sound.ENTITY_LLAMA_CHEST, Sound.ENTITY_LLAMA_EAT, Sound.ENTITY_LLAMA_SWAG),
TRADER_LLAMA(Sound.ENTITY_LLAMA_HURT, Sound.ENTITY_LLAMA_STEP, Sound.ENTITY_LLAMA_DEATH, Sound.ENTITY_LLAMA_AMBIENT,
Sound.ENTITY_LLAMA_ANGRY, Sound.ENTITY_LLAMA_CHEST, Sound.ENTITY_LLAMA_EAT, Sound.ENTITY_LLAMA_SWAG),
TROPICAL_FISH(Sound.ENTITY_TROPICAL_FISH_HURT, null, Sound.ENTITY_TROPICAL_FISH_DEATH, Sound.ENTITY_TROPICAL_FISH_AMBIENT, Sound.ENTITY_TROPICAL_FISH_FLOP,
Sound.ENTITY_FISH_SWIM),
TROPICAL_FISH(Sound.ENTITY_TROPICAL_FISH_HURT, null, Sound.ENTITY_TROPICAL_FISH_DEATH, Sound.ENTITY_TROPICAL_FISH_AMBIENT,
Sound.ENTITY_TROPICAL_FISH_FLOP, Sound.ENTITY_FISH_SWIM),
TURTLE(new Sound[]{Sound.ENTITY_TURTLE_HURT, Sound.ENTITY_TURTLE_HURT_BABY}, new Sound[]{Sound.ENTITY_TURTLE_SHAMBLE, Sound.ENTITY_TURTLE_SHAMBLE_BABY},
new Sound[]{Sound.ENTITY_TURTLE_DEATH, Sound.ENTITY_TURTLE_DEATH_BABY}, Sound.ENTITY_TURTLE_AMBIENT_LAND, Sound.ENTITY_TURTLE_LAY_EGG),
TURTLE(new Sound[]{Sound.ENTITY_TURTLE_HURT, Sound.ENTITY_TURTLE_HURT_BABY},
new Sound[]{Sound.ENTITY_TURTLE_SHAMBLE, Sound.ENTITY_TURTLE_SHAMBLE_BABY},
new Sound[]{Sound.ENTITY_TURTLE_DEATH, Sound.ENTITY_TURTLE_DEATH_BABY}, Sound.ENTITY_TURTLE_AMBIENT_LAND,
Sound.ENTITY_TURTLE_LAY_EGG),
VEX(Sound.ENTITY_VEX_HURT, null, Sound.ENTITY_VEX_DEATH, Sound.ENTITY_VEX_AMBIENT, Sound.ENTITY_VEX_CHARGE),
@ -250,42 +278,44 @@ public enum DisguiseSoundEnums {
VINDICATOR(Sound.ENTITY_VINDICATOR_HURT, null, Sound.ENTITY_VINDICATOR_DEATH, Sound.ENTITY_VINDICATOR_AMBIENT),
WANDERING_TRADER(Sound.ENTITY_WANDERING_TRADER_HURT, null, Sound.ENTITY_WANDERING_TRADER_DEATH, Sound.ENTITY_WANDERING_TRADER_AMBIENT,
Sound.ENTITY_WANDERING_TRADER_NO, Sound.ENTITY_WANDERING_TRADER_YES, Sound.ENTITY_WANDERING_TRADER_TRADE, Sound.ENTITY_WANDERING_TRADER_TRADE,
Sound.ENTITY_WANDERING_TRADER_REAPPEARED, Sound.ENTITY_WANDERING_TRADER_DRINK_POTION, Sound.ENTITY_WANDERING_TRADER_DRINK_MILK,
Sound.ENTITY_WANDERING_TRADER_DISAPPEARED),
Sound.ENTITY_WANDERING_TRADER_NO, Sound.ENTITY_WANDERING_TRADER_YES, Sound.ENTITY_WANDERING_TRADER_TRADE,
Sound.ENTITY_WANDERING_TRADER_TRADE, Sound.ENTITY_WANDERING_TRADER_REAPPEARED, Sound.ENTITY_WANDERING_TRADER_DRINK_POTION,
Sound.ENTITY_WANDERING_TRADER_DRINK_MILK, Sound.ENTITY_WANDERING_TRADER_DISAPPEARED),
WARDEN(Sound.ENTITY_WARDEN_HURT, Sound.ENTITY_WARDEN_STEP, Sound.ENTITY_WARDEN_DEATH, Sound.ENTITY_WARDEN_AMBIENT, Sound.ENTITY_WARDEN_AGITATED,
Sound.ENTITY_WARDEN_ANGRY, Sound.ENTITY_WARDEN_ATTACK_IMPACT, Sound.ENTITY_WARDEN_DIG, Sound.ENTITY_WARDEN_EMERGE, Sound.ENTITY_WARDEN_HEARTBEAT,
Sound.ENTITY_WARDEN_TENDRIL_CLICKS, Sound.ENTITY_WARDEN_LISTENING, Sound.ENTITY_WARDEN_LISTENING_ANGRY, Sound.ENTITY_WARDEN_NEARBY_CLOSE,
Sound.ENTITY_WARDEN_NEARBY_CLOSER, Sound.ENTITY_WARDEN_NEARBY_CLOSEST, Sound.ENTITY_WARDEN_SONIC_BOOM, Sound.ENTITY_WARDEN_SONIC_CHARGE,
Sound.ENTITY_WARDEN_ROAR, Sound.ENTITY_WARDEN_SNIFF),
WARDEN(Sound.ENTITY_WARDEN_HURT, Sound.ENTITY_WARDEN_STEP, Sound.ENTITY_WARDEN_DEATH, Sound.ENTITY_WARDEN_AMBIENT,
Sound.ENTITY_WARDEN_AGITATED, Sound.ENTITY_WARDEN_ANGRY, Sound.ENTITY_WARDEN_ATTACK_IMPACT, Sound.ENTITY_WARDEN_DIG,
Sound.ENTITY_WARDEN_EMERGE, Sound.ENTITY_WARDEN_HEARTBEAT, Sound.ENTITY_WARDEN_TENDRIL_CLICKS, Sound.ENTITY_WARDEN_LISTENING,
Sound.ENTITY_WARDEN_LISTENING_ANGRY, Sound.ENTITY_WARDEN_NEARBY_CLOSE, Sound.ENTITY_WARDEN_NEARBY_CLOSER,
Sound.ENTITY_WARDEN_NEARBY_CLOSEST, Sound.ENTITY_WARDEN_SONIC_BOOM, Sound.ENTITY_WARDEN_SONIC_CHARGE, Sound.ENTITY_WARDEN_ROAR,
Sound.ENTITY_WARDEN_SNIFF),
WINDCHARGE(null, null, Sound.ENTITY_GENERIC_WIND_BURST, null),
WITCH(Sound.ENTITY_WITCH_HURT, null, Sound.ENTITY_WITCH_DEATH, Sound.ENTITY_WITCH_AMBIENT),
WITHER(Sound.ENTITY_WITHER_HURT, null, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_WITHER_SPAWN,
Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_WITHER_SHOOT),
WITHER(Sound.ENTITY_WITHER_HURT, null, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
Sound.ENTITY_WITHER_SPAWN, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_WITHER_SHOOT),
WITHER_SKELETON(Sound.ENTITY_WITHER_SKELETON_HURT, Sound.ENTITY_WITHER_SKELETON_STEP, Sound.ENTITY_WITHER_SKELETON_DEATH,
Sound.ENTITY_WITHER_SKELETON_AMBIENT),
WOLF(Sound.ENTITY_WOLF_HURT, Sound.ENTITY_WOLF_STEP, Sound.ENTITY_WOLF_DEATH, Sound.ENTITY_WOLF_AMBIENT, Sound.ENTITY_WOLF_GROWL, Sound.ENTITY_WOLF_PANT,
Sound.ENTITY_WOLF_HOWL, Sound.ENTITY_WOLF_SHAKE, Sound.ENTITY_WOLF_WHINE),
WOLF(Sound.ENTITY_WOLF_HURT, Sound.ENTITY_WOLF_STEP, Sound.ENTITY_WOLF_DEATH, Sound.ENTITY_WOLF_AMBIENT, Sound.ENTITY_WOLF_GROWL,
Sound.ENTITY_WOLF_PANT, Sound.ENTITY_WOLF_HOWL, Sound.ENTITY_WOLF_SHAKE, Sound.ENTITY_WOLF_WHINE),
ZOGLIN(Sound.ENTITY_ZOGLIN_HURT, Sound.ENTITY_ZOGLIN_STEP, Sound.ENTITY_ZOGLIN_DEATH, Sound.ENTITY_ZOGLIN_AMBIENT, Sound.ENTITY_ZOGLIN_ANGRY,
Sound.ENTITY_ZOGLIN_ATTACK),
ZOGLIN(Sound.ENTITY_ZOGLIN_HURT, Sound.ENTITY_ZOGLIN_STEP, Sound.ENTITY_ZOGLIN_DEATH, Sound.ENTITY_ZOGLIN_AMBIENT,
Sound.ENTITY_ZOGLIN_ANGRY, Sound.ENTITY_ZOGLIN_ATTACK),
ZOMBIE(Sound.ENTITY_ZOMBIE_HURT, Sound.ENTITY_ZOMBIE_STEP, Sound.ENTITY_ZOMBIE_DEATH, Sound.ENTITY_ZOMBIE_AMBIENT, Sound.ENTITY_ZOMBIE_INFECT,
Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR),
ZOMBIE(Sound.ENTITY_ZOMBIE_HURT, Sound.ENTITY_ZOMBIE_STEP, Sound.ENTITY_ZOMBIE_DEATH, Sound.ENTITY_ZOMBIE_AMBIENT,
Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR,
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR),
ZOMBIE_HORSE(Sound.ENTITY_ZOMBIE_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD}, Sound.ENTITY_ZOMBIE_HORSE_DEATH,
Sound.ENTITY_ZOMBIE_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
ZOMBIE_HORSE(Sound.ENTITY_ZOMBIE_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
Sound.ENTITY_ZOMBIE_HORSE_DEATH, Sound.ENTITY_ZOMBIE_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
ZOMBIE_VILLAGER(Sound.ENTITY_ZOMBIE_VILLAGER_HURT, Sound.ENTITY_ZOMBIE_VILLAGER_STEP, Sound.ENTITY_ZOMBIE_VILLAGER_DEATH,
Sound.ENTITY_ZOMBIE_VILLAGER_AMBIENT, Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR,
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR),
Sound.ENTITY_ZOMBIE_VILLAGER_AMBIENT, Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR,
Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR),
ZOMBIFIED_PIGLIN(Sound.ENTITY_ZOMBIFIED_PIGLIN_HURT, null, Sound.ENTITY_ZOMBIFIED_PIGLIN_DEATH, Sound.ENTITY_ZOMBIFIED_PIGLIN_AMBIENT,
Sound.ENTITY_ZOMBIFIED_PIGLIN_ANGRY, Sound.ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED);

View File

@ -71,15 +71,16 @@ public class SoundManager {
SoundGroup subGroup = SoundGroup.getGroup(sound);
if (subGroup == null) {
DisguiseUtilities.getLogger().warning("Invalid sound '" + sound + "'! Must be a minecraft:sound.name or SoundGroup name!");
DisguiseUtilities.getLogger()
.warning("Invalid sound '" + sound + "'! Must be a minecraft:sound.name or SoundGroup name!");
continue;
}
Object[] sounds = subGroup.getDisguiseSounds().get(type);
if (sounds == null) {
DisguiseUtilities.getLogger()
.warning("Sound group '" + sound + "' does not contain a category for " + type + "! Can't use as default in " + key);
DisguiseUtilities.getLogger().warning(
"Sound group '" + sound + "' does not contain a category for " + type + "! Can't use as default in " + key);
continue;
}

View File

@ -78,8 +78,8 @@ public enum LibsMsg {
DCLONE_EQUIP("ignoreEquip"),
DCLONE_ADDEDANIMATIONS("doAddedAnimations"),
DMODRADIUS_HELP2(
"<dark_green>/disguisemodifyradius <<green>DisguiseType<dark_green>(<green>Optional<dark_green>)> <<green>Radius<dark_green>> <<green>Disguise " +
"Methods<dark_green>>"),
"<dark_green>/disguisemodifyradius <<green>DisguiseType<dark_green>(<green>Optional<dark_green>)> <<green>Radius<dark_green>> " +
"<<green>Disguise " + "Methods<dark_green>>"),
DMODRADIUS_HELP3("<dark_green>See the DisguiseType's usable by <green>/disguisemodifyradius DisguiseType"),
DMODRADIUS_NEEDOPTIONS("<red>You need to supply the disguise methods as well as the radius"),
DMODRADIUS_NEEDOPTIONS_ENTITY("<red>You need to supply the disguise methods as well as the radius and EntityType"),
@ -90,14 +90,18 @@ public enum LibsMsg {
DPLAYER_SUPPLY("<red>You need to supply a disguise as well as the player/uuid"),
DRADIUS_ENTITIES("<dark_green>EntityTypes usable are: %s"),
DRADIUS_HELP1("<dark_green>Disguise all entities in a radius! Caps at %s blocks!"),
DRADIUS_HELP3("<dark_green>/disguiseradius <<green>EntityType<dark_green>(<green>Optional<dark_green>)> <<green>Radius<dark_green>> player " +
"<<green>Name<dark_green>>"),
DRADIUS_HELP3(
"<dark_green>/disguiseradius <<green>EntityType<dark_green>(<green>Optional<dark_green>)> <<green>Radius<dark_green>> player " +
"<<green>Name<dark_green>>"),
DRADIUS_HELP4("<dark_green>/disguiseradius <<green>EntityType<dark_green>(<green>Optional<dark_green>)> <<green>Radius<dark_green>> " +
"<<green>DisguiseType<dark_green>> <<green>Baby<dark_green>(<green>Optional<dark_green>)>"),
DRADIUS_HELP5("<dark_green>/disguiseradius <<green>EntityType<dark_green>(<green>Optional<dark_green>)> <<green>Radius<dark_green>> " +
"<<green>Dropped_Item/Falling_Block<dark_green>> <<green>Id<dark_green>> <<green>Durability<dark_green>(<green>Optional<dark_green>)" + ">"),
"<<green>Dropped_Item/Falling_Block<dark_green>> <<green>Id<dark_green>> <<green>Durability<dark_green>" +
"(<green>Optional<dark_green>)" + ">"),
DRADIUS_HELP6("<dark_green>See the EntityType's usable by <green>/disguiseradius EntityTypes"),
DRADIUS_MISCDISG("<red>Failed to disguise %s entities because the option to disguise a living entity as a non-living has been disabled in the config"),
DRADIUS_MISCDISG(
"<red>Failed to disguise %s entities because the option to disguise a living entity as a non-living has been disabled in the " +
"config"),
DRADIUS_NEEDOPTIONS("<red>You need to supply a disguise as well as the radius"),
DRADIUS_NEEDOPTIONS_ENTITY("<red>You need to supply a disguise as well as the radius and EntityType"),
FAILED_DISGIUSE("<red>Failed to disguise as %s"),
@ -163,7 +167,9 @@ public enum LibsMsg {
PARSE_INVALID_TIME("<red>Error! %s is not a valid time! Use s,m,h,d or secs,mins,hours,days"),
PARSE_INVALID_TIME_SEQUENCE("<red>Error! %s is not a valid time! Do amount then time, eg. 4min10sec"),
PARSE_USE_SECOND_NUM("<red>Error! Only the disguises %s and %s uses a second number!"),
REF_TOO_MANY("<red>Failed to store the reference, too many cloned disguises. Please raise the maximum cloned disguises, or lower the time they last"),
REF_TOO_MANY(
"<red>Failed to store the reference, too many cloned disguises. Please raise the maximum cloned disguises, or lower the time they" +
" last"),
RELOADED_CONFIG("<green>[LibsDisguises] Reloaded config."),
UND_ENTITY("<red>Right click a disguised entity to undisguise them!"),
UNDISG("<red>You are no longer disguised"),
@ -171,10 +177,12 @@ public enum LibsMsg {
UNDISG_PLAYER_FAIL("<red>%s not disguised!"),
UNDISG_PLAYER_HELP("<red>/undisguiseplayer <Name>"),
UNDISRADIUS("<red>Successfully undisguised %s entities!"),
UPDATE_READY("<red>[LibsDisguises] <dark_red>There is a update ready to be downloaded! You are using <red>v%s<dark_red>, the new version is " +
"<red>v%s<dark_red>!"),
UPDATE_READY_SNAPSHOT("<red>[LibsDisguises] <dark_red>There is a new build of Lib's Disguises! You are using <red>%s<dark_red>, the latest build is " +
"<red>#%s<dark_red>!"),
UPDATE_READY(
"<red>[LibsDisguises] <dark_red>There is a update ready to be downloaded! You are using <red>v%s<dark_red>, the new version is " +
"<red>v%s<dark_red>!"),
UPDATE_READY_SNAPSHOT(
"<red>[LibsDisguises] <dark_red>There is a new build of Lib's Disguises! You are using <red>%s<dark_red>, the latest build is " +
"<red>#%s<dark_red>!"),
UPDATE_HOW("<dark_aqua>Use <aqua>/libsdisgusies changelog<dark_aqua> to see what changed, use <aqua>/libsdisguises update!" +
"<dark_aqua> to download the update!"),
VIEW_SELF_ON("<green>Toggled viewing own disguise on!"),
@ -220,7 +228,8 @@ public enum LibsMsg {
SAVE_DISG_HELP_4("<green>Your arguments need to be as if you're using /disguise. So '/disguise player Notch setsneaking' - " +
"Means '/savedisguise Notch player Notch setsneaking'"),
SAVE_DISG_HELP_5("<green>Remember! You can upload your own skins, then reference those skins!"),
SAVE_DISG_HELP_6("<green>If you are using setSkin, you can append :slim to your skin path to get the slim Alex model. So myskin.png:slim"),
SAVE_DISG_HELP_6(
"<green>If you are using setSkin, you can append :slim to your skin path to get the slim Alex model. So myskin.png:slim"),
GRAB_DISG_HELP_1("<green>You can choose a name to save the skins under, the names will be usable as if it was an actual player skin"),
GRAB_DISG_HELP_2("<dark_green>/grabskin <Optional Name> https://somesite.com/myskin.png"),
GRAB_DISG_HELP_3("<dark_green>/grabskin <Optional Name> myskin.png - Skins must be in the folder!"),
@ -268,10 +277,11 @@ public enum LibsMsg {
ITEM_SERIALIZED_MC_LD_NO_COPY("<gold>MC Serialized for LD: <yellow>%s"),
ITEM_SIMPLE_STRING_NO_COPY("<gold>Simple: <yellow>%s"),
LIBS_SCOREBOARD_NO_TEAM("<red>Not on a scoreboard team!"),
LIBS_SCOREBOARD_SUCCESS("<gold>On scoreboard team '%s' with pushing disabled! If you're still having issues and you are disguised right now, then " +
"you have a plugin modifying scoreboard through packets. Example of this is a plugin that modifies your " +
"name above head, or the tablist. Check their configs for pushing disabling options\nSay 'I read to the end' if you " +
"still need help with this, or we'll assume you can't read."),
LIBS_SCOREBOARD_SUCCESS(
"<gold>On scoreboard team '%s' with pushing disabled! If you're still having issues and you are disguised right now, then " +
"you have a plugin modifying scoreboard through packets. Example of this is a plugin that modifies your " +
"name above head, or the tablist. Check their configs for pushing disabling options\nSay 'I read to the end' if you " +
"still need help with this, or we'll assume you can't read."),
LIBS_SCOREBOARD_NAMES_DISABLED("<red>Scoreboard names has been disabled, the test for player disguises has failed before it started"),
LIBS_SCOREBOARD_IGNORE_TEST("<green>This was a seperate test from the self disguising collision test that will follow!"),
USING_DEFAULT_CONFIG("<dark_green>Using the default config!"),
@ -282,16 +292,18 @@ public enum LibsMsg {
LD_COMMAND_COUNT("<blue>/libsdisguises count - <aqua>Tells you how many active disguises there are"),
LD_COMMAND_METAINFO("<blue>/libsdisguises metainfo - <aqua>Debugging info, tells you what the metadata is for a disguise"),
LD_COMMAND_CONFIG("<blue>/libsdisguises config - <aqua>Tells you what's not normal in your config"),
LD_COMMAND_UPDATE(
"<blue>/libsdisguises update - <aqua>" + "'update' will fetch an update, 'update dev' will fetch a dev build update, 'update release' will fetch a" +
" release build update and 'update!' will download that update!"),
LD_COMMAND_UPDATE("<blue>/libsdisguises update - <aqua>" +
"'update' will fetch an update, 'update dev' will fetch a dev build update, 'update release' will fetch a" +
" release build update and 'update!' will download that update!"),
LD_COMMAND_CHANGELOG("<blue>/libsdisguises changelog - <aqua>Gives you the changelog of the current update fetched"),
LD_DEBUG_MINESKIN("<blue>/libsdisguises mineskin - <aqua>Prints debug information about MineSkin to console"),
LD_DEBUG_MINESKIN_TOGGLE("<blue>MineSkin debug is now %s, this command toggles the printing of MineSkin information to console"),
LD_COMMAND_JSON("<blue>/libsdisguises json - <aqua>Turns the current held item into a string format"),
LD_COMMAND_MODS("<blue>/libsdisguises mods <Player?> - <aqua>" + "If using modded entities, this will tell you what mods a player is using if possible"),
LD_COMMAND_MODS("<blue>/libsdisguises mods <Player?> - <aqua>" +
"If using modded entities, this will tell you what mods a player is using if possible"),
LD_COMMAND_PERMTEST("<blue>/libsdisguises permtest <Player?> - <aqua>Does a quick test to see if your permissions are working"),
LD_COMMAND_SCOREBOARD("<blue>/libsdisguises scoreboard <Player?> - <aqua>Does a test to see if there's any scoreboard issues it can detect"),
LD_COMMAND_SCOREBOARD(
"<blue>/libsdisguises scoreboard <Player?> - <aqua>Does a test to see if there's any scoreboard issues it can detect"),
LD_COMMAND_RELOAD("<blue>/libsdisguises reload - <aqua>Reload's the plugin config and possibly blows disguises"),
LD_COMMAND_DEBUG("<blue>/libsdisguises debug - <aqua>Used to help debug scoreboard issues on a player disguise"),
LD_COMMAND_UPLOAD_LOGS("<blue>/libsdisguises uploadlogs - <aqua>" +
@ -342,8 +354,8 @@ public enum LibsMsg {
int matches = StringUtils.countMatches(getRaw(), "%s");
if (matches != strings.length) {
DisguiseUtilities.getLogger()
.severe("Mismatch in messages, incorrect parameters supplied for " + name() + ". Please inform plugin author if not using translations.");
DisguiseUtilities.getLogger().severe("Mismatch in messages, incorrect parameters supplied for " + name() +
". Please inform plugin author if not using translations.");
}
String trans = TranslateType.MESSAGES.get(this);

View File

@ -21,13 +21,15 @@ 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.save(info.getRawDescriptiveName(), "A disguise option descriptive name");
}
TranslateType.DISGUISE_OPTIONS_PARAMETERS.save(info.getRawDescription(), "Description for the disguise option " + info.getRawName());
TranslateType.DISGUISE_OPTIONS_PARAMETERS.save(info.getRawDescription(),
"Description for the disguise option " + info.getRawName());
if (info.canTranslateValues()) {
for (String e : ((Map<String, Object>) info.getValues()).keySet()) {
@ -88,7 +90,8 @@ public class TranslateFiller {
for (Class c : validClasses) {
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(c.getSimpleName(),
"Name for the " + c.getSimpleName() + " EntityType, " + "this is used in radius commands");
}
}

View File

@ -59,7 +59,7 @@ public enum TranslateType {
}
}
protected void saveTranslations() {
void saveTranslations() {
// First remove translations which are not different from each other. We don't need to store messages that
// were not translated.
@ -119,8 +119,8 @@ public enum TranslateType {
if (!newKey.equals(translated.get(newKey))) {
diff++;
translated.put(newKey,
translated.get(newKey) + (diff % 3 == 0 || LibsMsg.OWNED_BY.getRaw().contains("Plugin registered to '") ? "" : " "));
translated.put(newKey, translated.get(newKey) +
(diff % 3 == 0 || LibsMsg.OWNED_BY.getRaw().contains("Plugin registered to '") ? "" : " "));
}
}
}
@ -129,7 +129,8 @@ public enum TranslateType {
}
if (LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
DisguiseUtilities.getLogger().info("Loaded " + translated.size() + " translations for " + name() + " with " + diff + " changed");
DisguiseUtilities.getLogger()
.info("Loaded " + translated.size() + " translations for " + name() + " with " + diff + " changed");
} else if (diff > 0 && !DisguiseConfig.isUseTranslations()) {
DisguiseUtilities.getLogger().info(
"Translations are disabled in libsdisguises.yml, but you modified " + diff + " messages in the translations for " + name() +
@ -216,7 +217,8 @@ public enum TranslateType {
return;
}
ArrayList<String> disguiseText = new ArrayList(Arrays.asList(new String(Files.readAllBytes(getFile().toPath())).split("\r?\n")));
ArrayList<String> disguiseText =
new ArrayList(Arrays.asList(new String(Files.readAllBytes(getFile().toPath())).split("\r?\n")));
int dupes = 0;
int outdated = 0;
@ -258,8 +260,9 @@ public enum TranslateType {
}
if (dupes + outdated > 0) {
DisguiseUtilities.getLogger().info("Removed " + dupes + " duplicate and " + outdated + " outdated translations from " + getFile().getName() +
", this was likely caused by a previous issue in the plugin");
DisguiseUtilities.getLogger().info(
"Removed " + dupes + " duplicate and " + outdated + " outdated translations from " + getFile().getName() +
", this was likely caused by a previous issue in the plugin");
Files.write(getFile().toPath(), StringUtils.join(disguiseText, "\n").getBytes());
}

View File

@ -72,7 +72,8 @@ public class LDGithub {
con.setRequestProperty("Accept", "application/vnd.github.v3+json");
// We believe we're on the latest version and know what the last etag was
if (Objects.equals(ourVersion, DisguiseConfig.getLastPluginUpdateVersion()) && DisguiseConfig.getLastGithubUpdateETag() != null) {
if (Objects.equals(ourVersion, DisguiseConfig.getLastPluginUpdateVersion()) &&
DisguiseConfig.getLastGithubUpdateETag() != null) {
con.setRequestProperty("If-None-Match", DisguiseConfig.getLastGithubUpdateETag());
}
@ -86,18 +87,21 @@ public class LDGithub {
// Get the input stream, what we receive
try (InputStream input = con.getInputStream()) {
// Read it to string
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String json =
new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
gitData = new Gson().fromJson(json, GithubData.class);
} catch (IOException ex) {
try (InputStream error = con.getErrorStream()) {
String line = new BufferedReader(new InputStreamReader(error, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String line =
new BufferedReader(new InputStreamReader(error, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
DisguiseUtilities.getLogger().severe("Error with Github! " + line);
if (line.contains("rate limit") && !DisguiseConfig.isHittingRateLimit()) {
DisguiseConfig.setHittingRateLimit(true);
DisguiseUtilities.getLogger().severe("Changed update checker to be every 36 hours due to rate limiting from this IP");
DisguiseUtilities.getLogger()
.severe("Changed update checker to be every 36 hours due to rate limiting from this IP");
return null;
}
} catch (Exception ex1) {

View File

@ -62,7 +62,8 @@ public class LDJenkins {
// Get the input stream, what we receive
try (InputStream input = con.getInputStream()) {
// Read it to string
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String json =
new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
map = new Gson().fromJson(json, HashMap.class);
}
@ -86,8 +87,8 @@ public class LDJenkins {
String[] users = getBadUsers();
for (String s : users) {
if (LibsPremium.getPaidInformation() != null &&
(s.equals(LibsPremium.getPaidInformation().getDownloadID()) || s.equals(LibsPremium.getPaidInformation().getUserID()))) {
if (LibsPremium.getPaidInformation() != null && (s.equals(LibsPremium.getPaidInformation().getDownloadID()) ||
s.equals(LibsPremium.getPaidInformation().getUserID()))) {
LibsDisguises.getInstance().unregisterCommands(true);
}
}
@ -103,7 +104,8 @@ public class LDJenkins {
// Get the input stream, what we receive
try (InputStream input = con.getInputStream()) {
// Read it to string
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String json =
new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
jsonObject = new Gson().fromJson(json, Map.class);
}

View File

@ -83,7 +83,8 @@ public class UpdateChecker {
public boolean isUsingReleaseBuilds() {
DisguiseConfig.UpdatesBranch builds = DisguiseConfig.getUpdatesBranch();
return builds == DisguiseConfig.UpdatesBranch.RELEASES || (builds == DisguiseConfig.UpdatesBranch.SAME_BUILDS && DisguiseConfig.isUsingReleaseBuild());
return builds == DisguiseConfig.UpdatesBranch.RELEASES ||
(builds == DisguiseConfig.UpdatesBranch.SAME_BUILDS && DisguiseConfig.isUsingReleaseBuild());
}
public void notifyUpdate(CommandSender player) {
@ -192,7 +193,8 @@ public class UpdateChecker {
String build = LibsDisguises.getInstance().getBuildNo();
updateMessage = new String[]{LibsMsg.UPDATE_READY_SNAPSHOT.get((build.matches("\\d+") ? "#" : "") + build, newBuild), LibsMsg.UPDATE_HOW.get()};
updateMessage = new String[]{LibsMsg.UPDATE_READY_SNAPSHOT.get((build.matches("\\d+") ? "#" : "") + build, newBuild),
LibsMsg.UPDATE_HOW.get()};
}
return null;
@ -233,7 +235,8 @@ public class UpdateChecker {
lastDownload = result;
updateMessage = new String[]{LibsMsg.UPDATE_SUCCESS.get(),
LibsMsg.UPDATE_INFO.get(result.getVersion(), result.getBuildNumber(), result.getParsedBuildDate().toString(), result.getSize() / 1024)};
LibsMsg.UPDATE_INFO.get(result.getVersion(), result.getBuildNumber(), result.getParsedBuildDate().toString(),
result.getSize() / 1024)};
return result;
} catch (Exception ex) {

View File

@ -57,7 +57,8 @@ public class CompileMethods {
int count = getFileCount(classesFolder);
try {
Files.write(new File(classesFolder, "plugin.yml").toPath(), ("\nfile-count: " + count).getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
Files.write(new File(classesFolder, "plugin.yml").toPath(), ("\nfile-count: " + count).getBytes(StandardCharsets.UTF_8),
StandardOpenOption.APPEND);
} catch (IOException e) {
throw new RuntimeException(e);
}
@ -132,7 +133,8 @@ public class CompileMethods {
}
private static void doMethods() {
ArrayList<Class<?>> classes = ClassGetter.getClassesForPackage(FlagWatcher.class, "me.libraryaddict.disguise.disguisetypes.watchers");
ArrayList<Class<?>> classes =
ClassGetter.getClassesForPackage(FlagWatcher.class, "me.libraryaddict.disguise.disguisetypes.watchers");
ArrayList<Class> sorted = new ArrayList<>();
@ -146,10 +148,11 @@ public class CompileMethods {
for (Method method : c.getMethods()) {
if (!FlagWatcher.class.isAssignableFrom(method.getDeclaringClass())) {
continue;
} else if (method.getParameterCount() > 1 && !method.isAnnotationPresent(NmsAddedIn.class) && !method.isAnnotationPresent(NmsRemovedIn.class)) {
} else if (method.getParameterCount() > 1 && !method.isAnnotationPresent(NmsAddedIn.class) &&
!method.isAnnotationPresent(NmsRemovedIn.class)) {
continue;
} else if (!(method.getName().startsWith("set") && method.getParameterCount() == 1) && !method.getName().startsWith("get") &&
!method.getName().startsWith("has") && !method.getName().startsWith("is")) {
} else if (!(method.getName().startsWith("set") && method.getParameterCount() == 1) &&
!method.getName().startsWith("get") && !method.getName().startsWith("has") && !method.getName().startsWith("is")) {
continue;
} else if (method.getName().equals("removePotionEffect")) {
continue;

View File

@ -99,13 +99,13 @@ public class DisguiseMethods {
String paramName = info.getParam();
MethodType type = param == null || param == Void.TYPE ? MethodType.methodType(returnType) : MethodType.methodType(returnType, param);
MethodType type =
param == null || param == Void.TYPE ? MethodType.methodType(returnType) : MethodType.methodType(returnType, param);
MethodHandle method = MethodHandles.publicLookup().findVirtual(watcher, info.getMethod(), type);
WatcherMethod m =
new WatcherMethod(watcher, method, info.getMethod(), returnType, param, info.isRandomDefault(), info.isDeprecated() && info.getAdded() == 0,
info.getUnusableBy());
WatcherMethod m = new WatcherMethod(watcher, method, info.getMethod(), returnType, param, info.isRandomDefault(),
info.isDeprecated() && info.getAdded() == 0, info.getUnusableBy());
methods.add(m);
@ -120,9 +120,9 @@ public class DisguiseMethods {
PlayerDisguise disguise = new PlayerDisguise("");
// Add these last as it's what we want to present to be called the least
for (String methodName : new String[]{"setSelfDisguiseVisible", "setHideHeldItemFromSelf", "setHideArmorFromSelf", "setHearSelfDisguise",
"setHidePlayer", "setExpires", "setNotifyBar", "setBossBarColor", "setBossBarStyle", "setTallDisguisesVisible", "setDynamicName",
"setSoundGroup", "setDisguiseName", "setDeadmau5Ears"}) {
for (String methodName : new String[]{"setSelfDisguiseVisible", "setHideHeldItemFromSelf", "setHideArmorFromSelf",
"setHearSelfDisguise", "setHidePlayer", "setExpires", "setNotifyBar", "setBossBarColor", "setBossBarStyle",
"setTallDisguisesVisible", "setDynamicName", "setSoundGroup", "setDisguiseName", "setDeadmau5Ears"}) {
try {
Class cl = boolean.class;
Class disguiseClass = Disguise.class;
@ -156,19 +156,19 @@ public class DisguiseMethods {
for (Class returnType : new Class[]{Void.TYPE, disguiseClass}) {
try {
WatcherMethod method = new WatcherMethod(disguiseClass,
MethodHandles.publicLookup().findVirtual(disguiseClass, methodName, MethodType.methodType(returnType, cl)), methodName, null,
cl, randomDefault, false, new boolean[DisguiseType.values().length]);
MethodHandles.publicLookup().findVirtual(disguiseClass, methodName, MethodType.methodType(returnType, cl)),
methodName, null, cl, randomDefault, false, new boolean[DisguiseType.values().length]);
methods.add(method);
watcherMethods.computeIfAbsent(disguiseClass == Disguise.class ? FlagWatcher.class : PlayerWatcher.class, (a) -> new ArrayList<>())
.add(method);
watcherMethods.computeIfAbsent(disguiseClass == Disguise.class ? FlagWatcher.class : PlayerWatcher.class,
(a) -> new ArrayList<>()).add(method);
String getName = (cl == boolean.class ? "is" : "get") + methodName.substring(3);
WatcherMethod getMethod =
new WatcherMethod(disguiseClass, MethodHandles.publicLookup().findVirtual(disguiseClass, getName, MethodType.methodType(cl)),
getName, cl, null, randomDefault, false, new boolean[DisguiseType.values().length]);
WatcherMethod getMethod = new WatcherMethod(disguiseClass,
MethodHandles.publicLookup().findVirtual(disguiseClass, getName, MethodType.methodType(cl)), getName, cl,
null, randomDefault, false, new boolean[DisguiseType.values().length]);
methods.add(getMethod);
break;

View File

@ -28,7 +28,8 @@ public class DisguiseUtilitiesTest {
Assert.assertArrayEquals(new String[]{"\"A double quoted string\""}, DisguiseUtilities.split("\"\"A double quoted string\"\""));
Assert.assertArrayEquals(new String[]{"A", "string", "containing a", "quote"}, DisguiseUtilities.split("A string \"containing a\" quote"));
Assert.assertArrayEquals(new String[]{"A", "string", "containing a", "quote"},
DisguiseUtilities.split("A string \"containing a\" quote"));
Assert.assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("\"A\" string fully split"));
@ -41,7 +42,8 @@ public class DisguiseUtilitiesTest {
Assert.assertArrayEquals(new String[]{"A", "\"string", "\"fully", "split"}, DisguiseUtilities.split("A \"string \"fully split"));
Assert.assertArrayEquals(new String[]{"\"A", "\"string", "\"fully", "split"}, DisguiseUtilities.split("\"A \"string \"fully split"));
Assert.assertArrayEquals(new String[]{"\"A", "\"string", "\"fully", "split"},
DisguiseUtilities.split("\"A \"string \"fully split"));
Assert.assertArrayEquals(new String[]{"A", "string\"", "fully", "split"}, DisguiseUtilities.split("A string\" fully split"));
@ -49,7 +51,8 @@ public class DisguiseUtilitiesTest {
Assert.assertArrayEquals(new String[]{"A", "string", "fully\"", "split"}, DisguiseUtilities.split("A \"string\" fully\" split"));
Assert.assertArrayEquals(new String[]{"A \"string", "with", "four", "splits"}, DisguiseUtilities.split("\"A \"string\" with four splits"));
Assert.assertArrayEquals(new String[]{"A \"string", "with", "four", "splits"},
DisguiseUtilities.split("\"A \"string\" with four splits"));
// Test for quotes inside words
Assert.assertArrayEquals(new String[]{"Fully", "split", "\"", "message"}, DisguiseUtilities.split("Fully split \"\"\" message"));
@ -98,10 +101,11 @@ public class DisguiseUtilitiesTest {
splitEquals("'//// ////'", "//// //");
splitEquals("Foobar is not 'Foo Bar' but is a single word 'foobar' or as some quote it, /'foobar/' and again, " + "not /'foo bar/' - It is 'foobar'!",
splitEquals("Foobar is not 'Foo Bar' but is a single word 'foobar' or as some quote it, /'foobar/' and again, " +
"not /'foo bar/' - It is 'foobar'!",
"Foobar", "is", "not", "Foo Bar", "but", "is", "a", "single", "word", "foobar", "or", "as", "some", "quote", "it,", "'foobar'", "and", "again,",
"not", "'foo", "bar'", "-", "It", "is", "'foobar'!");
"Foobar", "is", "not", "Foo Bar", "but", "is", "a", "single", "word", "foobar", "or", "as", "some", "quote", "it,", "'foobar'",
"and", "again,", "not", "'foo", "bar'", "-", "It", "is", "'foobar'!");
splitAndBack("Hi \" bye");
splitAndBack("Hi\\\" I'm Sam");

View File

@ -37,22 +37,26 @@ public class DisguisePermissionsTest {
public void testPermissionNames() {
Assert.assertFalse("There should not be permissions", createPermissions("Disguise", false).hasPermissions());
Assert.assertFalse("The commands should not match", createPermissions("Disguise", false, "libsdisguises.disguiseentity.cow").hasPermissions());
Assert.assertFalse("The commands should not match",
createPermissions("Disguise", false, "libsdisguises.disguiseentity.cow").hasPermissions());
Assert.assertFalse("The commands should not match", createPermissions("Disguised", false, "libsdisguises.disguise.cow").hasPermissions());
Assert.assertFalse("The commands should not match",
createPermissions("Disguised", false, "libsdisguises.disguise.cow").hasPermissions());
Assert.assertTrue("There should be permissions", createPermissions("Disguise", false, "libsdisguises.*.animal").hasPermissions());
}
@Test
public void testOperatorPermissions() {
DisguisePermissions permissions = createPermissions("Disguise", true, "-libsdisguises.disguise.sheep", "-libsdisguises.disguise.horse.setBaby");
DisguisePermissions permissions =
createPermissions("Disguise", true, "-libsdisguises.disguise.sheep", "-libsdisguises.disguise.horse.setBaby");
Assert.assertTrue("There should be permissions", permissions.hasPermissions());
Assert.assertTrue("The disguise cow should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
Assert.assertFalse("The disguise sheep should not be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")));
Assert.assertFalse("The disguise sheep should not be allowed",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")));
Assert.assertTrue("The disguise horse should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse")));
@ -78,7 +82,8 @@ public class DisguisePermissionsTest {
createPermissions("Disguise", false, "libsdisguises.*.Firework").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
Assert.assertFalse("The firework disguise should not be allowed",
createPermissions("Disguise", false, "libsdisguises.*.*", "-libsdisguises.*.misc").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
createPermissions("Disguise", false, "libsdisguises.*.*", "-libsdisguises.*.misc").isAllowedDisguise(
DisguiseParser.getDisguisePerm("Firework")));
Assert.assertTrue("The firework disguise should be allowed",
createPermissions("Disguise", false, "libsdisguises.disguise.*", "-libsdisguises.*.*").isAllowedDisguise(
@ -91,9 +96,11 @@ public class DisguisePermissionsTest {
@Test
public void testInheritedPermissions() {
testInheritedPermissions(createPermissions("Disguise", false, "libsdisguises.disguise.animal.setBaby", "-libsdisguises.disguise.sheep.setBaby"));
testInheritedPermissions(
createPermissions("Disguise", false, "libsdisguises.disguise.animal.setBaby", "-libsdisguises.disguise.sheep.setBaby"));
testInheritedPermissions(createPermissions("Disguise", false, "libsdisguises.disguise.animal.setBaby", "libsdisguises.disguise.sheep.-setBaby"));
testInheritedPermissions(
createPermissions("Disguise", false, "libsdisguises.disguise.animal.setBaby", "libsdisguises.disguise.sheep.-setBaby"));
}
private void testInheritedPermissions(DisguisePermissions permissions) {
@ -107,20 +114,22 @@ public class DisguisePermissionsTest {
Assert.assertFalse("The sheep disguise should not be allowed with setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep"), Collections.singletonList("setBaby")));
Assert.assertFalse("The firework disguise should not be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
Assert.assertFalse("The firework disguise should not be allowed",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
}
@Test
public void testNegatedPermissions() {
DisguisePermissions permissions =
createPermissions("Disguise", false, "libsdisguises.disguise.sheep", "-libsdisguises.disguise.cow.setSprinting", "-libsdisguises.disguise.donkey",
"-libsdisguises.disguise.horse.setRearing", "libsdisguises.disguise.horse");
createPermissions("Disguise", false, "libsdisguises.disguise.sheep", "-libsdisguises.disguise.cow.setSprinting",
"-libsdisguises.disguise.donkey", "-libsdisguises.disguise.horse.setRearing", "libsdisguises.disguise.horse");
Assert.assertFalse("The cow disguise should not be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
Assert.assertTrue("The sheep disguise should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")));
Assert.assertFalse("The donkey disguise should not be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Donkey")));
Assert.assertFalse("The donkey disguise should not be allowed",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Donkey")));
Assert.assertTrue("The horse disguise should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse")));
@ -133,8 +142,9 @@ public class DisguisePermissionsTest {
@Test
public void testMultiDisguises() {
DisguisePermissions permissions = createPermissions("Disguise", false, "libsdisguises.disguise.cow.setBaby", "libsdisguises.disguise.cow.setHealth",
"libsdisguises.disguise.cow.-setBurning");
DisguisePermissions permissions =
createPermissions("Disguise", false, "libsdisguises.disguise.cow.setBaby", "libsdisguises.disguise.cow.setHealth",
"libsdisguises.disguise.cow.-setBurning");
Assert.assertTrue("The cow disguise should be able to use setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBaby")));
@ -170,7 +180,8 @@ public class DisguisePermissionsTest {
Assert.assertTrue("The cow disguise should be allowed", permissions.isAllowedDisguise(cow));
Assert.assertTrue("The cow disguise should be allowed with options", permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setBurning")));
Assert.assertTrue("The cow disguise should be allowed with options",
permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setBurning")));
Assert.assertFalse("The cow disguise should not be allowed with options setSprinting",
permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setSprinting")));
@ -183,9 +194,11 @@ public class DisguisePermissionsTest {
Assert.assertFalse("The sheep disguise should not be allowed with options",
permissions.isAllowedDisguise(sheep, Arrays.asList("setBaby", "setBurning")));
Assert.assertTrue("The sheep disguise should be allowed setColor", permissions.isAllowedDisguise(sheep, Collections.singletonList("setColor")));
Assert.assertTrue("The sheep disguise should be allowed setColor",
permissions.isAllowedDisguise(sheep, Collections.singletonList("setColor")));
Assert.assertTrue("The sheep disguise should be allowed setSprinting", permissions.isAllowedDisguise(sheep, Collections.singletonList("setSprinting")));
Assert.assertTrue("The sheep disguise should be allowed setSprinting",
permissions.isAllowedDisguise(sheep, Collections.singletonList("setSprinting")));
Assert.assertFalse("The sheep disguise should not be allowed setColor and setBaby",
permissions.isAllowedDisguise(sheep, Arrays.asList("setColor", "setBaby")));
@ -201,9 +214,9 @@ public class DisguisePermissionsTest {
@Test
public void testDisguiseParameters() {
HashMap<String, HashMap<String, Boolean>> disguiseOptions =
DisguisePermissions.getDisguiseOptions(createPermissionsHolder(false, "libsdisguises.options.disguise.falling_block.setblock.stone"), "Disguise",
new DisguisePerm(DisguiseType.FALLING_BLOCK));
HashMap<String, HashMap<String, Boolean>> disguiseOptions = DisguisePermissions.getDisguiseOptions(
createPermissionsHolder(false, "libsdisguises.options.disguise.falling_block.setblock.stone"), "Disguise",
new DisguisePerm(DisguiseType.FALLING_BLOCK));
Assert.assertTrue("They should be allowed to use true as a disguise option on setBurning",
DisguisePermissions.hasPermissionOption(disguiseOptions, "setBurning", "true"));
@ -217,8 +230,8 @@ public class DisguisePermissionsTest {
@Test
public void testDisguiseValidWorksToGiveMore() {
DisguisePermissions permissions =
createPermissions("Disguise", false, "libsdisguises.disguise.falling_block.setCustomName", "libsdisguises.disguise.valid.falling_block.setblock");
DisguisePermissions permissions = createPermissions("Disguise", false, "libsdisguises.disguise.falling_block.setCustomName",
"libsdisguises.disguise.valid.falling_block.setblock");
Assert.assertFalse("The falling block disguise should not allow setBurning",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBurning")));
@ -234,7 +247,8 @@ public class DisguisePermissionsTest {
public void testDisguiseValidDoesntGiveExtra() {
DisguisePermissions permissions = createPermissions("Disguise", false, "libsdisguises.disguise.valid.falling_block.setblock");
Assert.assertFalse("The falling block disguise should not be allowed", permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK)));
Assert.assertFalse("The falling block disguise should not be allowed",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK)));
Assert.assertFalse("The falling block disguise should not allow setBurning",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBurning")));
@ -248,7 +262,8 @@ public class DisguisePermissionsTest {
public void testCustomDisguisePermissions() {
DisguiseConfig.getCustomDisguises().put(new DisguisePerm(DisguiseType.BEE, "babybee"), "bee setbaby");
DisguisePermissions permissions = createPermissions("disguise", false, "libsdisguises.disguise.bee.-*", "libsdisguises.disguise.babybee.nooptions");
DisguisePermissions permissions =
createPermissions("disguise", false, "libsdisguises.disguise.bee.-*", "libsdisguises.disguise.babybee.nooptions");
Assert.assertNotNull("The custom disguise babybee should exist", DisguiseParser.getDisguisePerm("babybee"));
@ -260,9 +275,11 @@ public class DisguisePermissionsTest {
Assert.assertFalse("They should not be allowed to disguise as a burning bee",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE), Collections.singletonList("setburning")));
Assert.assertFalse("They should not be allowed to disguise as a slime", permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.SLIME)));
Assert.assertFalse("They should not be allowed to disguise as a slime",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.SLIME)));
Assert.assertTrue("They should be allowed to disguise as babybee", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee")));
Assert.assertTrue("They should be allowed to disguise as babybee",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee")));
Assert.assertFalse("They should not be allowed to disguise as babybee and use setbaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee"), Collections.singletonList("setbaby")));
@ -275,8 +292,9 @@ public class DisguisePermissionsTest {
DisguiseConfig.setExplicitDisguisePermissions(true);
DisguisePermissions permissions =
createPermissions("Disguise", false, "libsdisguises.disguise.animal", "libsdisguises.disguise.zombie", "libsdisguises.disguise.skeleton.*",
"libsdisguises.disguise.wither.setburning", "libsdisguises.disguise.silverfish.-setburning");
createPermissions("Disguise", false, "libsdisguises.disguise.animal", "libsdisguises.disguise.zombie",
"libsdisguises.disguise.skeleton.*", "libsdisguises.disguise.wither.setburning",
"libsdisguises.disguise.silverfish.-setburning");
Assert.assertTrue("The cow disguise should be usable", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
@ -288,7 +306,8 @@ public class DisguisePermissionsTest {
Assert.assertFalse("The zombie disguise should not be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Zombie"), Collections.singletonList("setBurning")));
Assert.assertTrue("The skeleton disguise should be usable", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton")));
Assert.assertTrue("The skeleton disguise should be usable",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton")));
Assert.assertTrue("The skeleton disguise should be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton"), Collections.singletonList("setBurning")));
@ -301,7 +320,8 @@ public class DisguisePermissionsTest {
Assert.assertFalse("The wither disguise should not be able to use setSprinting",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither"), Collections.singletonList("setSprinting")));
Assert.assertTrue("The silverfish disguise should be usable", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish")));
Assert.assertTrue("The silverfish disguise should be usable",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish")));
Assert.assertFalse("The silverfish disguise should not be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish"), Collections.singletonList("setBurning")));

View File

@ -75,7 +75,8 @@ public interface ReflectionManagerAbstract {
Enum getEnumDirection(int direction);
PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible, EnumWrappers.PlayerInfoAction... actions);
PacketContainer getTabListPacket(String displayName, WrappedGameProfile gameProfile, boolean nameVisible,
EnumWrappers.PlayerInfoAction... actions);
Object getNmsEntity(Entity entity);