Ejemplo n.º 1
0
  @Override
  public void setLocation(Point p, boolean teleported) {
    Area r = Area.getArea(p);
    Area cur = area.get();

    if (cur != r) {
      if (cur != null) {
        cur.removeNpc(this);
      }
      r.addNpc(this);
      area.getAndSet(r);
    }
    super.setLocation(p, teleported);
  }
Ejemplo n.º 2
0
  public void remove() {
    Area cur = area.get();
    cur.removeNpc(this);

    if (!isRemoved() && shouldRespawn && def.respawnTime() > 0) {
      World.getWorld()
          .getDelayedEventHandler()
          .add(
              new DelayedEvent(null, def.respawnTime() * 1000) {

                public void run() {
                  world.registerNpc(new Npc(loc));
                  matchRunning = false;
                }
              });
    }

    removed.set(true);
  }