package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(
command = "createroadschematic",
aliases = {"crs"},
category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.NONE,
permission = "plots.createroadschematic",
description = "Add a road schematic to your world using the roads around your current plot",
usage = "/plot createroadschematic")
public class CreateRoadSchematic extends SubCommand {
@Override
public boolean onCommand(PlotPlayer player, String[] args) {
Location loc = player.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
}
if (!(loc.getPlotArea() instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
HybridUtils.manager.setupRoadSchematic(plot);
MainUtil.sendMessage(player, "$1Saved new road schematic. To test the road, fly to a few other plots and use /plot debugroadregen");
return true;
}
}