TinyProtocol #51
@ -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);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren