mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Allow debugroadregen to regenerate plot roads
This commit is contained in:
parent
df3c62609a
commit
64bb860594
@ -22,11 +22,14 @@ package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@ -44,12 +47,26 @@ public class DebugRoadRegen extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer player, final String ... args) {
|
||||
final Location loc = player.getLocation();
|
||||
final String world = loc.getWorld();
|
||||
if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) {
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(world);
|
||||
if (!(plotworld instanceof HybridPlotWorld)) {
|
||||
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
final boolean result = HybridUtils.manager.regenerateRoad(world, chunk, 0);
|
||||
MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
boolean result = HybridUtils.manager.regenerateRoad(world, chunk, 0);
|
||||
MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
||||
}
|
||||
else {
|
||||
HybridPlotManager manager = (HybridPlotManager) PS.get().getPlotManager(world);
|
||||
manager.createRoadEast(plotworld, plot);
|
||||
manager.createRoadSouth(plotworld, plot);
|
||||
manager.createRoadSouthEast(plotworld, plot);
|
||||
MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user