Exemplo n.º 1
0
 /**
  * @param activeChar the active GM
  * @param player the online target
  * @param lvl the access level
  */
 private static void onlineChange(L2PcInstance activeChar, L2PcInstance player, int lvl) {
   if (lvl >= 0) {
     if (AdminData.getInstance().hasAccessLevel(lvl)) {
       final L2AccessLevel acccessLevel = AdminData.getInstance().getAccessLevel(lvl);
       player.setAccessLevel(lvl);
       player.sendMessage(
           "你的权限等级变更到 " + acccessLevel.getName() + " (" + acccessLevel.getLevel() + ").");
       activeChar.sendMessage(
           player.getName()
               + "的权限等级变更到 "
               + acccessLevel.getName()
               + " ("
               + acccessLevel.getLevel()
               + ").");
     } else {
       activeChar.sendMessage("你在试图设定一个无效的权限等级: " + lvl + " 请使用一个有效的等级重试一次!");
     }
   } else {
     player.setAccessLevel(lvl);
     player.sendMessage("你的角色已被查封,再见.");
     player.logout();
   }
 }
Exemplo n.º 2
0
 @Override
 public boolean useAdminCommand(String command, L2PcInstance activeChar) {
   if (command.equals("admin_gm") && activeChar.isGM()) {
     AdminData.getInstance().deleteGm(activeChar);
     activeChar.setAccessLevel(0, true);
     activeChar.sendMessage("You no longer have GM status.");
     _log.info(
         "GM: "
             + activeChar.getName()
             + "("
             + activeChar.getObjectId()
             + ") turned his GM status off");
   }
   return true;
 }
Exemplo n.º 3
0
  @Override
  protected void runImpl() {
    L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) {
      return;
    }

    String command = "admin_" + _command.split(" ")[0];

    IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(command);

    if (ach == null) {
      if (activeChar.isGM()) {
        activeChar.sendMessage("指令「" + command.substring(6) + "」不存在!");
      }

      _log.warning("No handler registered for admin command '" + command + "'");
      return;
    }

    if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel())) {
      activeChar.sendMessage("没有相关权限");
      _log.warning(
          "Character "
              + activeChar.getName()
              + " tryed to use admin command "
              + command
              + ", but have no access to it!");
      return;
    }

    if (Config.GMAUDIT) {
      GMAudit.auditGMAction(
          activeChar.getName() + " [" + activeChar.getObjectId() + "]",
          _command,
          (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
    }

    ach.useAdminCommand("admin_" + _command, activeChar);
  }