mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Various
Fixes a few typos
Fixes #943
Fixes #944
Fixes metrics (broke in b69e31129d
)
Fixes plot setup issue
Fixes some lighting issues
Fixes ChunkListener + cauldron
Tweak some schematic stuff
This commit is contained in:
@ -20,11 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
@ -39,6 +34,11 @@ import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "setup",
|
||||
permission = "plots.admin.command.setup",
|
||||
@ -132,14 +132,13 @@ public class Setup extends SubCommand {
|
||||
object.type = allTypes.indexOf(args[0].toLowerCase());
|
||||
final GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||
if (object.type == 0) {
|
||||
object.current = 7;
|
||||
object.current = 6;
|
||||
if (object.step == null) {
|
||||
object.plotManager = object.setupGenerator;
|
||||
object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator().getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes();
|
||||
SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object);
|
||||
}
|
||||
if (object.step.length == 0) {
|
||||
object.current = 7;
|
||||
MainUtil.sendMessage(plr, "&6What do you want your world to be called?");
|
||||
object.setup_index = 0;
|
||||
return true;
|
||||
|
@ -1,18 +1,13 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.LazyResult;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class AugmentedUtils {
|
||||
|
||||
private static boolean enabled = true;
|
||||
@ -23,9 +18,9 @@ public class AugmentedUtils {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public static void generate(final String world, final int cx, final int cz, LazyResult<PlotChunk<?>> lazyChunk) {
|
||||
public static boolean generate(final String world, final int cx, final int cz, LazyResult<PlotChunk<?>> lazyChunk) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (lazyChunk == null) {
|
||||
lazyChunk = new LazyResult<PlotChunk<?>>() {
|
||||
@ -40,14 +35,15 @@ public class AugmentedUtils {
|
||||
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
|
||||
Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
|
||||
if (areas.isEmpty()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
final PseudoRandom r = new PseudoRandom();
|
||||
r.state = (cx << 16) | (cz & 0xFFFF);;
|
||||
r.state = (cx << 16) | (cz & 0xFFFF);
|
||||
ChunkWrapper wrap = SetQueue.IMP.new ChunkWrapper(world, cx, cz);
|
||||
boolean toReturn = false;
|
||||
for (final PlotArea area : areas) {
|
||||
if (area.TYPE == 0) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (area.TERRAIN == 3) {
|
||||
continue;
|
||||
@ -59,12 +55,13 @@ public class AugmentedUtils {
|
||||
final PlotChunk<?> result = lazyChunk.getOrCreate();
|
||||
final PlotChunk<?> primaryMask;
|
||||
// coords
|
||||
int bxx = Math.max(0, area.getRegion().minX - bx);
|
||||
int bzz = Math.max(0, area.getRegion().minZ - bz);
|
||||
int txx = Math.min(15, area.getRegion().maxX - bx);
|
||||
int tzz = Math.min(15, area.getRegion().maxZ - bz);
|
||||
int bxx,bzz,txx,tzz;
|
||||
// gen
|
||||
if (area.TYPE == 2) {
|
||||
bxx = Math.max(0, area.getRegion().minX - bx);
|
||||
bzz = Math.max(0, area.getRegion().minZ - bz);
|
||||
txx = Math.min(15, area.getRegion().maxX - bx);
|
||||
tzz = Math.min(15, area.getRegion().maxZ - bz);
|
||||
primaryMask = new PlotChunk<Object>(wrap) {
|
||||
@Override
|
||||
public Object getChunkAbs() {
|
||||
@ -96,6 +93,8 @@ public class AugmentedUtils {
|
||||
}
|
||||
};
|
||||
} else {
|
||||
bxx = bzz = 0;
|
||||
txx = tzz = 15;
|
||||
primaryMask = result;
|
||||
}
|
||||
PlotChunk<?> secondaryMask;
|
||||
@ -120,6 +119,8 @@ public class AugmentedUtils {
|
||||
}
|
||||
if (!has) {
|
||||
continue;
|
||||
} else {
|
||||
toReturn = true;
|
||||
}
|
||||
secondaryMask = new PlotChunk<Object>(wrap) {
|
||||
@Override
|
||||
@ -156,6 +157,7 @@ public class AugmentedUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
toReturn = true;
|
||||
}
|
||||
generator.generateChunk(secondaryMask, area, r);
|
||||
}
|
||||
@ -163,5 +165,6 @@ public class AugmentedUtils {
|
||||
lazyChunk.get().addToQueue();
|
||||
lazyChunk.get().flush(false);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
@ -22,14 +22,7 @@ package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.Template;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.FileBytes;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
|
||||
import java.io.File;
|
||||
@ -46,19 +39,18 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
public void exportTemplate(final PlotArea plotworld) throws IOException {
|
||||
final HashSet<FileBytes> files = new HashSet<>(
|
||||
Collections.singletonList(new FileBytes("templates/" + "tmp-data.yml", Template.getBytes(plotworld))));
|
||||
final String psRoot = PS.get().IMP.getDirectory() + File.separator;
|
||||
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotworld.worldname + File.separator;
|
||||
final String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
|
||||
try {
|
||||
final File sideroad = new File(psRoot + dir + "sideroad.schematic");
|
||||
final File sideroad = MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "sideroad.schematic");
|
||||
if (sideroad.exists()) {
|
||||
files.add(new FileBytes(newDir + "sideroad.schematic", Files.readAllBytes(sideroad.toPath())));
|
||||
}
|
||||
final File intersection = new File(psRoot + dir + "intersection.schematic");
|
||||
final File intersection = MainUtil.getFile(PS.get().IMP.getDirectory(), "intersection.schematic");
|
||||
if (intersection.exists()) {
|
||||
files.add(new FileBytes(newDir + "intersection.schematic", Files.readAllBytes(intersection.toPath())));
|
||||
}
|
||||
final File plot = new File(psRoot + dir + "plot.schematic");
|
||||
final File plot = MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "plot.schematic");
|
||||
if (plot.exists()) {
|
||||
files.add(new FileBytes(newDir + "plot.schematic", Files.readAllBytes(plot.toPath())));
|
||||
}
|
||||
|
@ -27,11 +27,13 @@ import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
@ -191,12 +193,12 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
|
||||
public void setupSchematics() {
|
||||
G_SCH = new HashMap<>();
|
||||
final String schem1Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/sideroad";
|
||||
final String schem2Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/intersection";
|
||||
final String schem3Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/plot";
|
||||
final Schematic schem1 = SchematicHandler.manager.getSchematic(schem1Str);
|
||||
final Schematic schem2 = SchematicHandler.manager.getSchematic(schem2Str);
|
||||
final Schematic schem3 = SchematicHandler.manager.getSchematic(schem3Str);
|
||||
final File schem1File = MainUtil.getFile(PS.get().IMP.getDirectory(),"schematics/GEN_ROAD_SCHEMATIC/" + worldname + "/sideroad.schematic");
|
||||
final File schem2File = MainUtil.getFile(PS.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + worldname + "/intersection.schematic");
|
||||
final File schem3File = MainUtil.getFile(PS.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + worldname + "/plot.schematic");
|
||||
final Schematic schem1 = SchematicHandler.manager.getSchematic(schem1File);
|
||||
final Schematic schem2 = SchematicHandler.manager.getSchematic(schem2File);
|
||||
final Schematic schem3 = SchematicHandler.manager.getSchematic(schem3File);
|
||||
final int shift = ROAD_WIDTH / 2;
|
||||
int oddshift = 0;
|
||||
if ((ROAD_WIDTH & 1) != 0) {
|
||||
|
@ -5,32 +5,12 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class HybridUtils {
|
||||
@ -313,7 +293,7 @@ public abstract class HybridUtils {
|
||||
final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
|
||||
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
||||
|
||||
final String dir = PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
|
||||
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
|
||||
.getArea().toString() + File.separator;
|
||||
SchematicHandler.manager.getCompoundTag(world, sideroad, new RunnableVal<CompoundTag>() {
|
||||
@Override
|
||||
|
@ -361,10 +361,11 @@ public class Plot {
|
||||
}
|
||||
if (isMerged()) {
|
||||
HashSet<Plot> plots = getConnectedPlots();
|
||||
final HashSet<UUID> owners = new HashSet<UUID>(2);
|
||||
Plot[] array = plots.toArray(new Plot[plots.size()]);
|
||||
final HashSet<UUID> owners = new HashSet<UUID>(1);
|
||||
UUID last = owner;
|
||||
owners.add(owner);
|
||||
for (Plot current : plots) {
|
||||
for (Plot current : array) {
|
||||
if (last == null || current.owner.getMostSignificantBits() != last.getMostSignificantBits()) {
|
||||
owners.add(current.owner);
|
||||
last = current.owner;
|
||||
@ -1953,7 +1954,11 @@ public class Plot {
|
||||
} else if (index < -1) {
|
||||
PS.debug("This should NEVER happen. Seriously, it's impossible.");
|
||||
}
|
||||
final String name = lines[i - 1].substring(index);
|
||||
String line = lines[i-1];
|
||||
if (line.length() <= index) {
|
||||
return null;
|
||||
}
|
||||
final String name = line.substring(index);
|
||||
if (name.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -205,4 +205,4 @@ public class BO3Handler {
|
||||
}
|
||||
return base;
|
||||
}
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ExpireManager {
|
||||
PlotMessage msg = new PlotMessage()
|
||||
.text(num + " " + (num > 1 ? "plots are" : "plot is") + " expired:").color("$1").command("/plot list expired").tooltip("/plot list expired")
|
||||
//.text("\n - ").color("$3").text("Delete all (/plot delete expired)").color("$2").command("/plot delete expired")
|
||||
.text("\n - ").color("$3").text("Delete this (/plot expired)").color("$2").command("/plot delete").tooltip("/plot delete")
|
||||
.text("\n - ").color("$3").text("Delete this (/plot delete)").color("$2").command("/plot delete").tooltip("/plot delete")
|
||||
.text("\n - ").color("$3").text("Remind later (/plot set keep 1d)").color("$2").command("/plot set keep 1d").tooltip("/plot set keep 1d")
|
||||
.text("\n - ").color("$3").text("Keep this (/plot set keep true)").color("$2").command("/plot set keep true").tooltip("/plot set keep true");
|
||||
msg.send(pp);
|
||||
|
@ -356,13 +356,15 @@ public class MainUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return player.getLocation().getPlotAbs();
|
||||
return player.getCurrentPlot();
|
||||
}
|
||||
PlotArea area;
|
||||
if (player != null) {
|
||||
area = player.getApplicablePlotArea();
|
||||
}
|
||||
else {
|
||||
area = PS.get().getPlotAreaByString(arg);
|
||||
if (area == null) {
|
||||
area = player.getApplicablePlotArea();
|
||||
}
|
||||
} else {
|
||||
area = ConsolePlayer.getConsole().getApplicablePlotArea();
|
||||
}
|
||||
final String[] split = arg.split(";|,");
|
||||
@ -376,24 +378,22 @@ public class MainUtil {
|
||||
} else if (split.length == 2) {
|
||||
id = PlotId.fromString(arg);
|
||||
} else {
|
||||
PlotArea tmp = PS.get().getPlotAreaByString(arg);
|
||||
Collection<Plot> plots;
|
||||
if (area == null) {
|
||||
if (message) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
||||
}
|
||||
return null;
|
||||
plots = PS.get().getPlots();
|
||||
} else {
|
||||
for (final Plot p : area.getPlots()) {
|
||||
final String name = p.getAlias();
|
||||
if (!name.isEmpty() && StringMan.isEqualIgnoreCase(name, arg)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
if (message) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
||||
}
|
||||
return null;
|
||||
plots = area.getPlots();
|
||||
}
|
||||
for (final Plot p : plots) {
|
||||
final String name = p.getAlias();
|
||||
if (!name.isEmpty() && StringMan.isEqualIgnoreCase(name, arg)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
if (message) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (id == null) {
|
||||
if (message) {
|
||||
|
@ -62,7 +62,7 @@ public abstract class SchematicHandler {
|
||||
if (outputDir == null) {
|
||||
directory = Settings.SCHEMATIC_SAVE_PATH;
|
||||
} else {
|
||||
directory = outputDir.getPath();
|
||||
directory = outputDir.getAbsolutePath();
|
||||
}
|
||||
final Runnable THIS = this;
|
||||
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||
@ -827,7 +827,7 @@ public abstract class SchematicHandler {
|
||||
ids2[i] = (byte) ids[i];
|
||||
}
|
||||
CompoundTag tag = createTag(ids2, datas, schematicDimension);
|
||||
SchematicHandler.this.save(tag, file.toString());
|
||||
SchematicHandler.this.save(tag, file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user