diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java index 4a7ae09b..53a77ce0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java @@ -53,18 +53,18 @@ public class DetonatorListener implements Listener { public DetonatorListener() { ProtocolAPI.setIncomingHandler(useEntity, (player, o) -> { - List entities = new ArrayList<>(Detonator.getDetoEntities(player)); + List entities = Detonator.getDetoEntities(player); if (entities.isEmpty()) { return o; } int entityId = entityIdFieldAccessor.get(o); - entities.removeIf(abstractDetonatorEntity -> abstractDetonatorEntity.getId() != entityId); + AbstractDetonatorEntity entity = entities.stream().filter(abstractDetonatorEntity -> abstractDetonatorEntity.getId() == entityId).findFirst().orElse(null); - if (entities.isEmpty()) { + if (entity == null) { return o; } - AbstractDetonatorEntity entity = entities.get(0); + Location location = entity.getBukkitEntity().getLocation().getBlock().getLocation(); addLocationToDetonator(location, player); HAS_UPDATED.add(player);