Advertisement
Nik

//gm dp

Nik
Apr 23rd, 2011
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.05 KB | None | 0 0
  1. Index: /trunk/datapack_development/data/scripts/handlers/admincommandhandlers/AdminGm.java
  2. ===================================================================
  3. --- /trunk/datapack_development/data/scripts/handlers/admincommandhandlers/AdminGm.java (revision 2)
  4. +++ /trunk/datapack_development/data/scripts/handlers/admincommandhandlers/AdminGm.java (revision 322)
  5. @@ -1,66 +1,74 @@
  6.  /*
  7.   * This program is free software: you can redistribute it and/or modify it under
  8.   * the terms of the GNU General Public License as published by the Free Software
  9.   * Foundation, either version 3 of the License, or (at your option) any later
  10.   * version.
  11.   *
  12.   * This program is distributed in the hope that it will be useful, but WITHOUT
  13.   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14.   * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15.   * details.
  16.   *
  17.   * You should have received a copy of the GNU General Public License along with
  18.   * this program. If not, see <http://www.gnu.org/licenses/>.
  19.   */
  20.  package handlers.admincommandhandlers;
  21.  
  22.  import java.util.logging.Logger;
  23.  
  24.  import com.l2jserver.Config;
  25.  import com.l2jserver.gameserver.GmListTable;
  26. -import com.l2jserver.gameserver.datatables.AccessLevels;
  27.  import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  28.  import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  29.  
  30.  
  31.  /**
  32.   * This class handles following admin commands:
  33.   * - gm = turns gm mode off
  34.   *
  35.   * @version $Revision: 1.2.4.4 $ $Date: 2005/04/11 10:06:06 $
  36.   */
  37.  public class AdminGm implements IAdminCommandHandler
  38.  {
  39.     private static Logger _log = Logger.getLogger(AdminGm.class.getName());
  40.     private static final String[] ADMIN_COMMANDS =
  41.     {
  42.         "admin_gm"
  43.     };
  44.    
  45.     public boolean useAdminCommand(String command, L2PcInstance activeChar)
  46.     {
  47.        
  48.         if (command.equals("admin_gm"))
  49.             handleGm(activeChar);
  50.        
  51.         return true;
  52.     }
  53.    
  54.     public String[] getAdminCommandList()
  55.     {
  56.         return ADMIN_COMMANDS;
  57.     }
  58.    
  59.     private void handleGm(L2PcInstance activeChar)
  60.     {
  61.         if (activeChar.isGM())
  62.         {
  63.             GmListTable.getInstance().deleteGm(activeChar);
  64. -           activeChar.setAccessLevel(AccessLevels._userAccessLevelNum);
  65. -           activeChar.sendMessage("You no longer have GM status.");
  66. +           activeChar.setIsGM(false);
  67. +           activeChar.sendMessage("You are no longer counted as a GM player. GM-Only restrictions disabled, but you can still use GM commands.");
  68.            
  69.             if (Config.DEBUG)
  70.                 _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") turned his GM status off");
  71.         }
  72. +       else // Player is not a GM, but if his L2AccessLevel allows this command, he can call it to become a GM
  73. +       {
  74. +           GmListTable.getInstance().addGm(activeChar, !Config.GM_STARTUP_AUTO_LIST);
  75. +           activeChar.setIsGM(true);
  76. +           activeChar.sendMessage("You are now counted as a GM player. GM-Only restrictions enabled.");
  77. +          
  78. +           if (Config.DEBUG)
  79. +               _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") turned his GM status on");
  80. +       }
  81.     }
  82.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement