Exemplo n.º 1
0
 public void removeBlockEntity(int id) {
   for (BlockEntity entity : this.entities) {
     if (entity.getEntityId() == id) {
       if (entity.getController() != null) entity.getController().onDeath();
       EventFactory.callEvent(new EntityDeathEvent(entity));
       this.entities.remove(entity);
     }
   }
 }
Exemplo n.º 2
0
  private static boolean physicsAllowed(Block block) {
    if (block.getType().getPhysics() == null) return false;

    BlockPhysicsEvent event = EventFactory.callEvent(new BlockPhysicsEvent(block));
    if (block.getType().getPhysics() instanceof FallingBlockPhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.falling", true)
          && !event.isCancelled();
    }

    if (block.getType().getPhysics() instanceof FlowerPhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.flower", true)
          && !event.isCancelled();
    }

    if (block.getType().getPhysics() instanceof MushroomPhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.mushroom", true)
          && !event.isCancelled();
    }

    if (block.getType().getPhysics() instanceof SaplingPhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.trees", true)
          && !event.isCancelled();
    }

    if (block.getType().getPhysics() instanceof SpongePhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.sponge", true)
          && !event.isCancelled();
    }

    if (block.getType().getPhysics() instanceof LiquidPhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.liquid", true)
          && !event.isCancelled();
    }

    if (block.getType().getPhysics() instanceof GrassPhysics) {
      return OpenClassic.getGame().getConfig().getBoolean("physics.grass", true)
          && !event.isCancelled();
    }

    return true;
  }
Exemplo n.º 3
0
 public void setSpawn(Position spawn) {
   Position old = this.spawn;
   this.spawn = spawn;
   EventFactory.callEvent(new SpawnChangeEvent(this, old));
 }