# How can i delete a Minecraft world



## KIWILETSPLAY (18. Jan 2021)

Hey guys I wanted to include a /reset command in my plugin that deletes the map "world" restarts the server and creates a new word. So basically a map reset




```
package Commands;


import java.io.File;

import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import Config.ConfigManager;



public class Reset_CMD implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender s, Command cmd, String arg2, String[] args) {
        if (s instanceof Player) {
            Player p = (Player) s;
            if(p.isOp()) {
                World delete = Bukkit.getWorld("world");
                File deleteFolder = delete.getWorldFolder();
              
                deleteWorld(deleteFolder);
              
                p.kickPlayer("Please Wait");
                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "rl");
          
            }
        }
        return false;
    }
    public boolean deleteWorld(File path) {
          if(path.exists()) {
              File files[] = path.listFiles();
              for(int i=0; i<files.length; i++) {
                  if(files[i].isDirectory()) {
                      deleteWorld(files[i]);
                  } else {
                      files[i].delete();
                  }
              }
          }
          return(path.delete());
    }
}
```


----------

