mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 08:36:45 +01:00
Merge remote-tracking branch 'origin/breaking' into breaking
This commit is contained in:
commit
f5388b9737
@ -27,7 +27,7 @@ import java.util.UUID;
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uuid = UUIDHandler.getUUID(value, null);
|
uuid = UUIDHandler.getUUID(value, null);
|
||||||
name = UUIDHandler.getName(uuid);
|
name = uuid == null ? value : UUIDHandler.getName(uuid);
|
||||||
name = name == null ? value : name;
|
name = name == null ? value : name;
|
||||||
}
|
}
|
||||||
if (uuid == null || value.equalsIgnoreCase("-")) {
|
if (uuid == null || value.equalsIgnoreCase("-")) {
|
||||||
|
@ -64,7 +64,7 @@ import java.util.UUID;
|
|||||||
MainUtil.sendMessage(player, Captions.SAVE_SUCCESS);
|
MainUtil.sendMessage(player, Captions.SAVE_SUCCESS);
|
||||||
List<String> schematics = player.getMeta("plot_schematics");
|
List<String> schematics = player.getMeta("plot_schematics");
|
||||||
if (schematics != null) {
|
if (schematics != null) {
|
||||||
schematics.add(file + ".schematic");
|
schematics.add(file + ".schem");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -31,22 +31,22 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
+ File.separator;
|
+ File.separator;
|
||||||
try {
|
try {
|
||||||
File sideroad =
|
File sideroad =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schematic");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
|
||||||
if (sideroad.exists()) {
|
if (sideroad.exists()) {
|
||||||
files.add(new FileBytes(newDir + "sideroad.schematic",
|
files.add(new FileBytes(newDir + "sideroad.schem",
|
||||||
Files.readAllBytes(sideroad.toPath())));
|
Files.readAllBytes(sideroad.toPath())));
|
||||||
}
|
}
|
||||||
File intersection =
|
File intersection =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schematic");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schem");
|
||||||
if (intersection.exists()) {
|
if (intersection.exists()) {
|
||||||
files.add(new FileBytes(newDir + "intersection.schematic",
|
files.add(new FileBytes(newDir + "intersection.schem",
|
||||||
Files.readAllBytes(intersection.toPath())));
|
Files.readAllBytes(intersection.toPath())));
|
||||||
}
|
}
|
||||||
File plot =
|
File plot =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schematic");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schem");
|
||||||
if (plot.exists()) {
|
if (plot.exists()) {
|
||||||
files.add(
|
files.add(
|
||||||
new FileBytes(newDir + "plot.schematic", Files.readAllBytes(plot.toPath())));
|
new FileBytes(newDir + "plot.schem", Files.readAllBytes(plot.toPath())));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -131,15 +131,16 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
|
|
||||||
public void setupSchematics() throws SchematicHandler.UnsupportedFormatException {
|
public void setupSchematics() throws SchematicHandler.UnsupportedFormatException {
|
||||||
this.G_SCH = new HashMap<>();
|
this.G_SCH = new HashMap<>();
|
||||||
File schematic1File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
File root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + this.worldname);
|
||||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/sideroad.schematic");
|
File schematic1File = new File(root, "sideroad.schem");
|
||||||
File schematic2File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
if (!schematic1File.exists()) schematic1File = new File(root, "sideroad.schematic");
|
||||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/intersection.schematic");
|
File schematic2File = new File(root, "intersection.schem");
|
||||||
File schem3File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
if (!schematic2File.exists()) schematic2File = new File(root, "intersection.schematic");
|
||||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/plot.schematic");
|
File schematic3File = new File(root, "plot.schem");
|
||||||
|
if (!schematic3File.exists()) schematic3File = new File(root, "plot.schematic");
|
||||||
Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
||||||
Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
||||||
Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File);
|
Schematic schematic3 = SchematicHandler.manager.getSchematic(schematic3File);
|
||||||
int shift = this.ROAD_WIDTH / 2;
|
int shift = this.ROAD_WIDTH / 2;
|
||||||
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
|
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
|
||||||
int minY = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
|
int minY = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
|
||||||
@ -169,10 +170,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
|
|
||||||
int startY = minY - PLOT_HEIGHT;
|
int startY = minY - PLOT_HEIGHT;
|
||||||
|
|
||||||
|
BlockVector3 min = blockArrayClipboard3.getMinimumPoint();
|
||||||
for (short x = 0; x < w3; x++) {
|
for (short x = 0; x < w3; x++) {
|
||||||
for (short z = 0; z < l3; z++) {
|
for (short z = 0; z < l3; z++) {
|
||||||
for (short y = 0; y < h3; y++) {
|
for (short y = 0; y < h3; y++) {
|
||||||
BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3.at(x, y, z));
|
BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ()));
|
||||||
if (!id.getBlockType().getMaterial().isAir()) {
|
if (!id.getBlockType().getMaterial().isAir()) {
|
||||||
addOverlayBlock((short) (x + shift + oddshift + centerShiftX),
|
addOverlayBlock((short) (x + shift + oddshift + centerShiftX),
|
||||||
(short) (y + startY), (short) (z + shift + oddshift + centerShiftZ),
|
(short) (y + startY), (short) (z + shift + oddshift + centerShiftZ),
|
||||||
@ -233,10 +235,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
short l2 = (short) d2.getZ();
|
short l2 = (short) d2.getZ();
|
||||||
short h2 = (short) d2.getY();
|
short h2 = (short) d2.getY();
|
||||||
int startY = minY - ROAD_HEIGHT;
|
int startY = minY - ROAD_HEIGHT;
|
||||||
for (short x = 0; x < w1; x++) {
|
BlockVector3 min = blockArrayClipboard2.getMinimumPoint();
|
||||||
for (short z = 0; z < l1; z++) {
|
for (short x = 0; x < w2; x++) {
|
||||||
for (short y = 0; y < h1; y++) {
|
for (short z = 0; z < l2; z++) {
|
||||||
BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3.at(x, y, z));
|
for (short y = 0; y < h2; y++) {
|
||||||
|
BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ()));
|
||||||
if (!id.getBlockType().getMaterial().isAir()) {
|
if (!id.getBlockType().getMaterial().isAir()) {
|
||||||
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
||||||
(short) (z + shift + oddshift), id, false, h1);
|
(short) (z + shift + oddshift), id, false, h1);
|
||||||
@ -246,10 +249,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
min = blockArrayClipboard1.getMinimumPoint();
|
||||||
for (short x = 0; x < w2; x++) {
|
for (short x = 0; x < w2; x++) {
|
||||||
for (short z = 0; z < l2; z++) {
|
for (short z = 0; z < l2; z++) {
|
||||||
for (short y = 0; y < h2; y++) {
|
for (short y = 0; y < h2; y++) {
|
||||||
BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3.at(x, y, z));
|
BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ()));
|
||||||
if (!id.getBlockType().getMaterial().isAir()) {
|
if (!id.getBlockType().getMaterial().isAir()) {
|
||||||
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
||||||
(short) (z - shift), id, false, h2);
|
(short) (z - shift), id, false, h2);
|
||||||
|
@ -238,13 +238,14 @@ public abstract class HybridUtils {
|
|||||||
final String dir =
|
final String dir =
|
||||||
"schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.getArea()
|
"schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.getArea()
|
||||||
.toString() + File.separator;
|
.toString() + File.separator;
|
||||||
|
|
||||||
SchematicHandler.manager.getCompoundTag(world, sideRoad, new RunnableVal<CompoundTag>() {
|
SchematicHandler.manager.getCompoundTag(world, sideRoad, new RunnableVal<CompoundTag>() {
|
||||||
@Override public void run(CompoundTag value) {
|
@Override public void run(CompoundTag value) {
|
||||||
SchematicHandler.manager.save(value, dir + "sideroad.schematic");
|
SchematicHandler.manager.save(value, dir + "sideroad.schem");
|
||||||
SchematicHandler.manager
|
SchematicHandler.manager
|
||||||
.getCompoundTag(world, intersection, new RunnableVal<CompoundTag>() {
|
.getCompoundTag(world, intersection, new RunnableVal<CompoundTag>() {
|
||||||
@Override public void run(CompoundTag value) {
|
@Override public void run(CompoundTag value) {
|
||||||
SchematicHandler.manager.save(value, dir + "intersection.schematic");
|
SchematicHandler.manager.save(value, dir + "intersection.schem");
|
||||||
plotworld.ROAD_SCHEMATIC_ENABLED = true;
|
plotworld.ROAD_SCHEMATIC_ENABLED = true;
|
||||||
try {
|
try {
|
||||||
plotworld.setupSchematics();
|
plotworld.setupSchematics();
|
||||||
|
@ -1891,7 +1891,7 @@ public class Plot {
|
|||||||
String name = Plot.this.id + "," + Plot.this.area + ',' + MainUtil
|
String name = Plot.this.id + "," + Plot.this.area + ',' + MainUtil
|
||||||
.getName(Plot.this.owner);
|
.getName(Plot.this.owner);
|
||||||
boolean result = SchematicHandler.manager.save(value,
|
boolean result = SchematicHandler.manager.save(value,
|
||||||
Settings.Paths.SCHEMATICS + File.separator + name + ".schematic");
|
Settings.Paths.SCHEMATICS + File.separator + name + ".schem");
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
whenDone.value = result;
|
whenDone.value = result;
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
|
@ -80,7 +80,7 @@ public abstract class SchematicHandler {
|
|||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
MainUtil.sendMessage(null, "&6ID: " + plot.getId());
|
MainUtil.sendMessage(null, "&6ID: " + plot.getId());
|
||||||
boolean result = SchematicHandler.manager
|
boolean result = SchematicHandler.manager
|
||||||
.save(value, directory + File.separator + name + ".schematic");
|
.save(value, directory + File.separator + name + ".schem");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(null, "&7 - Failed to save &c" + plot.getId());
|
.sendMessage(null, "&7 - Failed to save &c" + plot.getId());
|
||||||
@ -250,10 +250,13 @@ public abstract class SchematicHandler {
|
|||||||
throw new RuntimeException("Could not create schematic parent directory");
|
throw new RuntimeException("Could not create schematic parent directory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
if (!name.endsWith(".schem") && !name.endsWith(".schematic")) {
|
||||||
Settings.Paths.SCHEMATICS + File.separator + name + (name.endsWith(".schem") ?
|
name = name + ".schem";
|
||||||
"" :
|
}
|
||||||
".schematic"));
|
File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS + File.separator + name);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS + File.separator + name + "atic");
|
||||||
|
}
|
||||||
return getSchematic(file);
|
return getSchematic(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +270,7 @@ public abstract class SchematicHandler {
|
|||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
|
||||||
final List<String> names = new ArrayList<>();
|
final List<String> names = new ArrayList<>();
|
||||||
if (parent.exists()) {
|
if (parent.exists()) {
|
||||||
final String[] rawNames = parent.list((dir, name) -> name.endsWith(".schematic"));
|
final String[] rawNames = parent.list((dir, name) -> name.endsWith(".schematic") || name.endsWith(".schem"));
|
||||||
if (rawNames != null) {
|
if (rawNames != null) {
|
||||||
final List<String> transformed = Arrays.stream(rawNames)
|
final List<String> transformed = Arrays.stream(rawNames)
|
||||||
.map(rawName -> rawName.substring(0, rawName.length() - 10))
|
.map(rawName -> rawName.substring(0, rawName.length() - 10))
|
||||||
|
Loading…
Reference in New Issue
Block a user