diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_14Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_14Factory.java index e312af2..1fa2a0b 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_14Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_14Factory.java @@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData; public class V1_14Factory extends V1_13Factory { @Override - public EntityData skinLayers() { - return createSkinLayers(15); + public EntityData skinLayers(boolean enabled) { + return createSkinLayers(15, enabled); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_16Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_16Factory.java index da7c8d7..3dd2db0 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_16Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_16Factory.java @@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData; public class V1_16Factory extends V1_14Factory { @Override - public EntityData skinLayers() { - return createSkinLayers(16); + public EntityData skinLayers(boolean enabled) { + return createSkinLayers(16, enabled); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_17Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_17Factory.java index b83b796..2a02eb4 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_17Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_17Factory.java @@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData; public class V1_17Factory extends V1_16Factory { @Override - public EntityData skinLayers() { - return createSkinLayers(17); + public EntityData skinLayers(boolean enabled) { + return createSkinLayers(17, enabled); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_8Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_8Factory.java index cb05973..327be42 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_8Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_8Factory.java @@ -10,8 +10,8 @@ import java.util.Collection; public class V1_8Factory implements MetadataFactory { @Override - public EntityData skinLayers() { - return createSkinLayers(12); + public EntityData skinLayers(boolean enabled) { + return createSkinLayers(12, enabled); } @Override @@ -28,11 +28,11 @@ public class V1_8Factory implements MetadataFactory { } @Override - public EntityData silent() { - return new EntityData(4, EntityDataTypes.BYTE, 1); + public EntityData silent(boolean enabled) { + return new EntityData(4, EntityDataTypes.BYTE, enabled ? 1 : 0); } - protected EntityData createSkinLayers(int index) { - return new EntityData(index, EntityDataTypes.BYTE, Byte.MAX_VALUE); + protected EntityData createSkinLayers(int index, boolean enabled) { + return new EntityData(index, EntityDataTypes.BYTE, enabled ? Byte.MAX_VALUE : 0); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_9Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_9Factory.java index 48452ee..5750fdc 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_9Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/V1_9Factory.java @@ -10,8 +10,8 @@ import java.util.Collection; public class V1_9Factory extends V1_8Factory { @Override - public EntityData skinLayers() { - return createSkinLayers(13); + public EntityData skinLayers(boolean enabled) { + return createSkinLayers(13, enabled); } @Override @@ -28,7 +28,7 @@ public class V1_9Factory extends V1_8Factory { } @Override - public EntityData silent() { - return new EntityData(4, EntityDataTypes.BOOLEAN, true); + public EntityData silent(boolean enabled) { + return new EntityData(4, EntityDataTypes.BOOLEAN, enabled); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java index 8d6ab58..540d411 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java @@ -109,11 +109,9 @@ public class V1_8Factory implements PacketFactory { @Override public void sendAllMetadata(Player player, PacketEntity entity, PropertyHolder properties) { ArrayList data = new ArrayList<>(); - if (entity.getType() == EntityTypes.PLAYER && properties.getProperty(EntityPropertyImpl.SKIN_LAYERS)) data.add(MetadataFactory.get().skinLayers()); - boolean fire = properties.getProperty(EntityPropertyImpl.FIRE); - boolean invisible = properties.getProperty(EntityPropertyImpl.INVISIBLE); - if (fire || invisible) data.add(MetadataFactory.get().effects(fire, false, invisible)); - if (properties.getProperty(EntityPropertyImpl.SILENT)) data.add(MetadataFactory.get().silent()); + if (entity.getType() == EntityTypes.PLAYER) data.add(MetadataFactory.get().skinLayers(properties.getProperty(EntityPropertyImpl.SKIN_LAYERS))); + data.add(MetadataFactory.get().effects(properties.getProperty(EntityPropertyImpl.FIRE), false, properties.getProperty(EntityPropertyImpl.INVISIBLE))); + data.add(MetadataFactory.get().silent(properties.getProperty(EntityPropertyImpl.SILENT))); if (properties.hasProperty(EntityPropertyImpl.NAME)) data.addAll(MetadataFactory.get().name(properties.getProperty(EntityPropertyImpl.NAME))); sendMetadata(player, entity, data); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java index 2006095..b0b1b92 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java @@ -14,12 +14,9 @@ public class V1_9Factory extends V1_8Factory { @Override public void sendAllMetadata(Player player, PacketEntity entity, PropertyHolder properties) { ArrayList data = new ArrayList<>(); - if (entity.getType() == EntityTypes.PLAYER && properties.getProperty(EntityPropertyImpl.SKIN_LAYERS)) data.add(MetadataFactory.get().skinLayers()); - boolean glow = properties.hasProperty(EntityPropertyImpl.GLOW); - boolean fire = properties.getProperty(EntityPropertyImpl.FIRE); - boolean invisible = properties.getProperty(EntityPropertyImpl.INVISIBLE); - if (glow || fire || invisible) data.add(MetadataFactory.get().effects(fire, glow, invisible)); - if (properties.getProperty(EntityPropertyImpl.SILENT)) data.add(MetadataFactory.get().silent()); + if (entity.getType() == EntityTypes.PLAYER) data.add(MetadataFactory.get().skinLayers(properties.getProperty(EntityPropertyImpl.SKIN_LAYERS))); + data.add(MetadataFactory.get().effects(properties.getProperty(EntityPropertyImpl.FIRE), properties.hasProperty(EntityPropertyImpl.GLOW), properties.getProperty(EntityPropertyImpl.INVISIBLE))); + data.add(MetadataFactory.get().silent(properties.getProperty(EntityPropertyImpl.SILENT))); if (properties.hasProperty(EntityPropertyImpl.NAME)) data.addAll(MetadataFactory.get().name(properties.getProperty(EntityPropertyImpl.NAME))); sendMetadata(player, entity, data); }