mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Cleanup and Optimizations
Abstracted TitleManagers Removed a lot of Statics. ETC.
This commit is contained in:
@ -53,6 +53,7 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.util.area.QuadMap;
|
||||
import com.plotsquared.listener.WESubscriber;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -89,6 +90,7 @@ import java.util.zip.ZipInputStream;
|
||||
public class PS {
|
||||
|
||||
private static PS instance;
|
||||
public final IPlotMain IMP;
|
||||
private final HashSet<Integer> plotAreaHashCheck = new HashSet<>();
|
||||
/**
|
||||
* All plot areas mapped by world (quick world access).
|
||||
@ -98,6 +100,9 @@ public class PS {
|
||||
* All plot areas mapped by location (quick location based access).
|
||||
*/
|
||||
private final HashMap<String, QuadMap<PlotArea>> plotAreaGrid = new HashMap<>();
|
||||
private final int[] version;
|
||||
private final String platform;
|
||||
private final Thread thread;
|
||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||
public File styleFile;
|
||||
@ -108,7 +113,6 @@ public class PS {
|
||||
public YamlConfiguration config;
|
||||
public YamlConfiguration storage;
|
||||
public YamlConfiguration commands;
|
||||
public IPlotMain IMP = null;
|
||||
public TaskManager TASK;
|
||||
public WorldEdit worldedit;
|
||||
public URL update;
|
||||
@ -117,25 +121,23 @@ public class PS {
|
||||
* All plot areas (quick global access).
|
||||
*/
|
||||
private PlotArea[] plotAreas = new PlotArea[0];
|
||||
|
||||
private File storageFile;
|
||||
private File file = null; // This file
|
||||
private int[] version;
|
||||
private int[] lastVersion;
|
||||
private String platform = null;
|
||||
private Database database;
|
||||
private Thread thread;
|
||||
|
||||
/**
|
||||
* Initialize PlotSquared with the desired Implementation class.
|
||||
* @param imp_class
|
||||
* @param iPlotMain Implementation of {@link IPlotMain} used
|
||||
* @param platform The platform being used
|
||||
*/
|
||||
public PS(IPlotMain imp_class, String platform) {
|
||||
public PS(IPlotMain iPlotMain, String platform) {
|
||||
PS.instance = this;
|
||||
this.thread = Thread.currentThread();
|
||||
this.IMP = iPlotMain;
|
||||
this.platform = platform;
|
||||
this.version = this.IMP.getPluginVersion();
|
||||
try {
|
||||
PS.instance = this;
|
||||
this.thread = Thread.currentThread();
|
||||
SetupUtils.generators = new HashMap<>();
|
||||
this.IMP = imp_class;
|
||||
new ReflectionUtils(this.IMP.getNMSPackage());
|
||||
try {
|
||||
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
||||
@ -147,8 +149,6 @@ public class PS {
|
||||
this.file = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared-" + platform + ".jar");
|
||||
}
|
||||
}
|
||||
this.version = this.IMP.getPluginVersion();
|
||||
this.platform = platform;
|
||||
if (getJavaVersion() < 1.7) {
|
||||
PS.log(C.CONSOLE_JAVA_OUTDATED_1_7);
|
||||
this.IMP.disable();
|
||||
@ -194,50 +194,7 @@ public class PS {
|
||||
}
|
||||
// create UUIDWrapper
|
||||
UUIDHandler.implementation = this.IMP.initUUIDHandler();
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
debug("Starting UUID caching");
|
||||
UUIDHandler.startCaching(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Plot plot : getPlots()) {
|
||||
if (plot.hasOwner() && plot.temp != -1) {
|
||||
if (UUIDHandler.getName(plot.owner) == null) {
|
||||
UUIDHandler.implementation.unknown.add(plot.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Auto clearing
|
||||
if (Settings.AUTO_CLEAR) {
|
||||
ExpireManager.IMP = new ExpireManager();
|
||||
if (Settings.AUTO_CLEAR_CONFIRMATION) {
|
||||
ExpireManager.IMP.runConfirmedTask();
|
||||
} else {
|
||||
ExpireManager.IMP.runAutomatedTask();
|
||||
}
|
||||
}
|
||||
// PlotMe
|
||||
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME) {
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (PS.this.IMP.initPlotMeConverter()) {
|
||||
PS.log("&c=== IMPORTANT ===");
|
||||
PS.log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
|
||||
PS.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
||||
PS.log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
|
||||
PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the "
|
||||
+ "'settings.yml'");
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 20);
|
||||
startUuidCatching();
|
||||
// create event util class
|
||||
EventUtil.manager = this.IMP.initEventUtil();
|
||||
// create Hybrid utility class
|
||||
@ -348,10 +305,6 @@ public class PS {
|
||||
PS.get().IMP.log(StringMan.getString(message));
|
||||
}
|
||||
|
||||
public static void stacktrace() {
|
||||
System.err.println(StringMan.join(new Exception().getStackTrace(), "\n\tat "));
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message to the IPlotMain logger.
|
||||
*
|
||||
@ -364,6 +317,53 @@ public class PS {
|
||||
}
|
||||
}
|
||||
|
||||
private void startUuidCatching() {
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
debug("Starting UUID caching");
|
||||
UUIDHandler.startCaching(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Plot plot : getPlots()) {
|
||||
if (plot.hasOwner() && plot.temp != -1) {
|
||||
if (UUIDHandler.getName(plot.owner) == null) {
|
||||
UUIDHandler.implementation.unknown.add(plot.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Auto clearing
|
||||
if (Settings.AUTO_CLEAR) {
|
||||
ExpireManager.IMP = new ExpireManager();
|
||||
if (Settings.AUTO_CLEAR_CONFIRMATION) {
|
||||
ExpireManager.IMP.runConfirmedTask();
|
||||
} else {
|
||||
ExpireManager.IMP.runAutomatedTask();
|
||||
}
|
||||
}
|
||||
// PlotMe
|
||||
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME) {
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (PS.this.IMP.initPlotMeConverter()) {
|
||||
PS.log("&c=== IMPORTANT ===");
|
||||
PS.log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
|
||||
PS.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
||||
PS.log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
|
||||
PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the "
|
||||
+ "'settings.yml'");
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
public boolean isMainThread(Thread thread) {
|
||||
return this.thread == thread;
|
||||
}
|
||||
@ -2398,10 +2398,6 @@ public class PS {
|
||||
return count;
|
||||
}
|
||||
|
||||
public int getPlotAreaCount(String world) {
|
||||
return this.plotAreaMap.size();
|
||||
}
|
||||
|
||||
public Set<PlotArea> getPlotAreas() {
|
||||
HashSet<PlotArea> set = new HashSet<>(this.plotAreas.length);
|
||||
Collections.addAll(set, this.plotAreas);
|
||||
|
@ -357,8 +357,7 @@ public class DebugExec extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void run(Integer i, File file, PlotMessage message) {
|
||||
String name;
|
||||
name = file.getName();
|
||||
String name = file.getName();
|
||||
|
||||
message.text("[").color("$3")
|
||||
.text(i + "").color("$1")
|
||||
|
@ -19,7 +19,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
||||
description = "Mark a plot as done",
|
||||
permission = "plots.done",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE)
|
||||
requiredType = RequiredType.PLAYER)
|
||||
public class Done extends SubCommand {
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ import java.net.URL;
|
||||
command = "download",
|
||||
aliases = {"dl"},
|
||||
category = CommandCategory.SCHEMATIC,
|
||||
requiredType = RequiredType.NONE,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
description = "Download your plot",
|
||||
permission = "plots.download")
|
||||
public class Download extends SubCommand {
|
||||
|
@ -13,6 +13,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -24,7 +25,7 @@ import java.util.Map;
|
||||
usage = "/plot flag <set|remove|add|list|info> <flag> <value>",
|
||||
description = "Set plot flags",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.flag")
|
||||
public class FlagCmd extends SubCommand {
|
||||
|
||||
@ -75,18 +76,18 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||
return false;
|
||||
}
|
||||
AbstractFlag af = FlagManager.getFlag(args[1]);
|
||||
if (af == null) {
|
||||
AbstractFlag flag = FlagManager.getFlag(args[1]);
|
||||
if (flag == null) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||
return false;
|
||||
}
|
||||
// flag key
|
||||
MainUtil.sendMessage(player, C.FLAG_KEY, af.getKey());
|
||||
MainUtil.sendMessage(player, C.FLAG_KEY, flag.getKey());
|
||||
// flag type
|
||||
MainUtil.sendMessage(player, C.FLAG_TYPE, af.value.getClass().getSimpleName());
|
||||
MainUtil.sendMessage(player, C.FLAG_TYPE, flag.value.getClass().getSimpleName());
|
||||
// Flag type description
|
||||
MainUtil.sendMessage(player, C.FLAG_DESC, af.getValueDesc());
|
||||
MainUtil.sendMessage(player, C.FLAG_DESC, flag.getValueDesc());
|
||||
return true;
|
||||
}
|
||||
case "set": {
|
||||
@ -167,7 +168,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.FLAG_REMOVED);
|
||||
return true;
|
||||
}
|
||||
case "add": {
|
||||
case "add":
|
||||
if (!Permissions.hasPermission(player, "plots.flag.add")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.add");
|
||||
return false;
|
||||
@ -206,7 +207,6 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
||||
return true;
|
||||
}
|
||||
case "list":
|
||||
if (!Permissions.hasPermission(player, "plots.flag.list")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.list");
|
||||
@ -217,12 +217,12 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
HashMap<String, ArrayList<String>> flags = new HashMap<>();
|
||||
for (AbstractFlag af : FlagManager.getFlags()) {
|
||||
String type = af.value.getClass().getSimpleName().replaceAll("Value", "");
|
||||
for (AbstractFlag flag1 : FlagManager.getFlags()) {
|
||||
String type = flag1.value.getClass().getSimpleName().replaceAll("Value", "");
|
||||
if (!flags.containsKey(type)) {
|
||||
flags.put(type, new ArrayList<String>());
|
||||
}
|
||||
flags.get(type).add(af.getKey());
|
||||
flags.get(type).add(flag1.getKey());
|
||||
}
|
||||
String message = "";
|
||||
String prefix = "";
|
||||
|
@ -22,7 +22,7 @@ import java.util.UUID;
|
||||
description = "Merge the plot you are standing on, with another plot",
|
||||
permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
confirmation = true)
|
||||
public class Merge extends SubCommand {
|
||||
|
||||
|
@ -15,7 +15,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
||||
usage = "/plot target <<plot>|nearest>",
|
||||
description = "Target a plot with your compass",
|
||||
permission = "plots.target",
|
||||
requiredType = RequiredType.NONE,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
category = CommandCategory.INFO)
|
||||
public class Target extends SubCommand {
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandCaller;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
@ -19,7 +19,7 @@ public class ConfigurationNode {
|
||||
private final SettingValue type;
|
||||
private Object value;
|
||||
|
||||
public ConfigurationNode(String constant, Object defaultValue, String description, SettingValue type, boolean required) {
|
||||
public ConfigurationNode(String constant, Object defaultValue, String description, SettingValue type) {
|
||||
this.constant = constant;
|
||||
this.defaultValue = defaultValue;
|
||||
this.description = description;
|
||||
|
@ -6,16 +6,11 @@ import java.util.List;
|
||||
/**
|
||||
* Updater and DB settings
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public class Settings {
|
||||
public static boolean USE_SQLUUIDHANDLER = false;
|
||||
|
||||
public static boolean AUTO_PURGE = false;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static boolean UPDATE_NOTIFICATIONS = true;
|
||||
|
||||
public static boolean FAST_CLEAR = false;
|
||||
@ -163,8 +158,6 @@ public class Settings {
|
||||
|
||||
/**
|
||||
* Database settings
|
||||
*
|
||||
|
||||
*/
|
||||
public static class DB {
|
||||
/**
|
||||
|
@ -139,8 +139,7 @@ public interface AbstractDB {
|
||||
|
||||
/**
|
||||
* Set plot flags.
|
||||
*
|
||||
* @param plot Plot Object
|
||||
* @param plot Plot Object
|
||||
* @param flags flags to set (flag[])
|
||||
*/
|
||||
void setFlags(Plot plot, Collection<Flag> flags);
|
||||
|
@ -26,6 +26,10 @@ import java.util.Set;
|
||||
*/
|
||||
public class FlagManager {
|
||||
|
||||
//TODO Default Flags
|
||||
public static final IntegerFlag MUSIC = new IntegerFlag("music");
|
||||
|
||||
|
||||
private static final HashSet<String> reserved = new HashSet<>();
|
||||
|
||||
private static final HashSet<AbstractFlag> flags = new HashSet<>();
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.intellectualcrafters.plot.flag;
|
||||
|
||||
public class IntegerFlag extends Flag<Integer> {
|
||||
|
||||
public IntegerFlag(String name) {
|
||||
super(name);
|
||||
}
|
||||
}
|
@ -34,18 +34,18 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
||||
@Override
|
||||
public ConfigurationNode[] getSettingNodes() {
|
||||
return new ConfigurationNode[] {
|
||||
new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", Configuration.INTEGER, true),
|
||||
new ConfigurationNode("plot.size", this.PLOT_WIDTH, "Plot width", Configuration.INTEGER, true),
|
||||
new ConfigurationNode("plot.filling", this.MAIN_BLOCK, "Plot block", Configuration.BLOCKLIST, true),
|
||||
new ConfigurationNode("plot.floor", this.TOP_BLOCK, "Plot floor block", Configuration.BLOCKLIST, true),
|
||||
new ConfigurationNode("wall.block", this.WALL_BLOCK, "Top wall block", Configuration.BLOCK, true),
|
||||
new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK, "Wall block (claimed)", Configuration.BLOCK, true),
|
||||
new ConfigurationNode("road.width", this.ROAD_WIDTH, "Road width", Configuration.INTEGER, true),
|
||||
new ConfigurationNode("road.height", this.ROAD_HEIGHT, "Road height", Configuration.INTEGER, true),
|
||||
new ConfigurationNode("road.block", this.ROAD_BLOCK, "Road block", Configuration.BLOCK, true),
|
||||
new ConfigurationNode("wall.filling", this.WALL_FILLING, "Wall filling block", Configuration.BLOCK, true),
|
||||
new ConfigurationNode("wall.height", this.WALL_HEIGHT, "Wall height", Configuration.INTEGER, true),
|
||||
new ConfigurationNode("plot.bedrock", this.PLOT_BEDROCK, "Plot bedrock generation", Configuration.BOOLEAN, true)};
|
||||
new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", Configuration.INTEGER),
|
||||
new ConfigurationNode("plot.size", this.PLOT_WIDTH, "Plot width", Configuration.INTEGER),
|
||||
new ConfigurationNode("plot.filling", this.MAIN_BLOCK, "Plot block", Configuration.BLOCKLIST),
|
||||
new ConfigurationNode("plot.floor", this.TOP_BLOCK, "Plot floor block", Configuration.BLOCKLIST),
|
||||
new ConfigurationNode("wall.block", this.WALL_BLOCK, "Top wall block", Configuration.BLOCK),
|
||||
new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK, "Wall block (claimed)", Configuration.BLOCK),
|
||||
new ConfigurationNode("road.width", this.ROAD_WIDTH, "Road width", Configuration.INTEGER),
|
||||
new ConfigurationNode("road.height", this.ROAD_HEIGHT, "Road height", Configuration.INTEGER),
|
||||
new ConfigurationNode("road.block", this.ROAD_BLOCK, "Road block", Configuration.BLOCK),
|
||||
new ConfigurationNode("wall.filling", this.WALL_FILLING, "Wall filling block", Configuration.BLOCK),
|
||||
new ConfigurationNode("wall.height", this.WALL_HEIGHT, "Wall height", Configuration.INTEGER),
|
||||
new ConfigurationNode("plot.bedrock", this.PLOT_BEDROCK, "Plot bedrock generation", Configuration.BOOLEAN)};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,8 +9,8 @@ import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
|
||||
/**
|
||||
* This class allows for implementation independent world generation<br>
|
||||
* - Sponge/Bukkit API<br><br>
|
||||
* This class allows for implementation independent world generation.
|
||||
* - Sponge/Bukkit API
|
||||
* Use the specify method to get the generator for that platform.
|
||||
*/
|
||||
public abstract class IndependentPlotGenerator {
|
||||
|
@ -7,7 +7,7 @@ import com.intellectualcrafters.plot.object.SetupObject;
|
||||
|
||||
public abstract class PlotGenerator<T> {
|
||||
|
||||
public T generator;
|
||||
public final T generator;
|
||||
|
||||
public PlotGenerator(T generator) {
|
||||
this.generator = generator;
|
||||
|
@ -1302,7 +1302,7 @@ public class Plot {
|
||||
PlotArea plotworld = getArea();
|
||||
if (plotworld.SCHEMATIC_ON_CLAIM) {
|
||||
SchematicHandler.Schematic sch;
|
||||
if (schematic.isEmpty()) {
|
||||
if (schematic == null || schematic.isEmpty()) {
|
||||
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);
|
||||
} else {
|
||||
sch = SchematicHandler.manager.getSchematic(schematic);
|
||||
|
@ -91,7 +91,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PlotArea object with no functionality/information<br>
|
||||
* Create a new PlotArea object with no functionality/information.
|
||||
* - Mainly used during startup before worlds are created as a temporary object
|
||||
* @param world
|
||||
* @return
|
||||
@ -106,8 +106,9 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the region for this PlotArea or a RegionWrapper encompassing the whole world if none exists
|
||||
* @NotNull
|
||||
* Returns the region for this PlotArea or a RegionWrapper encompassing
|
||||
* the whole world if none exists.
|
||||
*
|
||||
* @return RegionWrapper
|
||||
*/
|
||||
public RegionWrapper getRegion() {
|
||||
@ -119,7 +120,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the region for this PlotArea
|
||||
* Returns the region for this PlotArea.
|
||||
*
|
||||
* @return RegionWrapper or null if no applicable region
|
||||
*/
|
||||
@ -135,7 +136,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the min PlotId
|
||||
* Returns the min PlotId.
|
||||
* @return
|
||||
*/
|
||||
public PlotId getMin() {
|
||||
@ -143,7 +144,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the max PlotId
|
||||
* Returns the max PlotId.
|
||||
* @return
|
||||
*/
|
||||
public PlotId getMax() {
|
||||
@ -151,7 +152,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the implementation independent generator for this area
|
||||
* Get the implementation independent generator for this area.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ -179,7 +180,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a PlotArea is compatible (move/copy etc)
|
||||
* Check if a PlotArea is compatible (move/copy etc).
|
||||
* @param plotArea
|
||||
* @return
|
||||
*/
|
||||
@ -198,7 +199,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* When a world is created, the following method will be called for each
|
||||
* When a world is created, the following method will be called for each.
|
||||
*
|
||||
* @param config Configuration Section
|
||||
*/
|
||||
|
@ -7,16 +7,16 @@ public abstract class ChatManager<T> {
|
||||
public static ChatManager<?> manager;
|
||||
|
||||
public abstract T builder();
|
||||
|
||||
public abstract void color(final PlotMessage message, final String color);
|
||||
|
||||
public abstract void tooltip(final PlotMessage message, final PlotMessage... tooltip);
|
||||
|
||||
public abstract void command(final PlotMessage message, final String command);
|
||||
|
||||
public abstract void text(final PlotMessage message, final String text);
|
||||
|
||||
public abstract void send(final PlotMessage plotMessage, final PlotPlayer player);
|
||||
|
||||
public abstract void suggest(final PlotMessage plotMessage, final String command);
|
||||
|
||||
public abstract void color(PlotMessage message, String color);
|
||||
|
||||
public abstract void tooltip(PlotMessage message, PlotMessage... tooltip);
|
||||
|
||||
public abstract void command(PlotMessage message, String command);
|
||||
|
||||
public abstract void text(PlotMessage message, String text);
|
||||
|
||||
public abstract void send(PlotMessage plotMessage, PlotPlayer player);
|
||||
|
||||
public abstract void suggest(PlotMessage plotMessage, String command);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.Rating;
|
||||
import com.plotsquared.listener.PlayerBlockEventType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
@ -24,6 +24,7 @@ import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -705,7 +706,7 @@ public abstract class SchematicHandler {
|
||||
* @return Map of block location to tag
|
||||
*/
|
||||
public HashMap<BlockLoc, CompoundTag> getTiles() {
|
||||
return this.tiles;
|
||||
return this.tiles == null ? new HashMap<BlockLoc, CompoundTag>() : this.tiles;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -150,7 +151,7 @@ public class SetQueue {
|
||||
}
|
||||
|
||||
public void regenerateChunk(String world, ChunkLoc loc) {
|
||||
queue.regenerateChunk(world, loc);
|
||||
this.queue.regenerateChunk(world, loc);
|
||||
}
|
||||
|
||||
public class ChunkWrapper {
|
||||
|
@ -11,10 +11,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class TaskManager {
|
||||
|
||||
public static HashSet<String> TELEPORT_QUEUE = new HashSet<>();
|
||||
|
||||
public static final HashSet<String> TELEPORT_QUEUE = new HashSet<>();
|
||||
public static final HashMap<Integer, Integer> tasks = new HashMap<>();
|
||||
public static AtomicInteger index = new AtomicInteger(0);
|
||||
public static HashMap<Integer, Integer> tasks = new HashMap<>();
|
||||
|
||||
public static int runTaskRepeat(Runnable runnable, int interval) {
|
||||
if (runnable != null) {
|
||||
|
@ -477,7 +477,7 @@ public abstract class Command {
|
||||
return getCommandString() + " " + args + "]";
|
||||
}
|
||||
|
||||
public Collection tab(PlotPlayer player, String[] args, boolean space) {
|
||||
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
return this.allCommands;
|
||||
|
Reference in New Issue
Block a user