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