From 61ee26887f4b686c29c12f980c9f972cde34ed40 Mon Sep 17 00:00:00 2001 From: Hugo B Date: Sun, 8 Aug 2021 19:38:52 +0200 Subject: [PATCH] fixed loot drops showing for everyone --- .../nms/v1_17_R1/PandeLootChannelHandler_v1_17_R1.java | 2 +- .../pandeloot/options/mechanics/VisibilityMechanic.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/seyarada/pandeloot/nms/v1_17_R1/PandeLootChannelHandler_v1_17_R1.java b/src/main/java/net/seyarada/pandeloot/nms/v1_17_R1/PandeLootChannelHandler_v1_17_R1.java index 7f476e3..7955cfe 100644 --- a/src/main/java/net/seyarada/pandeloot/nms/v1_17_R1/PandeLootChannelHandler_v1_17_R1.java +++ b/src/main/java/net/seyarada/pandeloot/nms/v1_17_R1/PandeLootChannelHandler_v1_17_R1.java @@ -22,7 +22,7 @@ public PandeLootChannelHandler_v1_17_R1(EntityPlayer player) { public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promise) throws Exception { if (packet instanceof PacketPlayOutSpawnEntity) { - int id = (int) PacketPlayOutSpawnEntity.a; + int id = ((PacketPlayOutSpawnEntity) packet).b(); if (NMSManager.hideItemFromPlayerMap.containsKey(id)) { List players = NMSManager.hideItemFromPlayerMap.get(id); if (!players.contains(player.getBukkitEntity())) { diff --git a/src/main/java/net/seyarada/pandeloot/options/mechanics/VisibilityMechanic.java b/src/main/java/net/seyarada/pandeloot/options/mechanics/VisibilityMechanic.java index 4fad50d..66e08bb 100644 --- a/src/main/java/net/seyarada/pandeloot/options/mechanics/VisibilityMechanic.java +++ b/src/main/java/net/seyarada/pandeloot/options/mechanics/VisibilityMechanic.java @@ -18,14 +18,14 @@ public void onCall(Reward reward, String value) { if (value.equalsIgnoreCase("player") && reward.player != null) { List players = Collections.singletonList(reward.player); hideEntity((Entity)reward.item, players); - NMSManager.hideItemFromPlayerMap.put(Integer.valueOf(reward.item.getEntityId()), players); + NMSManager.hideItemFromPlayerMap.put(reward.item.getEntityId(), players); } else if (value.equalsIgnoreCase("fight")) { List dropPlayers = new ArrayList<>(); for (UUID playerUUID : reward.damageUtil.getPlayers()) dropPlayers.add(Bukkit.getPlayer(playerUUID)); if (dropPlayers.size() > 0) { hideEntity((Entity)reward.item, dropPlayers); - NMSManager.hideItemFromPlayerMap.put(Integer.valueOf(reward.item.getEntityId()), dropPlayers); + NMSManager.hideItemFromPlayerMap.put(reward.item.getEntityId(), dropPlayers); } } }