From de6c8a257a2f7d9277802f5f5cfe51497dde205a Mon Sep 17 00:00:00 2001 From: Oth3r Date: Sat, 24 Aug 2024 16:45:54 -0500 Subject: [PATCH] makes sure the block interaction event only works on server player, fixes #13 --- src/main/java/one/oth3r/sit/Events.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/one/oth3r/sit/Events.java b/src/main/java/one/oth3r/sit/Events.java index a604bab..8e155db 100644 --- a/src/main/java/one/oth3r/sit/Events.java +++ b/src/main/java/one/oth3r/sit/Events.java @@ -11,6 +11,7 @@ import net.minecraft.block.enums.SlabType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.decoration.DisplayEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; @@ -212,6 +213,8 @@ public class Events { Sit.commandManager = s.getCommandManager(); UseBlockCallback.EVENT.register((pl, world, hand, hitResult) -> { if (!Config.handSitting) return ActionResult.PASS; + // make sure its a server player + if (pl.getClass() != ServerPlayerEntity.class) return ActionResult.PASS; ServerPlayerEntity player = Sit.server.getPlayerManager().getPlayer(pl.getUuid()); if (player == null) return ActionResult.PASS; if (hand == net.minecraft.util.Hand.MAIN_HAND && hitResult.getType() == HitResult.Type.BLOCK) {