Skip to content

Commit

Permalink
Fix null player crashing server on join
Browse files Browse the repository at this point in the history
  • Loading branch information
Ampflower committed Sep 24, 2023
1 parent b55fb46 commit 4378487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project Specifics
projectVersion=0.5.2
projectVersion=0.5.3
modrinthId=G9eJHDO2

# Minecraft
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/gay/ampflower/polysit/SeatEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ public void modifyRawTrackedData(List<DataTracker.SerializedEntry<?>> data, Serv
data.add(new DataTracker.Entry<>(ARMOR_STAND_FLAGS, (byte) 16).toSerialized());
// This must be manually sent as there's no other mechanism we can use to send
// this.
player.networkHandler.sendPacket(new EntityAttributesS2CPacket(getId(), MAX_HEALTH_NULL_SINGLE));
if (player != null) {
// Really, this shouldn't be null but apparently Polymer 0.3.13+1.19.3 is
// slightly busted in that joining a world while sitting on a seat causes an
// instant crash.
// We can at least mitigate it here.
player.networkHandler.sendPacket(new EntityAttributesS2CPacket(getId(), MAX_HEALTH_NULL_SINGLE));
}
}

@Override
Expand Down

0 comments on commit 4378487

Please sign in to comment.