mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +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() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
connection.setAutoCommit(false);
|
connection.setAutoCommit(false);
|
||||||
|
}
|
||||||
|
catch (SQLException e) {}
|
||||||
// Create the plots
|
// Create the plots
|
||||||
createPlots(myList, new Runnable() {
|
createPlots(myList, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -229,7 +231,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (SQLException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.log("&7[WARN] " + "Failed to set all helpers for plots");
|
PS.log("&7[WARN] " + "Failed to set all helpers for plots");
|
||||||
try {
|
try {
|
||||||
|
@ -16,6 +16,7 @@ import java.net.URLConnection;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -33,6 +34,7 @@ import com.intellectualcrafters.jnbt.ListTag;
|
|||||||
import com.intellectualcrafters.jnbt.NBTInputStream;
|
import com.intellectualcrafters.jnbt.NBTInputStream;
|
||||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
||||||
import com.intellectualcrafters.jnbt.ShortTag;
|
import com.intellectualcrafters.jnbt.ShortTag;
|
||||||
|
import com.intellectualcrafters.jnbt.StringTag;
|
||||||
import com.intellectualcrafters.jnbt.Tag;
|
import com.intellectualcrafters.jnbt.Tag;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -375,6 +377,33 @@ public abstract class SchematicHandler {
|
|||||||
return true;
|
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
|
* Gets the schematic of a plot
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user