fix distance meassure if the world hase been reloadet !

This commit is contained in:
Ste3et_C0st 2020-05-26 16:09:09 +02:00
parent b8d43954ad
commit 4a88d33310
1 changed files with 2 additions and 2 deletions

View File

@ -16,11 +16,11 @@ public class redstoneEvent implements Listener {
@EventHandler
private void onBlockPowered(BlockRedstoneEvent e){
World w = e.getBlock().getWorld();
World world = e.getBlock().getWorld();
Block block = e.getBlock();
Location location = block.getLocation();
Entry<Location, streetlamp> object = streetlamp.locationSet.entrySet().stream()
.filter(entry -> entry.getValue().getObjID().getWorldName().equalsIgnoreCase(w.getName()))
.filter(entry -> entry.getValue().getObjID().getWorld().equals(world))
.filter(entry -> entry.getKey().distance(location) <= 1).findFirst().orElse(null);
if(Objects.nonNull(object)) {
if(e.getNewCurrent()==0){