Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
6d641856fe
Commit
f5419a1a77
@ -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")
|
||||
|
@ -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) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren