mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Fix trimming for worlds in non-standard directories
This commit is contained in:
		@@ -31,6 +31,12 @@ public interface IPlotMain {
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    File getDirectory();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the directory containing all the worlds
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    File getWorldContainer();
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Wrap a player into a PlotPlayer object
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ public class Trim extends SubCommand {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                final String directory = world + File.separator + "region";
 | 
			
		||||
                final File folder = new File(directory);
 | 
			
		||||
                final File folder = new File(PS.get().IMP.getWorldContainer(), directory);
 | 
			
		||||
                final File[] regionFiles = folder.listFiles();
 | 
			
		||||
                for (final File file : regionFiles) {
 | 
			
		||||
                    final String name = file.getName();
 | 
			
		||||
@@ -155,12 +155,12 @@ public class Trim extends SubCommand {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void deleteChunks(final String world, final ArrayList<ChunkLoc> chunks) {
 | 
			
		||||
        ChunkManager.manager.deleteRegionFiles(world, chunks);
 | 
			
		||||
    public static void deleteChunks(final String world, final ArrayList<ChunkLoc> chunks, final Runnable whenDone) {
 | 
			
		||||
        ChunkManager.manager.deleteRegionFiles(world, chunks, whenDone);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void sendMessage(final String message) {
 | 
			
		||||
        PS.debug("&3PlotSquared -> World trim&8: &7" + message);
 | 
			
		||||
        PS.log("&3PlotSquared -> World trim&8: &7" + message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public PlotId getId(final String id) {
 | 
			
		||||
@@ -211,8 +211,12 @@ public class Trim extends SubCommand {
 | 
			
		||||
        getTrimRegions(empty, world, new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                deleteChunks(world, empty);
 | 
			
		||||
                PS.log("$1Trim task complete!");
 | 
			
		||||
                deleteChunks(world, empty, new Runnable() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void run() {
 | 
			
		||||
                        PS.log("$1Trim task complete!");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -111,6 +111,8 @@ public abstract class ChunkManager {
 | 
			
		||||
    
 | 
			
		||||
    public abstract void deleteRegionFiles(final String world, final List<ChunkLoc> chunks);
 | 
			
		||||
 | 
			
		||||
    public abstract void deleteRegionFiles(final String world, final List<ChunkLoc> chunks, final Runnable whenDone);
 | 
			
		||||
 | 
			
		||||
    public abstract Plot hasPlot(String world, ChunkLoc chunk);
 | 
			
		||||
 | 
			
		||||
    public abstract boolean copyRegion(final Location pos1, final Location pos2, final Location newPos, final Runnable whenDone);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user