Advertisement
Guest User

Untitled

a guest
Jun 18th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.17 KB | None | 0 0
  1.  
  2. //THIS IS JUST FOR WARPING ;-:
  3.  
  4. package eu.hangar.seconds;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Location;
  9. import org.bukkit.World;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15. public class Start extends JavaPlugin {
  16.        
  17.         SettingsManager settings = SettingsManager.getInstance();
  18.        
  19.         public void onEnable() {
  20.                 settings.setup(this);
  21.         }
  22.        
  23.         public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  24.                
  25.                 if (!(sender instanceof Player)) {
  26.                         sender.sendMessage(ChatColor.RED + "This plugin is for players only!");
  27.                         return true;
  28.                 }
  29.                
  30.                 Player p = (Player) sender;  
  31.               if (cmd.getName().equalsIgnoreCase("tp")) {
  32.                         if (args.length == 0) {
  33.                                 p.sendMessage(ChatColor.RED + "Please specify a player.");
  34.                                 return true;
  35.                         }
  36.                         Player target = Bukkit.getServer().getPlayer(args[0]);
  37.                         if (target == null) {
  38.                                 p.sendMessage(ChatColor.RED + "Could not find player " + args[0] + "!");
  39.                                 return true;
  40.                         }
  41.                         p.teleport(target.getLocation());
  42.                         return true;
  43.                 }
  44.                
  45.                 if (cmd.getName().equalsIgnoreCase("setstart")) {
  46.                     if (p.hasPermission("set.StartPoint")) {
  47.                         settings.getData().set("spawn.world", p.getLocation().getWorld().getName());
  48.                         settings.getData().set("spawn.x", p.getLocation().getX());
  49.                         settings.getData().set("spawn.y", p.getLocation().getY());
  50.                         settings.getData().set("spawn.z", p.getLocation().getZ());
  51.                         settings.saveData();
  52.                         p.sendMessage(ChatColor.GREEN + "Start set!");
  53.                     }else{
  54.                         p.sendMessage(ChatColor.DARK_RED + "I'm sorry, you cannot set the death lobby: Insufficient Permissions");
  55.                     }
  56.                         return true;
  57.                 }
  58.                
  59.                 if (cmd.getName().equalsIgnoreCase("TeleStart")) {
  60.                         if (settings.getData().getConfigurationSection("spawn") == null) {
  61.                                 p.sendMessage(ChatColor.RED + "The spawn has not yet been set!");
  62.                                 return true;
  63.                         }
  64.                         World w = Bukkit.getServer().getWorld(settings.getData().getString("spawn.world"));
  65.                         double x = settings.getData().getDouble("spawn.x");
  66.                         double y = settings.getData().getDouble("spawn.y");
  67.                         double z = settings.getData().getDouble("spawn.z");
  68.                         p.teleport(new Location(w, x, y, z));
  69.                         p.sendMessage(ChatColor.GREEN + "This is your start!");
  70.                 }
  71.                
  72.                 if (cmd.getName().equalsIgnoreCase("setdeath")) {
  73.                     if (p.hasPermission("set.DeathLobby")) {                
  74.                     settings.getData().set("death.world", p.getLocation().getWorld().getName());
  75.                     settings.getData().set("death.x", p.getLocation().getX());
  76.                     settings.getData().set("death.y", p.getLocation().getY());
  77.                     settings.getData().set("death.z", p.getLocation().getZ());
  78.                     settings.saveData();
  79.                     p.sendMessage(ChatColor.GREEN + "Death-Lobby set!");
  80.                     }else{
  81.                         p.sendMessage(ChatColor.DARK_RED + "I'm sorry, you cannot set the death lobby: Insufficient Permissions");
  82.                     }
  83.                     return true;
  84.             }
  85.            
  86.             if (cmd.getName().equalsIgnoreCase("TeleDeath")) {
  87.                     if (settings.getData().getConfigurationSection("death") == null) {
  88.                             p.sendMessage(ChatColor.RED + "The death-lobby has not yet been set!");
  89.                             return true;
  90.                     }
  91.                     World w = Bukkit.getServer().getWorld(settings.getData().getString("death.world"));
  92.                     double x = settings.getData().getDouble("death.x");
  93.                     double y = settings.getData().getDouble("death.y");
  94.                     double z = settings.getData().getDouble("death.z");
  95.                     p.teleport(new Location(w, x, y, z));
  96.                     p.sendMessage(ChatColor.GREEN + "This is your death-lobby!");
  97.                 }
  98.            
  99.             if (cmd.getName().equalsIgnoreCase("setstep3")) {
  100.                 if (p.hasPermission("set.Steps")) {                
  101.                 settings.getData().set("step3.world", p.getLocation().getWorld().getName());
  102.                 settings.getData().set("step3.x", p.getLocation().getX());
  103.                 settings.getData().set("step3.y", p.getLocation().getY());
  104.                 settings.getData().set("step3.z", p.getLocation().getZ());
  105.                 settings.saveData();
  106.                 p.sendMessage(ChatColor.DARK_GREEN + "Step 3 set!");
  107.                 }else{
  108.                     p.sendMessage(ChatColor.DARK_RED + "I'm sorry, you cannot set the Step: Insufficient Permissions");
  109.                 }
  110.                 return true;
  111.         }
  112.            
  113.                
  114.                
  115.                
  116.  
  117.                 if (cmd.getName().equalsIgnoreCase("TeleStep3")) {
  118.                     if (settings.getData().getConfigurationSection("step3") == null) {
  119.                             p.sendMessage(ChatColor.RED + "The 3rd step has not yet been set!");
  120.                             return true;
  121.                     }
  122.                     World w = Bukkit.getServer().getWorld(settings.getData().getString("step3.world"));
  123.                     double x = settings.getData().getDouble("step3.x");
  124.                     double y = settings.getData().getDouble("step3.y");
  125.                     double z = settings.getData().getDouble("step3.z");
  126.                     p.teleport(new Location(w, x, y, z));
  127.                     p.sendMessage(ChatColor.GREEN + "Teleporrting...");
  128.                
  129.                
  130.                
  131.         }
  132.                 if (cmd.getName().equalsIgnoreCase("SetStep2")) {
  133.                     if (p.hasPermission("set.Steps")) {
  134.                         settings.getData().set("step2.world", p.getLocation().getWorld().getName());
  135.                         settings.getData().set("step2.x", p.getLocation().getX());
  136.                         settings.getData().set("step2.y", p.getLocation().getY());
  137.                         settings.getData().set("step2.z", p.getLocation().getZ());
  138.                         settings.saveData();
  139.                         p.sendMessage(ChatColor.DARK_GREEN + "The second steps was set!");
  140.                     }else{
  141.                         p.sendMessage(ChatColor.DARK_RED + "I'm sorry, you cannot set the second step: Insufficient Permissions");
  142.                     }
  143.                         return true;
  144.                        
  145.                 }
  146.                 if (cmd.getName().equalsIgnoreCase("TeleStep2")) {
  147.                     if (settings.getData().getConfigurationSection("step2") == null) {
  148.                             p.sendMessage(ChatColor.RED + "The 2nd step has not yet been set!");
  149.                             return true;
  150.                     }
  151.                     World w = Bukkit.getServer().getWorld(settings.getData().getString("step2.world"));
  152.                     double x = settings.getData().getDouble("step2.x");
  153.                     double y = settings.getData().getDouble("step2.y");
  154.                     double z = settings.getData().getDouble("step2.z");
  155.                     p.teleport(new Location(w, x, y, z));
  156.                     p.sendMessage(ChatColor.GREEN + "Teleporting to the step2!");
  157.                 }
  158.                 return false;           }
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement