mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Nice code to handle schematic loading and remove the ability to debugroadregen a specific chunk, as it uses a completely different method to actual road generation.
This commit is contained in:
parent
5bdc5a0fcc
commit
8cb2bdc846
2 changed files with 4 additions and 27 deletions
|
@ -20,24 +20,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||||
}
|
}
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
C.NOT_IN_PLOT.send(player);
|
||||||
int extend = 0;
|
|
||||||
if (args.length == 1) {
|
|
||||||
if (MathMan.isInteger(args[0])) {
|
|
||||||
try {
|
|
||||||
extend = Integer.parseInt(args[0]);
|
|
||||||
} catch (NumberFormatException ignored) {
|
|
||||||
C.NOT_VALID_NUMBER.send(player, "(0, <EXTEND HEIGHT>)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boolean result = HybridUtils.manager.regenerateRoad(plotArea, chunk, extend);
|
|
||||||
MainUtil.sendMessage(player,
|
|
||||||
"&6Regenerating chunk: " + chunk.x + ',' + chunk.z + "\n&6 - Result: " + (result ?
|
|
||||||
"&aSuccess" :
|
|
||||||
"&cFailed"));
|
|
||||||
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
|
|
||||||
} else {
|
} else {
|
||||||
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
|
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
|
||||||
manager.createRoadEast(plotArea, plot);
|
manager.createRoadEast(plotArea, plot);
|
||||||
|
|
|
@ -291,15 +291,9 @@ public abstract class SchematicHandler {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ClipboardFormat format = ClipboardFormats.findByFile(file);
|
ClipboardFormat format = ClipboardFormats.findByFile(file);
|
||||||
if (format == BuiltInClipboardFormat.SPONGE_SCHEMATIC) {
|
if (format != null) {
|
||||||
SpongeSchematicReader ssr = new SpongeSchematicReader(
|
ClipboardReader reader = format.getReader(new FileInputStream(file));
|
||||||
new NBTInputStream(new GZIPInputStream(new FileInputStream(file))));
|
BlockArrayClipboard clip = (BlockArrayClipboard) reader.read();
|
||||||
BlockArrayClipboard clip = (BlockArrayClipboard) ssr.read();
|
|
||||||
return new Schematic(clip);
|
|
||||||
} else if (format == BuiltInClipboardFormat.MCEDIT_SCHEMATIC) {
|
|
||||||
MCEditSchematicReader msr = new MCEditSchematicReader(
|
|
||||||
new NBTInputStream(new GZIPInputStream(new FileInputStream(file))));
|
|
||||||
BlockArrayClipboard clip = (BlockArrayClipboard) msr.read();
|
|
||||||
return new Schematic(clip);
|
return new Schematic(clip);
|
||||||
} else {
|
} else {
|
||||||
throw new UnsupportedFormatException(
|
throw new UnsupportedFormatException(
|
||||||
|
|
Loading…
Reference in a new issue