SteamWar/FightSystem
Archiviert
13
1

Fix Sound and Particle HullHider
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-01-20 16:45:03 +01:00
Ursprung 6d641856fe
Commit f5419a1a77
2 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -91,7 +91,7 @@ public class Hull {
} }
public boolean isLocationHidden(Player player, Location location) { 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") @SuppressWarnings("deprecation")

Datei anzeigen

@ -182,18 +182,18 @@ public class HullHider implements Listener {
return packet; return packet;
} }
private void posHiderGenerator(String typeName, Class<?> posType, double factor) { private void posHiderGenerator(String typeName, Class<? extends Number> posType, double factor) {
Class<?> type = Reflection.getClass(typeName); Class<?> type = Reflection.getClass(typeName);
Function<Object, Location> location = posPacketToLocation(type, posType, factor); Function<Object, Location> location = posPacketToLocation(type, posType, factor);
packetHiders.put(type, (player, packet) -> packetHider(player, packet, location.apply(packet))); packetHiders.put(type, (player, packet) -> packetHider(player, packet, location.apply(packet)));
} }
private static Function<Object, Location> posPacketToLocation(Class<?> type, Class<?> posType, double factor) { private static Function<Object, Location> posPacketToLocation(Class<?> type, Class<? extends Number> posType, double factor) {
Reflection.FieldAccessor<?> x = Reflection.getField(type, posType, 0); Reflection.FieldAccessor<? extends Number> x = Reflection.getField(type, posType, 0);
Reflection.FieldAccessor<?> y = Reflection.getField(type, posType, 1); Reflection.FieldAccessor<? extends Number> y = Reflection.getField(type, posType, 1);
Reflection.FieldAccessor<?> z = Reflection.getField(type, posType, 2); Reflection.FieldAccessor<? extends Number> 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) { private Object packetHider(Player player, Object packet, Location location) {