Fix multi-worlds

This commit is contained in:
Ilya 2022-03-05 18:02:09 +03:00
parent 69dbb0980c
commit 53854664fd

View File

@ -424,7 +424,7 @@ public class WorldListener implements Listener {
} }
public int findNearbyPlayerMaxBlocks(Location location) { public int findNearbyPlayerMaxBlocks(Location location) {
Optional<? extends Player> op = Bukkit.getOnlinePlayers().stream().min(Comparator.comparingDouble(p -> p.getLocation().distance(location))); Optional<? extends Player> op = Bukkit.getOnlinePlayers().stream().filter(p -> p.getLocation().getWorld().equals(location.getWorld())).min(Comparator.comparingDouble(p -> p.getLocation().distance(location)));
if (op.isPresent()) { if (op.isPresent()) {
String[] groups = ExtendedPistons.INSTANCE.permsService.getPlayerGroups(op.get()); String[] groups = ExtendedPistons.INSTANCE.permsService.getPlayerGroups(op.get());
Optional<Integer> intOp = Arrays.stream(groups).map(group -> (ExtendedPistons.INSTANCE.conf.isSet("piston-move-limitations." + group) && ExtendedPistons.INSTANCE.conf.isInt("piston-move-limitations." + group)) ? ExtendedPistons.INSTANCE.conf.getInt("piston-move-limitations." + group) : 0).max(Comparator.comparingInt(i -> i)); Optional<Integer> intOp = Arrays.stream(groups).map(group -> (ExtendedPistons.INSTANCE.conf.isSet("piston-move-limitations." + group) && ExtendedPistons.INSTANCE.conf.isInt("piston-move-limitations." + group)) ? ExtendedPistons.INSTANCE.conf.getInt("piston-move-limitations." + group) : 0).max(Comparator.comparingInt(i -> i));