コード例 #1
0
ファイル: HookHandler.java プロジェクト: Runsafe/EventEngine
  private void handleItemHook(Hook hook, IPlayer player, RunsafeMeta item) {
    IWorld hookWorld = hook.getWorld();
    if (hookWorld.isWorld(player.getWorld())) {
      LuaTable table = new LuaTable();
      table.set("player", player.getName());
      table.set("itemID", item.getItemId());
      table.set("itemName", item.hasDisplayName() ? item.getDisplayName() : item.getNormalName());

      hook.execute(table);
    }
  }
コード例 #2
0
  private void concludeEvent(IPlayer winner) {
    if (winner == null) {
      // We have no winner, conclude without a winner.
      server.broadcastMessage(config.getConcludeNoWinnerMessage());
    } else {
      // We have a winner! Woooo!
      server.broadcastMessage(
          config.getConcludeMessage().replaceAll("<player>", winner.getPrettyName()));
      new TournamentWinEvent(winner).Fire(); // Fire win event.
      winner.give(mountHandler.getMountItem()); // Give the winner a squid mount.

      RunsafeMeta loot = Item.Materials.Emerald.getItem();
      loot.setAmount(10);
      winner.give(loot);
    }
    progress.clear(); // Clear all progress.
    stopEvent(); // Stop the event.
  }