Skip to content

Commit

Permalink
Fixed: A possible netty freeze when entering or exiting a ridable entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram1903 committed May 3, 2024
1 parent 67368ba commit 5e52fa0
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@ private LivingEntityData createLivingEntity(EntityType entityType) {
}

private void handlePassengerEvent(User user, int vehicleId, float healthValue, boolean entering) {
List<EntityData> metadata = new ArrayList<>();
platform.getScheduler().runAsyncTask((o) -> {
List<EntityData> metadata = new ArrayList<>();

if (!entering) {
if (isBypassEnabled) {
if (platform.hasPermission(user.getUUID(), "AntiHealthIndicator.Bypass")) return;
if (!entering) {
if (isBypassEnabled) {
if (platform.hasPermission(user.getUUID(), "AntiHealthIndicator.Bypass")) return;
}
}
}

metadata.add(new EntityData(MetadataIndex.HEALTH, EntityDataTypes.FLOAT, healthValue));
user.sendPacketSilently(new WrapperPlayServerEntityMetadata(vehicleId, metadata));
metadata.add(new EntityData(MetadataIndex.HEALTH, EntityDataTypes.FLOAT, healthValue));
user.sendPacketSilently(new WrapperPlayServerEntityMetadata(vehicleId, metadata));
});
}
}

0 comments on commit 5e52fa0

Please sign in to comment.