Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. package main;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.World;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandExecutor;
  8. import org.bukkit.command.CommandSender;
  9.  
  10. import java.io.File;
  11.  
  12. public class StopCommand implements CommandExecutor {
  13.     private Main plugin;
  14.     public StopCommand(Main plugin){
  15.         this.plugin=plugin;
  16.     }
  17.     @Override
  18.     public boolean onCommand(CommandSender sender, Command command, String lable, String[] args) {
  19.         if (args.length<1){
  20.             return false;
  21.         }
  22.         Thread deleteworldthread = new Thread(new Runnable() {
  23.             public void run() {
  24.                 String world = plugin.worldType.get(Bukkit.getPlayer(args[0]).getWorld().getName());
  25.                 World mainworld = Bukkit.getPlayer(args[0]).getWorld();
  26.                 Bukkit.getPlayer(args[0]).teleport(new Location(Bukkit.getWorld("zona"), plugin.getConfig().getInt(world + ".backx"), plugin.getConfig().getInt(world + ".backy"), plugin.getConfig().getInt(world + ".backz")));
  27.                 if (mainworld.getPlayers().isEmpty()) {
  28.                     File deleteFolder = mainworld.getWorldFolder();
  29.                     new worlddelet(plugin).deleteWorld(deleteFolder, mainworld.getName());
  30.                 }
  31.             }
  32.         });
  33.         deleteworldthread.start();
  34.         return true;
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement