From 96bde868d716d6e147491ffc7c5f2cd82acd8777 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 6 Nov 2020 11:17:21 +0100 Subject: [PATCH] Test sneaking --- src/de/steamwar/spectatesystem/elements/REntity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/spectatesystem/elements/REntity.java b/src/de/steamwar/spectatesystem/elements/REntity.java index adec209..4550cd5 100644 --- a/src/de/steamwar/spectatesystem/elements/REntity.java +++ b/src/de/steamwar/spectatesystem/elements/REntity.java @@ -101,8 +101,10 @@ public abstract class REntity { public void sneak(boolean sneaking) { entity.setSneaking(sneaking); - //entity.getDataWatcher().set(new DataWatcherObject(0, DataWatcherRegistry.a), (byte)0x02); - PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), false); + + DataWatcher dataWatcher = new DataWatcher(entity); + dataWatcher.register(new DataWatcherObject<>(0, DataWatcherRegistry.a), sneaking ? (byte)0x02 : (byte)0x00); + PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), dataWatcher, false); for(Player player : Bukkit.getOnlinePlayers()){ ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);