diff --git a/pom.xml b/pom.xml
index c6283de7..14cf9d06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,7 +98,7 @@
9.0
1.18.16
master-SNAPSHOT
- [1.16,1.16.5]
+ [1.17,]
4.13.1
[1.16,]
1.12-SNAPSHOT
diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java
index 8533895c..cfa0f1dc 100644
--- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java
+++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java
@@ -105,7 +105,9 @@ public class LibsDisguises extends JavaPlugin {
}
} catch (Throwable throwable) {
try {
- getUpdateChecker().doUpdate();
+ if (isNumberedBuild()) {
+ getUpdateChecker().doUpdate();
+ }
} catch (Throwable t) {
getLogger().severe("Failed to even do a forced update");
}
@@ -256,7 +258,9 @@ public class LibsDisguises extends JavaPlugin {
new MetricsInitalizer();
} catch (Throwable throwable) {
try {
- getUpdateChecker().doUpdate();
+ if (isNumberedBuild()) {
+ getUpdateChecker().doUpdate();
+ }
} catch (Throwable t) {
getLogger().severe("Failed to even do a forced update");
}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
index b4e49c6f..c75187b8 100644
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
@@ -738,13 +738,13 @@ public abstract class Disguise {
}
if (getInternalArmorstandIds().length > 0) {
- PacketContainer packet = new PacketContainer(Server.ENTITY_DESTROY);
- packet.getIntegerArrays().write(0, getInternalArmorstandIds());
-
try {
- for (Player player : getEntity().getWorld().getPlayers()) {
- ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
+ for (PacketContainer packet : DisguiseUtilities.getDestroyPackets(getInternalArmorstandIds())) {
+ for (Player player : getEntity().getWorld().getPlayers()) {
+ ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
+ }
}
+
} catch (InvocationTargetException e) {
e.printStackTrace();
}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
index 271c2586..09cf6d21 100644
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
@@ -7,6 +7,7 @@ import me.libraryaddict.disguise.utilities.translations.TranslateType;
import org.apache.commons.lang.StringUtils;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
+import org.omg.CORBA.UNKNOWN;
import java.util.Locale;
@@ -17,6 +18,8 @@ public enum DisguiseType {
ARROW(60, 0),
+ @NmsAddedIn(NmsVersion.v1_17) AXOLOTL,
+
BAT,
@NmsAddedIn(NmsVersion.v1_15) BEE,
@@ -83,6 +86,12 @@ public enum DisguiseType {
GIANT,
+ @NmsAddedIn(NmsVersion.v1_17) GLOW_ITEM_FRAME,
+
+ @NmsAddedIn(NmsVersion.v1_17) GLOW_SQUID,
+
+ @NmsAddedIn(NmsVersion.v1_17) GOAT,
+
GUARDIAN,
@NmsAddedIn(NmsVersion.v1_16) HOGLIN,
@@ -105,6 +114,8 @@ public enum DisguiseType {
MAGMA_CUBE,
+ @NmsAddedIn(NmsVersion.v1_17) MARKER,
+
MINECART(10),
MINECART_CHEST(10, 1),
@@ -285,8 +296,7 @@ public enum DisguiseType {
} else {
setEntityType(EntityType.valueOf(name()));
}
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
}
}
@@ -341,13 +351,11 @@ public enum DisguiseType {
}
public boolean isMisc() {
- return this == DisguiseType.MODDED_MISC ||
- (!isCustom() && getEntityType() != null && !getEntityType().isAlive());
+ return this == DisguiseType.MODDED_MISC || (!isCustom() && getEntityType() != null && !getEntityType().isAlive());
}
public boolean isMob() {
- return this == DisguiseType.MODDED_LIVING ||
- (!isCustom() && getEntityType() != null && getEntityType().isAlive() && !isPlayer());
+ return this == DisguiseType.MODDED_LIVING || (!isCustom() && getEntityType() != null && getEntityType().isAlive() && !isPlayer());
}
public boolean isPlayer() {
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java
index 7b992bd6..944b7955 100644
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java
@@ -33,32 +33,28 @@ public class MetaIndex {
/**
* The color of the Area Effect Cloud as RGB integer
*/
- public static MetaIndex AREA_EFFECT_CLOUD_COLOR =
- new MetaIndex<>(AreaEffectCloudWatcher.class, 1, Color.BLACK.asRGB());
+ public static MetaIndex AREA_EFFECT_CLOUD_COLOR = new MetaIndex<>(AreaEffectCloudWatcher.class, 1, Color.BLACK.asRGB());
/**
* Ignore radius and show effect as single point, not area
*/
- public static MetaIndex AREA_EFFECT_IGNORE_RADIUS =
- new MetaIndex<>(AreaEffectCloudWatcher.class, 2, false);
+ public static MetaIndex AREA_EFFECT_IGNORE_RADIUS = new MetaIndex<>(AreaEffectCloudWatcher.class, 2, false);
/**
* The type of particle to display
*/
@NmsAddedIn(NmsVersion.v1_13)
- public static MetaIndex AREA_EFFECT_PARTICLE = new MetaIndex<>(AreaEffectCloudWatcher.class, 3,
- NmsVersion.v1_13.isSupported() ? WrappedParticle.create(Particle.SPELL_MOB, null) : null);
+ public static MetaIndex 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 AREA_EFFECT_PARTICLE_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 3, 0);
@NmsRemovedIn(NmsVersion.v1_13)
- public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_1_OLD =
- new MetaIndex<>(AreaEffectCloudWatcher.class, 4, 0);
+ public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_1_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 4, 0);
@NmsRemovedIn(NmsVersion.v1_13)
- public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_2_OLD =
- new MetaIndex<>(AreaEffectCloudWatcher.class, 5, 0);
+ public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_2_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 5, 0);
/**
* The size of the area
@@ -68,26 +64,22 @@ public class MetaIndex {
/**
* Armorstand body eular vector
*/
- public static MetaIndex ARMORSTAND_BODY =
- new MetaIndex<>(ArmorStandWatcher.class, 2, new Vector3F(0, 0, 0));
+ public static MetaIndex ARMORSTAND_BODY = new MetaIndex<>(ArmorStandWatcher.class, 2, new Vector3F(0, 0, 0));
/**
* Armorstand head eular vector
*/
- public static MetaIndex ARMORSTAND_HEAD =
- new MetaIndex<>(ArmorStandWatcher.class, 1, new Vector3F(0, 0, 0));
+ public static MetaIndex ARMORSTAND_HEAD = new MetaIndex<>(ArmorStandWatcher.class, 1, new Vector3F(0, 0, 0));
/**
* Armorstand left arm eular vector
*/
- public static MetaIndex ARMORSTAND_LEFT_ARM =
- new MetaIndex<>(ArmorStandWatcher.class, 3, new Vector3F(-10, 0, -10));
+ public static MetaIndex ARMORSTAND_LEFT_ARM = new MetaIndex<>(ArmorStandWatcher.class, 3, new Vector3F(-10, 0, -10));
/**
* Armorstand left leg eular vector
*/
- public static MetaIndex ARMORSTAND_LEFT_LEG =
- new MetaIndex<>(ArmorStandWatcher.class, 5, new Vector3F(-1, 0, -1));
+ public static MetaIndex ARMORSTAND_LEFT_LEG = new MetaIndex<>(ArmorStandWatcher.class, 5, new Vector3F(-1, 0, -1));
/**
* Armorstand metadata
@@ -97,14 +89,12 @@ public class MetaIndex {
/**
* Armorstand right arm eular vector
*/
- public static MetaIndex ARMORSTAND_RIGHT_ARM =
- new MetaIndex<>(ArmorStandWatcher.class, 4, new Vector3F(-15, 0, 10));
+ public static MetaIndex ARMORSTAND_RIGHT_ARM = new MetaIndex<>(ArmorStandWatcher.class, 4, new Vector3F(-15, 0, 10));
/**
* Armorstand right leg eular vector
*/
- public static MetaIndex ARMORSTAND_RIGHT_LEG =
- new MetaIndex<>(ArmorStandWatcher.class, 6, new Vector3F(1, 0, 1));
+ public static MetaIndex ARMORSTAND_RIGHT_LEG = new MetaIndex<>(ArmorStandWatcher.class, 6, new Vector3F(1, 0, 1));
/**
* If the arrow is a critical strike
@@ -121,6 +111,15 @@ public class MetaIndex {
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex ARROW_PIERCE_LEVEL = new MetaIndex<>(ArrowWatcher.class, 2, (byte) 0);
+ @NmsAddedIn(NmsVersion.v1_17)
+ public static MetaIndex AXOLOTL_VARIENT = new MetaIndex<>(AxolotlWatcher.class, 0, 0);
+
+ @NmsAddedIn(NmsVersion.v1_17)
+ public static MetaIndex AXOLOTL_PLAYING_DEAD = new MetaIndex<>(AxolotlWatcher.class, 1, false);
+
+ @NmsAddedIn(NmsVersion.v1_17)
+ public static MetaIndex AXOLOTL_FROM_BUCKET = new MetaIndex<>(AxolotlWatcher.class, 2, false);
+
/**
* If the bat is hanging, false/true state
*/
@@ -188,8 +187,7 @@ public class MetaIndex {
/**
* No visible effect
*/
- public static MetaIndex DOLPHIN_TREASURE_POS =
- new MetaIndex<>(DolphinWatcher.class, 0, BlockPosition.ORIGIN);
+ public static MetaIndex DOLPHIN_TREASURE_POS = new MetaIndex<>(DolphinWatcher.class, 0, BlockPosition.ORIGIN);
/**
* No visible effect
*/
@@ -203,11 +201,9 @@ public class MetaIndex {
/**
* The itemstack of the dropped item, must be set
*/
- public static MetaIndex DROPPED_ITEM =
- new MetaIndex<>(DroppedItemWatcher.class, 0, new ItemStack(Material.AIR));
+ public static MetaIndex DROPPED_ITEM = new MetaIndex<>(DroppedItemWatcher.class, 0, new ItemStack(Material.AIR));
- public static MetaIndex> ENDER_CRYSTAL_BEAM =
- new MetaIndex<>(EnderCrystalWatcher.class, 0, Optional.empty());
+ public static MetaIndex> ENDER_CRYSTAL_BEAM = new MetaIndex<>(EnderCrystalWatcher.class, 0, Optional.empty());
/**
* If the ender crystal has a plate
@@ -217,8 +213,7 @@ public class MetaIndex {
public static MetaIndex ENDER_DRAGON_PHASE = new MetaIndex<>(EnderDragonWatcher.class, 0, 10);
@NmsAddedIn(NmsVersion.v1_14)
- public static MetaIndex ENDER_SIGNAL_ITEM =
- new MetaIndex<>(EnderSignalWatcher.class, 0, new ItemStack(Material.AIR));
+ public static MetaIndex ENDER_SIGNAL_ITEM = new MetaIndex<>(EnderSignalWatcher.class, 0, new ItemStack(Material.AIR));
/**
* If the enderman is screaming
@@ -231,8 +226,7 @@ public class MetaIndex {
/**
* What block the enderman is holding
*/
- public static MetaIndex> ENDERMAN_ITEM =
- new MetaIndex<>(EndermanWatcher.class, 0, Optional.empty());
+ public static MetaIndex> ENDERMAN_ITEM = new MetaIndex<>(EndermanWatcher.class, 0, Optional.empty());
public static MetaIndex ENTITY_AIR_TICKS = new MetaIndex<>(FlagWatcher.class, 1, 300);
@@ -240,8 +234,7 @@ public class MetaIndex {
* The custom name of the entity, empty if not set
*/
@NmsAddedIn(NmsVersion.v1_13)
- public static MetaIndex> ENTITY_CUSTOM_NAME =
- new MetaIndex<>(FlagWatcher.class, 2, Optional.empty());
+ public static MetaIndex> ENTITY_CUSTOM_NAME = new MetaIndex<>(FlagWatcher.class, 2, Optional.empty());
/**
* The custom name of the entity, empty if not set
*/
@@ -275,15 +268,16 @@ public class MetaIndex {
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex ENTITY_POSE = new MetaIndex<>(FlagWatcher.class, 6, EntityPose.STANDING);
- public static MetaIndex FALLING_BLOCK_POSITION =
- new MetaIndex<>(FallingBlockWatcher.class, 0, BlockPosition.ORIGIN);
+ @NmsAddedIn(NmsVersion.v1_16)
+ public static MetaIndex ENTITY_TICKS_FROZEN = new MetaIndex<>(FlagWatcher.class, 7, 0);
+
+ public static MetaIndex FALLING_BLOCK_POSITION = new MetaIndex<>(FallingBlockWatcher.class, 0, BlockPosition.ORIGIN);
@NmsAddedIn(NmsVersion.v1_14)
- public static MetaIndex FIREBALL_ITEM =
- new MetaIndex<>(FireballWatcher.class, 0, new ItemStack(Material.AIR));
+ public static MetaIndex FIREBALL_ITEM = new MetaIndex<>(FireballWatcher.class, 0, new ItemStack(Material.AIR));
- public static MetaIndex FIREWORK_ITEM = new MetaIndex<>(FireworkWatcher.class, 0,
- new ItemStack(NmsVersion.v1_13.isSupported() ? Material.FIREWORK_ROCKET : Material.AIR));
+ public static MetaIndex FIREWORK_ITEM =
+ new MetaIndex<>(FireworkWatcher.class, 0, new ItemStack(NmsVersion.v1_13.isSupported() ? Material.FIREWORK_ROCKET : Material.AIR));
public static MetaIndex FISH_FROM_BUCKET = new MetaIndex<>(FishWatcher.class, 0, false);
@@ -291,8 +285,7 @@ public class MetaIndex {
public static MetaIndex FIREWORK_ATTACHED_ENTITY_OLD = new MetaIndex<>(FireworkWatcher.class, 1, 0);
@NmsAddedIn(NmsVersion.v1_14)
- public static MetaIndex FIREWORK_ATTACHED_ENTITY =
- new MetaIndex<>(FireworkWatcher.class, 1, OptionalInt.empty());
+ public static MetaIndex FIREWORK_ATTACHED_ENTITY = new MetaIndex<>(FireworkWatcher.class, 1, OptionalInt.empty());
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex FIREWORK_SHOT_AT_ANGLE = new MetaIndex<>(FireworkWatcher.class, 2, false);
@@ -322,6 +315,12 @@ public class MetaIndex {
*/
public static MetaIndex GHAST_AGRESSIVE = new MetaIndex<>(GhastWatcher.class, 0, false);
+ @NmsAddedIn(NmsVersion.v1_17)
+ public static MetaIndex GLOW_SQUID_DARK_TICKS_REMAINING = new MetaIndex<>(GlowSquidWatcher.class, 0, 0);
+
+ @NmsAddedIn(NmsVersion.v1_17)
+ public static MetaIndex GOAT_SCREAMING = new MetaIndex<>(GoatWatcher.class, 0, false);
+
/**
* Switch between the guardian spikes enabled/disabled
*/
@@ -338,8 +337,7 @@ public class MetaIndex {
/**
* If horse has chest, set for donkey
*/
- public static MetaIndex HORSE_CHESTED_CARRYING_CHEST =
- new MetaIndex<>(ChestedHorseWatcher.class, 0, false);
+ public static MetaIndex HORSE_CHESTED_CARRYING_CHEST = new MetaIndex<>(ChestedHorseWatcher.class, 0, false);
@NmsRemovedIn(NmsVersion.v1_14)
public static MetaIndex HORSE_ARMOR = new MetaIndex<>(HorseWatcher.class, 1, 0);
@@ -356,8 +354,7 @@ public class MetaIndex {
/**
* Owner of the horse, no visual effect
*/
- public static MetaIndex> HORSE_OWNER =
- new MetaIndex<>(AbstractHorseWatcher.class, 1, Optional.empty());
+ public static MetaIndex> HORSE_OWNER = new MetaIndex<>(AbstractHorseWatcher.class, 1, Optional.empty());
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex ILLAGER_SPELL = new MetaIndex<>(IllagerWizardWatcher.class, 0, (byte) 0);
@@ -375,8 +372,7 @@ public class MetaIndex {
/**
* The itemstack inside the itemframe
*/
- public static MetaIndex ITEMFRAME_ITEM =
- new MetaIndex<>(ItemFrameWatcher.class, 0, new ItemStack(Material.AIR));
+ public static MetaIndex ITEMFRAME_ITEM = new MetaIndex<>(ItemFrameWatcher.class, 0, new ItemStack(Material.AIR));
/**
* The itemstack rotation inside the itemframe
@@ -415,8 +411,7 @@ public class MetaIndex {
public static MetaIndex LIVING_STINGS = new MetaIndex<>(LivingWatcher.class, 5, 0);
@NmsAddedIn(NmsVersion.v1_14)
- public static MetaIndex> LIVING_BED_POSITION =
- new MetaIndex<>(LivingWatcher.class, 6, Optional.empty());
+ public static MetaIndex> LIVING_BED_POSITION = new MetaIndex<>(LivingWatcher.class, 6, Optional.empty());
/**
* If there is no carpet, -1. Otherwise it's a color enum value
@@ -525,11 +520,9 @@ public class MetaIndex {
public static MetaIndex PLAYER_SKIN = new MetaIndex<>(PlayerWatcher.class, 2, (byte) 127);
- public static MetaIndex PLAYER_LEFT_SHOULDER_ENTITY =
- new MetaIndex<>(PlayerWatcher.class, 4, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
+ public static MetaIndex PLAYER_LEFT_SHOULDER_ENTITY = new MetaIndex<>(PlayerWatcher.class, 4, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
- public static MetaIndex PLAYER_RIGHT_SHOULDER_ENTITY =
- new MetaIndex<>(PlayerWatcher.class, 5, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
+ public static MetaIndex PLAYER_RIGHT_SHOULDER_ENTITY = new MetaIndex<>(PlayerWatcher.class, 5, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None"));
public static MetaIndex POLAR_BEAR_STANDING = new MetaIndex<>(PolarBearWatcher.class, 0, false);
@@ -542,8 +535,8 @@ public class MetaIndex {
public static MetaIndex SHEEP_WOOL = new MetaIndex<>(SheepWatcher.class, 0, (byte) 0);
- public static MetaIndex> SHULKER_ATTACHED =
- new MetaIndex<>(ShulkerWatcher.class, 1, Optional.empty());
+ @NmsRemovedIn(NmsVersion.v1_17)
+ public static MetaIndex> SHULKER_ATTACHED = new MetaIndex<>(ShulkerWatcher.class, 1, Optional.empty());
public static MetaIndex SHULKER_COLOR = new MetaIndex<>(ShulkerWatcher.class, 3, (byte) 16);
@@ -552,7 +545,10 @@ public class MetaIndex {
public static MetaIndex SHULKER_PEEKING = new MetaIndex<>(ShulkerWatcher.class, 2, (byte) 0);
@NmsRemovedIn(NmsVersion.v1_14)
- public static MetaIndex SKELETON_SWING_ARMS = new MetaIndex<>(SkeletonWatcher.class, 0, false);
+ public static MetaIndex SKELETON_SWING_ARMS = new MetaIndex<>(AbstractSkeletonWatcher.class, 0, false);
+
+ @NmsAddedIn(NmsVersion.v1_17)
+ public static MetaIndex SKELETON_CONVERTING_STRAY = new MetaIndex<>(SkeletonWatcher.class, 0, false);
public static MetaIndex SLIME_SIZE = new MetaIndex<>(SlimeWatcher.class, 0, 1);
@@ -569,17 +565,14 @@ public class MetaIndex {
public static MetaIndex SPIDER_CLIMB = new MetaIndex<>(SpiderWatcher.class, 0, (byte) 0);
- public static MetaIndex SPLASH_POTION_ITEM =
- new MetaIndex<>(SplashPotionWatcher.class, 0, new ItemStack(Material.SPLASH_POTION));
+ public static MetaIndex SPLASH_POTION_ITEM = new MetaIndex<>(SplashPotionWatcher.class, 0, new ItemStack(Material.SPLASH_POTION));
public static MetaIndex TAMEABLE_META = new MetaIndex<>(TameableWatcher.class, 0, (byte) 0);
- public static MetaIndex> TAMEABLE_OWNER =
- new MetaIndex<>(TameableWatcher.class, 1, Optional.empty());
+ public static MetaIndex> TAMEABLE_OWNER = new MetaIndex<>(TameableWatcher.class, 1, Optional.empty());
@NmsAddedIn(NmsVersion.v1_14)
- public static MetaIndex THROWABLE_ITEM =
- new MetaIndex<>(ThrowableWatcher.class, 0, new ItemStack(Material.AIR));
+ public static MetaIndex THROWABLE_ITEM = new MetaIndex<>(ThrowableWatcher.class, 0, new ItemStack(Material.AIR));
public static MetaIndex TIPPED_ARROW_COLOR = new MetaIndex<>(TippedArrowWatcher.class, 0, -1);
@@ -592,15 +585,13 @@ public class MetaIndex {
public static MetaIndex TROPICAL_FISH_VARIANT = new MetaIndex<>(TropicalFishWatcher.class, 0, 0);
- public static MetaIndex TURTLE_HOME_POSITION =
- new MetaIndex<>(TurtleWatcher.class, 0, BlockPosition.ORIGIN);
+ public static MetaIndex TURTLE_HOME_POSITION = new MetaIndex<>(TurtleWatcher.class, 0, BlockPosition.ORIGIN);
public static MetaIndex TURTLE_HAS_EGG = new MetaIndex<>(TurtleWatcher.class, 1, false);
public static MetaIndex TURTLE_UNKNOWN_3 = new MetaIndex<>(TurtleWatcher.class, 2, false);
- public static MetaIndex TURTLE_TRAVEL_POSITION =
- new MetaIndex<>(TurtleWatcher.class, 3, BlockPosition.ORIGIN);
+ public static MetaIndex TURTLE_TRAVEL_POSITION = new MetaIndex<>(TurtleWatcher.class, 3, BlockPosition.ORIGIN);
public static MetaIndex TURTLE_UNKNOWN_1 = new MetaIndex<>(TurtleWatcher.class, 4, false);
@@ -616,8 +607,7 @@ public class MetaIndex {
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex VILLAGER_DATA = new MetaIndex<>(VillagerWatcher.class, 0,
- NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) :
- null);
+ NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) : null);
public static MetaIndex WITCH_AGGRESSIVE = new MetaIndex<>(WitchWatcher.class, 0, false);
@@ -655,13 +645,11 @@ public class MetaIndex {
public static MetaIndex ZOMBIE_PLACEHOLDER = new MetaIndex<>(ZombieWatcher.class, 1, 0);
@NmsRemovedIn(NmsVersion.v1_14)
- public static MetaIndex ZOMBIE_VILLAGER_PROFESSION_OLD =
- new MetaIndex<>(ZombieVillagerWatcher.class, 1, 0);
+ public static MetaIndex ZOMBIE_VILLAGER_PROFESSION_OLD = new MetaIndex<>(ZombieVillagerWatcher.class, 1, 0);
@NmsAddedIn(NmsVersion.v1_14)
public static MetaIndex ZOMBIE_VILLAGER_PROFESSION = new MetaIndex<>(ZombieVillagerWatcher.class, 1,
- NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) :
- null);
+ NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) : null);
/**
* Shown for villager conversion
@@ -711,8 +699,7 @@ public class MetaIndex {
HashMap maxValues = new HashMap<>();
for (MetaIndex type : values()) {
- if (maxValues.containsKey(type.getFlagWatcher()) &&
- maxValues.get(type.getFlagWatcher()) > type.getIndex()) {
+ if (maxValues.containsKey(type.getFlagWatcher()) && maxValues.get(type.getFlagWatcher()) > type.getIndex()) {
continue;
}
@@ -735,10 +722,8 @@ public class MetaIndex {
}
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;
}
@@ -749,15 +734,14 @@ public class MetaIndex {
continue;
}
- DisguiseUtilities.getLogger()
- .severe(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
+ DisguiseUtilities.getLogger().severe(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
}
}
}
public String toString() {
- return LibsMsg.META_INFO.get(getName(this), getFlagWatcher().getSimpleName(), getIndex(),
- getDefault().getClass().getSimpleName(), DisguiseUtilities.getGson().toJson(getDefault()));
+ return LibsMsg.META_INFO.get(getName(this), getFlagWatcher().getSimpleName(), getIndex(), getDefault().getClass().getSimpleName(),
+ DisguiseUtilities.getGson().toJson(getDefault()));
}
/**
@@ -923,15 +907,12 @@ public class MetaIndex {
}
for (MetaIndex metaIndex : values()) {
- if (metaIndex == null || metaIndex.getFlagWatcher() != index.getFlagWatcher() ||
- metaIndex.getIndex() != index.getIndex()) {
+ if (metaIndex == null || metaIndex.getFlagWatcher() != index.getFlagWatcher() || metaIndex.getIndex() != index.getIndex()) {
continue;
}
- DisguiseUtilities.getLogger()
- .severe("MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " +
- metaIndex.getIndex() + " has already registered this! (" + metaIndex.getDefault() +
- "," + index.getDefault() + ")");
+ DisguiseUtilities.getLogger().severe("MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " + metaIndex.getIndex() +
+ " has already registered this! (" + metaIndex.getDefault() + "," + index.getDefault() + ")");
}
values()[i] = metaIndexes[a];
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AbstractSkeletonWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AbstractSkeletonWatcher.java
new file mode 100644
index 00000000..789a076a
--- /dev/null
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AbstractSkeletonWatcher.java
@@ -0,0 +1,29 @@
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.MetaIndex;
+import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
+import me.libraryaddict.disguise.utilities.reflection.NmsRemovedIn;
+import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
+
+/**
+ * @author Navid
+ */
+public abstract class AbstractSkeletonWatcher extends InsentientWatcher {
+ public AbstractSkeletonWatcher(Disguise disguise) {
+ super(disguise);
+ }
+
+ @Deprecated
+ @NmsRemovedIn(NmsVersion.v1_14)
+ public boolean isSwingArms() {
+ return getData(MetaIndex.SKELETON_SWING_ARMS);
+ }
+
+ @Deprecated
+ @NmsRemovedIn(NmsVersion.v1_14)
+ public void setSwingArms(boolean swingingArms) {
+ setData(MetaIndex.SKELETON_SWING_ARMS, swingingArms);
+ sendData(MetaIndex.SKELETON_SWING_ARMS);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AxolotlWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AxolotlWatcher.java
new file mode 100644
index 00000000..cf965cde
--- /dev/null
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AxolotlWatcher.java
@@ -0,0 +1,32 @@
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.MetaIndex;
+import org.bukkit.entity.Axolotl;
+
+/**
+ * Created by libraryaddict on 15/06/2021.
+ */
+public class AxolotlWatcher extends AgeableWatcher {
+ public AxolotlWatcher(Disguise disguise) {
+ super(disguise);
+ }
+
+ public boolean isPlayingDead() {
+ return getData(MetaIndex.AXOLOTL_PLAYING_DEAD);
+ }
+
+ public void setPlayingDead(boolean playingDead) {
+ setData(MetaIndex.AXOLOTL_PLAYING_DEAD, playingDead);
+ sendData(MetaIndex.AXOLOTL_PLAYING_DEAD);
+ }
+
+ public Axolotl.Variant getVarient() {
+ return Axolotl.Variant.values()[getData(MetaIndex.AXOLOTL_VARIENT)];
+ }
+
+ public void setVarient(Axolotl.Variant varient) {
+ setData(MetaIndex.AXOLOTL_VARIENT, varient.ordinal());
+ sendData(MetaIndex.AXOLOTL_VARIENT);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GlowSquidWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GlowSquidWatcher.java
new file mode 100644
index 00000000..e51a6063
--- /dev/null
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GlowSquidWatcher.java
@@ -0,0 +1,22 @@
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.MetaIndex;
+
+/**
+ * Created by libraryaddict on 15/06/2021.
+ */
+public class GlowSquidWatcher extends SquidWatcher {
+ public GlowSquidWatcher(Disguise disguise) {
+ super(disguise);
+ }
+
+ public int getDarkTicksRemaining() {
+ return getData(MetaIndex.GLOW_SQUID_DARK_TICKS_REMAINING);
+ }
+
+ public void setDarkTicksRemaining(int ticks) {
+ setData(MetaIndex.GLOW_SQUID_DARK_TICKS_REMAINING, ticks);
+ sendData(MetaIndex.GLOW_SQUID_DARK_TICKS_REMAINING);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GoatWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GoatWatcher.java
new file mode 100644
index 00000000..35844440
--- /dev/null
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GoatWatcher.java
@@ -0,0 +1,22 @@
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.MetaIndex;
+
+/**
+ * Created by libraryaddict on 15/06/2021.
+ */
+public class GoatWatcher extends AgeableWatcher {
+ public GoatWatcher(Disguise disguise) {
+ super(disguise);
+ }
+
+ public boolean isScreaming() {
+ return getData(MetaIndex.GOAT_SCREAMING);
+ }
+
+ public void setScreaming(boolean screaming) {
+ setData(MetaIndex.GOAT_SCREAMING, screaming);
+ sendData(MetaIndex.GOAT_SCREAMING);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.java
index a4affdb6..06cf074e 100644
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.java
@@ -1,28 +1,26 @@
-package me.libraryaddict.disguise.disguisetypes.watchers;
-
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.MetaIndex;
-import me.libraryaddict.disguise.utilities.reflection.NmsRemovedIn;
-import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
-
-/**
- * @author Navid
- */
-public class SkeletonWatcher extends InsentientWatcher {
- public SkeletonWatcher(Disguise disguise) {
- super(disguise);
- }
-
- @Deprecated
- @NmsRemovedIn(NmsVersion.v1_14)
- public boolean isSwingArms() {
- return getData(MetaIndex.SKELETON_SWING_ARMS);
- }
-
- @Deprecated
- @NmsRemovedIn(NmsVersion.v1_14)
- public void setSwingArms(boolean swingingArms) {
- setData(MetaIndex.SKELETON_SWING_ARMS, swingingArms);
- sendData(MetaIndex.SKELETON_SWING_ARMS);
- }
-}
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.MetaIndex;
+import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
+import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
+
+/**
+ * Created by libraryaddict on 15/06/2021.
+ */
+public class SkeletonWatcher extends AbstractSkeletonWatcher {
+ public SkeletonWatcher(Disguise disguise) {
+ super(disguise);
+ }
+
+ @NmsAddedIn(NmsVersion.v1_17)
+ public boolean isConvertingStray() {
+ return getData(MetaIndex.SKELETON_CONVERTING_STRAY);
+ }
+
+ @NmsAddedIn(NmsVersion.v1_17)
+ public void setConvertingStray(boolean converting) {
+ setData(MetaIndex.SKELETON_CONVERTING_STRAY, converting);
+ sendData(MetaIndex.SKELETON_CONVERTING_STRAY);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/StrayWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/StrayWatcher.java
new file mode 100644
index 00000000..44fd5c41
--- /dev/null
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/StrayWatcher.java
@@ -0,0 +1,12 @@
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+
+/**
+ * Created by libraryaddict on 15/06/2021.
+ */
+public class StrayWatcher extends AbstractSkeletonWatcher {
+ public StrayWatcher(Disguise disguise) {
+ super(disguise);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkeletonWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkeletonWatcher.java
new file mode 100644
index 00000000..bdba3845
--- /dev/null
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkeletonWatcher.java
@@ -0,0 +1,12 @@
+package me.libraryaddict.disguise.disguisetypes.watchers;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+
+/**
+ * Created by libraryaddict on 15/06/2021.
+ */
+public class WitherSkeletonWatcher extends AbstractSkeletonWatcher {
+ public WitherSkeletonWatcher(Disguise disguise) {
+ super(disguise);
+ }
+}
diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
index c2e98eff..051b850c 100644
--- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
+++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
@@ -41,6 +41,7 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer;
+import net.minecraft.server.level.EntityTrackerEntry;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.apache.logging.log4j.util.Strings;
@@ -349,11 +350,8 @@ public class DisguiseUtilities {
}
public static void removeInvisibleSlime(Player player) {
- PacketContainer container = new PacketContainer(Server.ENTITY_DESTROY);
- container.getIntegerArrays().write(0, new int[]{DisguiseAPI.getEntityAttachmentId()});
-
try {
- ProtocolLibrary.getProtocolManager().sendServerPacket(player, container, false);
+ ProtocolLibrary.getProtocolManager().sendServerPacket(player, getDestroyPacket(DisguiseAPI.getEntityAttachmentId()), false);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
@@ -990,9 +988,7 @@ public class DisguiseUtilities {
trackedPlayers = (Set) new HashSet(trackedPlayers).clone(); // Copy before iterating to prevent
// ConcurrentModificationException
- PacketContainer destroyPacket = new PacketContainer(Server.ENTITY_DESTROY);
-
- destroyPacket.getIntegerArrays().write(0, new int[]{disguise.getEntity().getEntityId()});
+ PacketContainer destroyPacket = getDestroyPacket(disguise.getEntity().getEntityId());
for (Object p : trackedPlayers) {
Player player = (Player) ReflectionManager.getBukkitEntity(p);
@@ -1057,6 +1053,10 @@ public class DisguiseUtilities {
}
public static PacketContainer getDestroyPacket(int... ids) {
+ if (NmsVersion.v1_17.isSupported() && ids.length != 1) {
+ throw new IllegalStateException("Should use getDestroyPackets for ints of len " + ids.length);
+ }
+
PacketContainer destroyPacket = new PacketContainer(Server.ENTITY_DESTROY);
destroyPacket.getIntegerArrays().write(0, ids);
@@ -1064,6 +1064,22 @@ public class DisguiseUtilities {
return destroyPacket;
}
+ public static PacketContainer[] getDestroyPackets(int... ids) {
+ if (!NmsVersion.v1_17.isSupported()) {
+ return new PacketContainer[]{getDestroyPacket(ids)};
+ }
+
+ PacketContainer[] packets = new PacketContainer[ids.length];
+
+ for (int i = 0; i < packets.length; i++) {
+ packets[i] = new PacketContainer(Server.ENTITY_DESTROY);
+
+ packets[i].getIntegers().write(0, ids[i]);
+ }
+
+ return packets;
+ }
+
public static TargetedDisguise getDisguise(Player observer, Entity entity) {
int entityId = entity.getEntityId();
@@ -1768,12 +1784,12 @@ public class DisguiseUtilities {
ids[ids.length - 1] = DisguiseAPI.getSelfDisguiseId();
// Send a packet to destroy the fake entity
- PacketContainer packet = getDestroyPacket(ids);
-
- try {
- ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
- } catch (Exception ex) {
- ex.printStackTrace();
+ for (PacketContainer packet : getDestroyPackets(ids)) {
+ try {
+ ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
}
// player.spigot().setCollidesWithEntities(true);
@@ -1806,10 +1822,10 @@ public class DisguiseUtilities {
if (!runningPaper) {
Object trackedPlayersObj = ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get(entityTrackerEntry);
- ((Set