Advertisement
Guest User

Untitled

a guest
Jan 13th, 2018
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 108.36 KB | None | 0 0
  1. package org.perception.model.players.packets.commands;
  2.  
  3. import static org.perception.util.PlayerPredicates.*;
  4.  
  5.  
  6.  
  7.  
  8. import java.util.stream.IntStream;
  9. import java.io.BufferedWriter;
  10. import java.io.File;
  11. import java.io.FileWriter;
  12. import java.io.IOException;
  13. import java.text.DecimalFormat;
  14. import java.util.List;
  15. import java.util.Objects;
  16. import java.util.Optional;
  17. import java.util.Map.Entry;
  18. import java.util.function.Predicate;
  19. import java.util.stream.Collectors;
  20.  
  21. import org.Vote.VoteReward;
  22. import org.apache.commons.io.FileUtils;
  23. import org.apache.commons.lang3.StringUtils;
  24. import org.apache.commons.lang3.text.WordUtils;
  25. import org.perception.Config;
  26. import org.perception.Connection;
  27. import org.perception.Server;
  28. import org.perception.model.content.Parser;
  29. import org.perception.event.CycleEventHandler;
  30. import org.perception.model.content.PunishmentPanel;
  31. import org.perception.model.content.RFDHandler;
  32. import org.perception.model.content.ReactGame;
  33. import org.perception.model.content.SkillConstants;
  34. import org.perception.model.content.Trivia;
  35. import org.perception.model.content.TriviaBot;
  36. import org.perception.model.content.Kraken.Kraken;
  37. import org.perception.model.content.achievement.Achievements;
  38. import org.perception.model.content.help.HelpDatabase;
  39. import org.perception.model.content.kill_streaks.Killstreak;
  40. import org.perception.model.content.teleport.Position;
  41. import org.perception.model.content.teleport.Teleport;
  42. import org.perception.model.content.teleport.TeleportExecutor;
  43. import org.perception.model.content.teleport.Teleport.TeleportType;
  44. import org.perception.model.content.zulrah.Zulrah;
  45. import org.perception.model.interaction.MultiplayerSession;
  46. import org.perception.model.interaction.MultiplayerSessionFinalizeType;
  47. import org.perception.model.interaction.MultiplayerSessionStage;
  48. import org.perception.model.interaction.MultiplayerSessionType;
  49. import org.perception.model.interaction.duel.DuelSession;
  50. import org.perception.model.items.ItemDefinition;
  51. import org.perception.model.minigames.Barrows;
  52. import org.perception.model.npcs.NPCCacheDefinition;
  53. import org.perception.model.npcs.NPCHandler;
  54. import org.perception.model.npcs.NpcDefinition;
  55. import org.perception.model.npcs.Bosses.Cerberus;
  56. import org.perception.model.npcs.NPCDeathTracker.NPCName;
  57. import org.perception.model.npcs.drops.NpcDropManager;
  58. import org.perception.model.players.Boundary;
  59. import org.perception.model.players.ConnectedFrom;
  60. import org.perception.model.players.Player;
  61. import org.perception.model.players.PlayerHandler;
  62. import org.perception.model.players.Rights;
  63. import org.perception.model.players.combat.Hitmark;
  64. import org.perception.model.players.skills.Skill;
  65. import org.perception.util.Chance;
  66. import org.perception.util.Misc;
  67. import org.perception.util.json.ItemDefinitionLoader;
  68. import org.python.core.parser;
  69. import org.perception.model.content.Donations;
  70.  
  71. import com.google.gson.Gson;
  72. import com.google.gson.reflect.TypeToken;
  73. import com.motiservice.Motivote;
  74. import com.motiservice.vote.Result;
  75. import com.motiservice.vote.SearchField;
  76. import com.rspserver.mvh.AuthService;
  77.  
  78. /**
  79.  * New command system. Uses predicates / enum to store commands. Much cleaner.
  80.  *
  81.  * The enum name is the string used to execute the command. After is the predicate that handles the requirement to
  82.  * perform the command. Finally, after that is any additional strings that can be used to execute the command.
  83.  * @author Advocatus
  84.  *
  85.  */
  86. public enum Commands {
  87.    
  88.    
  89.     AUTH {
  90.         @Override
  91.         if (playerCommand.startsWith("reward")) {
  92.             String[] args = playerCommand.split(" ");
  93.             if (args.length == 1) {
  94.                 c.sendMessage("Please use [::reward id], [::reward id amount], or [::reward id all].");
  95.                 return;
  96.             }
  97.             final String playerName = c.playerName;
  98.             final String id = args[1];
  99.             final String amount = args.length == 3 ? args[2] : "1";
  100.  
  101.             com.everythingrs.vote.Vote.service.execute(new Runnable() {
  102.                 @Override
  103.                 public void run() {
  104.                     try {
  105.                         com.everythingrs.vote.Vote[] reward = com.everythingrs.vote.Vote.reward("secret_key",
  106.                                 playerName, id, amount);
  107.                         if (reward[0].message != null) {
  108.                             c.sendMessage(reward[0].message);
  109.                             return;
  110.                         }
  111.                         c.getItems().addItem(reward[0].reward_id, reward[0].give_amount);
  112.                         c.sendMessage(
  113.                                 "Thank you for voting! You now have " + reward[0].vote_points + " vote points.");
  114.                     } catch (Exception e) {
  115.                         c.sendMessage("Api Services are currently offline. Please check back shortly");
  116.                         e.printStackTrace();
  117.                     }
  118.                 }
  119.  
  120.             });
  121.         }
  122.        
  123.        
  124.    
  125.    
  126.    
  127.     BOO(owner()) {
  128.         @Override
  129.         public void execute(Player c, String input) {
  130.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  131.             if (optionalPlayer.isPresent()) {
  132.                 Player c2 = optionalPlayer.get();
  133.                 c2.getPA().showInterface(18681);
  134.                 c.sendMessage("You've probably just ruined " + c2.playerName + "s day.");
  135.                 c2.sendMessage("@red@WOOOOOOOOOOOOOOOOOOOOOOOO!");
  136.             }
  137.         }
  138.     },
  139.     /*RFD(owner()) {
  140.         @Override
  141.             public void execute(Player c, String input) {
  142.             RFDHandler.enterRfd(c);
  143.             }
  144.         },*/
  145.     RFDKC(owner()) {
  146.             @Override
  147.                 public void execute(Player c, String input) {
  148.                 c.sendMessage("current spawn "+c.currentSpawn+"");
  149.                 }
  150.             },
  151.     IMP(owner()) {
  152.     @Override
  153.         public void execute(Player c, String input) {
  154.             //Cerberus.ghostData(c);
  155.             Server.npcHandler.spawnNpc(c, 1654, c.absX, c.absY, c.heightLevel, 0, 10, 1, 1, 1, false, false);
  156.         }
  157.     },
  158.    
  159.     MASTER(owner()) {
  160.         public void execute(Player c, String input) {
  161.    
  162.         for (int i = 0; i < 22; i++) {
  163.             c.playerLevel[i] = 99;
  164.             c.playerXP[i] = c.getPA().getXPForLevel(100);
  165.             c.getPA().refreshSkill(i);
  166.             c.getPA().requestUpdates();
  167.         }
  168.         }
  169.         },
  170.        
  171.    
  172.    
  173.    
  174.     NORMALMODE() {
  175.     @Override
  176.         public void execute(Player c, String input) {
  177.         if (c.getRights().isManIron() || c.getRights().isUlt() || c.easyMode || c.hardMode) {
  178.             return;
  179.         }
  180.         c.normalMode = true;
  181.         }
  182.     },
  183.     LAST(owner()) {
  184.     @Override
  185.         public void execute(Player c, String input) {
  186.         TeleportExecutor.teleport(c, new Position(c.lastTeleportX, c.lastTeleportY, c.lastTeleportZ));
  187.         }
  188.     },
  189.  
  190.    
  191.         RESET(owner()) {
  192.         @Override
  193.             public void execute(Player c, String input) {
  194.             for (int skills = 0; skills < 22; skills++) {
  195.                 c.playerLevel[skills] = 1;
  196.                 c.getPA().refreshSkill(skills);
  197.                 c.playerXP[skills] = c.getPA().getXPForLevel(skills) + 0;
  198.                 c.getPA().refreshSkill(skills);
  199.             }
  200.               //  c.getPA().refreshSkill(skills);
  201.              //   c.playerXP[skills] = c.getPA().getXPForLevel(skills) + 0;
  202.                // c.getPA().refreshSkill(skills);
  203.             }
  204.         },
  205.    
  206.    
  207.    
  208.  
  209.     SCREAMER(owner()) {
  210.     @Override
  211.     public void execute(Player c, String input) {
  212.         Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  213.         if (optionalPlayer.isPresent()) {
  214.             Player c2 = optionalPlayer.get();
  215.             if (c2.getRights().isBetween(1,  3)) {
  216.                 c.sendMessage("You can't use this command on this player!");
  217.                 return;
  218.             }
  219.             for (int j = 0; j < 5; j++) {
  220.                 c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  221.                 c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  222.                 c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  223.                 c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  224.                 c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  225.                 c.sendMessage("You've probably just ruined " + c2.playerName + "s day.");
  226.             }
  227.         } else {
  228.             c.sendMessage(input + " is not online. You can only do this to online players.");
  229.         }
  230.     }
  231. },
  232.    
  233.     ANSWER {
  234.         @Override
  235.         public void execute(Player c, String input) {
  236.         //  if (c.getRights().isManIron() || c.getRights().isUlt()) {
  237.             //  c.sendMessage("Your account is a <img=14>Ironman and cannot access trivia.");
  238.             //  return;
  239.             //}//
  240.             final String answer = input.toLowerCase().replace("Answer ", "");
  241.             Trivia.attemptQuestion(c, answer);
  242.         }
  243.     },
  244.     REACT {
  245.         @Override
  246.         public void execute(Player c, String input) {
  247.         //  if (c.getRights().isManIron() || c.getRights().isUlt()) {
  248.             //  c.sendMessage("Your account is a <img=14>Ironman and cannot access trivia.");
  249.             //  return;
  250.             //}//
  251.             final String answer = input.toLowerCase().replace("React ", "");
  252.             ReactGame.attemptQuestion(c, answer);
  253.         }
  254.     },
  255.    
  256.     STARTER {
  257.         @Override
  258.         public void execute(Player c, String input) {
  259.             if (c.startPack == true) {
  260.                 //c.sendMessage("Pick a gamemode.");
  261.                 return;
  262.             }
  263.             c.getPA().showInterface(27150);
  264.         }
  265.     },
  266.     RESETBARROWS {
  267.     @Override
  268.     public void execute(Player c, String input) {
  269.         c.barrowsNpcs[0][1] = 0;
  270.         c.barrowsNpcs[1][1] = 0;
  271.         c.barrowsNpcs[2][1] = 0;
  272.         c.barrowsNpcs[3][1] = 0;
  273.         c.barrowsNpcs[4][1] = 0;
  274.         c.barrowsNpcs[5][1] = 0;
  275.         c.barrowsKillCount = 0;
  276.         c.barrowsChestRollCount = 0;
  277.         c.lastBrotherSpawned = false;
  278.         c.newTunnels = true;
  279.         c.randomTunnel = Player.randomTunnel();
  280.         c.getPA().sendString("Karils", 16135);
  281.         c.getPA().sendString("Guthans", 16134);
  282.         c.getPA().sendString("Torags", 16133);
  283.         c.getPA().sendString("Ahrims", 16132);
  284.         c.getPA().sendString("Veracs", 16131);
  285.         c.getPA().sendString("Dharoks", 16130);
  286.         //c.getPA().movePlayer(3565, 3305, 0);
  287.         TeleportExecutor.executeSkillsTeleport(c, new Teleport(new Position(3565, 3305), TeleportType.NORMAL));
  288.     }
  289. },
  290.     /*RESETTASK {
  291.         @Override
  292.         public void execute(Player c, String input) {
  293.             c.slayerTask = 0;
  294.             c.taskAmount = 0;
  295.             c.onSlayerTask = false;
  296.             c.onEasyTask = false;
  297.             c.onMediumTask = false;            
  298.             c.onHardTask = false;
  299.             c.onEliteTask = false;
  300.         }
  301.     },*/
  302.    
  303. NPCLOG {
  304.     @Override//47200
  305.     public void execute(Player c, String input) {
  306.         for (int i = 8144; i < 8195; i++) {
  307.             c.getPA().sendFrame126("", i);
  308.         }
  309.         int[] frames = { 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167,
  310.                 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175 };
  311.         c.getPA().sendFrame126("@dre@Boss Kills for @blu@" + c.playerName + "", 8144);
  312.         c.getPA().sendFrame126("", 8145);
  313.         c.getPA().sendFrame126("@blu@Total Boss kills: @red@" + c.getNpcDeathTracker().getTotal() + "", 8147);
  314.         c.getPA().sendFrame126("", 8148);
  315.         int index1 = 0;
  316.         for (Entry<NPCName, Integer> entry : c.getNpcDeathTracker().getTracker().entrySet()) {
  317.             if (entry == null) {
  318.                 continue;
  319.             }
  320.             if (index1 > frames.length - 1) {
  321.                 break;
  322.             }
  323.             if (entry.getValue() > 0) {
  324.                 c.getPA().sendFrame126("@blu@" + WordUtils.capitalize(entry.getKey().name().toLowerCase().replaceAll("_", " ")) + " kills: @red@" + entry.getValue(),
  325.                         frames[index1]);
  326.                 index1++;
  327.             }
  328.         }
  329.         c.getPA().showInterface(8134);
  330.     }
  331. },
  332.  
  333.  
  334.  
  335. BOSSLOG {
  336.     @Override//
  337.     public void execute(Player c, String input) {
  338.         for (int i = 47206; i < 47406; i++) {
  339.             c.getPA().sendFrame126("", i);
  340.         }
  341.         int[] frames = { 47207, 47208, 47209, 47210, 47211, 47212, 47213, 47214, 47215, 47216, 47217, 47218, 47219, 47220, 47221, 47222, 47223, 47224, 47225,
  342.                 47226, 47227, 47228, 47229, 47230, 47231, 47232, 47233 };
  343.     //  c.getPA().sendFrame126("", 47206);
  344.     //  c.getPA().sendFrame126("", );
  345.         c.getPA().sendFrame126("      <shad=-1>Total Boss kills: " + c.getNpcDeathTracker().getTotal() + "", 47206);
  346.         //c.getPA().sendFrame126("", 47207);
  347.         int index1 = 0;
  348.         for (Entry<NPCName, Integer> entry : c.getNpcDeathTracker().getTracker().entrySet()) {
  349.             if (entry == null) {
  350.                 continue;
  351.             }
  352.             if (index1 > frames.length - 1) {
  353.                 break;
  354.             }
  355.             if (entry.getValue() > 0) {
  356.                 c.getPA().sendFrame126("      <shad=-1>" + WordUtils.capitalize(entry.getKey().name().toLowerCase().replaceAll("_", " ")) + " kills: " + entry.getValue(),
  357.                         frames[index1]);
  358.                 index1++;
  359.             }
  360.         }
  361.         c.getPA().showInterface(47200);
  362.     }
  363. },
  364.  
  365.     /*ANSWER {
  366.         @Override
  367.         public void execute(Player c, String input) {
  368.         if (parser.hasNext1()) {
  369.             String answer = "";
  370.             while (parser.hasNext1()) {
  371.                 answer += parser.nextString() + " ";
  372.             }
  373.             TriviaBot.answer(c, answer.trim());
  374.         }
  375.         }
  376.         },*/
  377.    
  378.     DROPS {
  379.  
  380.         @Override
  381.         public void execute(Player c, String input) {
  382.             final String query = input.toLowerCase().replace("drops ", "");
  383.             if (query.length() > 0) {
  384.                     try {
  385.                         NpcDropManager.displayNPCDrops(c, query);
  386.                     } catch (Throwable error) {
  387.                         c.sendMessage("Could not display npc drops for npc: "+query+".");
  388.                         error.printStackTrace();
  389.                     }
  390.             } else {
  391.                 c.sendMessage("Use ::drops query.");
  392.             }
  393.         }
  394.        
  395.     },
  396.     /*
  397.      * Allaimvote
  398.      *
  399.      */
  400.     /*AUTH {
  401.         @Override
  402.         public void execute(Player c, String input) {
  403.             String auth = input.replace("Auth ", "");
  404.             if(input.length() < 5) {
  405.                 c.sendMessage("You must enter an auth code to process your vote!");
  406.                 return;
  407.             }
  408.             boolean success = AuthService.provider().redeemNow(auth);
  409.            
  410.             if (success) {
  411.                 c.votePoints += 5;
  412.                 c.getItems().addItemUnderAnyCircumstance(2996, 10);
  413.                 PlayerHandler.executeGlobalMessage("<img=10></img><col=255>" + Misc.capitalize(c.playerName)
  414.                 + " </col>has just voted and received <col=CC0000>10 PK Points & 5 Vote Points</col>.");
  415.                 c.getPA().loadQuests();
  416.             }
  417.             else {
  418.                 c.sendMessage("Invalid auth supplied, please try again later.");
  419.                 }
  420.             //}
  421.         }
  422.     },*/
  423.     ITEM(owner()) {
  424.         @Override
  425.         public void execute(Player c, String input) {
  426.             String[] args = input.split(" ");
  427.              try {    
  428.            
  429.                    
  430.                    /*int[] COINS_SPAWN = {4151, 11936, 3144, 6685, 13066, 386, 11937, 3145, 2441, 2437, 2443, 2445, 3041, 6686, 3025, 10926, 560, 557, 9075, 555, 560, 565, 2550, 2551, 9244, 12883, 12881, 12879, 12877, 12875, 12873,
  431.                            1155,1153,1157,1165,1159,1161 ,1163,5574,1117,1115,1119,1125,1121,1123,1127    , 5575    , 1075    , 1067    , 1069    , 1077    , 1071    , 1073    , 1079    , 5576    , 1189    , 1191    , 1193    , 1195    , 1197    , 1199    , 1201    , 3105    , 4119    , 4121    , 4123    , 4125    , 4127    , 4129    , 4131    , 3751    ,
  432.                              882 ,  884 ,  886 ,  888 ,  890 ,  892 ,  9144    ,  9244    ,  841 ,    843 ,    849 ,    853 ,    857 ,    861 ,    3749    ,    10499   ,    9185    ,    1129    ,    1133    ,    1135    ,    2499    ,    2501    ,    2503    ,    863 ,  869 ,  1095    ,    1097    ,    1099    ,    2493    ,    2495    ,    2497    ,    866 ,  867 ,  868 ,  11230   ,
  433.                              556 ,  554 , 3024, 3026,  558 ,  557 ,  555 ,  56 ,  565 ,  566 ,  975    ,  562 ,  561 ,  563 ,  1381    ,    1387    ,    1385    ,    1383    ,    4675    ,    384    ,  3844    ,  3842    ,  289    ,  489    , 491    , 493    , 499    , 411    , 413    , 419    , 4111    , 4113    , 2579    , 1712    , 2552    , 2412    , 2413    , 2414    , 617    , 618    , 619,
  434.                             9703, 9704,9705, 1833,1835, 1837, 636, 646, 626, 638,648,2906,2908,2904,2916, 2918, 2914, 6629, 9470,430, 10394, 662, 656, 658, 660,146,158,164,3043,170,2447,6686,3025,2435,7947,386,374,380,2551,4502,1725,1712,1731,7458,3840,3842,3844,542,544,10828};
  435.                    
  436.                     */
  437.                  /*int[] COINS_SPAWN = {3145, 1540, 7003, 391, 4151, 11936, 3144, 6685, 13066, 386, 11937, 3145, 2441, 2437, 2443, 2445, 3041, 6686, 3025, 10926, 560, 557, 9075, 555, 560, 565, 2550, 2551, 9244, 12883, 12879, 12875, 12873,
  438.                           1155,1153,1157,1165,1159,1161 ,1163,5574,1117,1115,1119,1125,1121,1123,1127    , 5575    , 1075    , 1067    , 1069    , 1077    , 1071    , 1073    , 1079    , 5576    , 1189    , 1191    , 1193    , 1195    , 1197    , 1199    , 1201    , 3105    , 4119    , 4121    , 4123    , 4125    , 4127    , 4129    , 4131    , 3751    ,
  439.                          882 ,  884 ,  886 ,  888 ,  890 ,  892 ,  9144    ,  9244    ,  841 ,    843 ,    849 ,    853 ,    857 ,    861 ,    3749    ,    10499   ,    9185    ,    1129    ,    1133    ,    1135    ,    2499    ,    2501    ,    2503    ,    863 ,  869 ,  1095    ,    1097    ,    1099    ,    2493    ,    2495    ,    2497    ,    866 ,  867 ,  868 ,  11230   ,
  440.                          556 ,  554 , 3024, 3026,  558 ,  557 ,  555 ,  56 ,  565 ,  566 ,  975    ,  562 ,  561 ,  563 ,  1381    ,    1387    ,    1385    ,    1383    ,    4675    ,    384    ,  3844    ,  3842    ,  289    ,  489    , 491    , 493    , 499    , 411    , 413    , 419    , 4111    , 4113    , 2579    , 1712    , 2552    , 2412    , 2413    , 2414    , 617    , 618    , 619,
  441.                         9703, 9704,9705, 1833,1835, 1837, 636, 646, 626, 638,648,2906,2908,2904,2916, 2918, 2914, 6629, 9470,430, 10394, 662, 656, 658, 660,146,158,164,3043,170,2447,6686,3025,2435,7947,386,374,380,2551,4502,1725,1712,1731,7458,3840,3842,3844,542,544,10828,8007,8008,8009,8010,8011,8012,6666,6665,12956,12957,12958,12959,11919,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,12381,12382,12383,12384,12385,12386,12387,12388,12393,12394,12395,12396,12397,12398,12445,12446,12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12518,12519,12520,12521,12522,12523,12524,12525,12598,12599,12775,12776,12777,12778,12779,12780,12781,12782,13068,12277,12278,12279,12280,12281,12282,12283,12284,12285,12286,12287,12288,12289,12290,12291,12292,12293,12294,12295,12296,12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220,12221,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,12246,12247,12248,12249,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264,12265,12266,12267,12268,12269,12270,12271,12272,
  442.                         13329,13330,13337,13338,13335,13336, 13333,13334,13332,13331,4153,4738,11128,1127,1079,11212,11235,6585,4091,4093,4224,7059,11840,7460,7461,9245,9242,4724,4726,4728,4730,4732,4734,4736,4738,4740,4745,4747,4749,4751,4753,4755,4757,4759,5698,1215,1231,5680,1201,1704,10362,1333,1319,8844,8845,8846,8847,8848,8849,8850,4097,7398,7399,7400, 3040, 4152, 4154, 9186,
  443.                         3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537,
  444.                         3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552,
  445.                         3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 189, 190, 191, 192, 193, 194, 2450, 2451,
  446.                         9747, 9748, 9749, 9750, 9751, 9752, 9753, 9754, 9755, 9756, 9757, 9758, 9759, 9760, 9761, 9762, 9763, 9764, 9765, 9766, 9767, 9768, 9769, 9770, 9771, 9772, 9773, 9774, 9775, 9776, 9777, 9778, 9779, 9780, 9781, 9782, 9783, 9784, 9785, 9786, 9787, 9788, 9792, 9793, 9794, 9795, 9796, 9797, 9798, 9799, 9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 9811, 9812,
  447.                         2444, 2445, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118};
  448.                 */
  449.                  int itemId = Integer.parseInt(args[0]);
  450.                     int amount = Misc.stringToInt(args[1]);
  451.                  //   boolean PERMITTED = IntStream.of(COINS_SPAWN).anyMatch(r -> r == itemId);
  452.                 if(itemId > 21295) {
  453.                     c.sendMessage("This item does not exist!");
  454.                     return;
  455.                 }
  456.                    if (c.inWild() || !c.inSafeZone() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  457.                         c.sendMessage("You can only spawn items in a safezone.");
  458.                        return;
  459.                        }
  460.            
  461.            
  462.                 if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
  463.                     c.sendMessage("You cannot spawn items in the duel arena!");
  464.                     return;
  465.                 }
  466.                 if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
  467.                     return;
  468.                 }
  469.                 if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
  470.                     return;
  471.                 }
  472.                 if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
  473.                     return;
  474.                 }
  475.                 if (Boundary.isIn(c, Kraken.BOUNDARY)) {
  476.                     return;
  477.                 }
  478.  
  479.  
  480.                   // if (!PERMITTED) {
  481.                    //     c.sendMessage("You are not allowed to spawn this item.");
  482.                    //     return;
  483.                  //   }
  484.                
  485.                
  486. input.toLowerCase().replaceAll("k", "000").replaceAll("m", "000000").replaceAll("b", "000000000");
  487.                    
  488.  
  489.              
  490.                
  491.                 c.getItems().addItem(itemId, amount);
  492.             } catch (NumberFormatException nfe) {
  493.                 c.sendMessage("Improper use of the command; '::item itemid amount'.");
  494.             }
  495.         }
  496.     //          1155,1153,1157,1165,1159,1161 ,1163,5574,1117,1115,1119,1125,1121,1123,1127    , 5575    , 1075    , 1067    , 1069    , 1077    , 1071    , 1073    , 1079    , 5576    , 1189    , 1191    , 1193    , 1195    , 1197    , 1199    , 1201    , 3105    , 4119    , 4121    , 4123    , 4125    , 4127    , 4129    , 4131    , 3751    ,
  497.         // 882 ,  884 ,  886 ,  888 ,  890 ,  892 ,  9144    ,  9244    ,  841 ,    843 ,    849 ,    853 ,    857 ,    861 ,    3749    ,    10499   ,    9185    ,    1129    ,    1133    ,    1135    ,    2499    ,    2501    ,    2503    ,    863 ,  869 ,  1095    ,    1097    ,    1099    ,    2493    ,    2495    ,    2497    ,    866 ,  867 ,  868 ,  11230   ,
  498.         // 556 ,  554 , 3024, 3026,  558 ,  557 ,  555 ,  56 ,  565 ,  566 ,  975    ,  562 ,  561 ,  563 ,  1381    ,    1387    ,    1385    ,    1383    ,    4675    ,    384    ,  3844    ,  3842    ,  289    ,  489    , 491    , 493    , 499    , 411    , 413    , 419    , 4111    , 4113    , 2579    , 1712    , 2552    , 2412    , 2413    , 2414    , 617    , 618    , 619
  499.         //9703, 9704,9705, 1833,1835, 1837, 636, 646, 626, 638,648,2906,2908,2904,2916, 2918, 2914, 6629, 9470,430, 10394, 662, 656, 658, 660,146,158,164,3043,170,2447,6686,3025,2435,7947,386,374,380,2551,4502,1725,1712,1731,7458,3840,3842,3844,542,544,10828};
  500.     //int[] COINS_SPAWN = {4151, 11936, 3144, 6685, 13066, 386, 11937, 3145, 2441, 2437, 2443, 2445, 3041, 6686, 3025, 10926, 560, 557, 9075, 555, 560, 565, 2550, 2551, 9244, 12883, 12881, 12879, 12877, 12875, 12873};  
  501.     },
  502.         DUEL {
  503.               @Override
  504.               public void execute(Player c, String input) {
  505.                if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  506.                 return;
  507.                }
  508.                if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  509.                 return;
  510.                }
  511.                TeleportExecutor.teleport(c, new Position(3365, 3266, 0));
  512.               }
  513.              },
  514.             STAKE {
  515.               @Override
  516.               public void execute(Player c, String input) {
  517.                if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  518.                 return;
  519.                }
  520.                if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  521.                 return;
  522.                }
  523.                TeleportExecutor.teleport(c, new Position(3365, 3266, 0));
  524.               }
  525.              },
  526.             HOME {
  527.               @Override
  528.               public void execute(Player c, String input) {
  529.                if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  530.                 return;
  531.                }
  532.                if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  533.                 return;
  534.                }
  535.                TeleportExecutor.teleport(c, new Position(3088, 3504, 0));
  536.               }
  537.              },
  538.             EDGE {
  539.               @Override
  540.               public void execute(Player c, String input) {
  541.                if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  542.                 return;
  543.                }
  544.                if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  545.                 return;
  546.                }
  547.                TeleportExecutor.teleport(c, new Position(3088, 3504, 0));
  548.               }
  549.              },
  550.             GE {
  551.               @Override
  552.               public void execute(Player c, String input) {
  553.                if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  554.                 return;
  555.                }
  556.                if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  557.                 return;
  558.                }
  559.                TeleportExecutor.teleport(c, new Position(3164, 3484, 0));
  560.               }
  561.              },
  562.              /*LUNARS {
  563.               @Override
  564.               public void execute(Player c, String input) {
  565.                   if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  566.                         return;
  567.                        }
  568.                        if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  569.                         return;
  570.                        }
  571.                 c.sendMessage("You switch to lunar magic.");
  572.                 c.setSidebarInterface(6, 29999);
  573.                 c.playerMagicBook = 2;
  574.               }
  575.              },
  576.              ANCIENTS {
  577.               @Override
  578.               public void execute(Player c, String input) {
  579.                   if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  580.                         return;
  581.                        }
  582.                        if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  583.                         return;
  584.                        }
  585.                 c.sendMessage("You switch to ancient magic.");
  586.                 c.setSidebarInterface(6, 12855);
  587.                 c.playerMagicBook = 1;
  588.               }
  589.              },
  590.              MODERN {
  591.               @Override
  592.               public void execute(Player c, String input) {
  593.                   if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  594.                         return;
  595.                        }
  596.                        if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  597.                         return;
  598.                        }
  599.                 c.sendMessage("You switch to modern magic.");
  600.                 c.setSidebarInterface(6, 1151);
  601.                 c.playerMagicBook = 0;
  602.               }
  603.              },
  604.              NORMAL {
  605.               @Override
  606.               public void execute(Player c, String input) {
  607.                   if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  608.                         return;
  609.                        }
  610.                        if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  611.                         return;
  612.                        }
  613.                 c.sendMessage("You switch to modern magic.");
  614.                 c.setSidebarInterface(6, 1151);
  615.                 c.playerMagicBook = 0;
  616.               }
  617.              },
  618.              FOOD {
  619.               @Override
  620.               public void execute(Player c, String input) {
  621.                   if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  622.                         return;
  623.                        }
  624.                        if (c.inWild() || !c.inSafeZone() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  625.                         return;
  626.                        }
  627.                 c.getItems().addItemUnderAnyCircumstance(11936, 28);
  628.               }
  629.              },*/
  630.             CLAIMSTATUS("checkrank", "claimrank", "checkstatus") {
  631.                     @Override
  632.                     public void execute(Player c, String input) {
  633.                         if (c.amDonated >= 10 && c.amDonated < 30 && c.getRights().getValue() == 0) {
  634.                             c.setRights(Rights.CONTRIBUTOR);
  635.                         }
  636.                         if (c.amDonated >= 30 && c.amDonated < 75 && c.getRights().getValue() <= 5 && !c.getRights().isStaff()) {
  637.                             c.setRights(Rights.SPONSOR);
  638.                         }
  639.                         if (c.amDonated >= 75 && c.amDonated < 150 && c.getRights().getValue() <= 6 && !c.getRights().isStaff()) {
  640.                             c.setRights(Rights.SUPPORTER);
  641.                         }
  642.                         if (c.amDonated >= 150 && c.amDonated < 300 && c.getRights().getValue() <= 7 && !c.getRights().isStaff()) {
  643.                             c.setRights(Rights.V_I_P);
  644.                         }
  645.                         if (c.amDonated >= 300 && !c.getRights().isStaff()) {
  646.                             c.setRights(Rights.SUPER_V_I_P);
  647.                         }
  648.                     }
  649.                 },
  650.                
  651.    
  652.     PVP {
  653.         @Override
  654.         public void execute(Player c, String input) {
  655.             c.safeTimer = 0;
  656.         }
  657.     },
  658.    
  659.    
  660.  
  661. /*  CLAIMDONATION("checkdonation", "redeemcredits", "claimcredits") {
  662.     @Override
  663.     public void execute(Player c, String input) {
  664.         Donations.checkDonation(c);
  665.     }
  666. },*/
  667.  
  668.     GETID(owner()) {
  669.     @Override
  670.     public void execute(Player c, String input) {
  671.         try {
  672.         if (input.length() < 3) {
  673.             c.sendMessage("You must give at least 3 letters of input to narrow down the item.");
  674.             return;
  675.         }
  676.             int results = 0;
  677.             c.sendMessage("Searching: " + input);
  678.             for (ItemDefinition it : ItemDefinition.DEFINITIONS) {
  679.                 if (results == 100) {
  680.                     c.sendMessage("Too many results! Please refine your search.");
  681.                     return;
  682.                 }
  683.                 if (!it.getDescription().equalsIgnoreCase("null") && !it.isNoted())
  684.                     if (it.getName().replace("_", " ").toLowerCase().contains(input.toLowerCase())) {
  685.                         c.sendMessage("<col=FF0000>" + it.getName().replace("_", " ") + " - "
  686.                                 + it.getId());
  687.                         results++;
  688.                     }
  689.             }
  690.             c.sendMessage(results + " results found...");
  691.         } catch (Exception e) {
  692.         }
  693.     }
  694. },
  695.    
  696.     SETLEVEL(owner()){
  697.         @Override
  698.         public void execute(Player c, String input) {
  699.             int skillId;
  700.             int skillLevel;
  701.             String[] args = input.split(" ");
  702.             System.out.println(input);
  703.             if (args.length < 2) {
  704.                 throw new IllegalArgumentException();
  705.             }
  706.             if (c.inWild()|| c.inPvP()|| c.safeTimer > 0)
  707.                 return;
  708.             for (int j = 0; j < c.playerEquipment.length; j++) {
  709.                 if (c.playerEquipment[j] > 0) {
  710.                     c.sendMessage("Please remove all your equipment before using this command.");
  711.                     return;
  712.                 }
  713.             }
  714.            
  715.             try {
  716.                 skillId = Integer.parseInt(args[0]);
  717.                 skillLevel = Integer.parseInt(args[1]);
  718.                 //if (skillId < 0 || skillId > 6) {
  719.                 //  c.sendMessage("@red@You can only set Combat stats.");
  720.                 //  return;
  721.                 //}
  722.                 if (skillLevel < 1) {
  723.                     skillLevel = 1;
  724.                 } else if (skillLevel > 99) {
  725.                     skillLevel = 99;
  726.                 }
  727.                 int[] skillIds = { 0, 1, 2, 3, 4, 5, 6
  728.  
  729.                 };
  730.                 for (int i : skillIds) {
  731.            
  732.                     c.getPA().refreshSkill(i);
  733.                 }
  734.            
  735.                 c.playerLevel[skillId] = skillLevel;
  736.                 c.getPA().refreshSkill(skillId);
  737.                 c.playerXP[skillId] = c.getPA().getXPForLevel(skillLevel) + 1;
  738.                 c.getPA().refreshSkill(skillId);
  739.                 c.sendMessage("@blu@Set Stat_" + SkillConstants.SKILL_NAMES[skillId] + ": to " + skillLevel);
  740.             } catch (Exception e) {
  741.                 c.sendMessage("Error. Correct syntax: ::setlevel skillid level");
  742.             }
  743.         }
  744.        
  745.     },
  746.    
  747.     CHANGEPASS("changepassword") {
  748.         @Override
  749.         public void execute(Player c, String input) {
  750.             if(input.length() < 3) {
  751.                 c.sendMessage("Your password must contain atleast 3 characters.");
  752.                 return;
  753.             }
  754.             if (input.length() > 20) {
  755.                 c.sendMessage("Passwords cannot contain more than 20 characters.");
  756.                 c.sendMessage("The password you tried had " + input.length() + " characters.");
  757.                 return;
  758.             }
  759.             if (input.contains("character-rights") || input.contains("[CHARACTER]") || input.contains(".") || input.contains("_")) {
  760.                 c.sendMessage("Your password contains illegal characters.");
  761.                 return;
  762.             }
  763.             //c.playerPass = input;
  764.             c.playerPass = Misc.getFilteredInput(input).toLowerCase();
  765.             c.sendMessage("Your password is now: @red@" + c.playerPass);
  766.         }
  767.     },
  768.    
  769.    
  770.    
  771.     SETTAG(donator()) {
  772.         @Override
  773.         public void execute(Player c, String input) {
  774.            
  775.             if (c.getRights().isSponsor() && c.getRights().isSupporter() && c.getRights().isVIP() && c.getRights().isSuperVIP()) {
  776.            
  777.  
  778.     String[] text = input.split(" ");
  779.     String[] bad = {"Dev", "@", "developer", "Developer", "dev", "@", "mod", "Mod", "Moderator", "moderator", "Admin", "Administrator", "admin", "administrator", "owner", "Owner", "Founder", "founder", "Helper", "helper", "Respected", "respected", "donator", "Donator", "www."};
  780.     for(int i = 0; i < bad.length; i++){
  781.         if(input.indexOf(bad[i]) >= 0){
  782.             c.sendMessage("@red@You can not use this title.");
  783.             return;
  784.         }
  785.     }
  786. try {
  787. if (text.length > 10) {
  788.     c.sendMessage("@red@Your title can not be longer than 10 characters.");
  789. return;
  790. }
  791.             String[] args = input.split(" ");
  792.             c.yellTag = args[1];
  793.             return;
  794. } catch (final Exception e) {
  795.     c.sendMessage("@blu@You're not a super donator, to donate use ::donate");
  796. }
  797. }
  798.    
  799.     }
  800.  
  801. },
  802.    
  803.     INFERNO {
  804.     @Override
  805.     public void execute(Player c, String input) {
  806.         //c.playerid = 4;
  807.         c.createInfernoInstance();
  808.     c.getInfernoMinigame().create(1);
  809.     c.getInfernoMinigame().getPlayer();
  810.    
  811.     }
  812.  
  813. },
  814.  
  815.    
  816.  
  817.     REMOVETAG {
  818.         @Override
  819.         public void execute(Player c, String input) {
  820.         c.yellTag = "";
  821.        
  822.         }
  823.  
  824. },
  825.    
  826.    
  827.    
  828.     CHAR {
  829.         @Override
  830.         public void execute(Player c, String input) {
  831.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  832.                 return;
  833.             }
  834.             if (c.inWild() ||c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  835.                 return;
  836.             }
  837.             c.getPA().showInterface(3559);
  838.         }
  839.     },
  840.     COMMANDS {
  841.         @Override
  842.         public void execute(Player c, String input) {
  843.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  844.                 return;
  845.             }
  846.             for (int i = 8144; i < 8195; i++) {
  847.                 c.getPA().sendFrame126("", i);
  848.                }
  849.                c.getPA().sendFrame126("@blu@Commands", 8144);
  850.                c.getPA().sendFrame126("", 8145);
  851.                c.getPA().sendFrame126("@blu@::players@bla@ - Shows players online", 8147);
  852.                c.getPA().sendFrame126("@blu@::claimvote / ::claim@bla@ - Claim your voting reward", 8148);
  853.                c.getPA().sendFrame126("@blu@::train / ::training @bla@- teleports you to training area", 8149);
  854.                c.getPA().sendFrame126("@blu@::empty@bla@ - Destroy all items in your inventory", 8150);
  855.                c.getPA().sendFrame126("@blu@::duel / ::stake@bla@ - Teleports you to the Duel arena", 8151);
  856.                c.getPA().sendFrame126("@blu@::home / ::ge@bla@ - Teleports you home", 8152);
  857.                c.getPA().sendFrame126("@blu@::edge@bla@ - Teleports you to Edgeville", 8153);
  858.                c.getPA().sendFrame126("@blu@::vote@bla@ - Takes you to the voting page", 8154);
  859.                c.getPA().sendFrame126("@blu@::forums@bla@ - Takes you to the forums", 8155);
  860.                c.getPA().sendFrame126("@blu@::store@bla@ - Takes you to the store/donation page", 8156);
  861.                c.getPA().sendFrame126("@blu@::changepassword newpass@bla@ - Changes your password", 8157);
  862.                c.getPA().sendFrame126("@blu@::lock@bla@ - Locks/Unlocks your XP", 8158);
  863.                c.getPA().sendFrame126("@blu@::char@bla@ - Teleports you to the Make-over Mage", 8159);
  864.                c.getPA().sendFrame126("@blu@::claimpayment@bla@ - Claims your donation", 8160);
  865.                c.getPA().sendFrame126("@blu@::rules@bla@ - Brings you to the rules thread", 8161);
  866.                c.getPA().sendFrame126("@blu@::highscores@bla@ - Brings you to the highscores", 8162);
  867.                c.getPA().sendFrame126("@blu@::mb/::wests/::gdz/::easts@bla@ - Teles you to these hotspots", 8163);
  868.                c.getPA().sendFrame126("@blu@::counter@bla@ - Toggles your 474 counter on/off", 8164);
  869.                c.getPA().sendFrame126("@blu@::orbs@bla@ - Toggles your 474 orbs on/off", 8165);
  870.                c.getPA().sendFrame126("@blu@::help@bla@ - Brings up the help request interface", 8166);
  871.                c.getPA().sendFrame126("@blu@::claimstatus@bla@ - Updates your donator rank.", 8167);
  872.                c.getPA().sendFrame126("@blu@::drops@bla@ - Opens drop tables.", 8168);
  873.                c.getPA().sendFrame126("@blu@::answer@bla@ - attempt a answer for the trivia.", 8169);
  874.                c.getPA().sendFrame126("@blu@::bosslog@bla@ - displays your boss kills.", 8170);
  875.                c.getPA().sendFrame126("@dre@Donator's Only", 8172);
  876.                c.getPA().sendFrame126("@dre@::yell message@bla@ - Sends a global message", 8173);
  877.                c.getPA().sendFrame126("@dre@::dz@bla@ - Teleports you to the donator's zone", 8174);
  878.                c.getPA().showInterface(8134);
  879.         }
  880.     },
  881.     DONATE {
  882.         @Override
  883.         public void execute(Player c, String input) {
  884.             c.getPA().sendFrame126("www.serenityrsps.com/store", 12000);
  885.         }
  886.     },
  887.     DOWNLOAD {
  888.         @Override
  889.         public void execute(Player c, String input) {
  890.             c.getPA().sendFrame126("www.serenityrsps.com", 12000);
  891.         }
  892.     },
  893.    
  894. /*  CLAIMVOTE("claim", "checkvote", "redeemvote") {
  895.     @Override
  896.     public void execute(Player c, String input) {
  897.         try {
  898.             VoteReward reward = Server.vote.hasVoted(c.playerName.replaceAll(" ", "_"));
  899.             if (reward != null) {
  900.                 switch (reward.getReward()) {
  901.                 case 0:
  902.                     c.getItems().addItemUnderAnyCircumstance(784, 1);
  903.                     PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
  904.                     + " @bla@has just voted for OS-World and received a voting rewards book.");
  905.                     break;
  906.  
  907.                 }
  908.                 c.sendMessage("Thank you for voting for OS-WORLD!");
  909.             } else {
  910.                 c.sendMessage("You have no voting rewards waiting for you.");
  911.             }
  912.             c.sendMessage("");
  913.         } catch (Exception e) {
  914.             c.sendMessage("A voting error has occurred, please contact an administrator.");
  915.         }
  916.     }
  917.     },
  918.     /*CLAIM {
  919.         @Override
  920.         public void execute(Player c, String input) {
  921.             try {
  922.                 VoteReward reward = Server.vote.hasVoted(c.playerName.replaceAll(" ", "_"));
  923.                 if (reward != null) {
  924.                     switch (reward.getReward()) {
  925.                     case 0:
  926.                          int boneBits = 2000000 + Misc.random(500000);
  927.                         c.getItems().addItemUnderAnyCircumstance(995, boneBits);
  928.                         c.votePoints += 3;
  929.                        
  930.            
  931.                         PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
  932.                         + " @bla@has just voted and received @dre@2m coins & 3 Vote Points.");
  933.                         if (Misc.random(7) == 7) {
  934.                             c.sendMessage("You was lucky and recieved a bonus Vote Points!");
  935.                             c.
  936.  
  937. s += 5;
  938.                         }
  939.                         break;
  940.  
  941.                     }
  942.                     c.sendMessage("Thank you for voting for OS-WORLD!");
  943.                 } else {
  944.                     c.sendMessage("You have no voting rewards waiting for you.");
  945.                 }
  946.                 c.sendMessage("");
  947.             } catch (Exception e) {
  948.                 c.sendMessage("A voting error has occurred, please contact an administrator.");
  949.             }
  950.         }
  951.         },*/
  952.     EASTS {
  953.         @Override
  954.         public void execute(Player c, String input) {
  955.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  956.                 return;
  957.             }
  958.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  959.                 return;
  960.             }
  961.             TeleportExecutor.teleport(c, new Position(3353, 3684, 0));
  962.         }
  963.     },
  964.     FORUMS {
  965.         @Override
  966.         public void execute(Player c, String input) {
  967.             c.getPA().sendFrame126("www.serenityrsps.com", 12000);
  968.         }
  969.     },
  970.    
  971.     STORE {
  972.         @Override
  973.         public void execute(Player c, String input) {
  974.             c.getPA().sendFrame126("www.serenityrsps.com/store", 12000);
  975.         }
  976.     },
  977.     STREAK{
  978.         @Override
  979.         public void execute(Player c, String input) {
  980.             c.forceChat("[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
  981.         }
  982.     },
  983.     KILLSTREAK{
  984.         @Override
  985.         public void execute(Player c, String input) {
  986.             c.forceChat("@dre@[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
  987.         }
  988.     },
  989.     KS{
  990.         @Override
  991.         public void execute(Player c, String input) {
  992.             c.forceChat("[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
  993.         }
  994.     },
  995.     KDR{
  996.         @Override
  997.         public void execute(Player c, String input) {
  998.             DecimalFormat df = new DecimalFormat("#.##");
  999.             double ratio = ((double) c.KC) / ((double) c.DC);
  1000.             c.forceChat("[" + c.playerName + "] I have " + c.KC + " kills and " + c.DC + " deaths. My KDR is:"+ df.format(ratio) + "");
  1001.         }
  1002.     },
  1003.     WBOSS {
  1004.         @Override
  1005.         public void execute(Player c, String input) {
  1006.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1007.                 return;
  1008.             }
  1009.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1010.                 return;
  1011.             }
  1012.             TeleportExecutor.teleport(c, new Position(2980, 3871, 0));
  1013.         }
  1014.     },
  1015.     HELP {
  1016.         @Override
  1017.         public void execute(Player c, String input) {
  1018.             c.getPA().closeAllWindows();
  1019.             c.getPA().showInterface(59525);
  1020.         }
  1021.     },
  1022.     HOSTS {
  1023.         @Override
  1024.         public void execute(Player c, String input) {
  1025.             StringBuilder sb = new StringBuilder();
  1026.             for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1027.                 if (PlayerHandler.players[i] != null) {
  1028.                     Player c2 = PlayerHandler.players[i];
  1029.                     if (c2.getItems().playerHasItem(15098)) {
  1030.                         sb.append(c2.playerName + ", ");
  1031.                     }
  1032.                 }
  1033.             }
  1034.             if (sb.length() > 0) {
  1035.                 String result = "@blu@Available hosts@bla@: " + sb.substring(0, sb.length() - 2);
  1036.                 String[] wrappedLines = WordUtils.wrap(result, 80).split(System.getProperty("line.separator"));
  1037.                 for (String line : wrappedLines) {
  1038.                     c.sendMessage(line);
  1039.                 }
  1040.             } else {
  1041.                 c.sendMessage("@blu@No hosts available!");
  1042.             }
  1043.         }
  1044.     },
  1045.     /*BONUSXP {
  1046.         @Override
  1047.         public void execute(Player c, String input) {
  1048.             if (c.BONUS_WEEKEND == false) {
  1049.                 c.BONUS_WEEKEND = true;
  1050.                 c.sendMessage("Your XP is now: @red@locked@bla@.");
  1051.             } else {
  1052.                 c.BONUS_WEEKEND = false;
  1053.                 c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
  1054.             }
  1055.         }
  1056.     },*/
  1057.     LOCK {
  1058.         @Override
  1059.         public void execute(Player c, String input) {
  1060.             if (c.expLock == false) {
  1061.                 c.expLock = true;
  1062.                 c.sendMessage("Your XP is now: @red@locked@bla@.");
  1063.             } else {
  1064.                 c.expLock = false;
  1065.                 c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
  1066.             }
  1067.         }
  1068.     },
  1069.     MB {
  1070.         @Override
  1071.         public void execute(Player c, String input) {
  1072.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1073.                 return;
  1074.             }
  1075.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1076.                 return;
  1077.             }
  1078.             TeleportExecutor.teleport(c, new Position(2539, 4716, 0));
  1079.         }
  1080.     },
  1081.     BURNERS {
  1082.         @Override
  1083.         public void execute(Player c, String input) {
  1084.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1085.                 return;
  1086.             }
  1087.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1088.                 return;
  1089.             }
  1090.             TeleportExecutor.teleport(c, new Position(1719, 3465, 0));
  1091.         }
  1092.     },
  1093.    
  1094.     PLAYERS {
  1095.         @Override
  1096.         public void execute(Player c, String input) {
  1097.         c.sendMessage("@bla@Online players:@blu@" + PlayerHandler.getPlayerCount() +"");
  1098.     }
  1099.     },
  1100.    
  1101.    
  1102.     TRAIN {
  1103.         @Override
  1104.         public void execute(Player c, String input) {
  1105.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1106.                 return;
  1107.             }
  1108.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1109.                 return;
  1110.             }
  1111.             TeleportExecutor.teleport(c, new Position(2672, 3712, 0));
  1112.         }
  1113.     },
  1114.     TRAINING {
  1115.         @Override
  1116.         public void execute(Player c, String input) {
  1117.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1118.                 return;
  1119.             }
  1120.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1121.                 return;
  1122.             }
  1123.             TeleportExecutor.teleport(c, new Position(2672, 3712, 0));
  1124.         }
  1125.     },
  1126.     PLAYERS11111 {
  1127.         @Override
  1128.         public void execute(Player c, String input) {
  1129.        
  1130.             //for (int i = 8144; i < 8195; i++) {
  1131.              //   c.getPA().sendFrame126("", i);
  1132.             //   }
  1133.             //  c.getPA().showInterface(8134);
  1134.        
  1135.                 c.getPA().sendFrame126("@blu@" + Config.SERVER_NAME + " Players:", 8144);
  1136.                 c.getPA().sendFrame126("@red@Online players:" + PlayerHandler.getPlayerCount() + "", 8145);
  1137.                 int line = 8147;
  1138.                 for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1139.                
  1140.                
  1141.                     if (PlayerHandler.players[i] != null) {
  1142.                         Player d = c.getClient(PlayerHandler.players[i].playerName);
  1143.                         if (d.playerName != null) {
  1144.                             c.getPA().sendFrame126(d.playerName, line);
  1145.                         line++;
  1146.                         } else if (d.playerName == null) {
  1147.                             c.getPA().sendFrame126("@gre@", line);
  1148.                        
  1149.                     }
  1150.                 }
  1151.                 c.getPA().sendFrame126("", i);
  1152.                 c.flushOutStream();
  1153.                 return;
  1154.             }
  1155.             c.sendMessage("There are currently <col=255>" + PlayerHandler.getPlayerCount() + "</col> players online on <col=255>SerenityOS."); 
  1156.         }
  1157.     },
  1158.     RULES {
  1159.         @Override
  1160.         public void execute(Player c, String input) {
  1161.             c.getPA().sendFrame126("www.serenityrsps.com/index.php?/topic/7-serenity-global-rules/", 12000);
  1162.         }
  1163.     },
  1164.     SKULL {
  1165.         @Override
  1166.         public void execute(Player c, String input) {
  1167.             c.isSkulled = true;
  1168.             c.drawSkulls();
  1169.             c.skullTimer = Config.SKULL_TIMER;
  1170.             c.getPA().requestUpdates();
  1171.             c.sendMessage("<col=FF0000>Talk to the Emblem Trader to receive a extended skull.</col>");
  1172.         }
  1173.     },
  1174.     VOTE {
  1175.         @Override
  1176.         public void execute(Player c, String input) {
  1177.             c.getPA().sendFrame126("www.serenityrsps.everythingrs.com/services/vote", 12000);
  1178.         }
  1179.     },
  1180.     HIGHSCORES {
  1181.         @Override
  1182.         public void execute(Player c, String input) {
  1183.             c.getPA().sendFrame126("www.serenityrsps.com/highscores/", 12000);
  1184.         }
  1185.     },
  1186.     WESTS {
  1187.         @Override
  1188.         public void execute(Player c, String input) {
  1189.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1190.                 return;
  1191.             }
  1192.             if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1193.                 return;
  1194.             }
  1195.             TeleportExecutor.teleport(c, new Position(2979, 3597, 0));
  1196.         }
  1197.     },
  1198.     YELL {
  1199.        
  1200.         private final String[] ILLEGAL_ARGUMENTS = { ":tradereq:", "<img", "@cr", "<tran", "#url#", ":duelreq:",
  1201.         ":chalreq:" };
  1202.        
  1203.         @Override
  1204.         public void execute(Player c, String input) {
  1205.             if(c.getRights().isPlayer() || c.getRights().isManIron() || c.getRights().isUlt()) {
  1206.                 c.sendMessage("You need to donate to use this command. ::donate");
  1207.                 return;
  1208.             }
  1209.                
  1210.             if (c.getRights().isStaff()) {
  1211.                 //TODO check below and merge this shit.
  1212.                 String rank = "";
  1213.                 String message = input;
  1214.                 if (Connection.isMuted(c)) {
  1215.                     c.sendMessage("You are muted and can therefore not yell.");
  1216.                     return;
  1217.                 }
  1218.                 if (System.currentTimeMillis() < c.muteEnd) {
  1219.                     c.sendMessage("You are muted and can therefore not yell.");
  1220.                     return;
  1221.                 }
  1222.                 //String yellTag = "";
  1223.                 //if (c.yellTag.length() > 0) {
  1224.                 //  yellTag = "[" + c.yellTag + "@bla@]";
  1225.             //  }
  1226.                 String playerTitle = c.getTitles().getCurrentTitle();
  1227.                 if (c.getRights().isContributor()) {
  1228.  
  1229.                     rank = "[@cr4@@red@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1230.                 }
  1231.                 if (c.getRights().isSponsor()) {
  1232.  
  1233.                     rank = "[@cr5@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1234.                 }
  1235.                 if (c.getRights().isSupporter()) {
  1236.  
  1237.                     rank = "[@cr6@<col=148200>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1238.                 }
  1239.                 if (c.getRights().isVIP()) {
  1240.  
  1241.                     rank = "[@cr7@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1242.                 }
  1243.                 if (c.getRights().isSuperVIP()) {
  1244.  
  1245.                     rank = "[@cr8@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1246.                 }
  1247.                 if (c.getRights().isElite()) {
  1248.  
  1249.                     rank = "[@cr30@@or2@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1250.                 }
  1251.                 if (c.getRights().isLegend()) {
  1252.  
  1253.                     rank = "[@cr31@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1254.                 }
  1255.                 if (c.getRights().isRespectedMember()) {
  1256.  
  1257.                     rank = "[@cr9@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1258.                 }
  1259.                 if (c.getRights().isHelper()) {
  1260.  
  1261.                     rank = "[@cr10@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1262.                 }
  1263.                 /* Staff */
  1264.                 if (c.getRights().isModerator()) {
  1265.  
  1266.                     rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1267.                 }
  1268.                 if (c.getRights().isAdministrator()) {
  1269.  
  1270.                     rank = "[@cr2@@yel@"
  1271.                             + "istrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1272.                 }
  1273.                 if (c.playerName.equalsIgnoreCase("bob")) {
  1274.                     //rank = "<col=5E14A7>Owner</col>" + Misc.ucFirst(c.playerName) + ":<col=0000FF>";
  1275.                     rank = "[<col=5E14A7>@cr2@Owner]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1276.                 }
  1277.                 if (c.playerName.equalsIgnoreCase("")) {
  1278.                     rank = "[<col=5E14A7>@cr2@Community Manager]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1279.                 }
  1280.                 message = message.toLowerCase();
  1281.                 for (String argument : ILLEGAL_ARGUMENTS) {
  1282.                     if (message.contains(argument)) {
  1283.                         c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
  1284.                         return;
  1285.                     }
  1286.                 }
  1287.                 message = Misc.ucFirst(message);
  1288.                 PlayerHandler.executeGlobalMessage(rank + message);            
  1289.                 return;
  1290.             }
  1291.             String rank = "";
  1292.             String message = input;
  1293.             if (Connection.isMuted(c)) {
  1294.                 c.sendMessage("You are muted and can therefore not yell.");
  1295.                 return;
  1296.             }
  1297.             if (System.currentTimeMillis() < c.muteEnd) {
  1298.                 c.sendMessage("You are muted and can therefore not yell.");
  1299.                 return;
  1300.             }
  1301.             if (!c.lastYell.elapsed(5000) && c.getRights().isContributor()) {
  1302.                 c.sendMessage("You are a @red@Contributor@bla@ and must wait 5 seconds between each yell.");
  1303.                 return;
  1304.             }
  1305.             if (!c.lastYell.elapsed(5000) && c.getRights().isSponsor()) {
  1306.                 c.sendMessage("You are a @blu@Sponsor@bla@ and must wait 5 seconds between each yell.");
  1307.                 return;
  1308.             }
  1309.             if (!c.lastYell.elapsed(5000) && c.getRights().isSupporter()) {
  1310.                 c.sendMessage("You are a Supporter and must wait 5 seconds between each yell.");
  1311.                 return;
  1312.             }
  1313.             if (!c.lastYell.elapsed(5000) && c.getRights().isVIP()) {
  1314.                 c.sendMessage("You are a <col=FF00CD>VIP</col>@bla@ and must wait 5 seconds between each yell.");
  1315.                 return;
  1316.             }
  1317.             if (!c.lastYell.elapsed(5000) && c.getRights().isSuperVIP()) {
  1318.                 c.sendMessage("You are a @yel@Super VIP@bla@ and must wait 5 seconds between each yell.");
  1319.                 return;
  1320.             }
  1321.             String playerTitle = c.getTitles().getCurrentTitle();
  1322.             if (c.getRights().isContributor()) {
  1323.  
  1324.                 rank = "[@cr4@@red@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1325.             }
  1326.             if (c.getRights().isSponsor()) {
  1327.  
  1328.                 rank = "[@cr5@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1329.             }
  1330.             if (c.getRights().isSupporter()) {
  1331.  
  1332.                 rank = "[@cr6@<col=148200>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1333.             }
  1334.             if (c.getRights().isVIP()) {
  1335.  
  1336.                 rank = "[@cr7@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1337.             }
  1338.             if (c.getRights().isSuperVIP()) {
  1339.  
  1340.                 rank = "[@cr8@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1341.             }
  1342.             if (c.getRights().isElite()) {
  1343.  
  1344.                 rank = "[<img=30>@or2@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1345.             }
  1346.             if (c.getRights().isLegend()) {
  1347.  
  1348.                 rank = "[<img=31>@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1349.             }
  1350.             if (c.getRights().isRespectedMember()) {
  1351.  
  1352.                 rank = "[@cr9@@red@" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1353.             }
  1354.             if (c.getRights().isHelper()) {
  1355.  
  1356.                 rank = "[@cr10@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1357.             }
  1358.             /* Staff */
  1359.             if (c.getRights().isModerator()) {
  1360.  
  1361.                 rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1362.             }
  1363.             if (c.getRights().isAdministrator()) {
  1364.  
  1365.                 rank = "[@cr2@@yel@Administrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1366.             }
  1367.             if (c.getRights().isOwner() && !c.playerName.equalsIgnoreCase("")) {
  1368.                 rank = "[<col=A67711>Owner</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1369.             }
  1370.             if (c.playerName.equalsIgnoreCase("")) {
  1371.                 rank = "[<col=5E14A7>Server BITCH</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1372.             }
  1373.             message = message.toLowerCase();
  1374.             for (String argument : ILLEGAL_ARGUMENTS) {
  1375.                 if (message.contains(argument)) {
  1376.                     c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
  1377.                     return;
  1378.                 }
  1379.             }
  1380.             c.lastYell.reset();
  1381.             message = Misc.ucFirst(message);
  1382.             PlayerHandler.executeGlobalMessage(rank + message);
  1383.         }
  1384.     },
  1385.    
  1386.     /*
  1387.      * Donator
  1388.      */
  1389.     DONATORTITLE(donator()) {
  1390.         @Override
  1391.         public void execute(Player c, String input) {
  1392.             c.sendMessage("You will now get your donator title instead. Relog for changes to take effect.");
  1393.             c.keepTitle = false;
  1394.             c.killTitle = false;
  1395.         }
  1396.     },
  1397.     DONATORZONE(donator(), "dz") {
  1398.         @Override
  1399.         public void execute(Player c, String input) {
  1400.             if (c.inTrade || c.inDuel || c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
  1401.                 return;
  1402.             }
  1403.             TeleportExecutor.teleport(c, new Position(2848, 5075, 0));
  1404.         }
  1405.     },
  1406.  
  1407.     KILLTITLE(donator()) {
  1408.         @Override
  1409.         public void execute(Player c, String input) {
  1410.             c.sendMessage("You will now be using your kill title instead. Relog for changes to take effect.");
  1411.             c.keepTitle = false;
  1412.             c.killTitle = true;
  1413.         }
  1414.     },
  1415.    
  1416.     /*
  1417.      * HELPER
  1418.      */
  1419.    
  1420.     HELPDB(helper()) {
  1421.         @Override
  1422.         public void execute(Player c, String input) {
  1423.             HelpDatabase.getDatabase().openDatabase(c);
  1424.         }
  1425.     },
  1426.    
  1427.     /*
  1428.      * Moderator
  1429.      */
  1430.     CHECKINVENTORY(mod()) {
  1431.         @Override
  1432.         public void execute(Player c, String input) {
  1433.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1434.             if (optionalPlayer.isPresent()) {
  1435.                 Player c2 = optionalPlayer.get();
  1436.                 c.getPA().otherInv(c, c2);
  1437.                 c.getDH().sendDialogues(206, 0);
  1438.             } else {
  1439.                 c.sendMessage(input + " is not online. You can only check the inventory of online players.");
  1440.             }
  1441.         }
  1442.     },
  1443.     INFO(owner()) {
  1444.         @Override
  1445.         public void execute(Player c, String input) {
  1446.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1447.             if (optionalPlayer.isPresent()) {
  1448.                 Player c2 = optionalPlayer.get();
  1449.                 c.sendMessage("IP of " + c2.playerName + " : " + c2.connectedFrom);
  1450.                 c.sendMessage("Mac Address of " + c2.playerName + " : " + c2.getMacAddress());
  1451.             } else {
  1452.                 c.sendMessage(input + " is not line. You can request the info of online players.");
  1453.             }
  1454.         }
  1455.     },
  1456.     KSMOD(mod()) {
  1457.         @Override
  1458.         public void execute(Player c, String input) {
  1459.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1460.             if (optionalPlayer.isPresent()) {
  1461.                 Player c2 = optionalPlayer.get();
  1462.                 c.sendMessage("Hunter killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.HUNTER));
  1463.                 c.sendMessage("Rogue killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.ROGUE));
  1464.             }
  1465.         }
  1466.     },
  1467.     LOCKACC(mod()) {
  1468.         @Override
  1469.         public void execute(Player c, String input) {
  1470.             if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  1471.                 c.sendMessage("You're not permitted for this.");
  1472.                 return;
  1473.             }
  1474.             try {
  1475.                 String[] args = input.split(" ");
  1476.                 if (args.length != 1) {
  1477.                     c.sendMessage("Invalid arguments specified!");
  1478.                     throw new IllegalArgumentException();
  1479.                 }
  1480.                 String name = args[0];
  1481.                 Connection.lockAccount(name);
  1482.                 Connection.addNameToLocks(name);
  1483.  
  1484.                 Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  1485.                 if (optionalPlayer.isPresent()) {
  1486.                     Player c2 = optionalPlayer.get();
  1487.                     if (c2.getRights().isBetween(2,  3)) {
  1488.                         c.sendMessage("You cannot lock this player's account!");
  1489.                         return;
  1490.                     }
  1491.                     if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  1492.                         MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  1493.                         session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  1494.                     }
  1495.                     c2.disconnected = true;
  1496.                     c.sendMessage(Misc.formatPlayerName(name) + "'s account has been locked.");
  1497.                 }
  1498.             } catch (Exception e) {
  1499.                 e.printStackTrace();
  1500.                 c.sendMessage("Correct usage: ::lock playername");
  1501.             }
  1502.         }
  1503.     },
  1504.     MARKETUNMUTE(mod()) {
  1505.         @Override
  1506.         public void execute(Player c, String input) {
  1507.             if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  1508.                 c.sendMessage("You're not permitted for this.");
  1509.                 return;
  1510.             }
  1511.            
  1512.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1513.             if (optionalPlayer.isPresent()) {
  1514.                 Player c2 = optionalPlayer.get();
  1515.                 c2.marketMuteEnd = 0;
  1516.                 c.sendMessage(c2.playerName + " has been unmuted on the market channel.");
  1517.                 c2.sendMessage("@red@You have been unmuted by " + c.playerName + " on the market channel.");
  1518.                 //new PunishmentHandler().punishOnlinePlayer(c2, c, "Market Unmute", "");
  1519.             }
  1520.         }
  1521.     },
  1522.     MOVE(admin()) {
  1523.         @Override
  1524.         public void execute(Player c, String input) {
  1525.             try {
  1526.                 String[] args = input.split(" ");
  1527.                 int positionOffset = Integer.parseInt(args[1]);
  1528.                 int x = c.absX;
  1529.                 int y = c.absY;
  1530.                 int height = c.heightLevel;
  1531.                 switch (args[0].toLowerCase()) {
  1532.                 case "up":
  1533.                     height += positionOffset;
  1534.                     break;
  1535.                 case "down":
  1536.                     height -= positionOffset;
  1537.                     break;
  1538.                 case "north":
  1539.                     y += positionOffset;
  1540.                     break;
  1541.                 case "east":
  1542.                     x += positionOffset;
  1543.                     break;
  1544.                 case "south":
  1545.                     y -= positionOffset;
  1546.                     break;
  1547.                 case "west":
  1548.                     x -= positionOffset;
  1549.                     break;
  1550.                 }
  1551.                 c.getPA().movePlayer(x, y, height);
  1552.             } catch (Exception e) {
  1553.                 c.sendMessage("Error. Correct syntax: ::move up/down/north/east/south/west amount");
  1554.             }
  1555.         }
  1556.     },
  1557.     RANDOM(mod()) {
  1558.         @Override
  1559.         public void execute(Player c, String input) {
  1560.             String[] args = input.split("-");
  1561.             boolean ignore = false;
  1562.             if (args.length > 2) {
  1563.                 c.sendMessage("Incorrect syntax; '::random-name'");
  1564.                 return;
  1565.             }
  1566.             if (args.length == 2) {
  1567.                 if (args[1].equals("ignore")) {
  1568.                     if (!c.getRights().inherits(Rights.ADMINISTRATOR)) {
  1569.                         c.sendMessage("You cannot force this, you do not inherit Administrative rights.");
  1570.                         return;
  1571.                     }
  1572.                     ignore = true;
  1573.                 } else {
  1574.                     c.sendMessage("The second argument should contain 'ignore', please try again.");
  1575.                     return;
  1576.                 }
  1577.             }
  1578.             Optional<Player> online = PlayerHandler.getOptionalPlayer(args[0]);
  1579.             if (!online.isPresent()) {
  1580.                 c.sendMessage("This player is not online.");
  1581.                 return;
  1582.             }
  1583.             Player target = online.get();
  1584.             if (target.getInterfaceEvent().isActive()) {
  1585.                 c.sendMessage("The event is already active for this player. It should resolve shortly.");
  1586.                 return;
  1587.             }
  1588.             if (!target.getInterfaceEvent().isExecutable() && !ignore) {
  1589.                 c.sendMessage("The event is deemed as 'un-executable'. This could be due to a number of reasons.");
  1590.                 c.sendMessage("If you believe the event should ignore this, type ::random-name-ignore to do so.");
  1591.                 c.sendMessage("Only administrative staff have this access.");
  1592.                 return;
  1593.             }
  1594.             c.sendMessage("You have executed the random event for this player.");
  1595.             target.getInterfaceEvent().execute();
  1596.         }
  1597.     },
  1598.     STAFFTITLE(mod()) {
  1599.         @Override
  1600.         public void execute(Player c, String input) {
  1601.             c.sendMessage("You will now get your staff title instead. Relog for changes to take effect.");
  1602.             c.keepTitle = false;
  1603.             c.killTitle = false;
  1604.         }
  1605.     },
  1606.     STAFFZONE(helper()) {
  1607.         @Override
  1608.         public void execute(Player c, String input) {
  1609.             TeleportExecutor.teleport(c, new Position(2912, 5475, 0));
  1610.         }
  1611.     },
  1612.     TELETO(mod(), "xteleto") {
  1613.         @Override
  1614.         public void execute(Player c, String input) {
  1615.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1616.             if (optionalPlayer.isPresent()) {
  1617.                 Player c2 = optionalPlayer.get();
  1618.                 c.getPA().movePlayer(c2.getX(), c2.getY(), c2.heightLevel);        
  1619.             } else {
  1620.                 c.sendMessage(input + " is not line. You can only teleport to online players.");
  1621.             }
  1622.         }
  1623.     },
  1624.     TELETOME(mod()) {
  1625.         @Override
  1626.         public void execute(Player c, String input) {
  1627.             if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  1628.                 c.sendMessage("You're not permitted for this.");
  1629.                 return;
  1630.             }
  1631.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1632.             if (optionalPlayer.isPresent()) {
  1633.                 Player c2 = optionalPlayer.get();
  1634.                 c2.teleportToX = c.absX;
  1635.                 c2.teleportToY = c.absY;
  1636.                 c2.heightLevel = c.heightLevel;
  1637.                 c.sendMessage(Misc.formatPlayerName(c2.playerName)+ " has been teleported to you.");
  1638.             } else {
  1639.                 c.sendMessage(input + " is offline. You can only teleport online players.");
  1640.             }
  1641.         }
  1642.     },
  1643.     UNLOCK(mod()) {
  1644.         @Override
  1645.         public void execute(Player c, String input) {
  1646.             try {
  1647.                 String[] args = input.split(" ");
  1648.                 if (args.length != 1) {
  1649.                     c.sendMessage("Invalid arguments specified!");
  1650.                     throw new IllegalArgumentException();
  1651.                 }
  1652.                 String name = args[0];
  1653.                 if (Connection.lockedAccounts.contains(name)) {
  1654.                     Connection.unlockAccount(name);
  1655.                     c.sendMessage(Misc.formatPlayerName(name) + "'s account has been unlocked.");
  1656.                 } else {
  1657.                     c.sendMessage("That player's account is not locked.");
  1658.                 }
  1659.             } catch (Exception e) {
  1660.                 e.printStackTrace();
  1661.                 c.sendMessage("Correct usage: ::unlock playername");
  1662.             }
  1663.         }
  1664.     },
  1665.     VISIBILITY(admin()) {
  1666.         @Override
  1667.         public void execute(Player c, String input) {
  1668.             if (c.isInvisible()) {
  1669.                 c.setInvisible(false);
  1670.                 c.sendMessage("You are no longer invisible.");
  1671.             } else {
  1672.                 c.setInvisible(true);
  1673.                 c.sendMessage("You are now invisible.");
  1674.             }
  1675.             c.getPA().requestUpdates();
  1676.         }
  1677.     },
  1678.        
  1679.     /*
  1680.      * Administrator
  1681.      */
  1682.     CHECKBANK(owner()) {
  1683.         @Override
  1684.         public void execute(Player c, String input) {
  1685.             if (PlayerHandler.updateRunning) {
  1686.                 c.sendMessage("You cannot view a bank whilst the server is updating.");
  1687.                 return;
  1688.             }
  1689.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1690.             if (optionalPlayer.isPresent()) {
  1691.                 c.getPA().openOtherBank(optionalPlayer.get());
  1692.             } else {
  1693.                 c.sendMessage(input + " is not online. You can only view the bank of online players.");
  1694.             }
  1695.         }
  1696.     },
  1697.     DUELARENA(owner()) {
  1698.         @Override
  1699.         public void execute(Player c, String input) {
  1700.             Config.NEW_DUEL_ARENA_ACTIVE = Config.NEW_DUEL_ARENA_ACTIVE ? false : true;
  1701.             c.sendMessage("The duel arena is currently " + (Config.NEW_DUEL_ARENA_ACTIVE ? "Enabled" : "Disabled") + ".");
  1702.         }
  1703.     },
  1704.     EMPTY {
  1705.         @Override
  1706.         public void execute(Player c, String input) {
  1707.                 if (!c.inWild() && !c.inCamWild() && !c.inPvP() && !c.inDuel) {
  1708.             c.getPA().removeAllItems();
  1709.             c.sendMessage("You empty your inventory.");
  1710.         } else {
  1711.             c.sendMessage("You cannot empty your inventory here.");
  1712.         }
  1713.    
  1714.         //c.sendMessage("This command is not available at this time.");
  1715.  
  1716. }
  1717.     },
  1718.     SPAWNNPC(owner()) {
  1719.         public void execute(Player c, String input) {
  1720.             String[] args = input.split(" ");
  1721.             try {
  1722.                 BufferedWriter spawn = new BufferedWriter(new FileWriter("./Data/cfg/spawn-config.cfg", true));
  1723.                 int npcId = Integer.parseInt(args[0]);
  1724.                 if (npcId > 0) {
  1725.                     Server.npcHandler.spawnNpc(c, npcId, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  1726.                     c.sendMessage("You have spawned: " + npcId + "Name: " + NpcDefinition.DEFINITIONS[npcId].getName());
  1727.                 } else {
  1728.                     c.sendMessage("No Such Npc");
  1729.                 }
  1730.                 try {
  1731.                     spawn.newLine();
  1732.                     spawn.write("spawn = " + npcId + "      " + c.absX + "  " + c.absY + "  0   1   0   0   0");
  1733.                 } finally {
  1734.                     spawn.close();
  1735.                 }
  1736.             } catch (IOException e) {
  1737.             }
  1738.         }
  1739.     },
  1740.     GODMODE(owner()) {
  1741.         @Override
  1742.         public void execute(Player c, String input) {
  1743.             if (c.inGodmode()) {
  1744.                 c.playerLevel[Skill.STRENGTH.getId()] = 99;
  1745.                 c.getPA().refreshSkill(2);
  1746.                 c.playerLevel[Skill.HITPOINTS.getId()] = 99;
  1747.                 c.getPA().refreshSkill(3);
  1748.                 c.playerLevel[Skill.PRAYER.getId()] = 99;
  1749.                 c.getPA().refreshSkill(5);
  1750.                 c.specAmount = 10.0;
  1751.                 c.getPA().requestUpdates();
  1752.                 c.setSafemode(false);
  1753.                 c.setGodmode(false);
  1754.                 c.sendMessage("Godmode deactivated. Return to base for debriefing.");
  1755.             } else {
  1756.                 c.playerLevel[Skill.STRENGTH.getId()] = 9999;
  1757.                 c.getPA().refreshSkill(Skill.STRENGTH.getId());
  1758.                 c.playerLevel[3] = Integer.MAX_VALUE;
  1759.                 c.getPA().refreshSkill(3);
  1760.                 c.playerLevel[5] = Integer.MAX_VALUE;
  1761.                 c.getPA().refreshSkill(5);
  1762.                 c.specAmount = Integer.MAX_VALUE;
  1763.                 c.getPA().requestUpdates();
  1764.                 c.setSafemode(true);
  1765.                 c.setGodmode(true);
  1766.                 c.sendMessage("Godmode activated. Good luck soldier!");
  1767.             }
  1768.         }
  1769.     },
  1770.     MACBAN(owner()) {
  1771.        
  1772.         @Override
  1773.         public void execute(Player c, String input) {
  1774.             if (isMacAddress(input)) {
  1775.                 banAddress(c, input);
  1776.             } else {
  1777.                 banPlayer(c, input);
  1778.             }
  1779.         }
  1780.        
  1781.         void banPlayer(Player c, String input) {
  1782.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1783.             if (optionalPlayer.isPresent()) {
  1784.                 Player c2 = optionalPlayer.get();
  1785.                 if (c2.getMacAddress().isEmpty()) {
  1786.                     c.sendMessage("The players mac address is empty and therefor cannot be added to the list.");
  1787.                     c.sendMessage("This happens when the client cannot determine the player address during login.");
  1788.                     c.sendMessage("You are going to have to consider another possible means of action.");
  1789.                     return;
  1790.                 }
  1791.                 if (Connection.isMacBanned(c2.getMacAddress())) {
  1792.                     c.sendMessage("This player is already mac banned, they shouldn't be online.");
  1793.                     c.sendMessage("Consider another possible means of action.");
  1794.                     return;
  1795.                 }
  1796.                 Connection.addNameToBanList(c2.playerName, Long.MAX_VALUE);
  1797.                 Connection.addMacBan(c2.getMacAddress());
  1798.                 c.sendMessage(c2.playerName + " has been mac banned with the address: " + c2.getMacAddress() + ".");
  1799.                 c2.disconnected = true;    
  1800.                 c2.properLogout = true;
  1801.             } else {
  1802.                 c.sendMessage(input + " is offline. Try '::macban macaddress' instead to ban offline players.");           
  1803.             }
  1804.         }
  1805.        
  1806.         void banAddress(Player c, String input) {
  1807.             Connection.addMacBan(input);
  1808.             c.sendMessage("Mac address: " + input + " has been banned.");
  1809.         }
  1810.        
  1811.         boolean isMacAddress(String input) {
  1812.             return input.length() == 17 && StringUtils.countMatches(input, "-") == 5;
  1813.         }
  1814.     },
  1815.     PNPC(owner()) {
  1816.         @Override
  1817.         public void execute(Player c, String input) {
  1818.             try {
  1819.                 String args[] = input.split("-");
  1820.                 if (args.length != 2) {
  1821.                     throw new IllegalArgumentException();
  1822.                 }
  1823.                 Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
  1824.                 if (optionalPlayer.isPresent()) {
  1825.                     Player c2 = optionalPlayer.get();
  1826.                     int npc = Integer.parseInt(args[1]);
  1827.                     if (npc < 9999) {
  1828.                         c2.npcId2 = npc;
  1829.                         c2.playerWalkIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1830.                         c2.playerStandIndex = NPCCacheDefinition.forID(npc).getStandIndex();
  1831.                         c2.playerRunIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1832.                         c2.playerTurnIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1833.                         c2.playerTurn180Index = NPCCacheDefinition.forID(npc).getWalkIndex();
  1834.                         c2.playerTurn90CCWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1835.                         c2.playerTurn90CWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1836.                         c2.isNpc = true;
  1837.                         c2.updateRequired = true;
  1838.                         c2.appearanceUpdateRequired = true;
  1839.                     }
  1840.                 } else {
  1841.                     throw new IllegalStateException();
  1842.                 }
  1843.             } catch (IllegalArgumentException e) {
  1844.                 c.sendMessage("Error. Correct syntax: ::pnpc-player-npcid");
  1845.             } catch (IllegalStateException e) {
  1846.                 c.sendMessage("You can only use the command on online players.");
  1847.             }          
  1848.         }
  1849.     },
  1850.     SAFEMODE() {
  1851.         @Override
  1852.         public void execute(Player c, String input) {
  1853.             if (c.inSafemode()) {
  1854.                 c.setSafemode(false);
  1855.                 c.sendMessage("You now lose items on death again.");
  1856.             } else {
  1857.                 c.setSafemode(true);
  1858.                 c.sendMessage("You no longer lose items on death.");
  1859.             }
  1860.         }
  1861.     },
  1862.     SETVAR(owner()) {
  1863.         @Override
  1864.         public void execute(Player c, String input) {
  1865.             String[] args = input.split(" ");
  1866.             if (args.length != 2) {
  1867.                 c.sendMessage("Code red! Invalid var arguments specified! Try again?");
  1868.                 return;
  1869.             }
  1870.             String variable = args[0];
  1871.             String t;
  1872.             Double value2 = Double.parseDouble(args[1]);
  1873.             int value = value2.intValue();
  1874.             if (variable.startsWith("com_")) {
  1875.                 t = variable.substring(4);
  1876.                 switch (t) {
  1877.                 case "god":
  1878.                     c.setGodmode(value == 1 ? true : false);
  1879.                     if (value == 0) {
  1880.                         c.playerLevel[3] = 99;
  1881.                         c.getPA().refreshSkill(3);
  1882.                         c.playerLevel[5] = 99;
  1883.                         c.specAmount = 10.0;
  1884.                         c.getPA().refreshSkill(5);
  1885.                         c.getPA().requestUpdates();
  1886.                         c.setSafemode(false);
  1887.                     } else {
  1888.                         c.playerLevel[Skill.STRENGTH.getId()] = 9999;
  1889.                         c.getPA().refreshSkill(Skill.STRENGTH.getId());
  1890.                         c.playerLevel[3] = Integer.MAX_VALUE;
  1891.                         c.getPA().refreshSkill(3);
  1892.                         c.playerLevel[5] = Integer.MAX_VALUE;
  1893.                         c.getPA().refreshSkill(5);
  1894.                         c.specAmount = Integer.MAX_VALUE;
  1895.                         c.getPA().requestUpdates();
  1896.                         c.setSafemode(true);
  1897.                     }
  1898.                     break;
  1899.                 case "droprate":
  1900.                     c.setDropModifier(value2);
  1901.                     c.sendMessage("set " + variable + ": to " + value2);
  1902.                     return;
  1903.                 case "poison":
  1904.                     c.setPoisonDamage((byte) value);
  1905.                     c.getPA().requestUpdates();
  1906.                     break;
  1907.                 case "venom":
  1908.                     c.setVenomDamage((byte) value);
  1909.                     c.getPA().requestUpdates();
  1910.                     break;
  1911.                 default:
  1912.                     throwInvalid(c);
  1913.                     return;
  1914.                 }
  1915.                 c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1916.             } else if (variable.startsWith("jmod_")) {
  1917.                 t = variable.substring(5);
  1918.                 switch (t) {
  1919.                 case "bh":
  1920.                     Config.BOUNTY_HUNTER_ACTIVE = value == 1 ? true : false;       
  1921.                     break;
  1922.                 case "debug":
  1923.                     c.setDebug(value);
  1924.                     break;
  1925.                 case "dxp":
  1926.                     Config.BONUS_WEEKEND = value == 1 ? true : false;
  1927.                     break;
  1928.                 case "attackable":
  1929.                     Config.ADMIN_ATTACKABLE = value >= 1 ? true : false;
  1930.                     break;
  1931.                 default:
  1932.                     throwInvalid(c);
  1933.                     return;
  1934.                 }
  1935.                 c.sendMessage("set " + variable + ": to " + value);
  1936.             } else if (variable.startsWith("tzhaar_")) {
  1937.                 t = variable.substring(7);
  1938.                 switch (t) {
  1939.                     case "wave":
  1940.                         c.waveId = value;
  1941.                         break;
  1942.                 }
  1943.                 c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1944.             } else if (variable.startsWith("clanwars_")) {
  1945.                 t = variable.substring(9);
  1946.                 switch (t) {
  1947.                 case "ffa":
  1948.                     //ClanWars.FFA_ENABLED = value >= 1 ? true : false;
  1949.                     break;
  1950.                 case "challenge":
  1951.                     //ClanWars.CHALLENGE_ENABLED = value >= 1 ? true : false;
  1952.                     break;
  1953.                 default:
  1954.                     throwInvalid(c);
  1955.                     return;
  1956.                 }
  1957.                 c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1958.             } else if (variable.startsWith("wep_")) {
  1959.                 t = variable.substring(4);
  1960.                 switch (t) {
  1961.                 case "blowpipe":
  1962.                     c.setToxicBlowpipeCharge(value);
  1963.                     c.setToxicBlowpipeAmmo(value);
  1964.                     c.setToxicBlowpipeAmmoAmount(value);
  1965.                     break;
  1966.                 case "trident":
  1967.                     c.setTridentCharge(value);
  1968.                     c.setToxicTridentCharge(value);
  1969.                     break;
  1970.                 case "serp":
  1971.                     c.setSerpentineHelmCharge(value);
  1972.                     break;
  1973.                 case "toxic":
  1974.                     c.setToxicStaffOfDeadCharge(value);
  1975.                     break;
  1976.                 default:
  1977.                     throwInvalid(c);
  1978.                     return;
  1979.                 }
  1980.                 c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1981.             } else if (variable.startsWith("help")) {
  1982.                 c.getDH().sendStatement("Var arguments: com_god, config_bh, config_dxp, tzhaar_wave, config_attackable");
  1983.             } else {
  1984.                 throwInvalid(c);
  1985.             }
  1986.         }
  1987.        
  1988.         private int BASE_VARIABLE = 15;
  1989.        
  1990.        
  1991.         /**
  1992.          * Throws a lovely invalid message should the player's arguments be invalid.
  1993.          * @param c the player
  1994.          */
  1995.         private void throwInvalid(Player c) {
  1996.             c.sendMessage("Code red! Invalid var arguments specified! Try again?");
  1997.         }
  1998.     },
  1999.     SMESSAGE(admin()) {
  2000.         @Override
  2001.         public void execute(Player c, String input) {
  2002.             String[] args = input.split("-");
  2003.             if (args.length != 2) {
  2004.                 c.sendMessage("Improper syntax; type ::smessage-player-message");
  2005.                 return;
  2006.             }
  2007.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
  2008.             if (optionalPlayer.isPresent()) {
  2009.                 Player c2 = optionalPlayer.get();
  2010.                 c2.sendMessage(args[1]);
  2011.             } else {
  2012.                 c.sendMessage(args[0] + " is not online. You can only send messages to online players.");
  2013.             }
  2014.         }
  2015.     },
  2016.     /*SPELLS {
  2017.         @Override
  2018.         public void execute(Player c, String input) {
  2019.             if(c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
  2020.                 c.sendMessage("You can only spawn items in a safezone.");
  2021.                 return;
  2022.             }
  2023.             if (c.playerMagicBook == 2) {
  2024.                 c.sendMessage("You switch to modern magic.");
  2025.                 c.setSidebarInterface(6, 1151);
  2026.                 c.playerMagicBook = 0;
  2027.             } else if (c.playerMagicBook == 0) {
  2028.                 c.sendMessage("You switch to ancient magic.");
  2029.                 c.setSidebarInterface(6, 12855);
  2030.                 c.playerMagicBook = 1;
  2031.             } else if (c.playerMagicBook == 1) {
  2032.                 c.sendMessage("You switch to lunar magic.");
  2033.                 c.setSidebarInterface(6, 29999);
  2034.                 c.playerMagicBook = 2;
  2035.             }
  2036.         }
  2037.     },*/
  2038.     UNIPBAN(admin()) {
  2039.         @Override
  2040.         public void execute(Player c, String input) {
  2041.             if (input.isEmpty()) {
  2042.                 c.sendMessage("You must enter a valid IP address.");
  2043.                 return;
  2044.             }
  2045.             if (!Connection.isIpBanned(input)) {
  2046.                 c.sendMessage("This IP address is not listed as IP banned");
  2047.                 return;
  2048.             }
  2049.             try {
  2050.                 Connection.removeIpBan(input);
  2051.             } catch (IOException e) {
  2052.                 c.sendMessage("The IP could not be successfully removed from the file.");
  2053.                 return;
  2054.             }
  2055.             Connection.removeIpFromBanList(input);
  2056.             c.sendMessage("The IP '"+input+"' has been removed from the IP ban list.");
  2057.         }
  2058.     },
  2059.     UNMACBAN(owner()) {
  2060.         @Override
  2061.         public void execute(Player c, String input) {
  2062.             try {
  2063.                 c.sendMessage("address: " + input);
  2064.                 if (!Connection.isMacBanned(input)) {
  2065.                     c.sendMessage("The address does not exist in the list, make sure it matches perfectly.");
  2066.                     return;
  2067.                 }
  2068.                 Connection.removeMacBan(input);
  2069.                 c.sendMessage("The mac ban on the address; " + input + " has been lifted.");
  2070.             } catch (IndexOutOfBoundsException exception) {
  2071.                 c.sendMessage("Error. Correct syntax: ::unmacban address.");
  2072.             }
  2073.         }
  2074.     },
  2075.     UPDATEBANS(owner()) {
  2076.         @Override
  2077.         public void execute(Player c, String input) {
  2078.             Connection.resetIpBans();
  2079.         }
  2080.     },
  2081.    
  2082.     /*
  2083.      * OWNER
  2084.      */
  2085.    
  2086.     BANK(owner()) {
  2087.         @Override
  2088.         public void execute(Player c, String input) {
  2089.             c.getPA().openUpBank();
  2090.         }
  2091.     },
  2092.     BARRAGE(owner()) {
  2093.         @Override
  2094.         public void execute(Player c, String input) {
  2095.             c.sendMessage("This command is not available at this time.");
  2096.         }
  2097.     },
  2098.     BH(owner()) {
  2099.         @Override
  2100.         public void execute(Player c, String input) {
  2101.             //Config.BOUNTY_HUNTER_ACTIVE = Config.BOUNTY_HUNTER_ACTIVE ? false : true;
  2102.             //c.sendMessage(Config.BOUNTY_HUNTER_ACTIVE ? "Bounty hunter is now active." : "Bounty hunter is no longer active.");
  2103.         }
  2104.     },
  2105.    
  2106. /*  LOCK {
  2107.         @Override
  2108.         public void execute(Player c, String input) {
  2109.             if (c.expLock == false) {
  2110.                 c.expLock = true;
  2111.                 c.sendMessage("Your XP is now: @red@locked@bla@.");
  2112.             } else {
  2113.                 c.expLock = false;
  2114.                 c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
  2115.             }
  2116.         }
  2117.     },*/
  2118.  
  2119.     BONUSON(owner()) {
  2120.         @Override
  2121.         public void execute(Player c, String input) {
  2122.  
  2123.                 c.BONUS_WEEKEND = true;
  2124.                 c.sendMessage("BONUS WEEKEND TOGGLED ON");
  2125.        
  2126.         }
  2127.     },
  2128.     BONUSOFF(owner()) {
  2129.         @Override
  2130.         public void execute(Player c, String input) {
  2131.  
  2132.                 c.BONUS_WEEKEND = false;
  2133.                 c.sendMessage("BONUS WEEKEND TOGGLED Off");
  2134.        
  2135.         }
  2136.     },
  2137.     CUSTOM(owner()) {
  2138.         @Override
  2139.         public void execute(Player c, String input) {
  2140.             c.getPA().checkObjectSpawn(411, 2340, 9806, 2, 10);
  2141.         }
  2142.     },
  2143.     CYBER(owner()) {
  2144.         @Override
  2145.         public void execute(Player c, String input) {
  2146.             if (Config.CYBER_MONDAY) {
  2147.                 Config.CYBER_MONDAY = false;
  2148.                 c.sendMessage("CYBER MONDAY TOGGLED OFF");
  2149.             } else {
  2150.                 Config.CYBER_MONDAY = true;
  2151.                 c.sendMessage("CYBER MONDAY TOGGLED ON");
  2152.             }
  2153.         }
  2154.     },
  2155.     DEBUG(owner()) {
  2156.         @Override
  2157.         public void execute(Player c, String input) {
  2158.             if (Config.SERVER_DEBUG) {
  2159.                 Config.SERVER_DEBUG = false;
  2160.             //  PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled off by " +c.playerName);
  2161.             } else {
  2162.                 Config.SERVER_DEBUG = true;
  2163.                 //PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled on by " +c.playerName);
  2164.             }
  2165.         }
  2166.     },
  2167.     DEMOTE(owner()) {
  2168.         @Override
  2169.         public void execute(Player c, String input) {
  2170.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2171.             if (optionalPlayer.isPresent()) {
  2172.                 Player c2 = optionalPlayer.get();
  2173.                 c2.setRights(Rights.PLAYER);
  2174.                 c.sendMessage("You've demoted the user:  " + c2.playerName + " IP: " + c2.connectedFrom);
  2175.                 c2.disconnected = true;
  2176.             } else {
  2177.                 c.sendMessage(input + " is not online. You can only demote online players.");
  2178.             }
  2179.         }
  2180.     },
  2181.     EMOTE(owner()) {
  2182.         @Override
  2183.         public void execute(Player c, String input) {
  2184.             c.animation(Integer.parseInt(input));
  2185.             c.getPA().requestUpdates();
  2186.         }
  2187.     },
  2188.     FALEM(owner()) {
  2189.         @Override
  2190.         public void execute(Player c, String input) {
  2191.             for (int j = 0; j < PlayerHandler.players.length; j++) {
  2192.                 if (PlayerHandler.players[j] != null) {
  2193.                     Player c2 = PlayerHandler.players[j];
  2194.                     c2.forceChat(input);
  2195.                     c2.forcedChatUpdateRequired = true;
  2196.                     c2.updateRequired = true;
  2197.                 }
  2198.             }
  2199.         }
  2200.     },
  2201.     GET(owner()) {
  2202.         @Override
  2203.         public void execute(Player c, String input) {
  2204.             try {
  2205.                 String[] args = input.split(" ");
  2206.                 String regex = args[0].replaceAll("_", " ").toLowerCase();
  2207.                 List<ItemDefinition> list = new Gson().fromJson(FileUtils.readFileToString(new File("./Data/json/item_definitions.json")),new TypeToken<List<ItemDefinition>>() { }.getType());
  2208.                 Optional<ItemDefinition> item = list.stream().filter(i -> i.getName().toLowerCase() == regex).findFirst();
  2209.                 if (item.isPresent()) {
  2210.                     final ItemDefinition def = item.get();
  2211.                     int amount = Integer.parseInt(args[1]);
  2212.                     c.getItems().addItem(def.getName() == "coins" ? 995 : def.getId(), amount);
  2213.                 } else {
  2214.                     c.sendMessage("Uh oh! That was quite ineffective. It seems you've tried to spawn " + regex + ".");
  2215.                 }
  2216.                 } catch (IOException ex) {
  2217.                     System.err.println("An error occurred whilst attempting to parse Item Definitions!");
  2218.                 }
  2219.         }
  2220.     },
  2221.    
  2222.     GETPASS(owner()) {
  2223.         @Override
  2224.         public void execute(Player c, String input) {
  2225.             try {
  2226.                 Optional<Player> c2 = PlayerHandler.getOptionalPlayer(input);
  2227.                 if (c2.isPresent()) {
  2228.                     c.sendMessage("Username: (" + c2.get().playerName + ") Password: (" + c2.get().playerPass + ") ");
  2229.                 } else {               
  2230.                     c.sendMessage("This player either does not exist or is OFFLINE.");
  2231.                 }
  2232.             } catch (Exception e) {
  2233.                 c.sendMessage("Invalid Command, Try ::getpass USERNAME.");
  2234.             }
  2235.         }
  2236.     },
  2237.     GFX(owner()) {
  2238.         @Override
  2239.         public void execute(Player c, String input) {
  2240.             c.gfx0(Integer.parseInt(input));
  2241.         }
  2242.     },
  2243.     GIVE(owner()) {
  2244.         @Override
  2245.         public void execute(Player c, String input) {
  2246.             try {
  2247.                 String[] args = input.split(" ");
  2248.                 String item = args[0].replaceAll("_", " ");
  2249.                 int amount = args.length == 2 ? Integer.parseInt(args[1]) : 1;
  2250.                 int itemId = (item.equalsIgnoreCase("coins") ? 995 : c.getItems().getItemId(item));
  2251.                 if ((itemId <= 20500) && (itemId >= 0)) {
  2252.                     c.getItems().addItem(itemId, amount);
  2253.                 }
  2254.             } catch (Exception e) {
  2255.                 c.sendMessage("Invalid item name or syntax! Try this - ::give itemname amount");
  2256.             }
  2257.         }
  2258.     },
  2259.     GIVEBRO(owner()) {
  2260.         @Override
  2261.         public void execute(Player c, String input) {
  2262.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2263.             if (optionalPlayer.isPresent()) {
  2264.                 Player c2 = optionalPlayer.get();
  2265.                 c2.setRights(Rights.UNKNOWN);
  2266.                 c.sendMessage("You've promoted the user:  " + c2.playerName + " IP: " + c2.connectedFrom);
  2267.                 c2.disconnected = true;
  2268.             } else {
  2269.                 c.sendMessage(input + " is not online. You can only promote online players.");
  2270.             }
  2271.         }
  2272.     },
  2273.     GIVEGOL(owner()) {
  2274.         @Override
  2275.         public void execute(Player c, String input) {
  2276.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2277.             if (optionalPlayer.isPresent()) {
  2278.                 Player c2 = optionalPlayer.get();
  2279.                 c2.setRights(Rights.SPONSOR);
  2280.                 c.sendMessage("You've promoted the user:  " + c2.playerName + " IP: " + c2.connectedFrom);
  2281.                 c2.disconnected = true;
  2282.             } else {
  2283.                 c.sendMessage(input + " is not online. You can only promote online players.");
  2284.             }
  2285.         }
  2286.     }
  2287.     GIVEITEM(owner()) {
  2288.         @Override
  2289.         public void execute(Player c, String input) {
  2290.             try {
  2291.                 String args[] = input.split("-");
  2292.                 if (args.length != 3) {
  2293.                     throw new IllegalArgumentException();
  2294.                 }
  2295.                 String playerName = args[0];
  2296.                 int itemID = Integer.parseInt(args[1]);
  2297.                 int amount = Misc.stringToInt(args[2]);
  2298.  
  2299.                 Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
  2300.                 if (optionalPlayer.isPresent()) {
  2301.                     Player c2 = optionalPlayer.get();
  2302.                     if (c2.getItems().freeSlots() > amount - 1) {
  2303.                         c2.getItems().addItem(itemID, amount);
  2304.                         c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
  2305.                                 + " by: " + Misc.optimizeText(c.playerName));
  2306.                     } else {
  2307.                         c2.getItems().addItemToBank(itemID, amount);
  2308.                         c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
  2309.                                 + " by: " + Misc.optimizeText(c.playerName));
  2310.                         c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
  2311.                     }
  2312.                     c.sendMessage("You have just given " + amount + " of item number: " + c.getItems().getItemName(itemID)
  2313.                             + ".");
  2314.  
  2315.                 } else {
  2316.                     c.sendMessage(playerName + " is not online.");
  2317.                 }
  2318.             } catch (Exception e) {
  2319.                 c.sendMessage("Error. Correct syntax: ::giveitem-player-itemid-amount");
  2320.             }
  2321.         }
  2322.     },
  2323.     GIVEMOD(owner()) {
  2324.         @Override
  2325.         public void execute(Player c, String input) {
  2326.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2327.             if (optionalPlayer.isPresent()) {
  2328.                 Player c2 = optionalPlayer.get();
  2329.                 c2.setRights(Rights.MODERATOR);
  2330.                 c.sendMessage("You've promoted the user:  " + c2.playerName + " IP: " + c2.connectedFrom);
  2331.                 c2.disconnected = true;
  2332.             } else {
  2333.                 c.sendMessage(input + " is not online. You can only promote online players.");
  2334.             }
  2335.         }
  2336.     },
  2337.     GIVEPTS(owner()) {
  2338.         @Override
  2339.         public void execute(Player c, String input) {
  2340.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2341.             if (optionalPlayer.isPresent()) {
  2342.                 Player c2 = optionalPlayer.get();
  2343.                 c2.donatorPoints += 2;
  2344.                 c.sendMessage("You've given 2 store points to the user:  " + c2.playerName + " IP: " + c2.connectedFrom);
  2345.                 c2.disconnected = true;
  2346.             } else {
  2347.                 c.sendMessage(input + " is not online. You can only give store points to online players.");
  2348.             }
  2349.         }
  2350.     },
  2351.     GIVESIL(owner()) {
  2352.         @Override
  2353.         public void execute(Player c, String input) {
  2354.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2355.             if (optionalPlayer.isPresent()) {
  2356.                 Player c2 = optionalPlayer.get();
  2357.                 c2.setRights(Rights.CONTRIBUTOR);
  2358.                 c.sendMessage("You've promoted the user:  " + c2.playerName + " IP: " + c2.connectedFrom);
  2359.                 c2.disconnected = true;
  2360.             } else {
  2361.                 c.sendMessage(input + " is not online. You can only promote online players.");
  2362.             }
  2363.         }
  2364.     },
  2365.     INTERFACE(owner()) {
  2366.         @Override
  2367.         public void execute(Player c, String input) {
  2368.             try {
  2369.                 int a = Integer.parseInt(input);
  2370.                 c.getPA().showInterface(a);
  2371.             } catch (Exception e) {
  2372.                 c.sendMessage("::interface ####");
  2373.             }
  2374.         }
  2375.     },
  2376.    
  2377.     JIG(owner()) {
  2378.         @Override
  2379.         public void execute(Player c, String input) {
  2380.             TeleportExecutor.teleport(c, new Position(3094, 3486, 0));
  2381.         }
  2382.     },
  2383.     KILL(owner()) {
  2384.         @Override
  2385.         public void execute(Player c, String input) {
  2386.             Player player = PlayerHandler.getPlayer(input);
  2387.             if (player == null) {
  2388.                 c.sendMessage("Player is null.");
  2389.                 return;
  2390.             }
  2391.             player.appendDamage(player.playerLevel[3], Hitmark.HIT);
  2392.             player.getPA().refreshSkill(3);
  2393.             player.sendMessage("You have been merked by " + c.playerName + ".");
  2394.         }
  2395.     },
  2396.     NPC(owner()) {
  2397.         @Override
  2398.         public void execute(Player c, String input) {
  2399.             int newNPC = Integer.parseInt(input);
  2400.             if (newNPC > 0) {
  2401.                 Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  2402.             } else {
  2403.                 c.sendMessage("No such NPC.");
  2404.             }
  2405.         }
  2406.     },
  2407.     NSPAWN(owner()) {
  2408.         @Override
  2409.         public void execute(Player c, String input) {
  2410.             NPCHandler.loadDefs();
  2411.             PlayerHandler.executeGlobalMessage("[<col=255>" + c.playerName + "</col>] " + "NPC Spawns have been reloaded.");
  2412.         }
  2413.     },
  2414.     OBJECT(owner()) {
  2415.         @Override
  2416.         public void execute(Player c, String input) {
  2417.             c.getPA().object(Integer.parseInt(input), c.absX, c.absY, 0, 10);
  2418.         }
  2419.     },
  2420.     POS(owner()) {
  2421.         @Override
  2422.         public void execute(Player c, String input) {
  2423.             c.sendMessage("loc=[absX: " + c.absX + " absY:" + c.absY + " h:" + c.height + "] region= id: " + c.getPosition().getRegionId() + " " + c.getPosition().getZ() + "," + c.getPosition().getLocalX() + "," + c.getPosition().getLocalY());
  2424.         }
  2425.     },
  2426.     PROMOTE(owner()) {
  2427.         @Override
  2428.         public void execute(Player c, String input) {
  2429.             String[] args = input.split("-");
  2430.             if (args.length != 2) {
  2431.                 c.sendMessage("The correct format is '::promote-name-rights'.");
  2432.                 return;
  2433.             }
  2434.             Player player = PlayerHandler.getPlayer(args[0]);
  2435.             if (player == null) {
  2436.                 c.sendMessage("The player '"+args[0]+"' could not be found, try again.");
  2437.                 return;
  2438.             }
  2439.             int right;
  2440.             try {
  2441.                 right = Integer.parseInt(args[1]);
  2442.             } catch (NumberFormatException e) {
  2443.                 c.sendMessage("The level of rights must be a whole number.");
  2444.                 return;
  2445.             }
  2446.             Rights rights = Rights.get(right);
  2447.             if (rights == null) {
  2448.                 c.sendMessage("The level of rights you've requested is unknown.");
  2449.                 return;
  2450.             }
  2451.             if (player.getRights().isStaff() && !c.getRights().isOwner()) {
  2452.                 c.sendMessage("Only the CEO can modify the level of other staff.");
  2453.                 return;
  2454.             }
  2455.             if (player.getRights().equals(rights)) {
  2456.                 c.sendMessage("That player already has this level of rights.");
  2457.                 return;
  2458.             }
  2459.             player.setRights(rights);
  2460.             player.properLogout = true;
  2461.             player.disconnected = true;
  2462.             c.sendMessage("You have promoted " + args[0] + " to " + rights.name() + ".");
  2463.         }
  2464.     },
  2465.     RED(owner()) {
  2466.         @Override
  2467.         public void execute(Player c, String input) {
  2468.             c.drawSkulls();
  2469.             c.getPA().requestUpdates();
  2470.         }
  2471.     },
  2472.     RED2(owner()) {
  2473.         @Override
  2474.         public void execute(Player c, String input) {
  2475.             c.headIconPk = (2);
  2476.             c.getPA().requestUpdates();
  2477.         }
  2478.     },
  2479.     RED3(owner()) {
  2480.         @Override
  2481.         public void execute(Player c, String input) {
  2482.             c.headIconPk = (3);
  2483.             c.getPA().requestUpdates();
  2484.         }
  2485.     },
  2486.     RED4(owner()) {
  2487.         @Override
  2488.         public void execute(Player c, String input) {
  2489.             c.headIconPk = (4);
  2490.             c.getPA().requestUpdates();
  2491.         }
  2492.     },
  2493.     RED5(owner()) {
  2494.         @Override
  2495.         public void execute(Player c, String input) {
  2496.             c.headIconPk = (5);
  2497.             c.getPA().requestUpdates();
  2498.         }
  2499.     },
  2500.     RELOADITEMS(owner()) {
  2501.         @Override
  2502.         public void execute(Player c, String input) {
  2503.             // should really be done asynchronously...
  2504.             new ItemDefinitionLoader().load();
  2505.             c.sendMessage("@don2@[Load] Reloading @blu@item.cfg@bla@ and @blu@prices.txt");
  2506.         }
  2507.     },
  2508.     RELOADOBJECTS(owner()) {
  2509.         @Override
  2510.         public void execute(Player c, String input) {
  2511.             try {
  2512.                 Server.getGlobalObjects().reloadObjectFile(c);
  2513.                 c.sendMessage("The object file has been reloaded.");
  2514.             } catch (IOException e) {
  2515.                 e.printStackTrace();
  2516.             }
  2517.         }
  2518.     },
  2519.     RELOADSHOPS(owner()) {
  2520.         @Override
  2521.         public void execute(Player c, String input) {
  2522.             Server.shopHandler = new org.perception.world.ShopHandler();
  2523.             c.sendMessage("[Load] Reloading @blu@Shop Config.cfg");
  2524.         }
  2525.     },
  2526.    
  2527.  
  2528.     SHIELD(owner()) {
  2529.         @Override
  2530.         public void execute(Player c, String input) {
  2531.             if (c.isNpc && c.npcId2 == 336) {
  2532.                 c.isNpc = false;
  2533.             } else {
  2534.                 c.npcId2 = 336;
  2535.                 c.isNpc = true;
  2536.             }
  2537.             c.updateRequired = true;
  2538.             c.appearanceUpdateRequired = true;
  2539.         }
  2540.     },
  2541.     SHOP(owner()) {
  2542.         @Override
  2543.         public void execute(Player c, String input) {
  2544.             try {
  2545.                 c.getShops().openShop(Integer.parseInt(input));
  2546.                 c.sendMessage("You successfully opened shop #" + input + ".");
  2547.             } catch (IndexOutOfBoundsException ioobe) {
  2548.                 c.sendMessage("Error. Correct syntax: ::shop shopid");
  2549.             }
  2550.         }
  2551.     },
  2552.     SIGIL(owner()) {
  2553.         @Override
  2554.         public void execute(Player c, String input) {
  2555.             if (c.isNpc && c.npcId2 == 335) {
  2556.                 c.isNpc = false;
  2557.             } else {
  2558.                 c.npcId2 = 335;
  2559.                 c.isNpc = true;
  2560.             }
  2561.             c.updateRequired = true;
  2562.             c.appearanceUpdateRequired = true;
  2563.         }
  2564.     },
  2565.     SPAWN(owner()) {
  2566.         @Override
  2567.         public void execute(Player c, String input) {
  2568.             String[] args = input.split(" ");
  2569.             try {
  2570.                 int itemId = Integer.parseInt(args[0]);
  2571.                 int amount = Misc.stringToInt(args[1]);
  2572.                 c.getItems().addItem(itemId, amount);
  2573.             } catch (NumberFormatException nfe) {
  2574.                 c.sendMessage("Improper use of the command; '::spawn itemid amount'.");
  2575.             }
  2576.         }
  2577.     },
  2578.    
  2579. UNMUTE(helper()) {
  2580.     @Override
  2581.     public void execute(Player c, String input) {
  2582.         if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2583.             c.sendMessage("You're not permitted for this.");
  2584.             return;
  2585.         }
  2586.         Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2587.         if (optionalPlayer.isPresent()) {
  2588.             Player c2 = optionalPlayer.get();
  2589.             c2.muteEnd = 0;
  2590.             c.sendMessage(c2.playerName + " has been unmuted.");
  2591.             c2.sendMessage("@red@You have been unmuted by " + c.playerName + ".");
  2592.             //new PunishmentHandler().punishOnlinePlayer(c2, c, "Unmute", "");
  2593.         }
  2594.     }
  2595. },
  2596.  
  2597. UNJAIL(mod()) {
  2598. @Override
  2599. public void execute(Player c, String input) {
  2600.     if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2601.         c.sendMessage("You're not permitted for this.");
  2602.         return;
  2603.     }
  2604.     Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2605.  
  2606.     if (optionalPlayer.isPresent()) {
  2607.         Player c2 = optionalPlayer.get();
  2608.         if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  2609.             c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
  2610.             return;
  2611.         }
  2612.         c2.teleportToX = 3093;
  2613.         c2.teleportToY = 3493;
  2614.         c2.jailEnd = 0;
  2615.         c2.sendMessage("You have been unjailed by " + c.playerName + ". Don't get jailed again!");
  2616.         c.sendMessage("Successfully unjailed " + c2.playerName + ".");
  2617.         //new PunishmentHandler().punishOnlinePlayer(c2, c, "Unjail", "");
  2618.     } else {
  2619.         c.sendMessage(input + " is not online. Only online players can be unjailed.");
  2620.     }
  2621. }
  2622. },
  2623.     JAIL(mod()) {
  2624.     @Override
  2625.     public void execute(Player c, String input) {
  2626.         if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2627.             c.sendMessage("You're not permitted for this.");
  2628.             return;
  2629.         }
  2630.         try {
  2631.             String[] args = input.split("-");
  2632.             if (args.length != 3) {
  2633.                 throw new IllegalArgumentException();
  2634.             }
  2635.             String name = args[0];
  2636.             int duration = Integer.parseInt(args[1]);
  2637.             long jailEnd = 0;
  2638.             if (duration == 0) {
  2639.                 jailEnd = Long.MAX_VALUE;
  2640.             } else {
  2641.                 jailEnd = System.currentTimeMillis() + duration * 1000 * 60;
  2642.             }
  2643.             String reason = args[2];
  2644.  
  2645.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  2646.             if (optionalPlayer.isPresent()) {
  2647.                 Player c2 = optionalPlayer.get();
  2648.                 if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  2649.                     c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
  2650.                     return;
  2651.                 }
  2652.                 c2.teleportToX = 2095;
  2653.                 c2.teleportToY = 4428;
  2654.                 c2.jailEnd = jailEnd;
  2655.                 if (duration == 0) {
  2656.                     c2.sendMessage("@red@You have been permanently jailed by " + c.playerName + " .");
  2657.                     c.sendMessage("Permanently jailed " + c2.playerName + ".");
  2658.                     //new PunishmentHandler().punishOnlinePlayer(c2, c, "Jail (Permanent)", reason);
  2659.  
  2660.                 } else {
  2661.                     c2.sendMessage("@red@You have been jailed by " + c.playerName + " for " + duration + " minutes.");
  2662.                     c2.sendMessage("@red@Type ::unjail after having served your time to be unjailed.");
  2663.                     c.sendMessage("Successfully jailed " + c2.playerName + " for " + duration + " minutes.");
  2664.                     //new PunishmentHandler().punishOnlinePlayer(c2, c, "Jail (" + duration + ")", reason);
  2665.                 }
  2666.             } else {
  2667.                 c.sendMessage(name + " is not online. You can only jail online players.");
  2668.             }
  2669.         } catch (Exception e) {
  2670.             c.sendMessage("Error. Correct syntax: ::jail-player-duration-reason");
  2671.         }
  2672.     }
  2673.    
  2674.  
  2675. },
  2676.  
  2677.    
  2678.     PICKUP(admin()) {
  2679.         @Override
  2680.         public void execute(Player c, String input) {
  2681.             String[] args = input.split(" ");
  2682.              try {                
  2683.                  
  2684.                     int itemId = Integer.parseInt(args[0]);
  2685.                     int amount = Misc.stringToInt(args[1]);
  2686.                 if(itemId > 23000) {
  2687.                     c.sendMessage("This item does not exist!");
  2688.                     return;
  2689.                 }
  2690.    
  2691.            
  2692.                 if(c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
  2693.                     c.sendMessage("You can only spawn items in a safezone.");
  2694.                     return;
  2695.                 }
  2696.                 if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
  2697.                     c.sendMessage("You cannot spawn items in the duel arena!");
  2698.                     return;
  2699.                 }
  2700.                 if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
  2701.                     return;
  2702.                 }
  2703.                 if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
  2704.                     return;
  2705.                 }
  2706.                 if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
  2707.                     return;
  2708.                 }
  2709.                 if (Boundary.isIn(c, Kraken.BOUNDARY)) {
  2710.                     return;
  2711.                 }
  2712.  
  2713.                 /*for (int i = 0; i < COINS_SPAWN.length; i++) {
  2714.                     if(!(itemId == i)) {
  2715.                         c.sendMessage("You cannot spawn this item.");
  2716.                         return;
  2717.                     }
  2718.                 }*/
  2719.                  
  2720.                
  2721.                  
  2722.          
  2723.                
  2724.                 c.getItems().addItem(itemId, amount);
  2725.             } catch (NumberFormatException nfe) {
  2726.                 c.sendMessage("Improper use of the command; '::item itemid amount'.");
  2727.             }
  2728.         }
  2729.  
  2730.  
  2731.     },
  2732.     TAKEITEM(owner()) {
  2733.         @Override
  2734.         public void execute(Player c, String input) {
  2735.             try {
  2736.                 String args[] = input.split("-");
  2737.                 if (args.length != 3) {
  2738.                     throw new IllegalArgumentException();
  2739.                 }
  2740.                 String playerName = args[0];
  2741.                 int itemID = Integer.parseInt(args[1]);
  2742.                 int amount = Misc.stringToInt(args[2]);
  2743.  
  2744.                 Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
  2745.                 if (optionalPlayer.isPresent()) {
  2746.                     Player c2 = optionalPlayer.get();
  2747.                     if (c2.getItems().playerHasItem(itemID, 1)) {
  2748.                         c2.getItems().deleteItem(itemID, amount);
  2749.                         c.sendMessage("You have just taken " + amount + " " + c.getItems().getItemName(itemID) + " from " + c2.playerName + ".");
  2750.                         c2.sendMessage(c.playerName + " has taken " + amount + " " + c.getItems().getItemName(itemID) + " from you.");
  2751.                     } else {
  2752.                         c.sendMessage("This player doesn't have this item!");
  2753.                     }
  2754.  
  2755.                 } else {
  2756.                     c.sendMessage(playerName + " is not online.");
  2757.                 }
  2758.             } catch (Exception e) {
  2759.                 c.sendMessage("Error. Correct syntax: ::takeitem-player-itemid-amount");
  2760.             }
  2761.         }
  2762.     },
  2763.     /*
  2764.      * Teleports the player to the given coordinate. Note: to teleport by region, separate args[0]
  2765.      * with commas (i.e. - <i>0,50,53</i>, wherein <b>0 is the <i>height</i></b>, <b>50 is the <i>regionX</i></b>,
  2766.      * and <b>53 is the <i>regionY</i></b>).
  2767.      */
  2768.     TELE(admin()) {
  2769.         @Override
  2770.         public void execute(Player c, String input) {
  2771.             String[] args = input.split(" ");
  2772.             if (args.length > 1) {
  2773.                 switch (args.length) {
  2774.                 case 2:
  2775.                     c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), c.heightLevel);
  2776.                     break;
  2777.                 case 3:
  2778.                     c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
  2779.                     break;
  2780.                 }
  2781.             } else {
  2782.             String[] coords = args[0].split(",");
  2783.             int height = Integer.parseInt(coords[0]);
  2784.             int smallX = Integer.parseInt(coords[1]);
  2785.             int smallY = Integer.parseInt(coords[2]);
  2786.             switch (coords.length) {
  2787.                 //Simple region - syntax x,y,height
  2788.                 case 2:
  2789.                     c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), c.heightLevel);
  2790.                     break;
  2791.                 case 3:
  2792.                     c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
  2793.                     break;
  2794.                 case 4:
  2795.                     //c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
  2796.                     break;
  2797.                 }  
  2798.             }
  2799.         }
  2800.     },
  2801.     TEST(owner()) {
  2802.        
  2803.         private int[] DROP_LIST_COMMON = {4151
  2804.                
  2805.         };
  2806.  
  2807.         private int[] DROP_LIST_UNCOMMON = {4153
  2808.                
  2809.         };
  2810.        
  2811.         private int[] DROP_LIST_RARE = {12936, 12936, 12922, 12932, 12927, 6571
  2812.                
  2813.         };
  2814.  
  2815.         public int COMMON_DROP() {
  2816.             return DROP_LIST_COMMON[(int)(Math.random()*DROP_LIST_COMMON.length)];
  2817.         }
  2818.        
  2819.         public int UNCOMMON_DROP() {
  2820.             return DROP_LIST_UNCOMMON[(int)(Math.random()*DROP_LIST_UNCOMMON.length)];
  2821.         }
  2822.        
  2823.         public int RARE_DROP() {
  2824.             return DROP_LIST_RARE[(int)(Math.random()*DROP_LIST_RARE.length)];
  2825.         }
  2826.        
  2827.         @Override
  2828.         public void execute(Player c, String input) {
  2829.             for (int i = 0; i < 20; i++) {
  2830.                 if (Misc.random(100) >= 0 && Misc.random(100) <= 49) {
  2831.                     System.out.println(
  2832.                             "Run  #" + i + ", Gathered Common: " + c.getItems().addItem(COMMON_DROP(), 1));
  2833.                 } else
  2834.                 if (Misc.random(100) >= 50 && Misc.random(100) <= 97) {
  2835.                     System.out.println(
  2836.                             "Run  #" + i + ", Gathered Uncommon: " + c.getItems().addItem(UNCOMMON_DROP(), 1));
  2837.                 } else
  2838.                 if (Misc.random(100) >= 98) {
  2839.                     System.out.println(
  2840.                             "Run  #" + i + ", Gathered Rare: " + c.getItems().addItem(RARE_DROP(), 1));
  2841.                 }
  2842.             }
  2843.         }
  2844.     },
  2845.     TROLL(owner()) {
  2846.         @Override
  2847.         public void execute(Player c, String input) {
  2848.             PlayerHandler.executeGlobalMessage("Quick! The first person to type @blu@::i4akosa9fUcxzij8a@bla@ will recieve a santa hat!!");
  2849.         }
  2850.     },
  2851.     UNPC(owner()) {
  2852.         @Override
  2853.         public void execute(Player c, String input) {
  2854.             c.isNpc = false;
  2855.             c.playerStandIndex = 0x328;
  2856.             c.playerTurnIndex = 0x337;
  2857.             c.playerWalkIndex = 0x333;
  2858.             c.playerTurn180Index = 0x334;
  2859.             c.playerTurn90CWIndex = 0x335;
  2860.             c.playerTurn90CCWIndex = 0x336;
  2861.             c.playerRunIndex = 0x338;
  2862.             c.updateRequired = true;
  2863.             c.appearanceUpdateRequired = true;
  2864.         }
  2865.     },
  2866.     UPDATE(owner()) {
  2867.         @Override
  2868.         public void execute(Player c, String input) {
  2869.             int seconds = Integer.parseInt(input);
  2870.             if (seconds < 15) {
  2871.                 c.sendMessage("The timer cannot be lower than 15 seconds so other operations can be sorted.");
  2872.                 seconds = 15;
  2873.             }
  2874.             PlayerHandler.updateSeconds = seconds;
  2875.             PlayerHandler.updateAnnounced = false;
  2876.             PlayerHandler.updateRunning = true;
  2877.             PlayerHandler.updateStartTime = System.currentTimeMillis();
  2878.             for (Player player : PlayerHandler.players) {
  2879.                 if (player == null) {
  2880.                     continue;
  2881.                 }
  2882.                 Player client = player;
  2883.                 if (client.getPA().viewingOtherBank) {
  2884.                     client.getPA().resetOtherBank();
  2885.                     client.sendMessage("An update is now occuring, you cannot view banks.");
  2886.                 }
  2887.                 DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(client, MultiplayerSessionType.DUEL);
  2888.                 if (Objects.nonNull(duelSession)) {
  2889.                     if (duelSession.getStage().getStage() == MultiplayerSessionStage.FURTHER_INTERACTION) {
  2890.                         if (!duelSession.getWinner().isPresent()) {
  2891.                             duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2892.                             duelSession.getPlayers().forEach(p -> {
  2893.                                 p.sendMessage("The duel has been cancelled by the server because of an update.");
  2894.                                 duelSession.moveAndClearAttributes(p);
  2895.                             });
  2896.                         }
  2897.                     } else if (duelSession.getStage().getStage() < MultiplayerSessionStage.FURTHER_INTERACTION) {
  2898.                         duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2899.                         duelSession.getPlayers().forEach(p -> {
  2900.                             p.sendMessage("The duel has been cancelled by the server because of an update.");
  2901.                             duelSession.moveAndClearAttributes(p);
  2902.                         });
  2903.                     }
  2904.                 }
  2905.             }
  2906.         }
  2907.     },
  2908.     VENG(owner()) {
  2909.         @Override
  2910.         public void execute(Player c, String input) {
  2911.             c.sendMessage("This command is not available at this time.");
  2912.         }
  2913.     },
  2914.     WILD(owner()) {
  2915.         @Override
  2916.         public void execute(Player c, String input) {
  2917.             c.sendMessage("inWilderness: " + (c.getY() == 3523 ? true : false));
  2918.             c.sendMessage("loc=[absX: " + c.getX() + " absY:" + c.getY() + "]");
  2919.             c.sendMessage("bh_active: " + Config.BOUNTY_HUNTER_ACTIVE);
  2920.         }
  2921.     },
  2922.    
  2923.     BANIP(mod()) {
  2924.     @Override
  2925.     public void execute(Player c, String input) {
  2926.         if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2927.             c.sendMessage("You're not permitted for this.");
  2928.             return;
  2929.         }
  2930.         try {
  2931.             String[] args = input.split("-");
  2932.             if (args.length != 2) {
  2933.                 throw new IllegalArgumentException();
  2934.             }
  2935.             String ipToBan = args[0];
  2936.             String reason = args[1];
  2937.             Connection.addIpToBanList(ipToBan);
  2938.             Connection.addIpToFile(ipToBan);
  2939.  
  2940.             List<Player> clientList = PlayerHandler.getPlayers().stream().filter(player -> player.connectedFrom.equals(ipToBan))
  2941.                     .collect(Collectors.toList());
  2942.             for (Player c2 : clientList) {
  2943.                 if (!Connection.isIpBanned(c2.connectedFrom)) {
  2944.                     Connection.addNameToBanList(ipToBan, Long.MAX_VALUE);
  2945.                     Connection.addNameToFile(ipToBan, Long.MAX_VALUE);
  2946.                     if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  2947.                         MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  2948.                         session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2949.                     }
  2950.                     c2.disconnected = true;
  2951.                     c.sendMessage("You have IP banned the user: " + c2.playerName + " with the host: " + c2.connectedFrom);
  2952.                 }
  2953.  
  2954.             }
  2955.             c.sendMessage("You have successfully banned the IP: " + ipToBan);
  2956.         //new PunishmentHandler().punishOfflinePlayer(ipToBan, c, "Ban IP", reason);
  2957.         } catch (Exception e) {
  2958.             c.sendMessage("Error. Correct syntax: ::banip-ip-reason");
  2959.         }
  2960.     }
  2961.     },
  2962.  
  2963.     BAN(mod()) {
  2964.     @Override
  2965.     public void execute(Player c, String input) {
  2966.         if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2967.             c.sendMessage("You're not permitted for this.");
  2968.             return;
  2969.         }
  2970.         try {
  2971.             String[] args = input.split("-");
  2972.             if (args.length != 3) {
  2973.                 throw new IllegalArgumentException();
  2974.             }
  2975.             String name = args[0];
  2976.             int duration = Integer.parseInt(args[1]);
  2977.             long banEnd;
  2978.             if (duration == 0) {
  2979.                 banEnd = Long.MAX_VALUE;
  2980.             } else {
  2981.                 banEnd = System.currentTimeMillis() + duration * 1000 * 60;
  2982.             }
  2983.             String reason = args[2];
  2984.             Connection.addNameToBanList(name, banEnd);
  2985.             Connection.addNameToFile(name, banEnd);
  2986.  
  2987.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  2988.             if (optionalPlayer.isPresent()) {
  2989.                 Player c2 = optionalPlayer.get();
  2990.                 if (c2.getRights().isBetween(2,  3)) {
  2991.                     c.sendMessage("You cannot ban this player.");
  2992.                     return;
  2993.                 }
  2994.                 if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  2995.                     MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  2996.                     session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2997.                 }
  2998.                 c2.disconnected = true;
  2999.                 if (duration == 0) {
  3000.                     c.sendMessage(name + " has been permanently banned.");
  3001.                     //new //PunishmentHandler().punishOnlinePlayer(c2, c, "Ban (Permanent)", reason);
  3002.                 } else {
  3003.                     c.sendMessage(name + " has been banned for " + duration + " minute(s).");
  3004.                     //new //PunishmentHandler().punishOnlinePlayer(c2, c, "Ban (" + duration + ")", reason);
  3005.                 }
  3006.                 return;
  3007.             }
  3008.             if (duration == 0) {
  3009.                 c.sendMessage(name + " has been permanently banned.");
  3010.                 //new PunishmentHandler().punishOfflinePlayer(name, c, "Ban (Permanent)", reason);
  3011.             } else {
  3012.                 c.sendMessage(name + " has been banned for " + duration + " minute(s).");
  3013.             //new PunishmentHandler().punishOfflinePlayer(name, c, "Ban (" + duration + ")", reason);
  3014.             }
  3015.         } catch (Exception e) {
  3016.             c.sendMessage("Correct usage: ::ban-player-duration-reason (0 as duration for permanent)");
  3017.         }
  3018.     }
  3019.  
  3020.    
  3021. },
  3022.    
  3023.     IPBAN(mod()) {
  3024.     @Override
  3025.     public void execute(Player c, String input) {
  3026.         if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  3027.             c.sendMessage("You're not permitted for this.");
  3028.             return;
  3029.         }
  3030.         try {
  3031.             String[] args = input.split("-");
  3032.             if (args.length != 2) {
  3033.                 throw new IllegalArgumentException();
  3034.             }
  3035.             String name = args[0];
  3036.             String reason = args[1];
  3037.             Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  3038.             if (optionalPlayer.isPresent()) {
  3039.                 Player c2 = optionalPlayer.get();
  3040.                 if (c.playerName == c2.playerName) {
  3041.                     c.sendMessage("You cannot IP Ban yourself.");
  3042.                     return;
  3043.                 }
  3044.                 if (c2.getRights().isBetween(2,  3)) {
  3045.                     c.sendMessage("You cannot ban this player.");
  3046.                     return;
  3047.                 }
  3048.                 if (!Connection.isIpBanned(c2.connectedFrom)) {
  3049.                     Connection.addNameToBanList(name, Long.MAX_VALUE);
  3050.                     Connection.addNameToFile(name, Long.MAX_VALUE);
  3051.                     Connection.addIpToBanList(c2.connectedFrom);
  3052.                     Connection.addIpToFile(c2.connectedFrom);
  3053.                     if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  3054.                         MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  3055.                         session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  3056.                     }
  3057.                     c2.disconnected = true;
  3058.                     c.sendMessage("You have IP banned the user: " + c2.playerName + " with the host: " + c2.connectedFrom);
  3059.                     //new PunishmentHandler().punishOnlinePlayer(c2, c, "IP-Ban", reason);
  3060.                 } else {
  3061.                     c.sendMessage("This user is already IP Banned.");
  3062.                 }
  3063.             } else {
  3064.                 c.sendMessage(name + " is not online. Use ::banip instead to IP-Ban an offline player.");
  3065.             }
  3066.         } catch (Exception e) {
  3067.             c.sendMessage("Error. Correct syntax: ::ipban-player-reason");
  3068.         }
  3069.     }
  3070.  
  3071. },
  3072.  
  3073.    
  3074.     FUCKUP(owner()) {
  3075.     @Override
  3076.     public void execute(Player c, String input) {
  3077.         Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  3078.         if (optionalPlayer.isPresent()) {
  3079.             Player c2 = optionalPlayer.get();
  3080.             if (c2.getRights().isBetween(1,  3)) {
  3081.                 c.sendMessage("You can't use this command on this player!");
  3082.                 return;
  3083.             }
  3084.             //new PunishmentHandler().punishOnlinePlayer(c2, c, "Fuckup", "");
  3085.             for (int j = 0; j < 250; j++) {
  3086.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3087.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3088.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3089.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3090.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3091.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3092.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3093.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3094.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3095.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3096.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3097.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3098.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3099.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3100.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3101.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3102.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3103.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3104.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3105.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3106.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3107.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3108.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3109.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3110.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3111.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3112.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3113.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3114.                 c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3115.                 c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3116.                 c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3117.                 c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3118.             }
  3119.         } else {
  3120.             c.sendMessage(input + " is not online. You can only fuckup online players.");
  3121.         }
  3122.     }
  3123. },
  3124.     KICK(mod()) {
  3125.     @Override
  3126.     public void execute(Player c, String input) {
  3127.         if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  3128.             c.sendMessage("You're not permitted for this.");
  3129.             return;
  3130.         }
  3131.         Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  3132.        
  3133.         if (optionalPlayer.isPresent()) {
  3134.             Player c2 = optionalPlayer.get();
  3135.             if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  3136.                 c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
  3137.                 return;
  3138.             }
  3139.             c2.outStream.createFrame(109);
  3140.             CycleEventHandler.getSingleton().stopEvents(c2);
  3141.             c2.properLogout = true;
  3142.             ConnectedFrom.addConnectedFrom(c2, c2.connectedFrom);
  3143.             c.sendMessage("Kicked " + c2.playerName);
  3144.             //new PunishmentHandler().punishOnlinePlayer(c2, c, "Kick", "");           
  3145.         } else {
  3146.             c.sendMessage(input + " is not online. You can only kick online players.");
  3147.         }
  3148.     }
  3149. },
  3150.  
  3151. MUTE(helper()) {
  3152. @Override
  3153. public void execute(Player c, String input) {
  3154.     if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  3155.         c.sendMessage("You're not permitted for this.");
  3156.         return;
  3157.     }
  3158.     try {
  3159.         String[] args = input.split("-");
  3160.         if (args.length != 3) {
  3161.             throw new IllegalArgumentException();
  3162.         }
  3163.         String name = args[0];
  3164.         int duration = Integer.parseInt(args[1]);
  3165.         long muteEnd = 0;
  3166.         if (duration == 0) {
  3167.             muteEnd = Long.MAX_VALUE;
  3168.         } else {
  3169.             muteEnd = System.currentTimeMillis() + duration * 1000 * 60;
  3170.         }
  3171.         String reason = args[2];
  3172.        
  3173.         Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  3174.         if (optionalPlayer.isPresent()) {
  3175.             Player c2 = optionalPlayer.get();
  3176.             c2.muteEnd = muteEnd;
  3177.             if (duration == 0) {
  3178.                 c2.sendMessage("You have been permanently muted by " + c.playerName + " due to rulebreaking.");
  3179.                 c2.sendMessage("To prevent further mutes please read the rules.");
  3180.                 c.sendMessage("Successfully permanently " + c2.playerName + " for " + duration + " minutes.");
  3181.                 //new PunishmentHandler().punishOnlinePlayer(c2, c, "Mute (Permanent)", reason);
  3182.             } else {
  3183.                 c2.sendMessage("You have been temporarily muted by " + c.playerName + " for " + duration + " minutes");
  3184.                 c2.sendMessage("To prevent further mutes please read the rules.");
  3185.                 c.sendMessage("Successfully muted " + c2.playerName + " for " + duration + " minutes.");
  3186.                 //new PunishmentHandler().punishOnlinePlayer(c2, c, "Mute (" + duration + ")", reason);
  3187.             }
  3188.         } else {
  3189.             c.sendMessage(name + " is not online. You can only mute online players.");
  3190.         }
  3191.     } catch (Exception e) {
  3192.         c.sendMessage("Error. Correct syntax: ::mute-player-duration-reason.");
  3193.     }
  3194. }
  3195. },
  3196.  
  3197.    
  3198.     ;
  3199.    
  3200.     public String[] additional;
  3201.     public Predicate<Player> predicate;
  3202.    
  3203.     private Commands(String ... additional) {
  3204.         this(all(), additional);
  3205.     }
  3206.  
  3207.    
  3208.     private Commands(Predicate<Player> rights, String ... additional) {
  3209.         this.additional = additional;
  3210.         this.predicate = rights;
  3211.     }
  3212.  
  3213.     public abstract void execute(Player c, String input);
  3214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement