mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-11-29 05:35:12 +01:00
Fix saving/restoring schematics with WorldEdit 7
This commit is contained in:
parent
27eaa27765
commit
0d326d973d
@ -8,6 +8,7 @@ import com.sk89q.worldedit.Vector;
|
|||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
@ -28,6 +29,7 @@ import me.wiefferink.areashop.interfaces.AreaShopInterface;
|
|||||||
import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
|
import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
|
||||||
import me.wiefferink.areashop.interfaces.WorldEditInterface;
|
import me.wiefferink.areashop.interfaces.WorldEditInterface;
|
||||||
import me.wiefferink.areashop.interfaces.WorldEditSelection;
|
import me.wiefferink.areashop.interfaces.WorldEditSelection;
|
||||||
|
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@ -124,8 +126,7 @@ public class WorldEditHandler7 extends WorldEditInterface {
|
|||||||
return false;
|
return false;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
pluginInterface.getLogger().warning("An error occured while restoring schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
|
pluginInterface.getLogger().warning("An error occured while restoring schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
|
||||||
// TODO enable
|
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
|
||||||
//pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
editSession.flushQueue();
|
editSession.flushQueue();
|
||||||
@ -158,17 +159,11 @@ public class WorldEditHandler7 extends WorldEditInterface {
|
|||||||
try(Closer closer = Closer.create()) {
|
try(Closer closer = Closer.create()) {
|
||||||
FileOutputStream fos = closer.register(new FileOutputStream(file));
|
FileOutputStream fos = closer.register(new FileOutputStream(file));
|
||||||
BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
|
BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
|
||||||
ClipboardFormat clipboardFormat = ClipboardFormats.findByAlias("schematic");
|
ClipboardWriter writer = closer.register(BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(bos));
|
||||||
if (clipboardFormat == null) {
|
|
||||||
pluginInterface.getLogger().warning("WorldEdit could not load default schematic format, try updating WorldEdit");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ClipboardWriter writer = closer.register(clipboardFormat.getWriter(bos));
|
|
||||||
writer.write(clipboard);
|
writer.write(clipboard);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
pluginInterface.getLogger().warning("An error occured while saving schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
|
pluginInterface.getLogger().warning("An error occured while saving schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
|
||||||
// TODO enable
|
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
|
||||||
//pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user