Fix minor issues

This commit is contained in:
Alexander Söderberg 2020-05-23 15:02:31 +02:00
parent 47c74cfa6d
commit 8c37cc5340
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
3 changed files with 15 additions and 40 deletions

View File

@ -46,6 +46,7 @@ import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.RegionManager;
import com.plotsquared.core.util.RegionUtil;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
@ -140,6 +141,8 @@ public class Area extends SubCommand {
hybridPlotWorld.ROAD_WIDTH = hybridPlotWorld.ROAD_OFFSET_X = hybridPlotWorld.ROAD_OFFSET_Z = 0;
// Set the plot height to the selection height
hybridPlotWorld.PLOT_HEIGHT = hybridPlotWorld.ROAD_HEIGHT = hybridPlotWorld.WALL_HEIGHT = selectedRegion.getMaximumPoint().getBlockY();
// No sign plz
hybridPlotWorld.setAllowSigns(false);
final File parentFile = MainUtil.getFile(PlotSquared.imp().getDirectory(), "schematics" + File.separator +
"GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator +
hybridPlotWorld.getId());
@ -156,6 +159,14 @@ public class Area extends SubCommand {
e.printStackTrace();
return false;
}
// Setup schematic
try {
hybridPlotWorld.setupSchematics();
} catch (final SchematicHandler.UnsupportedFormatException e) {
e.printStackTrace();
}
// Calculate the offset
final BlockVector3 singlePos1 = selectedRegion.getMinimumPoint();
@ -187,21 +198,14 @@ public class Area extends SubCommand {
final String world = SetupUtils.manager.setupWorld(singleSetup);
if (WorldUtil.IMP.isWorld(world)) {
PlotSquared.get().loadWorld(world, null);
Captions.SETUP_FINISHED.send(player);
player.teleport(WorldUtil.IMP.getSpawn(world),
TeleportCause.COMMAND);
MainUtil.sendMessage(player, Captions.SINGLE_AREA_CREATED);
} else {
MainUtil.sendMessage(player,
"An error occurred while creating the world: " + hybridPlotWorld
.getWorldName());
}
};
if (hasConfirmation(player)) {
CmdConfirm.addPending(player,
getCommandString() + " create pos2 (Creates world)", singleRun);
} else {
singleRun.run();
}
singleRun.run();
return true;
case "c":
case "setup":

View File

@ -280,37 +280,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
(short) (z + shift + oddshift + centerShiftZ), biome);
}
}
/* HashMap<BlockLoc, CompoundTag> items = schematic3.getTiles();
if (!items.isEmpty()) {
this.G_SCH_STATE = new HashMap<>();
outer:
for (Map.Entry<BlockLoc, CompoundTag> entry : items.entrySet()) {
BlockLoc loc = entry.getKey();
short x = (short) (loc.x + shift + oddshift + centerShiftX);
short z = (short) (loc.z + shift + oddshift + centerShiftZ);
short y = (short) (loc.y + this.PLOT_HEIGHT);
int pair = MathMan.pair(x, z);
HashMap<Integer, CompoundTag> existing = this.G_SCH_STATE.get(pair);
if (existing == null) {
existing = new HashMap<>();
this.G_SCH_STATE.put(pair, existing);
}
existing.put((int) y, entry.getValue());
CompoundTag tag = entry.getValue();
Map<String, Tag> map = ReflectionUtils.getMap(tag.getValue());
for (int i = 1; i <= 4; i++) {
String ln = tag.getString("Line" + i);
if (ln == null || ln.length() > 11)
continue outer;
}
SIGN_LOCATION =
new Location(worldname, loc.x + centerShiftX, this.PLOT_HEIGHT + loc.y,
loc.z + centerShiftZ);
ALLOW_SIGNS = true;
continue outer;
}
}*/
PlotSquared.debug(Captions.PREFIX + "&3 - plot schematic: &7true");
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
PlotSquared.debug(Captions.PREFIX + "&3 - schematic: &7false");

View File

@ -1023,7 +1023,7 @@ public abstract class PlotArea {
* @return true if plot signs are allow, false otherwise.
*/
public boolean allowSigns() {
return allowSigns;
return allowSigns && (this.plots.size() > 1) /* Do not generate signs for single plots */;
}
/**