Package org.moparscape.msc.gs.event

Examples of org.moparscape.msc.gs.event.DelayedEvent


  }

  public void drop(Player player, final InvItem item) {
    player.setStatus(Action.DROPPING_GITEM);
    Instance.getDelayedEventHandler().add(new DelayedEvent(player, 500) {
      public void run() {
        if (owner.isBusy() || !owner.getInventory().contains(item.id)
            || owner.getStatus() != Action.DROPPING_GITEM) {
          matchRunning = false;
          return;
View Full Code Here


   * Registers an item to be removed after 3 minutes
   */
  public void registerItem(final Item i) {
    try {
      if (i.getLoc() == null) {
        delayedEventHandler.add(new DelayedEvent(null, 180000) {

          public void run() {
            ActiveTile tile = getTile(i.getLocation());
            if (tile.hasItem(i)) {
              unregisterItem(i);
View Full Code Here

  public void run() {
    Logger.println("GameEngine now running");
    time = System.nanoTime() / 1000000000;

    eventHandler
        .add(new DelayedEvent(null, Config.GARBAGE_COLLECT_INTERVAL) { // Ran
                                        // every
          // 50*2
          // minutes
          @Override
          public void run() {
            new Thread(new Runnable() {
              public void run() {
                garbageCollect();
              }
            }).start();
          }
        });
    eventHandler.add(new DelayedEvent(null, Config.SAVE_INTERVAL) {
      public void run() {
        long now = GameEngine.getTime();
        for (Player p : world.getPlayers()) {
          if (now - p.getLastSaveTime() >= Config.SAVE_INTERVAL) {
            p.save();
View Full Code Here

  }

  void remove() {
    if (!removed && loc != null && loc.getRespawnTime() > 0) {
      Instance.getDelayedEventHandler().add(
          new DelayedEvent(null, loc.getRespawnTime() * 1000) {
            public void run() {
              world.registerItem(new Item(loc));
              matchRunning = false;
            }
          });
View Full Code Here

    private final Lock lock = new ReentrantLock();

  private PacketThrottler() {
    // Clears the count every second, so we can check the packets per
    // second.
    Instance.getDelayedEventHandler().add(new DelayedEvent(null, 1000) {

      @Override
      public void run() {
//        playerToPacketCount.clear();
                try {
View Full Code Here

                        final GameObject fire = new GameObject(
                            item.getLocation(), 97,
                            0, 0);
                        world.registerGameObject(fire);
                        world.getDelayedEventHandler()
                            .add(new DelayedEvent(
                                null,
                                def.getLength()) {
                              public void run() {
                                if (tile.hasGameObject()
                                    && tile.getGameObject()
View Full Code Here

    }
  }

  public void addSkull(long timeLeft) {
    if (!isSkulled()) {
      skullEvent = new DelayedEvent(this, 1200000) {

        public void run() {
          removeSkull();
          this.stop();
        }
View Full Code Here

    if (force || canLogout()) {
      destroy = true;
      actionSender.sendLogout();
    } else {
      final long startDestroy = GameEngine.getTime();
      Instance.getDelayedEventHandler().add(new DelayedEvent(this, 3000) {

        public void run() {
          if (owner.canLogout()
              || (!(owner.inCombat() && owner.isDueling()) && GameEngine
                  .getTime() - startDestroy > 600000 * 2)) {
View Full Code Here

    if (force || canLogout()) {
      destroy = true;
      actionSender.sendLogout();
    } else {
      final long startDestroy = GameEngine.getTime();
      Instance.getDelayedEventHandler().add(new DelayedEvent(this, 3000) {

        public void run() {
          if (owner.canLogout()
              || (!(owner.inCombat() && owner.isDueling()) && GameEngine
                  .getTime() - startDestroy > 60000)) {
View Full Code Here

      Instance.getServer().getLoginConnector().getActionSender()
          .playerLogin(this);
      final Player p = this;
      Instance.getDelayedEventHandler().add(
          new DelayedEvent(this, 60000) {

            private void checkStat(int statIndex) {
              if (statIndex != 3
                  && owner.getCurStat(statIndex) == owner
                      .getMaxStat(statIndex)) {
                owner.getActionSender()
                    .sendMessage(
                        "Your "
                            + Formulae.statArray[statIndex]
                            + " ability has returned to normal.");
              }
            }

            public void run() {
              if (p == null || p.isDestroy()) {
                this.stop();
              }
              for (int statIndex = 0; statIndex < 18; statIndex++) {
                if (statIndex == 5) {
                  continue;
                }// addByte(-1
                int curStat = getCurStat(statIndex);
                int maxStat = getMaxStat(statIndex);
                if (curStat > maxStat) {
                  setCurStat(statIndex, curStat - 1);
                  getActionSender().sendStat(statIndex);
                  checkStat(statIndex);
                }// sendAppear
                else if (curStat < maxStat) {
                  setCurStat(statIndex, curStat + 1);
                  getActionSender().sendStat(statIndex);
                  checkStat(statIndex);
                }
              }
            }
          });
      drainer = new DelayedEvent(this, Integer.MAX_VALUE) {

        public void run() {
          if (p == null || p.isDestroy()) {
            this.stop();
          }
View Full Code Here

TOP

Related Classes of org.moparscape.msc.gs.event.DelayedEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.