Advertisement
LIONN

Admin Olympiad Stat

Dec 31st, 2011
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.28 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_DataPack
  3. Index: sql/admin_command_access_rights.sql
  4. ===================================================================
  5. --- sql/admin_command_access_rights.sql (revision 986)
  6. +++ sql/admin_command_access_rights.sql (working copy)
  7. @@ -27,6 +27,7 @@
  8.  ('admin_set_menu','1'), -- Not Implemented
  9.  ('admin_set_mod','3'),
  10.  ('admin_saveolymp','2'),
  11. +('admin_olympiad_stat', '2'),
  12.  ('admin_manualhero','2'),
  13.  
  14.  -- Section: Announcements
  15. #P L2jFrozen_GameServer
  16. Index: head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
  17. ===================================================================
  18. --- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java  (revision 986)
  19. +++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java  (working copy)
  20. @@ -69,6 +69,7 @@
  21.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMobGroup;
  22.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMonsterRace;
  23.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminNoble;
  24. +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminOlympiadStat;
  25.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPForge;
  26.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPetition;
  27.  import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPledge;
  28. @@ -186,6 +187,7 @@
  29.         registerAdminCommandHandler(new AdminAio());
  30.         registerAdminCommandHandler(new AdminCharSupervision());
  31.         registerAdminCommandHandler(new AdminWho()); // L2OFF command
  32. +       registerAdminCommandHandler(new AdminOlympiadStat());
  33.         // ATTENTION: adding new command handlers, you have to change the
  34.         // sql file containing the access levels rights
  35.        
  36. Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminOlympiadStat.java
  37. ===================================================================
  38. --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminOlympiadStat.java   (revision 0)
  39. +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminOlympiadStat.java   (working copy)
  40. @@ -0,0 +1,67 @@
  41. +/*
  42. + * This program is free software; you can redistribute it and/or modify
  43. + * it under the terms of the GNU General Public License as published by
  44. + * the Free Software Foundation; either version 2, or (at your option)
  45. + * any later version.
  46. + *
  47. + * This program is distributed in the hope that it will be useful,
  48. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  49. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  50. + * GNU General Public License for more details.
  51. + *
  52. + * You should have received a copy of the GNU General Public License
  53. + * along with this program; if not, write to the Free Software
  54. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  55. + * 02111-1307, USA.
  56. + *
  57. + * http://www.gnu.org/copyleft/gpl.html
  58. + */
  59. +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
  60. +
  61. +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  62. +import com.l2jfrozen.gameserver.model.L2Object;
  63. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  64. +import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
  65. +
  66. +/**
  67. + * @author RedHoT
  68. + */
  69. +public class AdminOlympiadStat implements IAdminCommandHandler
  70. +{
  71. +   private static String[] ADMIN_COMMANDS =
  72. +   {
  73. +       "admin_olympiad_stat"
  74. +   };
  75. +  
  76. +   @Override
  77. +   public boolean useAdminCommand(String command, L2PcInstance activeChar)
  78. +   {
  79. +       if (command.startsWith("admin_olympiad_stat"))
  80. +       {
  81. +           L2Object target = activeChar.getTarget();
  82. +
  83. +           if (target instanceof L2PcInstance)
  84. +           {
  85. +               L2PcInstance player = (L2PcInstance) target;
  86. +          
  87. +               if (!player.isNoble())
  88. +               {
  89. +                   activeChar.sendMessage("Oops! Your target is not a Noble!");
  90. +                   return false;
  91. +               }
  92. +               activeChar.sendMessage("Match(s): " + Olympiad.getInstance().getCompetitionDone(player.getObjectId()));
  93. +               activeChar.sendMessage("Points: " + Olympiad.getInstance().getNoblePoints(player.getObjectId()));
  94. +               return true;
  95. +           }
  96. +           activeChar.sendMessage("Usage: //olympiad_stat <target>");
  97. +           return false;
  98. +       }
  99. +       return true;
  100. +   }
  101. +  
  102. +   @Override
  103. +   public String[] getAdminCommandList()
  104. +   {
  105. +       return ADMIN_COMMANDS;
  106. +   }
  107. +}
  108. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement