fix ArmorStandMeta not applying false flags (#8632)

This commit is contained in:
TehBrian 2022-12-23 12:30:42 -05:00 committed by GitHub
parent 5717b84708
commit e6f61f715d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ starting point for future additions in this area.
Fixes GH-559 Fixes GH-559
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
index 4017933f2244fca32cf9d39444f3a4f550e8af01..0c40a4a18cfc6f4ed6473a475f307f5c75ab56c5 100644 index 4017933f2244fca32cf9d39444f3a4f550e8af01..e721517ce7b52a1aa10d039aa9f309eb69db4733 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
@@ -8,9 +8,22 @@ import org.bukkit.Material; @@ -8,9 +8,22 @@ import org.bukkit.Material;
@ -31,11 +31,11 @@ index 4017933f2244fca32cf9d39444f3a4f550e8af01..0c40a4a18cfc6f4ed6473a475f307f5c
+ static final ItemMetaKey SMALL = new ItemMetaKey("Small", "small"); + static final ItemMetaKey SMALL = new ItemMetaKey("Small", "small");
+ static final ItemMetaKey MARKER = new ItemMetaKey("Marker", "marker"); + static final ItemMetaKey MARKER = new ItemMetaKey("Marker", "marker");
+ +
+ private boolean invisible; + private Boolean invisible = null;
+ private boolean noBasePlate; + private Boolean noBasePlate = null;
+ private boolean showArms; + private Boolean showArms = null;
+ private boolean small; + private Boolean small = null;
+ private boolean marker; + private Boolean marker = null;
+ // Paper end + // Paper end
CompoundTag entityTag; CompoundTag entityTag;
@ -103,23 +103,23 @@ index 4017933f2244fca32cf9d39444f3a4f550e8af01..0c40a4a18cfc6f4ed6473a475f307f5c
+ this.entityTag = new CompoundTag(); + this.entityTag = new CompoundTag();
+ } + }
+ +
+ if (isInvisible()) { + if (this.invisible != null) {
+ this.entityTag.putBoolean(INVISIBLE.NBT, this.invisible); + this.entityTag.putBoolean(INVISIBLE.NBT, this.invisible);
+ } + }
+ +
+ if (hasNoBasePlate()) { + if (this.noBasePlate != null) {
+ this.entityTag.putBoolean(NO_BASE_PLATE.NBT, this.noBasePlate); + this.entityTag.putBoolean(NO_BASE_PLATE.NBT, this.noBasePlate);
+ } + }
+ +
+ if (shouldShowArms()) { + if (this.showArms != null) {
+ this.entityTag.putBoolean(SHOW_ARMS.NBT, this.showArms); + this.entityTag.putBoolean(SHOW_ARMS.NBT, this.showArms);
+ } + }
+ +
+ if (isSmall()) { + if (this.small != null) {
+ this.entityTag.putBoolean(SMALL.NBT, this.small); + this.entityTag.putBoolean(SMALL.NBT, this.small);
+ } + }
+ +
+ if (isMarker()) { + if (this.marker != null) {
+ this.entityTag.putBoolean(MARKER.NBT, this.marker); + this.entityTag.putBoolean(MARKER.NBT, this.marker);
+ } + }
+ // Paper end + // Paper end
@ -131,7 +131,7 @@ index 4017933f2244fca32cf9d39444f3a4f550e8af01..0c40a4a18cfc6f4ed6473a475f307f5c
boolean isArmorStandEmpty() { boolean isArmorStandEmpty() {
- return !(this.entityTag != null); - return !(this.entityTag != null);
+ return !(this.isInvisible() || this.hasNoBasePlate() || this.shouldShowArms() || this.isSmall() || this.isMarker() || this.entityTag != null); + return !(this.invisible != null || this.noBasePlate != null || this.showArms != null || this.small != null || this.marker != null || this.entityTag != null); // Paper
} }
@Override @Override
@ -173,23 +173,23 @@ index 4017933f2244fca32cf9d39444f3a4f550e8af01..0c40a4a18cfc6f4ed6473a475f307f5c
super.serialize(builder); super.serialize(builder);
+ // Paper start + // Paper start
+ if (this.isInvisible()) { + if (invisible != null) {
+ builder.put(INVISIBLE.BUKKIT, invisible); + builder.put(INVISIBLE.BUKKIT, invisible);
+ } + }
+ +
+ if (this.hasNoBasePlate()) { + if (noBasePlate != null) {
+ builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate); + builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate);
+ } + }
+ +
+ if (this.shouldShowArms()) { + if (showArms != null) {
+ builder.put(SHOW_ARMS.BUKKIT, showArms); + builder.put(SHOW_ARMS.BUKKIT, showArms);
+ } + }
+ +
+ if (this.isSmall()) { + if (small != null) {
+ builder.put(SMALL.BUKKIT, small); + builder.put(SMALL.BUKKIT, small);
+ } + }
+ +
+ if (this.isMarker()) { + if (marker != null) {
+ builder.put(MARKER.BUKKIT, marker); + builder.put(MARKER.BUKKIT, marker);
+ } + }
+ // Paper end + // Paper end
@ -205,27 +205,27 @@ index 4017933f2244fca32cf9d39444f3a4f550e8af01..0c40a4a18cfc6f4ed6473a475f307f5c
+ // Paper start + // Paper start
+ @Override + @Override
+ public boolean isInvisible() { + public boolean isInvisible() {
+ return invisible; + return invisible != null && invisible;
+ } + }
+ +
+ @Override + @Override
+ public boolean hasNoBasePlate() { + public boolean hasNoBasePlate() {
+ return noBasePlate; + return noBasePlate != null && noBasePlate;
+ } + }
+ +
+ @Override + @Override
+ public boolean shouldShowArms() { + public boolean shouldShowArms() {
+ return showArms; + return showArms != null && showArms;
+ } + }
+ +
+ @Override + @Override
+ public boolean isSmall() { + public boolean isSmall() {
+ return small; + return small != null && small;
+ } + }
+ +
+ @Override + @Override
+ public boolean isMarker() { + public boolean isMarker() {
+ return marker; + return marker != null && marker;
+ } + }
+ +
+ @Override + @Override