mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +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;
|
package com.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
@ -35,25 +33,30 @@ import java.util.ArrayDeque;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
public class ChunkListener implements Listener {
|
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 RefMethod methodGetHandleChunk;
|
||||||
|
private RefClass classChunk;
|
||||||
|
private RefClass classCraftChunk;
|
||||||
|
private RefField mustSave;
|
||||||
|
private Chunk lastChunk;
|
||||||
|
|
||||||
|
|
||||||
public ChunkListener() {
|
public ChunkListener() {
|
||||||
RefMethod method;
|
if (Settings.CHUNK_PROCESSOR_GC || Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE) {
|
||||||
try {
|
try {
|
||||||
method = classCraftChunk.getMethod("getHandle");
|
this.classChunk = getRefClass("{nms}.Chunk");
|
||||||
} catch (final Exception e) {
|
this.classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
method = null;
|
this.mustSave = classChunk.getField("mustSave");
|
||||||
e.printStackTrace();
|
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) {
|
if (!Settings.CHUNK_PROCESSOR_GC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
public class DefaultTitle extends AbstractTitle {
|
public class DefaultTitle extends AbstractTitle {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -13,8 +11,7 @@ public class DefaultTitle extends AbstractTitle {
|
|||||||
try {
|
try {
|
||||||
final DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out);
|
final DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out);
|
||||||
title.send(((BukkitPlayer) player).player);
|
title.send(((BukkitPlayer) player).player);
|
||||||
} catch (ClassNotFoundException | InvocationTargetException | SecurityException | NoSuchMethodException | InstantiationException |
|
} catch (Throwable e) {
|
||||||
IllegalArgumentException | IllegalAccessException e) {
|
|
||||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_183();
|
AbstractTitle.TITLE_CLASS = new DefaultTitle_183();
|
||||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class HackTitle extends AbstractTitle {
|
|||||||
try {
|
try {
|
||||||
final HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
|
final HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
|
||||||
title.send(((BukkitPlayer) player).player);
|
title.send(((BukkitPlayer) player).player);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("&cYour server version does not support titles!");
|
PS.debug("&cYour server version does not support titles!");
|
||||||
Settings.TITLES = false;
|
Settings.TITLES = false;
|
||||||
AbstractTitle.TITLE_CLASS = null;
|
AbstractTitle.TITLE_CLASS = null;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -64,14 +63,6 @@ public class Metrics {
|
|||||||
* All of the custom graphs to submit to metrics
|
* All of the custom graphs to submit to metrics
|
||||||
*/
|
*/
|
||||||
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
|
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
|
* Unique server id
|
||||||
*/
|
*/
|
||||||
@ -90,21 +81,8 @@ public class Metrics {
|
|||||||
throw new IllegalArgumentException("Plugin cannot be null");
|
throw new IllegalArgumentException("Plugin cannot be null");
|
||||||
}
|
}
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
// load the config
|
guid = UUID.randomUUID().toString();
|
||||||
configurationFile = getConfigFile();
|
debug = false;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,6 +254,7 @@ public class Metrics {
|
|||||||
// Each post thereafter will be a ping
|
// Each post thereafter will be a ping
|
||||||
firstPost = false;
|
firstPost = false;
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
if (debug) {
|
if (debug) {
|
||||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
|
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;
|
playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).invoke(null)).length;
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
|
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
// END server software specific section -- all code below does not use
|
// END server software specific section -- all code below does not use
|
||||||
// any code outside of this class / Java
|
// any code outside of this class / Java
|
||||||
@ -435,14 +415,17 @@ public class Metrics {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
PS.debug("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
PS.debug("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
||||||
}
|
}
|
||||||
// Write the data
|
try {
|
||||||
String response;
|
try (OutputStream os = connection.getOutputStream()) {
|
||||||
try (OutputStream os = connection.getOutputStream();
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
|
||||||
os.write(compressed);
|
os.write(compressed);
|
||||||
os.flush();
|
os.flush();
|
||||||
// Now read the response
|
}
|
||||||
|
String response;
|
||||||
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||||
response = reader.readLine();
|
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.startsWith("ERR") || response.startsWith("7")) {
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
@ -464,6 +447,12 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
if (debug) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
|
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
|
||||||
|
@ -338,6 +338,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final int[] array = bc.getIdArray(j);
|
final int[] array = bc.getIdArray(j);
|
||||||
|
if (array != null) {
|
||||||
int l = PseudoRandom.random.random(2);
|
int l = PseudoRandom.random.random(2);
|
||||||
for (int k = 0; k < array.length; k++) {
|
for (int k = 0; k < array.length; k++) {
|
||||||
final int i = array[k];
|
final int i = array[k];
|
||||||
@ -380,6 +381,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -20,11 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
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.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
@ -39,6 +34,11 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "setup",
|
command = "setup",
|
||||||
permission = "plots.admin.command.setup",
|
permission = "plots.admin.command.setup",
|
||||||
@ -132,14 +132,13 @@ public class Setup extends SubCommand {
|
|||||||
object.type = allTypes.indexOf(args[0].toLowerCase());
|
object.type = allTypes.indexOf(args[0].toLowerCase());
|
||||||
final GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
final GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||||
if (object.type == 0) {
|
if (object.type == 0) {
|
||||||
object.current = 7;
|
object.current = 6;
|
||||||
if (object.step == null) {
|
if (object.step == null) {
|
||||||
object.plotManager = object.setupGenerator;
|
object.plotManager = object.setupGenerator;
|
||||||
object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator().getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes();
|
object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator().getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes();
|
||||||
SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object);
|
SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object);
|
||||||
}
|
}
|
||||||
if (object.step.length == 0) {
|
if (object.step.length == 0) {
|
||||||
object.current = 7;
|
|
||||||
MainUtil.sendMessage(plr, "&6What do you want your world to be called?");
|
MainUtil.sendMessage(plr, "&6What do you want your world to be called?");
|
||||||
object.setup_index = 0;
|
object.setup_index = 0;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
package com.intellectualcrafters.plot.generator;
|
package com.intellectualcrafters.plot.generator;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.object.LazyResult;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
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.util.PlotChunk;
|
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||||
import com.intellectualcrafters.plot.util.SetQueue;
|
import com.intellectualcrafters.plot.util.SetQueue;
|
||||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class AugmentedUtils {
|
public class AugmentedUtils {
|
||||||
|
|
||||||
private static boolean enabled = true;
|
private static boolean enabled = true;
|
||||||
@ -23,9 +18,9 @@ public class AugmentedUtils {
|
|||||||
enabled = true;
|
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) {
|
if (!enabled) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (lazyChunk == null) {
|
if (lazyChunk == null) {
|
||||||
lazyChunk = new LazyResult<PlotChunk<?>>() {
|
lazyChunk = new LazyResult<PlotChunk<?>>() {
|
||||||
@ -40,14 +35,15 @@ public class AugmentedUtils {
|
|||||||
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
|
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
|
Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
|
||||||
if (areas.isEmpty()) {
|
if (areas.isEmpty()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
final PseudoRandom r = new PseudoRandom();
|
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);
|
ChunkWrapper wrap = SetQueue.IMP.new ChunkWrapper(world, cx, cz);
|
||||||
|
boolean toReturn = false;
|
||||||
for (final PlotArea area : areas) {
|
for (final PlotArea area : areas) {
|
||||||
if (area.TYPE == 0) {
|
if (area.TYPE == 0) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (area.TERRAIN == 3) {
|
if (area.TERRAIN == 3) {
|
||||||
continue;
|
continue;
|
||||||
@ -59,12 +55,13 @@ public class AugmentedUtils {
|
|||||||
final PlotChunk<?> result = lazyChunk.getOrCreate();
|
final PlotChunk<?> result = lazyChunk.getOrCreate();
|
||||||
final PlotChunk<?> primaryMask;
|
final PlotChunk<?> primaryMask;
|
||||||
// coords
|
// coords
|
||||||
int bxx = Math.max(0, area.getRegion().minX - bx);
|
int bxx,bzz,txx,tzz;
|
||||||
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);
|
|
||||||
// gen
|
// gen
|
||||||
if (area.TYPE == 2) {
|
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) {
|
primaryMask = new PlotChunk<Object>(wrap) {
|
||||||
@Override
|
@Override
|
||||||
public Object getChunkAbs() {
|
public Object getChunkAbs() {
|
||||||
@ -96,6 +93,8 @@ public class AugmentedUtils {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
bxx = bzz = 0;
|
||||||
|
txx = tzz = 15;
|
||||||
primaryMask = result;
|
primaryMask = result;
|
||||||
}
|
}
|
||||||
PlotChunk<?> secondaryMask;
|
PlotChunk<?> secondaryMask;
|
||||||
@ -120,6 +119,8 @@ public class AugmentedUtils {
|
|||||||
}
|
}
|
||||||
if (!has) {
|
if (!has) {
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
toReturn = true;
|
||||||
}
|
}
|
||||||
secondaryMask = new PlotChunk<Object>(wrap) {
|
secondaryMask = new PlotChunk<Object>(wrap) {
|
||||||
@Override
|
@Override
|
||||||
@ -156,6 +157,7 @@ public class AugmentedUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
toReturn = true;
|
||||||
}
|
}
|
||||||
generator.generateChunk(secondaryMask, area, r);
|
generator.generateChunk(secondaryMask, area, r);
|
||||||
}
|
}
|
||||||
@ -163,5 +165,6 @@ public class AugmentedUtils {
|
|||||||
lazyChunk.get().addToQueue();
|
lazyChunk.get().addToQueue();
|
||||||
lazyChunk.get().flush(false);
|
lazyChunk.get().flush(false);
|
||||||
}
|
}
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,7 @@ package com.intellectualcrafters.plot.generator;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.Template;
|
import com.intellectualcrafters.plot.commands.Template;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
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.util.*;
|
import com.intellectualcrafters.plot.util.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -46,19 +39,18 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
public void exportTemplate(final PlotArea plotworld) throws IOException {
|
public void exportTemplate(final PlotArea plotworld) throws IOException {
|
||||||
final HashSet<FileBytes> files = new HashSet<>(
|
final HashSet<FileBytes> files = new HashSet<>(
|
||||||
Collections.singletonList(new FileBytes("templates/" + "tmp-data.yml", Template.getBytes(plotworld))));
|
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 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;
|
final String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
|
||||||
try {
|
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()) {
|
if (sideroad.exists()) {
|
||||||
files.add(new FileBytes(newDir + "sideroad.schematic", Files.readAllBytes(sideroad.toPath())));
|
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()) {
|
if (intersection.exists()) {
|
||||||
files.add(new FileBytes(newDir + "intersection.schematic", Files.readAllBytes(intersection.toPath())));
|
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()) {
|
if (plot.exists()) {
|
||||||
files.add(new FileBytes(newDir + "plot.schematic", Files.readAllBytes(plot.toPath())));
|
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.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
@ -191,12 +193,12 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
|
|
||||||
public void setupSchematics() {
|
public void setupSchematics() {
|
||||||
G_SCH = new HashMap<>();
|
G_SCH = new HashMap<>();
|
||||||
final String schem1Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/sideroad";
|
final File schem1File = MainUtil.getFile(PS.get().IMP.getDirectory(),"schematics/GEN_ROAD_SCHEMATIC/" + worldname + "/sideroad.schematic");
|
||||||
final String schem2Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/intersection";
|
final File schem2File = MainUtil.getFile(PS.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + worldname + "/intersection.schematic");
|
||||||
final String schem3Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/plot";
|
final File schem3File = MainUtil.getFile(PS.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + worldname + "/plot.schematic");
|
||||||
final Schematic schem1 = SchematicHandler.manager.getSchematic(schem1Str);
|
final Schematic schem1 = SchematicHandler.manager.getSchematic(schem1File);
|
||||||
final Schematic schem2 = SchematicHandler.manager.getSchematic(schem2Str);
|
final Schematic schem2 = SchematicHandler.manager.getSchematic(schem2File);
|
||||||
final Schematic schem3 = SchematicHandler.manager.getSchematic(schem3Str);
|
final Schematic schem3 = SchematicHandler.manager.getSchematic(schem3File);
|
||||||
final int shift = ROAD_WIDTH / 2;
|
final int shift = ROAD_WIDTH / 2;
|
||||||
int oddshift = 0;
|
int oddshift = 0;
|
||||||
if ((ROAD_WIDTH & 1) != 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.config.C;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.util.*;
|
||||||
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 java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayDeque;
|
import java.util.*;
|
||||||
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.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public abstract class HybridUtils {
|
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> 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 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;
|
.getArea().toString() + File.separator;
|
||||||
SchematicHandler.manager.getCompoundTag(world, sideroad, new RunnableVal<CompoundTag>() {
|
SchematicHandler.manager.getCompoundTag(world, sideroad, new RunnableVal<CompoundTag>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -361,10 +361,11 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
if (isMerged()) {
|
if (isMerged()) {
|
||||||
HashSet<Plot> plots = getConnectedPlots();
|
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;
|
UUID last = owner;
|
||||||
owners.add(owner);
|
owners.add(owner);
|
||||||
for (Plot current : plots) {
|
for (Plot current : array) {
|
||||||
if (last == null || current.owner.getMostSignificantBits() != last.getMostSignificantBits()) {
|
if (last == null || current.owner.getMostSignificantBits() != last.getMostSignificantBits()) {
|
||||||
owners.add(current.owner);
|
owners.add(current.owner);
|
||||||
last = current.owner;
|
last = current.owner;
|
||||||
@ -1953,7 +1954,11 @@ public class Plot {
|
|||||||
} else if (index < -1) {
|
} else if (index < -1) {
|
||||||
PS.debug("This should NEVER happen. Seriously, it's impossible.");
|
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()) {
|
if (name.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class ExpireManager {
|
|||||||
PlotMessage msg = new PlotMessage()
|
PlotMessage msg = new PlotMessage()
|
||||||
.text(num + " " + (num > 1 ? "plots are" : "plot is") + " expired:").color("$1").command("/plot list expired").tooltip("/plot list expired")
|
.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 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("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");
|
.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);
|
msg.send(pp);
|
||||||
|
@ -356,13 +356,15 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return player.getLocation().getPlotAbs();
|
return player.getCurrentPlot();
|
||||||
}
|
}
|
||||||
PlotArea area;
|
PlotArea area;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
area = PS.get().getPlotAreaByString(arg);
|
||||||
|
if (area == null) {
|
||||||
area = player.getApplicablePlotArea();
|
area = player.getApplicablePlotArea();
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
area = ConsolePlayer.getConsole().getApplicablePlotArea();
|
area = ConsolePlayer.getConsole().getApplicablePlotArea();
|
||||||
}
|
}
|
||||||
final String[] split = arg.split(";|,");
|
final String[] split = arg.split(";|,");
|
||||||
@ -376,14 +378,13 @@ public class MainUtil {
|
|||||||
} else if (split.length == 2) {
|
} else if (split.length == 2) {
|
||||||
id = PlotId.fromString(arg);
|
id = PlotId.fromString(arg);
|
||||||
} else {
|
} else {
|
||||||
PlotArea tmp = PS.get().getPlotAreaByString(arg);
|
Collection<Plot> plots;
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (message) {
|
plots = PS.get().getPlots();
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} else {
|
} else {
|
||||||
for (final Plot p : area.getPlots()) {
|
plots = area.getPlots();
|
||||||
|
}
|
||||||
|
for (final Plot p : plots) {
|
||||||
final String name = p.getAlias();
|
final String name = p.getAlias();
|
||||||
if (!name.isEmpty() && StringMan.isEqualIgnoreCase(name, arg)) {
|
if (!name.isEmpty() && StringMan.isEqualIgnoreCase(name, arg)) {
|
||||||
return p;
|
return p;
|
||||||
@ -394,7 +395,6 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
if (message) {
|
if (message) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
||||||
|
@ -62,7 +62,7 @@ public abstract class SchematicHandler {
|
|||||||
if (outputDir == null) {
|
if (outputDir == null) {
|
||||||
directory = Settings.SCHEMATIC_SAVE_PATH;
|
directory = Settings.SCHEMATIC_SAVE_PATH;
|
||||||
} else {
|
} else {
|
||||||
directory = outputDir.getPath();
|
directory = outputDir.getAbsolutePath();
|
||||||
}
|
}
|
||||||
final Runnable THIS = this;
|
final Runnable THIS = this;
|
||||||
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||||
@ -827,7 +827,7 @@ public abstract class SchematicHandler {
|
|||||||
ids2[i] = (byte) ids[i];
|
ids2[i] = (byte) ids[i];
|
||||||
}
|
}
|
||||||
CompoundTag tag = createTag(ids2, datas, schematicDimension);
|
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