Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void run(Server server, Player player, Command cmd, String commandLabel, String[] args) throws CommandException {
- SWCPlayer swcPlayer = SWCPlayers.findPlayer(player);
- if (args.length == 1) {
- if (args[0].equalsIgnoreCase("hubList")) {
- // Display hubs
- player.sendMessage("-----");
- ArrayList<SWCHub> hbs = Hubs.getAllHubs();
- SWCHub[] hubs = hbs.toArray(new SWCHub[hbs.size()]);
- for (SWCHub hub : hubs) {
- player.sendMessage(hub.getName());
- }
- player.sendMessage("-----");
- }
- if(args[0].equalsIgnoreCase("showall")){
- for(Player p : Bukkit.getOnlinePlayers()){
- for(Player p1 : Bukkit.getOnlinePlayers()){
- p.showPlayer(p1);
- }
- }
- }
- if(args[0].equalsIgnoreCase("test")){
- Chat.chat(player, "test", 1);
- Chat.chat(player, "test1", 2);
- Chat.chat(player, "test2", 3);
- }
- }
- if(args.length == 2){
- if(args[0].equalsIgnoreCase("spawn")){
- SWCHub h = Hubs.findHubByName(args[1]);
- if(h == null){
- throw new CommandException("That hub does not exist!");
- }
- if(h.getSpawnLocation() == null){
- throw new CommandException("That hub has no spawn!");
- }
- SWCPlayer p = SWCPlayers.findPlayer(player);
- if(p == null){
- throw new CommandException("An error occured. Please relog");
- }
- if(!p.isStaff()){
- throw new CommandException("Only staff can use this command!");
- }
- // TP player
- Bukkit.getPlayer(p.getPlayerName()).teleport(h.getSpawnLocation());
- player.sendMessage("Teleported to the spawn of "+h.getName()+"!");
- }
- if(args[0].equalsIgnoreCase("setspawn")){
- //TODO: Finish Setspawn
- throw new CommandException("This comand has been temporarily disabled");
- /* String hub = args[1];
- SWCHub swcHub = Hubs.findHubByName(hub);
- if(swcHub == null){
- throw new CommandException("That hub does not exist!");
- }
- Player p = Bukkit.getPlayer(swcPlayer.playerUUID());
- SWCPlayer swcP = SWCPlayers.findPlayer(p);
- if(!swcP.isStaff()){
- throw new CommandException("You do not have permission to preform this command!");
- }
- swcHub.setSpawn(p.getLocation());
- player.sendMessage(Hubs.updateHub(swcHub) + "");*/
- }
- }
- if(args.length == 3){
- if(args[0].equalsIgnoreCase("chatLevel")){
- String hub = args[1];
- SWCHub swcHub = Hubs.findHubByName(hub);
- if(swcHub == null){
- throw new CommandException("That hub does not exist!");
- }
- Player p = Bukkit.getPlayer(swcPlayer.playerUUID());
- SWCPlayer swcP = SWCPlayers.findPlayer(p);
- if(!swcP.isStaff()){
- throw new CommandException("You do not have permission to preform this command!");
- }
- Rank hcl = Rank.valueOf(args[2]);
- swcHub.setChatLevel(hcl);
- Hubs.updateHub(swcHub);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement