~/paste/14611
~/paste/14611
~/paste/14611

  1. package me.Zenderagon;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Location;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class SkySurvival extends JavaPlugin {
  11.        
  12.         public static final SkySurvival plugin = new SkySurvival();
  13.        
  14.         public final Location[] warpLocations = new Location[100];
  15.         public final String[] pNames = new String[100];
  16.         public int pCounter = 0;
  17.        
  18.         String planets = "";
  19.  
  20.         @Override
  21.         public void onEnable() {
  22.                 getLogger().info("Sky Survival Enabled!");
  23.        
  24.         }
  25.        
  26.         @Override
  27.         public void onDisable() {
  28.                
  29.         }
  30.        
  31.         public boolean onCommand(CommandSender sender, Command cmd,
  32.                         String commandLabel, String args[]) {
  33.                 Player player = (Player) sender;
  34.                 if (cmd.getName().equalsIgnoreCase("skysurvival")){
  35.                 if (args.length == 0){
  36.                        
  37.                         player.sendMessage(ChatColor.BLUE + "Help for the Sky Survival plugin."
  38.                         + ChatColor.GREEN + "/skysurvival setplanet [Name]" + ChatColor.LIGHT_PURPLE + "Sets the planets teleport location."
  39.                         + ChatColor.GREEN + "/skysurvival planet [Name]" + ChatColor.LIGHT_PURPLE + "Teleports the player to the designated planet."
  40.                         + ChatColor.GREEN + "/skysurvival listplanets" + ChatColor.LIGHT_PURPLE + "List all the configured planets.");
  41.                 }else if
  42.                 (args[0].equalsIgnoreCase("setplanet")){       
  43.                         if(args.length == 0){
  44.                                 player.sendMessage(ChatColor.RED + "/skysurvival setplanet <PlanetName>");     
  45.                         }else{
  46.                                 Location location = player.getLocation();
  47.                                 if(!(pCounter > 100)){
  48.                                         warpLocations[pCounter] = location;
  49.                                         pNames[pCounter] = args[0];
  50.                                         pCounter++;
  51.                                         player.sendMessage(ChatColor.GREEN + "Planet " + args[0] + " teleport location set!");
  52.                                 }else{
  53.                                         player.sendMessage(ChatColor.RED + "Planet Limit Exceeded! Unable to set planet teleport location!");
  54.                                 }
  55.  
  56.                         }
  57.                 }else if (cmd.getName().equalsIgnoreCase("skysurvival")){
  58.                 if(args.length == 0){
  59.                 }else if(args[0].equalsIgnoreCase("planet"))
  60.                         for(int i = 0; i < pNames.length; i++){
  61.                                 String pName = pNames[i];
  62.                                 if(args[0].equalsIgnoreCase(pName)){
  63.                                         Location warpLocation = warpLocations[i];
  64.                                         player.teleport(warpLocation);
  65.                                         player.sendMessage(ChatColor.GREEN + "Teleported to " + pName);
  66.                                         break;
  67.                                 }
  68.                         }
  69.                 }else if (cmd.getName().equalsIgnoreCase("skysurvival")){
  70.                 if(args.length == 0){
  71.                 }else if(args[0].equalsIgnoreCase("listplanets"))
  72.                 for(int i = 0; i < pNames.length; i++){
  73.                                 if(i !=pNames.length){
  74.                                         planets+= pNames [i] + ", ".replace("null", "");
  75.                                 }else{ player.sendMessage(ChatColor.DARK_GRAY + "Showing all Planets: " + ChatColor.GRAY + planets);
  76.                                        
  77.                                 }
  78.                                
  79.                         }
  80.                
  81.                 }      
  82.                
  83.                 }
  84.                
  85.        
  86.                 return false;
  87.  
  88. }
  89.        
  90. }
Language: java
Posted by Zenderagon at 27 Jul 2014, 02:56:58 UTC