SteamWar/BauSystem2.0
Archiviert
12
0

TinyProtocol #51

Zusammengeführt
YoyoNow hat 12 Commits von TinyProtocol nach master 2021-10-12 21:38:59 +02:00 zusammengeführt
Nur Änderungen aus Commit 94be6998d2 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -53,18 +53,18 @@ public class DetonatorListener implements Listener {
public DetonatorListener() { public DetonatorListener() {
ProtocolAPI.setIncomingHandler(useEntity, (player, o) -> { ProtocolAPI.setIncomingHandler(useEntity, (player, o) -> {
List<AbstractDetonatorEntity> entities = new ArrayList<>(Detonator.getDetoEntities(player)); List<AbstractDetonatorEntity> entities = Detonator.getDetoEntities(player);
if (entities.isEmpty()) { if (entities.isEmpty()) {
return o; return o;
} }
int entityId = entityIdFieldAccessor.get(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; return o;
} }
AbstractDetonatorEntity entity = entities.get(0);
Location location = entity.getBukkitEntity().getLocation().getBlock().getLocation(); Location location = entity.getBukkitEntity().getLocation().getBlock().getLocation();
addLocationToDetonator(location, player); addLocationToDetonator(location, player);
HAS_UPDATED.add(player); HAS_UPDATED.add(player);