SteamWar/FightSystem
Archiviert
13
1

(Untested) Explosion, Particle and Sound Hider #410

Zusammengeführt
Lixfel hat 2 Commits von hullHider nach master 2024-01-20 17:52:07 +01:00 zusammengeführt
2 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen
Nur Änderungen aus Commit f5419a1a77 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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")

Datei anzeigen

@ -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<? extends Number> posType, double factor) {
Class<?> type = Reflection.getClass(typeName);
Function<Object, Location> location = posPacketToLocation(type, posType, factor);
packetHiders.put(type, (player, packet) -> packetHider(player, packet, location.apply(packet)));
}
private static Function<Object, Location> 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<Object, Location> posPacketToLocation(Class<?> type, Class<? extends Number> posType, double factor) {
Reflection.FieldAccessor<? extends Number> x = Reflection.getField(type, posType, 0);
Reflection.FieldAccessor<? extends Number> y = Reflection.getField(type, posType, 1);
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) {