warc222

SetTeam Admin Command

Dec 31st, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P trunk2
  3. Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
  4. ===================================================================
  5. --- gameserver/head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 910)
  6. +++ gameserver/head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy)
  7. @@ -79,6 +79,7 @@
  8. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRes;
  9. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRideWyvern;
  10. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminScript;
  11. +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSetTeam;
  12. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminShop;
  13. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminShutdown;
  14. import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSiege;
  15. @@ -185,6 +186,7 @@
  16. registerAdminCommandHandler(new AdminNoble());
  17. registerAdminCommandHandler(new AdminBuffs());
  18. registerAdminCommandHandler(new AdminAio());
  19. + registerAdminCommandHandler(new AdminSetTeam());
  20. //ATTENTION: adding new command handlers, you have to change the
  21. //sql file containing the access levels rights
  22.  
  23. Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSetTeam.java
  24. ===================================================================
  25. --- gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSetTeam.java (revision 0)
  26. +++ gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSetTeam.java (revision 0)
  27. @@ -0,0 +1,62 @@
  28. +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
  29. +
  30. +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  31. +import com.l2jfrozen.gameserver.model.L2Object;
  32. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  33. +
  34. +/**
  35. + *
  36. + * @author Elfocrash
  37. + */
  38. +public class AdminSetTeam implements IAdminCommandHandler
  39. +{
  40. + private static String[] _adminCommands =
  41. + {
  42. + "admin_setteam1", "admin_setteam2", "admin_clearteam"
  43. + };
  44. +
  45. + @Override
  46. + public boolean useAdminCommand(String command, L2PcInstance activeChar)
  47. + {
  48. +
  49. + L2Object target = activeChar.getTarget();
  50. +
  51. + if(activeChar.getTarget() instanceof L2PcInstance)
  52. + {
  53. +
  54. +
  55. + if(command.startsWith("admin_setteam1"))
  56. + {
  57. + ((L2PcInstance) activeChar.getTarget()).setTeam(1);
  58. + ((L2PcInstance) activeChar.getTarget()).sendMessage(activeChar.getName() + " selected you to be in the blue team");
  59. + ((L2PcInstance) activeChar.getTarget()).broadcastUserInfo();
  60. + }
  61. + else if(command.startsWith("admin_setteam2"))
  62. + {
  63. + ((L2PcInstance) activeChar.getTarget()).setTeam(2);
  64. + ((L2PcInstance) activeChar.getTarget()).sendMessage(activeChar.getName() + " selected you to be in the red team");
  65. + ((L2PcInstance) activeChar.getTarget()).broadcastUserInfo();
  66. + }
  67. + else if(command.startsWith("admin_clearteam"))
  68. + {
  69. + ((L2PcInstance) activeChar.getTarget()).setTeam(0);
  70. + ((L2PcInstance) activeChar.getTarget()).sendMessage("Your team has been cleared from " + activeChar.getName());
  71. + ((L2PcInstance) activeChar.getTarget()).broadcastUserInfo();
  72. + }
  73. + }
  74. + else
  75. + {
  76. + activeChar.sendMessage("Hey!! This is only for players!");
  77. + return false;
  78. + }
  79. + return true;
  80. + }
  81. +
  82. +
  83. +
  84. + @Override
  85. + public String[] getAdminCommandList()
  86. + {
  87. + return _adminCommands;
  88. + }
  89. +}
  90.  
  91.  
  92. INSERT INTO `admin_command_access_rights` VALUES ('admin_setteam1','3');
  93. INSERT INTO `admin_command_access_rights` VALUES ('admin_setteam2','3');
  94. INSERT INTO `admin_command_access_rights` VALUES ('admin_clearteam','3');
Advertisement
Add Comment
Please, Sign In to add comment