Advertisement
mrkirby153

Untitled

Dec 20th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. @Override
  2. public void run(Server server, Player player, Command cmd, String commandLabel, String[] args) throws CommandException {
  3. SWCPlayer swcPlayer = SWCPlayers.findPlayer(player);
  4. if (args.length == 1) {
  5. if (args[0].equalsIgnoreCase("hubList")) {
  6. // Display hubs
  7. player.sendMessage("-----");
  8. ArrayList<SWCHub> hbs = Hubs.getAllHubs();
  9. SWCHub[] hubs = hbs.toArray(new SWCHub[hbs.size()]);
  10. for (SWCHub hub : hubs) {
  11. player.sendMessage(hub.getName());
  12. }
  13. player.sendMessage("-----");
  14. }
  15. if(args[0].equalsIgnoreCase("showall")){
  16. for(Player p : Bukkit.getOnlinePlayers()){
  17. for(Player p1 : Bukkit.getOnlinePlayers()){
  18. p.showPlayer(p1);
  19. }
  20. }
  21. }
  22. if(args[0].equalsIgnoreCase("test")){
  23. Chat.chat(player, "test", 1);
  24. Chat.chat(player, "test1", 2);
  25. Chat.chat(player, "test2", 3);
  26. }
  27. }
  28. if(args.length == 2){
  29. if(args[0].equalsIgnoreCase("spawn")){
  30. SWCHub h = Hubs.findHubByName(args[1]);
  31. if(h == null){
  32. throw new CommandException("That hub does not exist!");
  33. }
  34. if(h.getSpawnLocation() == null){
  35. throw new CommandException("That hub has no spawn!");
  36. }
  37. SWCPlayer p = SWCPlayers.findPlayer(player);
  38. if(p == null){
  39. throw new CommandException("An error occured. Please relog");
  40. }
  41. if(!p.isStaff()){
  42. throw new CommandException("Only staff can use this command!");
  43. }
  44. // TP player
  45. Bukkit.getPlayer(p.getPlayerName()).teleport(h.getSpawnLocation());
  46. player.sendMessage("Teleported to the spawn of "+h.getName()+"!");
  47. }
  48. if(args[0].equalsIgnoreCase("setspawn")){
  49. //TODO: Finish Setspawn
  50. throw new CommandException("This comand has been temporarily disabled");
  51. /* String hub = args[1];
  52. SWCHub swcHub = Hubs.findHubByName(hub);
  53. if(swcHub == null){
  54. throw new CommandException("That hub does not exist!");
  55. }
  56. Player p = Bukkit.getPlayer(swcPlayer.playerUUID());
  57. SWCPlayer swcP = SWCPlayers.findPlayer(p);
  58. if(!swcP.isStaff()){
  59. throw new CommandException("You do not have permission to preform this command!");
  60. }
  61. swcHub.setSpawn(p.getLocation());
  62. player.sendMessage(Hubs.updateHub(swcHub) + "");*/
  63. }
  64. }
  65. if(args.length == 3){
  66. if(args[0].equalsIgnoreCase("chatLevel")){
  67. String hub = args[1];
  68. SWCHub swcHub = Hubs.findHubByName(hub);
  69. if(swcHub == null){
  70. throw new CommandException("That hub does not exist!");
  71. }
  72. Player p = Bukkit.getPlayer(swcPlayer.playerUUID());
  73. SWCPlayer swcP = SWCPlayers.findPlayer(p);
  74. if(!swcP.isStaff()){
  75. throw new CommandException("You do not have permission to preform this command!");
  76. }
  77. Rank hcl = Rank.valueOf(args[2]);
  78. swcHub.setChatLevel(hcl);
  79. Hubs.updateHub(swcHub);
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement