mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01: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:
parent
c979be2994
commit
66da71bc9f
@ -1,7 +1,5 @@
|
||||
package com.plotsquared.bukkit.listeners;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
@ -35,25 +33,30 @@ import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
public class ChunkListener implements Listener {
|
||||
|
||||
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
private final RefField mustSave = classChunk.getField("mustSave");
|
||||
private Chunk lastChunk = null;
|
||||
private RefMethod methodGetHandleChunk;
|
||||
private RefClass classChunk;
|
||||
private RefClass classCraftChunk;
|
||||
private RefField mustSave;
|
||||
private Chunk lastChunk;
|
||||
|
||||
|
||||
public ChunkListener() {
|
||||
RefMethod method;
|
||||
try {
|
||||
method = classCraftChunk.getMethod("getHandle");
|
||||
} catch (final Exception e) {
|
||||
method = null;
|
||||
e.printStackTrace();
|
||||
if (Settings.CHUNK_PROCESSOR_GC || Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE) {
|
||||
try {
|
||||
this.classChunk = getRefClass("{nms}.Chunk");
|
||||
this.classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
this.mustSave = classChunk.getField("mustSave");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
} catch (Throwable e) {
|
||||
PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc");
|
||||
Settings.CHUNK_PROCESSOR_GC = false;
|
||||
Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE = false;
|
||||
}
|
||||
}
|
||||
methodGetHandleChunk = method;
|
||||
|
||||
if (!Settings.CHUNK_PROCESSOR_GC) {
|
||||
return;
|
||||
}
|
||||
|
@ -4,8 +4,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class DefaultTitle extends AbstractTitle {
|
||||
|
||||
@Override
|
||||
@ -13,8 +11,7 @@ public class DefaultTitle extends AbstractTitle {
|
||||
try {
|
||||
final DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (ClassNotFoundException | InvocationTargetException | SecurityException | NoSuchMethodException | InstantiationException |
|
||||
IllegalArgumentException | IllegalAccessException e) {
|
||||
} catch (Throwable e) {
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_183();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class HackTitle extends AbstractTitle {
|
||||
try {
|
||||
final HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
PS.debug("&cYour server version does not support titles!");
|
||||
Settings.TITLES = false;
|
||||
AbstractTitle.TITLE_CLASS = null;
|
||||
|
@ -20,7 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -64,14 +63,6 @@ public class Metrics {
|
||||
* All of the custom graphs to submit to metrics
|
||||
*/
|
||||
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
|
||||
/**
|
||||
* The plugin configuration file
|
||||
*/
|
||||
private final YamlConfiguration configuration;
|
||||
/**
|
||||
* The plugin configuration file
|
||||
*/
|
||||
private final File configurationFile;
|
||||
/**
|
||||
* Unique server id
|
||||
*/
|
||||
@ -90,21 +81,8 @@ public class Metrics {
|
||||
throw new IllegalArgumentException("Plugin cannot be null");
|
||||
}
|
||||
this.plugin = plugin;
|
||||
// load the config
|
||||
configurationFile = getConfigFile();
|
||||
configuration = YamlConfiguration.loadConfiguration(configurationFile);
|
||||
// add some defaults
|
||||
configuration.addDefault("opt-out", false);
|
||||
configuration.addDefault("guid", UUID.randomUUID().toString());
|
||||
configuration.addDefault("debug", false);
|
||||
// Do we need to create the file?
|
||||
if (configuration.get("guid", null) == null) {
|
||||
configuration.options().header("http://mcstats.org").copyDefaults(true);
|
||||
configuration.save(configurationFile);
|
||||
}
|
||||
// Load the guid then
|
||||
guid = configuration.getString("guid");
|
||||
debug = configuration.getBoolean("debug", false);
|
||||
guid = UUID.randomUUID().toString();
|
||||
debug = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,6 +254,7 @@ public class Metrics {
|
||||
// Each post thereafter will be a ping
|
||||
firstPost = false;
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
if (debug) {
|
||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
|
||||
}
|
||||
@ -350,6 +329,7 @@ public class Metrics {
|
||||
playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).invoke(null)).length;
|
||||
}
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
// END server software specific section -- all code below does not use
|
||||
// any code outside of this class / Java
|
||||
@ -435,34 +415,43 @@ public class Metrics {
|
||||
if (debug) {
|
||||
PS.debug("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
||||
}
|
||||
// Write the data
|
||||
String response;
|
||||
try (OutputStream os = connection.getOutputStream();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
os.write(compressed);
|
||||
os.flush();
|
||||
// Now read the response
|
||||
response = reader.readLine();
|
||||
}
|
||||
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
|
||||
if (response == null) {
|
||||
response = "null";
|
||||
} else if (response.startsWith("7")) {
|
||||
response = response.substring(response.startsWith("7,") ? 2 : 1);
|
||||
try {
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
os.write(compressed);
|
||||
os.flush();
|
||||
}
|
||||
throw new IOException(response);
|
||||
} else {
|
||||
// Is this the first update this hour?
|
||||
if ("1".equals(response) || response.contains("This is your first update this hour")) {
|
||||
synchronized (graphs) {
|
||||
for (final Graph graph : graphs) {
|
||||
for (final Plotter plotter : graph.getPlotters()) {
|
||||
plotter.reset();
|
||||
String response;
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
response = reader.readLine();
|
||||
if (debug) {
|
||||
PS.debug("[Metrics] Response for " + pluginName + ": " + response);
|
||||
}
|
||||
}
|
||||
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
|
||||
if (response == null) {
|
||||
response = "null";
|
||||
} else if (response.startsWith("7")) {
|
||||
response = response.substring(response.startsWith("7,") ? 2 : 1);
|
||||
}
|
||||
throw new IOException(response);
|
||||
} else {
|
||||
// Is this the first update this hour?
|
||||
if ("1".equals(response) || response.contains("This is your first update this hour")) {
|
||||
synchronized (graphs) {
|
||||
for (final Graph graph : graphs) {
|
||||
for (final Plotter plotter : graph.getPlotters()) {
|
||||
plotter.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (debug) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,45 +338,47 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
continue;
|
||||
}
|
||||
final int[] array = bc.getIdArray(j);
|
||||
int l = PseudoRandom.random.random(2);
|
||||
for (int k = 0; k < array.length; k++) {
|
||||
final int i = array[k];
|
||||
if (i < 16) {
|
||||
continue;
|
||||
}
|
||||
final short id = (short) (i >> 4);
|
||||
switch (id) { // Lighting
|
||||
default:
|
||||
if (!fixAll) {
|
||||
continue;
|
||||
}
|
||||
if ((k & 1) == l) {
|
||||
l = 1 - l;
|
||||
continue;
|
||||
}
|
||||
case 10:
|
||||
case 11:
|
||||
case 39:
|
||||
case 40:
|
||||
case 50:
|
||||
case 51:
|
||||
case 62:
|
||||
case 74:
|
||||
case 76:
|
||||
case 89:
|
||||
case 122:
|
||||
case 124:
|
||||
case 130:
|
||||
case 138:
|
||||
case 169:
|
||||
final int x = MainUtil.x_loc[j][k];
|
||||
final int y = MainUtil.y_loc[j][k];
|
||||
final int z = MainUtil.z_loc[j][k];
|
||||
if (isSurrounded(bc.getIdArrays(), x, y, z)) {
|
||||
continue;
|
||||
}
|
||||
final Object pos = classBlockPositionConstructor.create(X + x, y, Z + z);
|
||||
relight.call(pos);
|
||||
if (array != null) {
|
||||
int l = PseudoRandom.random.random(2);
|
||||
for (int k = 0; k < array.length; k++) {
|
||||
final int i = array[k];
|
||||
if (i < 16) {
|
||||
continue;
|
||||
}
|
||||
final short id = (short) (i >> 4);
|
||||
switch (id) { // Lighting
|
||||
default:
|
||||
if (!fixAll) {
|
||||
continue;
|
||||
}
|
||||
if ((k & 1) == l) {
|
||||
l = 1 - l;
|
||||
continue;
|
||||
}
|
||||
case 10:
|
||||
case 11:
|
||||
case 39:
|
||||
case 40:
|
||||
case 50:
|
||||
case 51:
|
||||
case 62:
|
||||
case 74:
|
||||
case 76:
|
||||
case 89:
|
||||
case 122:
|
||||
case 124:
|
||||
case 130:
|
||||
case 138:
|
||||
case 169:
|
||||
final int x = MainUtil.x_loc[j][k];
|
||||
final int y = MainUtil.y_loc[j][k];
|
||||
final int z = MainUtil.z_loc[j][k];
|
||||
if (isSurrounded(bc.getIdArrays(), x, y, z)) {
|
||||
continue;
|
||||
}
|
||||
final Object pos = classBlockPositionConstructor.create(X + x, y, Z + z);
|
||||
relight.call(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user