TinyProtocol #51
@ -53,18 +53,18 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
public DetonatorListener() {
|
||||
ProtocolAPI.setIncomingHandler(useEntity, (player, o) -> {
|
||||
List<AbstractDetonatorEntity> entities = new ArrayList<>(Detonator.getDetoEntities(player));
|
||||
List<AbstractDetonatorEntity> 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);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren