mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
Set floor async / fixed exportall
This commit is contained in:
parent
86a1acdd83
commit
09acff8508
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.11.5</version>
|
<version>2.11.6</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -6,6 +6,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -39,20 +40,22 @@ public abstract class SchematicHandler {
|
|||||||
|
|
||||||
private boolean exportAll = false;
|
private boolean exportAll = false;
|
||||||
|
|
||||||
public boolean exportAll(final Collection<Plot> plots, final File outputDir, final String namingScheme, final Runnable ifSuccess) {
|
public boolean exportAll(final Collection<Plot> collection, final File outputDir, final String namingScheme, final Runnable ifSuccess) {
|
||||||
if (exportAll) {
|
if (exportAll) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plots.size() == 0) {
|
if (collection.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exportAll = true;
|
exportAll = true;
|
||||||
|
final ArrayList<Plot> plots = new ArrayList<Plot>(collection);
|
||||||
TaskManager.index.increment();
|
TaskManager.index.increment();
|
||||||
final Integer currentIndex = TaskManager.index.toInteger();
|
final Integer currentIndex = TaskManager.index.toInteger();
|
||||||
final int task = TaskManager.runTaskRepeat(new Runnable() {
|
final int task = TaskManager.runTaskRepeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (plots.size() == 0) {
|
if (plots.size() == 0) {
|
||||||
|
exportAll = false;
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(currentIndex);
|
TaskManager.tasks.remove(currentIndex);
|
||||||
TaskManager.runTask(ifSuccess);
|
TaskManager.runTask(ifSuccess);
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
@ -12,15 +10,10 @@ import com.sk89q.worldedit.CuboidClipboard;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.data.DataException;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.schematic.MCEditSchematicFormat;
|
|
||||||
import com.sk89q.worldedit.schematic.SchematicFormat;
|
|
||||||
|
|
||||||
public class WorldEditSchematic {
|
public class WorldEditSchematic {
|
||||||
public void saveSchematic(String file, final String world, final PlotId id) {
|
public void saveSchematic(String file, final String world, final PlotId id) {
|
||||||
System.out.print("SAVCING SCHSAKJHDJKAS HDKAS");
|
|
||||||
Location bot = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);
|
Location bot = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);
|
||||||
Location top = MainUtil.getPlotTopLoc(world, id);
|
Location top = MainUtil.getPlotTopLoc(world, id);
|
||||||
Vector size = new Vector(top.getX() - bot.getX() + 1, top.getY() - bot.getY() - 1, top.getZ() - bot.getZ() + 1);
|
Vector size = new Vector(top.getX() - bot.getX() + 1, top.getY() - bot.getY() - 1, top.getZ() - bot.getZ() + 1);
|
||||||
@ -28,7 +21,6 @@ public class WorldEditSchematic {
|
|||||||
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
|
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
|
||||||
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
|
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
|
||||||
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
|
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
|
||||||
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
|
||||||
EditSession session = PlotSquared.worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
|
EditSession session = PlotSquared.worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
|
||||||
clipboard.copy(session);
|
clipboard.copy(session);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user