From f5419a1a770e36a923bd6aeceafbed1fc0eef6cc Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Jan 2024 16:45:03 +0100 Subject: [PATCH] Fix Sound and Particle HullHider Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/utils/Hull.java | 2 +- .../src/de/steamwar/fightsystem/utils/HullHider.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java index 838bc2f..118e564 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java @@ -91,7 +91,7 @@ public class Hull { } public boolean isLocationHidden(Player player, Location location) { - return players.contains(player) && !visibility.get(new IntVector(location).toId(region)); + return players.contains(player) && region.inRegion(location) && !visibility.get(new IntVector(location).toId(region)); } @SuppressWarnings("deprecation") diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java index 465204f..06363e3 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java @@ -182,18 +182,18 @@ public class HullHider implements Listener { return packet; } - private void posHiderGenerator(String typeName, Class posType, double factor) { + private void posHiderGenerator(String typeName, Class posType, double factor) { Class type = Reflection.getClass(typeName); Function location = posPacketToLocation(type, posType, factor); packetHiders.put(type, (player, packet) -> packetHider(player, packet, location.apply(packet))); } - private static Function posPacketToLocation(Class type, Class posType, double factor) { - Reflection.FieldAccessor x = Reflection.getField(type, posType, 0); - Reflection.FieldAccessor y = Reflection.getField(type, posType, 1); - Reflection.FieldAccessor z = Reflection.getField(type, posType, 2); + private static Function posPacketToLocation(Class type, Class posType, double factor) { + Reflection.FieldAccessor x = Reflection.getField(type, posType, 0); + Reflection.FieldAccessor y = Reflection.getField(type, posType, 1); + Reflection.FieldAccessor z = Reflection.getField(type, posType, 2); - return packet -> new Location(Config.world, (double)x.get(packet)/factor, (double)y.get(packet)/factor, (double)z.get(packet)/factor); + return packet -> new Location(Config.world, x.get(packet).doubleValue()/factor, y.get(packet).doubleValue()/factor, z.get(packet).doubleValue()/factor); } private Object packetHider(Player player, Object packet, Location location) {