@Override public void spawnEntity(Entity entity) { if (entity == null) throw new NullPointerException(); synchronized (entities) { if (!entities.contains(entity)) entities.add(entity); } }
@Override public void despawnEntity(Entity entity) { if (entity == null) throw new NullPointerException(); synchronized (entities) { entities.remove(entity); } }
@Override public Entity[] getEntities() { synchronized (entities) { return entities.toArray(new Entity[entities.size()]); } }