mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-27 17:28:28 +01:00
Merge branch 'master' of https://github.com/IntellectualSites/PlotSquared
Conflicts: src/main/java/com/intellectualcrafters/plot/IPlotMain.java src/main/java/com/intellectualcrafters/plot/commands/Trim.java src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java src/main/java/com/plotsquared/bukkit/BukkitMain.java src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java src/main/java/com/plotsquared/sponge/SpongeMain.java src/main/java/com/plotsquared/sponge/util/SpongeChunkManager.java
This commit is contained in:
commit
1cccdd9d4d
@ -32,6 +32,12 @@ public interface IPlotMain
|
||||
*/
|
||||
File getDirectory();
|
||||
|
||||
/**
|
||||
* Get the directory containing all the worlds
|
||||
* @return
|
||||
*/
|
||||
File getWorldContainer();
|
||||
|
||||
/**
|
||||
* Wrap a player into a PlotPlayer object
|
||||
* @param obj
|
||||
|
@ -237,6 +237,33 @@ public class PS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auto clearing
|
||||
if (Settings.AUTO_CLEAR)
|
||||
{
|
||||
ExpireManager.runTask();
|
||||
}
|
||||
|
||||
// PlotMe
|
||||
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME)
|
||||
{
|
||||
TaskManager.runTaskLater(new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (IMP.initPlotMeConverter())
|
||||
{
|
||||
log("&c=== IMPORTANT ===");
|
||||
log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
|
||||
log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
||||
log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
|
||||
log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml'");
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -278,33 +305,6 @@ public class PS
|
||||
}
|
||||
});
|
||||
|
||||
// PlotMe
|
||||
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME)
|
||||
{
|
||||
TaskManager.runTaskLater(new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (IMP.initPlotMeConverter())
|
||||
{
|
||||
log("&c=== IMPORTANT ===");
|
||||
log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
|
||||
log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
||||
log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
|
||||
log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml'");
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
// Auto clearing
|
||||
if (Settings.AUTO_CLEAR)
|
||||
{
|
||||
ExpireManager.runTask();
|
||||
}
|
||||
|
||||
// World generators:
|
||||
final ConfigurationSection section = config.getConfigurationSection("worlds");
|
||||
if (section != null)
|
||||
|
@ -64,7 +64,7 @@ public class Trim extends SubCommand
|
||||
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)
|
||||
{
|
||||
@ -175,14 +175,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);
|
||||
public static void sendMessage(final String message) {
|
||||
PS.log("&3PlotSquared -> World trim&8: &7" + message);
|
||||
}
|
||||
|
||||
public PlotId getId(final String id)
|
||||
@ -244,11 +242,13 @@ public class Trim extends SubCommand
|
||||
final ArrayList<ChunkLoc> empty = new ArrayList<>();
|
||||
getTrimRegions(empty, world, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
deleteChunks(world, empty);
|
||||
PS.log("$1Trim task complete!");
|
||||
public void run() {
|
||||
deleteChunks(world, empty, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PS.log("$1Trim task complete!");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
@ -125,7 +125,9 @@ public abstract class ChunkManager
|
||||
|
||||
public abstract void deleteRegionFiles(final String world, final List<ChunkLoc> chunks);
|
||||
|
||||
public abstract Plot hasPlot(final String world, final ChunkLoc chunk);
|
||||
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);
|
||||
|
||||
|
@ -193,6 +193,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
return getDataFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getWorldContainer() {
|
||||
return Bukkit.getWorldContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskManager getTaskManager()
|
||||
{
|
||||
|
@ -137,10 +137,9 @@ public class BukkitChunkManager extends ChunkManager
|
||||
public void run()
|
||||
{
|
||||
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
|
||||
final File file = new File(directory);
|
||||
PS.debug("&6 - Deleting region: " + file.getName() + " (approx 1024 chunks)");
|
||||
if (file.exists())
|
||||
{
|
||||
final File file = new File(PS.get().IMP.getWorldContainer(), directory);
|
||||
PS.log("&6 - Deleting region: " + file.getName() + " (approx 1024 chunks)");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
try
|
||||
@ -154,23 +153,28 @@ public class BukkitChunkManager extends ChunkManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRegionFiles(final String world, final List<ChunkLoc> chunks)
|
||||
{
|
||||
TaskManager.runTaskAsync(new Runnable()
|
||||
{
|
||||
public void deleteRegionFiles(String world, List<ChunkLoc> chunks) {
|
||||
deleteRegionFiles(world, chunks, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRegionFiles(final String world, final List<ChunkLoc> chunks, final Runnable whenDone) {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (final ChunkLoc loc : chunks)
|
||||
{
|
||||
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
|
||||
final File file = new File(directory);
|
||||
PS.debug("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
if (file.exists())
|
||||
{
|
||||
final File file = new File(PS.get().IMP.getWorldContainer(), directory);
|
||||
PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
if (whenDone != null) {
|
||||
whenDone.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -491,8 +491,12 @@ public class SpongeMain implements IPlotMain, PluginContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
public File getWorldContainer() {
|
||||
return new File("world");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
PS.get().disable();
|
||||
THIS = null;
|
||||
}
|
||||
|
@ -139,6 +139,11 @@ public class SpongeChunkManager extends ChunkManager
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRegionFiles(String world, List<ChunkLoc> chunks, Runnable whenDone) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plot hasPlot(final String world, final ChunkLoc chunk)
|
||||
{
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user