mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Schematic stuff
This commit is contained in:
parent
db05ea4cca
commit
30a1e4505e
@ -143,9 +143,11 @@ public class SQLManager implements AbstractDB {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
try {
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
}
|
||||
catch (SQLException e) {}
|
||||
// Create the plots
|
||||
createPlots(myList, new Runnable() {
|
||||
@Override
|
||||
@ -229,7 +231,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (SQLException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
PS.log("&7[WARN] " + "Failed to set all helpers for plots");
|
||||
try {
|
||||
|
@ -16,6 +16,7 @@ import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -33,6 +34,7 @@ import com.intellectualcrafters.jnbt.ListTag;
|
||||
import com.intellectualcrafters.jnbt.NBTInputStream;
|
||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
||||
import com.intellectualcrafters.jnbt.ShortTag;
|
||||
import com.intellectualcrafters.jnbt.StringTag;
|
||||
import com.intellectualcrafters.jnbt.Tag;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
@ -375,6 +377,33 @@ public abstract class SchematicHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a compound tag from blocks
|
||||
* - Untested
|
||||
* @param blocks
|
||||
* @param blockdata
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
public CompoundTag createTag(byte[] blocks, byte[] blockdata, Dimension d) {
|
||||
final HashMap<String, Tag> schematic = new HashMap<>();
|
||||
schematic.put("Width", new ShortTag("Width", (short) d.getX()));
|
||||
schematic.put("Length", new ShortTag("Length", (short) d.getZ()));
|
||||
schematic.put("Height", new ShortTag("Height", (short) d.getY()));
|
||||
schematic.put("Materials", new StringTag("Materials", "Alpha"));
|
||||
schematic.put("WEOriginX", new IntTag("WEOriginX", 0));
|
||||
schematic.put("WEOriginY", new IntTag("WEOriginY", 0));
|
||||
schematic.put("WEOriginZ", new IntTag("WEOriginZ", 0));
|
||||
schematic.put("WEOffsetX", new IntTag("WEOffsetX", 0));
|
||||
schematic.put("WEOffsetY", new IntTag("WEOffsetY", 0));
|
||||
schematic.put("WEOffsetZ", new IntTag("WEOffsetZ", 0));
|
||||
schematic.put("Blocks", new ByteArrayTag("Blocks", blocks));
|
||||
schematic.put("Data", new ByteArrayTag("Data", blockdata));
|
||||
schematic.put("Entities", new ListTag("Entities", CompoundTag.class, new ArrayList<Tag>()));
|
||||
schematic.put("TileEntities", new ListTag("TileEntities", CompoundTag.class, new ArrayList<Tag>()));
|
||||
return new CompoundTag("Schematic", schematic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the schematic of a plot
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user