mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Refactor PS (and rename to PlotSquared)
This commit is contained in:
parent
16dbbe5244
commit
8df7f63931
@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.bukkit.util.block.*;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.uuid.*;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -124,8 +124,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
||||
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||
return new int[] {1, 13, 0};
|
||||
}
|
||||
}
|
||||
@ -138,12 +138,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
this.pluginName = getDescription().getName();
|
||||
getServer().getName();
|
||||
new PS(this, "Bukkit");
|
||||
new PlotSquared(this, "Bukkit");
|
||||
if (Settings.Enabled_Components.METRICS) {
|
||||
new Metrics(this).start();
|
||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
} else {
|
||||
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||
}
|
||||
if (Settings.Enabled_Components.WORLDS) {
|
||||
TaskManager.IMP.taskRepeat(new Runnable() {
|
||||
@ -171,7 +171,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
ignore.printStackTrace();
|
||||
}
|
||||
}
|
||||
final PlotAreaManager manager = PS.get().getPlotAreaManager();
|
||||
final PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||
if (manager instanceof SinglePlotAreaManager) {
|
||||
long start = System.currentTimeMillis();
|
||||
final SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||
@ -200,7 +200,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
final Chunk[] chunks = world.getLoadedChunks();
|
||||
if (chunks.length == 0) {
|
||||
if (!Bukkit.unloadWorld(world, true)) {
|
||||
PS.debug("Failed to unload " + world.getName());
|
||||
PlotSquared.debug("Failed to unload " + world.getName());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@ -236,7 +236,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override public void onDisable() {
|
||||
PS.get().disable();
|
||||
PlotSquared.get().disable();
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
}
|
||||
|
||||
@ -291,10 +291,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
||||
PS.log(C.PREFIX + "KillAllEntities started.");
|
||||
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override public void run() {
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea plotArea) {
|
||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||
try {
|
||||
@ -522,7 +522,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (currentPlotId != null) {
|
||||
entity.setMetadata("plot",
|
||||
new FixedMetadataValue(
|
||||
(Plugin) PS.get().IMP,
|
||||
(Plugin) PlotSquared.get().IMP,
|
||||
currentPlotId));
|
||||
}
|
||||
}
|
||||
@ -549,8 +549,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (id != null && id.equalsIgnoreCase("single")) {
|
||||
result = new SingleWorldGenerator();
|
||||
} else {
|
||||
result = PS.get().IMP.getDefaultGenerator();
|
||||
if (!PS.get().setupPlotWorld(world, id, result)) {
|
||||
result = PlotSquared.get().IMP.getDefaultGenerator();
|
||||
if (!PlotSquared.get().setupPlotWorld(world, id, result)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -565,30 +565,30 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
Class.forName("org.bukkit.event.entity.EntitySpawnEvent");
|
||||
getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this);
|
||||
} catch (final NoSuchMethodException | ClassNotFoundException ignored) {
|
||||
PS.debug("Not running Spigot. Skipping EntitySpawnListener event.");
|
||||
PlotSquared.debug("Not running Spigot. Skipping EntitySpawnListener event.");
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 7, 9)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), 1, 7, 9)) {
|
||||
try {
|
||||
getServer().getPluginManager().registerEvents(new EntityPortal_1_7_9(), this);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
||||
try {
|
||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
||||
try {
|
||||
getServer().getPluginManager().registerEvents(new PlayerEvents183(), this);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
try {
|
||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this);
|
||||
} catch (Throwable e) {
|
||||
@ -604,7 +604,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
@Override public void registerPlotPlusEvents() {
|
||||
PlotPlusListener.startRunnable(this);
|
||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_12_0)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_12_0)) {
|
||||
getServer().getPluginManager().registerEvents(new PlotPlusListener_1_12(), this);
|
||||
} else {
|
||||
getServer().getPluginManager().registerEvents(new PlotPlusListener_Legacy(), this);
|
||||
@ -629,7 +629,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
return econ;
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
PS.debug("No economy detected!");
|
||||
PlotSquared.debug("No economy detected!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -639,20 +639,20 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
new SendChunk();
|
||||
MainUtil.canSendChunk = true;
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_13_0)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_13_0)) {
|
||||
return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class);
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
return QueueProvider.of(BukkitLocalQueue_1_9.class, BukkitLocalQueue.class);
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
||||
return QueueProvider.of(BukkitLocalQueue_1_8_3.class, BukkitLocalQueue.class);
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
||||
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
||||
return QueueProvider.of(BukkitLocalQueue_1_8.class, BukkitLocalQueue.class);
|
||||
}
|
||||
return QueueProvider.of(BukkitLocalQueue_1_7.class, BukkitLocalQueue.class);
|
||||
@ -683,7 +683,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
return new BukkitPlotGenerator(world, gen);
|
||||
} else {
|
||||
return new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator());
|
||||
return new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator());
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,7 +722,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
Settings.UUID.OFFLINE = true;
|
||||
}
|
||||
if (!checkVersion) {
|
||||
PS.log(C.PREFIX
|
||||
PlotSquared.log(C.PREFIX
|
||||
+ " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||
Settings.TITLES = false;
|
||||
} else {
|
||||
@ -733,11 +733,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
}
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
PS.log(C.PREFIX + " &6" + getPluginName()
|
||||
PlotSquared.log(C.PREFIX + " &6" + getPluginName()
|
||||
+ " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
|
||||
+ "Bukkit");
|
||||
} else {
|
||||
PS.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
|
||||
PlotSquared.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
|
||||
}
|
||||
if (Settings.UUID.USE_SQLUUIDHANDLER) {
|
||||
return new SQLUUIDHandler(wrapper);
|
||||
@ -776,7 +776,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
@Override public void startMetrics() {
|
||||
new Metrics(this).start();
|
||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
}
|
||||
|
||||
@Override public void setGenerator(@NonNull final String worldName) {
|
||||
@ -784,7 +784,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (world == null) {
|
||||
// create world
|
||||
ConfigurationSection worldConfig =
|
||||
PS.get().worlds.getConfigurationSection("worlds." + worldName);
|
||||
PlotSquared.get().worlds.getConfigurationSection("worlds." + worldName);
|
||||
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
||||
SetupObject setup = new SetupObject();
|
||||
setup.plotManager = manager;
|
||||
@ -797,22 +797,22 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
world = Bukkit.getWorld(worldName);
|
||||
} else {
|
||||
try {
|
||||
if (!PS.get().hasPlotArea(worldName)) {
|
||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.log("Failed to reload world: " + world + " | " + ignored.getMessage());
|
||||
PlotSquared.log("Failed to reload world: " + world + " | " + ignored.getMessage());
|
||||
Bukkit.getServer().unloadWorld(world, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ChunkGenerator gen = world.getGenerator();
|
||||
if (gen instanceof BukkitPlotGenerator) {
|
||||
PS.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
||||
PlotSquared.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
||||
} else if (gen != null) {
|
||||
PS.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
|
||||
} else if (PS.get().worlds.contains("worlds." + worldName)) {
|
||||
PS.get().loadWorld(worldName, null);
|
||||
PlotSquared.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
|
||||
} else if (PlotSquared.get().worlds.contains("worlds." + worldName)) {
|
||||
PlotSquared.get().loadWorld(worldName, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrap
|
||||
import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.SubCommand;
|
||||
@ -180,7 +180,7 @@ public class DebugUUID extends SubCommand {
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)");
|
||||
|
||||
File file = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
File file = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (file.exists()) {
|
||||
try {
|
||||
List<String> lines =
|
||||
@ -220,7 +220,7 @@ public class DebugUUID extends SubCommand {
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Updating plot objects");
|
||||
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
UUID value = uCMap.get(plot.owner);
|
||||
if (value != null) {
|
||||
plot.owner = value;
|
||||
@ -239,13 +239,13 @@ public class DebugUUID extends SubCommand {
|
||||
DBFunc.createTables();
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, "&cConversion failed! Attempting recovery");
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
UUID value = uCReverse.get(plot.owner);
|
||||
if (value != null) {
|
||||
plot.owner = value;
|
||||
}
|
||||
}
|
||||
DBFunc.createPlotsAndData(new ArrayList<>(PS.get().getPlots()),
|
||||
DBFunc.createPlotsAndData(new ArrayList<>(PlotSquared.get().getPlots()),
|
||||
new Runnable() {
|
||||
@Override public void run() {
|
||||
MainUtil.sendMessage(player, "&6Recovery was successful!");
|
||||
@ -259,14 +259,14 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
|
||||
if (newWrapper instanceof OfflineUUIDWrapper) {
|
||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
||||
PS.get().worlds.set("UUID.offline", true);
|
||||
PlotSquared.get().worlds.set("UUID.force-lowercase", false);
|
||||
PlotSquared.get().worlds.set("UUID.offline", true);
|
||||
} else if (newWrapper instanceof DefaultUUIDWrapper) {
|
||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
||||
PS.get().worlds.set("UUID.offline", false);
|
||||
PlotSquared.get().worlds.set("UUID.force-lowercase", false);
|
||||
PlotSquared.get().worlds.set("UUID.offline", false);
|
||||
}
|
||||
try {
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException ignored) {
|
||||
MainUtil.sendMessage(player,
|
||||
"Could not save configuration. It will need to be manual set!");
|
||||
@ -276,7 +276,7 @@ public class DebugUUID extends SubCommand {
|
||||
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
|
||||
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||
DBFunc.createPlotsAndData(plots, new Runnable() {
|
||||
@Override public void run() {
|
||||
MainUtil.sendMessage(player, "&aConversion complete!");
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
@ -27,23 +27,23 @@ public abstract class APlotMeConnector {
|
||||
|
||||
public void copyConfig(FileConfiguration plotConfig, String world, String actualWorldName) {
|
||||
int pathWidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth);
|
||||
int plotSize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize);
|
||||
String wallBlock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock);
|
||||
String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
||||
PS.get().worlds
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
||||
String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
||||
PS.get().worlds
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
||||
String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.block", road);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.block", road);
|
||||
int height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
}
|
||||
|
||||
public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
||||
@ -68,8 +68,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
if (!plots.containsKey(world)) {
|
||||
plots.put(world, new HashMap<PlotId, Plot>());
|
||||
if (merge) {
|
||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
||||
int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||
int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width");
|
||||
plotWidth.put(world, plot);
|
||||
roadWidth.put(world, path);
|
||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
||||
@ -113,7 +113,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
PlotSquared
|
||||
.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
missing++;
|
||||
continue;
|
||||
}
|
||||
@ -127,10 +128,10 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
plots.get(world).put(id, plot);
|
||||
}
|
||||
if (missing > 0) {
|
||||
PS.log("&cSome names could not be identified:");
|
||||
PS.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
||||
PS.log("&7 - Names you have never seen before could be from people mistyping commands");
|
||||
PS.log(
|
||||
PlotSquared.log("&cSome names could not be identified:");
|
||||
PlotSquared.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
||||
PlotSquared.log("&7 - Names you have never seen before could be from people mistyping commands");
|
||||
PlotSquared.log(
|
||||
"&7 - Converting from a non-uuid version of PlotMe can't identify owners if the playerdata files are deleted (these plots will "
|
||||
+ "remain unknown until the player connects)");
|
||||
}
|
||||
@ -151,7 +152,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
|
||||
try {
|
||||
|
||||
PS.log(" - " + this.prefix + "Denied");
|
||||
PlotSquared.log(" - " + this.prefix + "Denied");
|
||||
statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Denied`");
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
@ -174,7 +175,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
}
|
||||
if (denied == null) {
|
||||
PS.log("&6Could not identify denied for plot: " + id);
|
||||
PlotSquared.log("&6Could not identify denied for plot: " + id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -209,7 +210,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
}
|
||||
if (helper == null) {
|
||||
PS.log("&6Could not identify helper for plot: " + id);
|
||||
PlotSquared.log("&6Could not identify helper for plot: " + id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -231,7 +232,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
}
|
||||
|
||||
@Override public boolean accepts(String version) {
|
||||
return version == null || PS.get().canUpdate(version, "0.17.0") || PS.get()
|
||||
return version == null || PlotSquared.get().canUpdate(version, "0.17.0") || PlotSquared.get()
|
||||
.canUpdate("0.999.999", version);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
|
||||
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -47,7 +47,7 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
|
||||
private void sendMessage(String message) {
|
||||
PS.debug("&3PlotMe&8->&3" + PS.imp().getPluginName() + "&8: &7" + message);
|
||||
PlotSquared.debug("&3PlotMe&8->&3" + PlotSquared.imp().getPluginName() + "&8: &7" + message);
|
||||
}
|
||||
|
||||
public String getPlotMePath() {
|
||||
@ -96,7 +96,7 @@ public class LikePlotMeConverter {
|
||||
return;
|
||||
}
|
||||
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
||||
String pluginName = PS.imp().getPluginName();
|
||||
String pluginName = PlotSquared.imp().getPluginName();
|
||||
content = content.replace("PlotMe-DefaultGenerator", pluginName);
|
||||
content = content.replace("PlotMe", pluginName);
|
||||
content = content.replace("AthionPlots", pluginName);
|
||||
@ -110,32 +110,32 @@ public class LikePlotMeConverter {
|
||||
String actualWorldName = getWorld(world);
|
||||
String plotMeWorldName = world.toLowerCase();
|
||||
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
||||
PS.get().worlds.set("worlds." + world + ".road.width", pathWidth);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".road.width", pathWidth);
|
||||
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight",
|
||||
plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); //
|
||||
PS.get().worlds.set("worlds." + world + ".road.height", height);
|
||||
PS.get().worlds.set("worlds." + world + ".wall.height", height);
|
||||
PS.get().worlds.set("worlds." + world + ".plot.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".road.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".plot.height", height);
|
||||
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
|
||||
PS.get().worlds.set("worlds." + world + ".plot.size", plotSize);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".plot.size", plotSize);
|
||||
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".UnclaimedBorder",
|
||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44")); //
|
||||
PS.get().worlds.set("worlds." + world + ".wall.block", wallblock);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.block", wallblock);
|
||||
String claimed =
|
||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".ProtectedWallBlock", "44:1"); //
|
||||
PS.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed);
|
||||
String floor =
|
||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
||||
PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
||||
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
|
||||
PS.get().worlds
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
||||
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
||||
PS.get().worlds.set("worlds." + world + ".road.block", road);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".road.block", road);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
}
|
||||
|
||||
public boolean run(APlotMeConnector connector) {
|
||||
@ -154,7 +154,7 @@ public class LikePlotMeConverter {
|
||||
return false;
|
||||
}
|
||||
|
||||
PS.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
||||
PlotSquared.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
||||
|
||||
Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder);
|
||||
|
||||
@ -187,7 +187,7 @@ public class LikePlotMeConverter {
|
||||
try {
|
||||
String actualWorldName = getWorld(world);
|
||||
connector.copyConfig(plotConfig, world, actualWorldName);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
sendMessage("&c-- &lFailed to save configuration for world '" + world
|
||||
@ -224,7 +224,7 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||
String world = entry.getKey();
|
||||
PlotArea area = PS.get().getPlotArea(world, null);
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||
int duplicate = 0;
|
||||
if (area != null) {
|
||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||
@ -235,13 +235,13 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
}
|
||||
if (duplicate > 0) {
|
||||
PS.debug("&c[WARNING] Found " + duplicate
|
||||
PlotSquared.debug("&c[WARNING] Found " + duplicate
|
||||
+ " duplicate plots already in DB for world: '" + world
|
||||
+ "'. Have you run the converter already?");
|
||||
}
|
||||
} else {
|
||||
if (PS.get().plots_tmp != null) {
|
||||
HashMap<PlotId, Plot> map = PS.get().plots_tmp.get(world);
|
||||
if (PlotSquared.get().plots_tmp != null) {
|
||||
HashMap<PlotId, Plot> map = PlotSquared.get().plots_tmp.get(world);
|
||||
if (map != null) {
|
||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||
if (map.containsKey(entry2.getKey())) {
|
||||
@ -251,7 +251,7 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
}
|
||||
if (duplicate > 0) {
|
||||
PS.debug("&c[WARNING] Found " + duplicate
|
||||
PlotSquared.debug("&c[WARNING] Found " + duplicate
|
||||
+ " duplicate plots already in DB for world: '" + world
|
||||
+ "'. Have you run the converter already?");
|
||||
}
|
||||
@ -269,13 +269,13 @@ public class LikePlotMeConverter {
|
||||
if (done.get()) {
|
||||
done();
|
||||
sendMessage("&aDatabase conversion is now complete!");
|
||||
PS.debug("&c - Stop the server");
|
||||
PS.debug(
|
||||
PlotSquared.debug("&c - Stop the server");
|
||||
PlotSquared.debug(
|
||||
"&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
|
||||
PS.debug("&c - Start the server");
|
||||
PS.get().setPlots(DBFunc.getPlots());
|
||||
PlotSquared.debug("&c - Start the server");
|
||||
PlotSquared.get().setPlots(DBFunc.getPlots());
|
||||
} else {
|
||||
sendMessage(
|
||||
"&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
||||
@ -285,7 +285,7 @@ public class LikePlotMeConverter {
|
||||
});
|
||||
sendMessage("Saving configuration...");
|
||||
try {
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException ignored) {
|
||||
sendMessage(" - &cFailed to save configuration.");
|
||||
}
|
||||
@ -316,7 +316,7 @@ public class LikePlotMeConverter {
|
||||
sendMessage(
|
||||
"&cYou need to stop the server to reload this world properly");
|
||||
} else {
|
||||
PS.get().removePlotAreas(actualWorldName);
|
||||
PlotSquared.get().removePlotAreas(actualWorldName);
|
||||
if (mv) {
|
||||
// unload world with MV
|
||||
Bukkit.getServer()
|
||||
@ -330,7 +330,7 @@ public class LikePlotMeConverter {
|
||||
// load world with MV
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||
"mv import " + actualWorldName + " normal -g " + PS
|
||||
"mv import " + actualWorldName + " normal -g " + PlotSquared
|
||||
.imp().getPluginName());
|
||||
} else if (mw) {
|
||||
// unload world with MW
|
||||
@ -345,14 +345,15 @@ public class LikePlotMeConverter {
|
||||
// load world with MW
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||
"mw create " + actualWorldName + " plugin:" + PS.imp()
|
||||
"mw create " + actualWorldName + " plugin:" + PlotSquared
|
||||
.imp()
|
||||
.getPluginName());
|
||||
} else {
|
||||
// Load using Bukkit API
|
||||
// - User must set generator manually
|
||||
Bukkit.getServer().unloadWorld(world, true);
|
||||
World myWorld = WorldCreator.name(actualWorldName).generator(
|
||||
new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator()))
|
||||
new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator()))
|
||||
.createWorld();
|
||||
myWorld.save();
|
||||
}
|
||||
@ -364,12 +365,12 @@ public class LikePlotMeConverter {
|
||||
if (done.get()) {
|
||||
done();
|
||||
sendMessage("&aDatabase conversion is now complete!");
|
||||
PS.debug("&c - Stop the server");
|
||||
PS.debug(
|
||||
PlotSquared.debug("&c - Stop the server");
|
||||
PlotSquared.debug(
|
||||
"&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
|
||||
PS.debug("&c - Start the server");
|
||||
PlotSquared.debug("&c - Start the server");
|
||||
} else {
|
||||
sendMessage(
|
||||
"&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
||||
@ -379,12 +380,12 @@ public class LikePlotMeConverter {
|
||||
});
|
||||
} catch (InterruptedException | SQLException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&/end/");
|
||||
PlotSquared.debug("&/end/");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void done() {
|
||||
PS.get().setPlots(DBFunc.getPlots());
|
||||
PlotSquared.get().setPlots(DBFunc.getPlots());
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
||||
@ -53,12 +53,12 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_plots`");
|
||||
resultSet = statement.executeQuery();
|
||||
} catch (SQLException e) {
|
||||
PS.debug("========= Table does not exist =========");
|
||||
PlotSquared.debug("========= Table does not exist =========");
|
||||
e.printStackTrace();
|
||||
PS.debug("=======================================");
|
||||
PS.debug(
|
||||
PlotSquared.debug("=======================================");
|
||||
PlotSquared.debug(
|
||||
"&8 - &7The database does not match the version specified in the PlotMe config");
|
||||
PS.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
||||
PlotSquared.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
||||
return null;
|
||||
}
|
||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
||||
@ -70,8 +70,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
String name = resultSet.getString("owner");
|
||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
||||
if (!plots.containsKey(world) && merge) {
|
||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
||||
int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||
int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width");
|
||||
plotWidth.put(world, plot);
|
||||
roadWidth.put(world, path);
|
||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
||||
@ -111,7 +111,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
}
|
||||
}
|
||||
if (owner == null) {
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
"&cCould not identify owner for plot: " + id + " -> '" + name + '\'');
|
||||
continue;
|
||||
}
|
||||
@ -133,7 +133,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
try {
|
||||
PS.log(" - " + this.plugin + "core_denied");
|
||||
PlotSquared.log(" - " + this.plugin + "core_denied");
|
||||
statement =
|
||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_denied`");
|
||||
resultSet = statement.executeQuery();
|
||||
@ -142,7 +142,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
int key = resultSet.getInt("plot_id");
|
||||
Plot plot = plots.get(key);
|
||||
if (plot == null) {
|
||||
PS.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
||||
PlotSquared.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
||||
continue;
|
||||
}
|
||||
String player = resultSet.getString("player");
|
||||
@ -150,7 +150,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
plot.getDenied().add(denied);
|
||||
}
|
||||
|
||||
PS.log(" - " + this.plugin + "core_allowed");
|
||||
PlotSquared.log(" - " + this.plugin + "core_allowed");
|
||||
statement =
|
||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_allowed`");
|
||||
resultSet = statement.executeQuery();
|
||||
@ -159,7 +159,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
int key = resultSet.getInt("plot_id");
|
||||
Plot plot = plots.get(key);
|
||||
if (plot == null) {
|
||||
PS.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
||||
PlotSquared.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
||||
continue;
|
||||
}
|
||||
String player = resultSet.getString("player");
|
||||
@ -189,6 +189,6 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
if (version == null) {
|
||||
return false;
|
||||
}
|
||||
return !PS.get().canUpdate(version, "0.17");
|
||||
return !PlotSquared.get().canUpdate(version, "0.17");
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -78,7 +78,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
}
|
||||
}
|
||||
BukkitPlotGenerator.this.random.state = c.getX() << 16 | c.getZ() & 0xFFFF;
|
||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
||||
ChunkWrapper wrap = new ChunkWrapper(area.worldname, c.getX(), c.getZ());
|
||||
ScopedLocalBlockQueue chunk = queue.getForChunk(wrap.x, wrap.z);
|
||||
if (BukkitPlotGenerator.this.plotGenerator
|
||||
@ -98,7 +98,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
+ " is already a BukkitPlotGenerator!");
|
||||
}
|
||||
this.full = false;
|
||||
PS.debug("BukkitPlotGenerator does not fully support: " + cg);
|
||||
PlotSquared.debug("BukkitPlotGenerator does not fully support: " + cg);
|
||||
this.platformGenerator = cg;
|
||||
this.plotGenerator = new IndependentPlotGenerator() {
|
||||
@Override public void processSetup(SetupObject setup) {
|
||||
@ -108,7 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
}
|
||||
|
||||
@Override public PlotManager getNewPlotManager() {
|
||||
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||
}
|
||||
|
||||
@Override public String getName() {
|
||||
@ -117,7 +117,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
|
||||
@Override
|
||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||
return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -199,8 +199,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
try {
|
||||
if (!this.loaded) {
|
||||
String name = world.getName();
|
||||
PS.get().loadWorld(name, this);
|
||||
Set<PlotArea> areas = PS.get().getPlotAreas(name);
|
||||
PlotSquared.get().loadWorld(name, this);
|
||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(name);
|
||||
if (!areas.isEmpty()) {
|
||||
PlotArea area = areas.iterator().next();
|
||||
if (!area.MOB_SPAWNING) {
|
||||
@ -276,7 +276,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
// Load if improperly loaded
|
||||
if (!this.loaded) {
|
||||
String name = world.getName();
|
||||
PS.get().loadWorld(name, this);
|
||||
PlotSquared.get().loadWorld(name, this);
|
||||
this.loaded = true;
|
||||
}
|
||||
// Set random seed
|
||||
@ -285,7 +285,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
if (ChunkManager.preProcessChunk(result)) {
|
||||
return;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
||||
try {
|
||||
this.plotGenerator.generateChunk(this.chunkSetter, area, this.random);
|
||||
} catch (Throwable e) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
@ -47,7 +47,7 @@ public class ChunkListener implements Listener {
|
||||
this.mustSave = classChunk.getField("mustSave");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
} catch (Throwable ignored) {
|
||||
PS.debug(PS.imp().getPluginName()
|
||||
PlotSquared.debug(PlotSquared.imp().getPluginName()
|
||||
+ "/Server not compatible for chunk processor trim/gc");
|
||||
Settings.Chunk_Processor.AUTO_TRIM = false;
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class ChunkListener implements Listener {
|
||||
HashSet<Chunk> toUnload = new HashSet<>();
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
String worldName = world.getName();
|
||||
if (!PS.get().hasPlotArea(worldName)) {
|
||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||
continue;
|
||||
}
|
||||
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
|
||||
@ -153,7 +153,7 @@ public class ChunkListener implements Listener {
|
||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
||||
Chunk chunk = event.getChunk();
|
||||
String world = chunk.getWorld().getName();
|
||||
if (PS.get().hasPlotArea(world)) {
|
||||
if (PlotSquared.get().hasPlotArea(world)) {
|
||||
if (unloadChunk(world, chunk, true)) {
|
||||
return;
|
||||
}
|
||||
@ -176,7 +176,7 @@ public class ChunkListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
Entity[] entities = chunk.getEntities();
|
||||
@ -205,7 +205,7 @@ public class ChunkListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
Entity[] entities = chunk.getEntities();
|
||||
@ -226,7 +226,7 @@ public class ChunkListener implements Listener {
|
||||
if (!chunk.isLoaded()) {
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
chunk.unload(true, true);
|
||||
return;
|
||||
}
|
||||
@ -234,7 +234,7 @@ public class ChunkListener implements Listener {
|
||||
if (tiles.length == 0) {
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
chunk.unload(true, true);
|
||||
return;
|
||||
}
|
||||
@ -244,7 +244,7 @@ public class ChunkListener implements Listener {
|
||||
if (i >= tiles.length) {
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
||||
chunk.unload(true, true);
|
||||
return;
|
||||
}
|
||||
@ -257,7 +257,7 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
|
||||
public boolean processChunk(Chunk chunk, boolean unload) {
|
||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||
return false;
|
||||
}
|
||||
Entity[] entities = chunk.getEntities();
|
||||
@ -268,12 +268,14 @@ public class ChunkListener implements Listener {
|
||||
ent.remove();
|
||||
}
|
||||
}
|
||||
PS.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4)
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4)
|
||||
+ "," + (chunk.getX() << 4));
|
||||
}
|
||||
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
||||
if (unload) {
|
||||
PS.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
|
||||
PlotSquared
|
||||
.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
|
||||
chunk.getX() << 4));
|
||||
cleanChunk(chunk);
|
||||
return true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
@ -28,9 +28,9 @@ public class EntityPortal_1_7_9 implements Listener {
|
||||
List<MetadataValue> meta = entity.getMetadata("plotworld");
|
||||
World world = entity.getLocation().getWorld();
|
||||
if (meta == null || meta.isEmpty()) {
|
||||
if (PS.get().hasPlotArea(world.getName())) {
|
||||
if (PlotSquared.get().hasPlotArea(world.getName())) {
|
||||
entity.setMetadata("plotworld",
|
||||
new FixedMetadataValue((Plugin) PS.get().IMP, entity.getLocation()));
|
||||
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation()));
|
||||
}
|
||||
} else {
|
||||
Location origin = (Location) meta.get(0).value();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
@ -54,7 +54,7 @@ public class EntitySpawnListener implements Listener {
|
||||
case SHULKER:
|
||||
if (!entity.hasMetadata("plot")) {
|
||||
entity.setMetadata("plot",
|
||||
new FixedMetadataValue((Plugin) PS.get().IMP, plot.getId()));
|
||||
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
@ -66,7 +66,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
private Field fieldPlayer;
|
||||
private PlayerMoveEvent moveTmp;
|
||||
private boolean v112 =
|
||||
PS.get().checkVersion(PS.imp().getServerVersion(), BukkitVersion.v1_12_0);
|
||||
PlotSquared.get().checkVersion(PlotSquared.imp().getServerVersion(), BukkitVersion.v1_12_0);
|
||||
|
||||
{
|
||||
try {
|
||||
@ -483,7 +483,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Location l = BukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
@ -497,7 +497,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||
Projectile entity = event.getEntity();
|
||||
Location loc = BukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(loc.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
|
||||
return true;
|
||||
}
|
||||
PlotArea area = loc.getPlotArea();
|
||||
@ -685,7 +685,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = PlotPlayer.wrap(player);
|
||||
Location loc = BukkitUtil.getLocation(to);
|
||||
PlotArea area = PS.get().getPlotAreaAbs(loc);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(loc);
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
@ -776,7 +776,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
} else if (toPlot != null) {
|
||||
vehicle.setMetadata("plot",
|
||||
new FixedMetadataValue((Plugin) PS.get().IMP, toPlot));
|
||||
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, toPlot));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -956,7 +956,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
player.sendMessage(spyMessage);
|
||||
}
|
||||
}
|
||||
PS.debug(full);
|
||||
PlotSquared.debug(full);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
|
||||
@ -1021,8 +1021,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||
return;
|
||||
}
|
||||
if (PS.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getItemInHand().getTypeId() == PS.get().worldedit
|
||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getItemInHand().getTypeId() == PlotSquared.get().worldedit
|
||||
.getConfiguration().wandItem) {
|
||||
return;
|
||||
}
|
||||
@ -1036,7 +1036,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Location location = BukkitUtil.getLocation(event.getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Iterator<Block> iterator = event.blockList().iterator();
|
||||
@ -1066,7 +1066,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
.equals(EntityType.MINECART_TNT)) {
|
||||
if (!near.hasMetadata("plot")) {
|
||||
near.setMetadata("plot",
|
||||
new FixedMetadataValue((Plugin) PS.get().IMP, plot));
|
||||
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1097,7 +1097,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (plot != null) {
|
||||
plotExit(pp, plot);
|
||||
}
|
||||
if (PS.get().worldedit != null) {
|
||||
if (PlotSquared.get().worldedit != null) {
|
||||
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
||||
if (pp.getAttribute("worldedit")) {
|
||||
pp.removeAttribute("worldedit");
|
||||
@ -1108,7 +1108,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
pp.deleteMeta("perm");
|
||||
}
|
||||
Location loc = pp.getLocation();
|
||||
PlotArea area = PS.get().getPlotAreaAbs(loc);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(loc);
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
@ -1136,7 +1136,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityBlockForm(EntityBlockFormEvent event) {
|
||||
String world = event.getBlock().getWorld().getName();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
return;
|
||||
}
|
||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||
@ -1381,7 +1381,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Vector relative = new Vector(face.getModX(), face.getModY(), face.getModZ());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
for (Block b : event.getBlocks()) {
|
||||
@ -1419,7 +1419,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
if (this.pistonBlocks) {
|
||||
@ -1512,7 +1512,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onStructureGrow(StructureGrowEvent event) {
|
||||
if (!PS.get().hasPlotArea(event.getWorld().getName())) {
|
||||
if (!PlotSquared.get().hasPlotArea(event.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
List<BlockState> blocks = event.getBlocks();
|
||||
@ -1761,8 +1761,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (PS.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getItemInHand().getTypeId() == PS.get().worldedit
|
||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getItemInHand().getTypeId() == PlotSquared.get().worldedit
|
||||
.getConfiguration().wandItem) {
|
||||
return;
|
||||
}
|
||||
@ -1832,7 +1832,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Block block = event.getBlock();
|
||||
World world = block.getWorld();
|
||||
String worldName = world.getName();
|
||||
if (!PS.get().hasPlotArea(worldName)) {
|
||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||
return;
|
||||
}
|
||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||
@ -1858,7 +1858,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
} else if (event.getTo() == Material.AIR) {
|
||||
event.getEntity()
|
||||
.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot));
|
||||
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2100,7 +2100,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot));
|
||||
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2314,7 +2314,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
public void onPotionSplash(PotionSplashEvent event) {
|
||||
ThrownPotion damager = event.getPotion();
|
||||
Location l = BukkitUtil.getLocation(damager);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
int count = 0;
|
||||
@ -2332,7 +2332,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||
EntityDamageByEntityEvent eventChange = null;
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
|
||||
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
||||
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
||||
} else {
|
||||
@ -2359,7 +2359,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||
Entity damager = event.getDamager();
|
||||
Location l = BukkitUtil.getLocation(damager);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Entity victim = event.getEntity();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -20,7 +20,7 @@ public class PlayerEvents183 implements Listener {
|
||||
Block block = event.getBlock();
|
||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||
String world = location.getWorld();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
return;
|
||||
}
|
||||
PlotArea area = location.getPlotArea();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||
@ -42,7 +42,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
HumanEntity entity = event.getWhoClicked();
|
||||
if (!(entity instanceof Player) || !PS.get().hasPlotArea(entity.getWorld().getName())) {
|
||||
if (!(entity instanceof Player) || !PlotSquared.get().hasPlotArea(entity.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) entity;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import org.bukkit.entity.LingeringPotion;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -21,7 +21,7 @@ public class PlayerEvents_1_9 implements Listener {
|
||||
public void onPotionSplash(LingeringPotionSplashEvent event) {
|
||||
LingeringPotion entity = event.getEntity();
|
||||
Location l = BukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
if (!parent.onProjectileHit(event)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
|
||||
@ -58,7 +58,7 @@ public class SingleWorldListener implements Listener {
|
||||
private void handle(ChunkEvent event) {
|
||||
World world = event.getWorld();
|
||||
String name = world.getName();
|
||||
PlotAreaManager man = PS.get().getPlotAreaManager();
|
||||
PlotAreaManager man = PlotSquared.get().getPlotAreaManager();
|
||||
if (!(man instanceof SinglePlotAreaManager))
|
||||
return;
|
||||
if (!isPlotId(name))
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||
@ -18,7 +18,7 @@ public class WorldEvents implements Listener {
|
||||
public void onWorldInit(WorldInitEvent event) {
|
||||
World world = event.getWorld();
|
||||
String name = world.getName();
|
||||
PlotAreaManager manager = PS.get().getPlotAreaManager();
|
||||
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||
if (manager instanceof SinglePlotAreaManager) {
|
||||
SinglePlotAreaManager single = (SinglePlotAreaManager) manager;
|
||||
if (single.isWorld(name)) {
|
||||
@ -28,9 +28,9 @@ public class WorldEvents implements Listener {
|
||||
}
|
||||
ChunkGenerator gen = world.getGenerator();
|
||||
if (gen instanceof GeneratorWrapper) {
|
||||
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||
} else {
|
||||
PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
|
||||
PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -76,7 +76,7 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
private void callEvent(final Event event) {
|
||||
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||
for (RegisteredListener listener : listeners) {
|
||||
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
|
||||
if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.*;
|
||||
@ -53,7 +53,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
if (depth == 1) {
|
||||
return;
|
||||
}
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
|| entity instanceof ArmorStand) {
|
||||
if (!entity.hasGravity()) {
|
||||
this.noGravity = true;
|
||||
@ -62,7 +62,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
switch (entity.getType()) {
|
||||
case ARROW:
|
||||
case BOAT:
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
Boat boat = (Boat) entity;
|
||||
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
||||
}
|
||||
@ -102,7 +103,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
// Do this stuff later
|
||||
return;
|
||||
default:
|
||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||
return;
|
||||
// MISC //
|
||||
case DROPPED_ITEM:
|
||||
@ -322,7 +323,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
|
||||
void restoreEquipment(LivingEntity entity) {
|
||||
EntityEquipment equipment = entity.getEquipment();
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
equipment.setItemInMainHand(this.lived.mainHand);
|
||||
equipment.setItemInOffHand(this.lived.offHand);
|
||||
} else {
|
||||
@ -338,7 +339,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
try {
|
||||
entity.getInventory().setContents(this.inventory);
|
||||
} catch (IllegalArgumentException e) {
|
||||
PS.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage());
|
||||
PlotSquared.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,7 +367,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
|
||||
void storeEquipment(EntityEquipment equipment) {
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
this.lived.mainHand = equipment.getItemInMainHand().clone();
|
||||
this.lived.offHand = equipment.getItemInOffHand().clone();
|
||||
} else {
|
||||
@ -458,7 +459,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
if (this.depth == 1) {
|
||||
return entity;
|
||||
}
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0)
|
||||
|| entity instanceof ArmorStand) {
|
||||
if (this.noGravity) {
|
||||
entity.setGravity(false);
|
||||
@ -467,7 +468,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
switch (entity.getType()) {
|
||||
case ARROW:
|
||||
case BOAT:
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
if (PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||
Boat boat = (Boat) entity;
|
||||
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
||||
}
|
||||
@ -512,7 +514,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
// Do this stuff later
|
||||
return entity;
|
||||
default:
|
||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||
return entity;
|
||||
// MISC //
|
||||
case ITEM_FRAME:
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.titles;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -12,7 +12,8 @@ import org.bukkit.entity.Player;
|
||||
private final boolean valid;
|
||||
|
||||
public DefaultTitle_111() {
|
||||
this.valid = PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0);
|
||||
this.valid = PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.titles;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
|
||||
@ -14,7 +14,7 @@ public class HackTitle extends AbstractTitle {
|
||||
HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&cYour server version does not support titles!");
|
||||
PlotSquared.debug("&cYour server version does not support titles!");
|
||||
Settings.TITLES = false;
|
||||
AbstractTitle.TITLE_CLASS = null;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.entity.EntityWrapper;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
@ -344,7 +344,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
@SuppressWarnings("deprecation") @Override
|
||||
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
|
||||
final boolean safe) {
|
||||
if (!PS.get().isMainThread(Thread.currentThread())) {
|
||||
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@SuppressWarnings("deprecation") @Override public void run() {
|
||||
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
||||
@ -700,7 +700,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
try {
|
||||
entity.spawn(world, xOffset, zOffset);
|
||||
} catch (Exception e) {
|
||||
PS.debug("Failed to restore entity (e): " + e.toString());
|
||||
PlotSquared.debug("Failed to restore entity (e): " + e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -719,12 +719,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
chest.getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate chest: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -744,12 +744,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate sign: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IndexOutOfBoundsException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate sign: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -765,12 +765,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -786,12 +786,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -807,12 +807,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -827,13 +827,13 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Jukebox) state).setPlaying(blockLocMaterialEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore jukebox: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore jukebox: " + (
|
||||
blockLocMaterialEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocMaterialEntry.getKey().y + ',' + (
|
||||
blockLocMaterialEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (
|
||||
blockLocMaterialEntry.getKey().x + xOffset) + ',' + blockLocMaterialEntry
|
||||
.getKey().y + ',' + (blockLocMaterialEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -853,12 +853,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Skull) state).setSkullType((SkullType) data[3]);
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore skull: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore skull: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
e.printStackTrace();
|
||||
@ -875,12 +875,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -894,12 +894,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((NoteBlock) state).setNote(blockLocNoteEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate note block: " + (
|
||||
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry
|
||||
.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (
|
||||
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry.getKey().y
|
||||
+ ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -912,12 +912,14 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
if (state instanceof BrewingStand) {
|
||||
((BrewingStand) state).setBrewingTime(blockLocShortEntry.getValue());
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (
|
||||
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (
|
||||
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -934,13 +936,13 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setSpawnedType(blockLocEntityTypeEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore spawner type: " + (
|
||||
blockLocEntityTypeEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocEntityTypeEntry.getKey().y + ',' + (
|
||||
blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + (
|
||||
blockLocEntityTypeEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocEntityTypeEntry.getKey().y + ',' + (
|
||||
blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||
@ -955,12 +957,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((CommandBlock) state).setCommand(blockLocStringEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore command block: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore command block: " + (
|
||||
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore command block (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to restore command block (e): " + (
|
||||
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -977,12 +979,14 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -998,12 +1002,14 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Furnace) state).setBurnTime(time[0]);
|
||||
((Furnace) state).setCookTime(time[1]);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + (
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore furnace cooking (e): " + (
|
||||
PlotSquared
|
||||
.debug("&c[WARN] Plot clear failed to restore furnace cooking (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -1019,12 +1025,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate furnace: " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + (
|
||||
blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||
+ (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -1043,12 +1049,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
banner.setPatterns(patterns);
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate banner: " + (
|
||||
blockLocByteEntry.getKey().x + xOffset) + ',' + blockLocByteEntry
|
||||
.getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (
|
||||
PlotSquared.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (
|
||||
blockLocByteEntry.getKey().x + xOffset) + ',' + blockLocByteEntry.getKey().y
|
||||
+ ',' + (blockLocByteEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -1155,9 +1161,9 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PS.debug("------------ FAILED TO DO SOMETHING --------");
|
||||
PlotSquared.debug("------------ FAILED TO DO SOMETHING --------");
|
||||
e.printStackTrace();
|
||||
PS.debug("------------ but we caught it ^ --------");
|
||||
PlotSquared.debug("------------ but we caught it ^ --------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
@ -33,7 +33,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
if (plugin.isEnabled()) {
|
||||
ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
|
||||
if (generator != null) {
|
||||
PS.get().removePlotAreas(testWorld);
|
||||
PlotSquared.get().removePlotAreas(testWorld);
|
||||
String name = plugin.getDescription().getName();
|
||||
GeneratorWrapper<?> wrapped;
|
||||
if (generator instanceof GeneratorWrapper<?>) {
|
||||
@ -80,11 +80,11 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
switch (type) {
|
||||
case 2: {
|
||||
if (object.id != null) {
|
||||
if (!PS.get().worlds.contains(worldPath)) {
|
||||
PS.get().worlds.createSection(worldPath);
|
||||
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||
PlotSquared.get().worlds.createSection(worldPath);
|
||||
}
|
||||
ConfigurationSection worldSection =
|
||||
PS.get().worlds.getConfigurationSection(worldPath);
|
||||
PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||
String areaName = object.id + "-" + object.min + "-" + object.max;
|
||||
String areaPath = "areas." + areaName;
|
||||
if (!worldSection.contains(areaPath)) {
|
||||
@ -123,20 +123,20 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (!PS.get().worlds.contains(worldPath)) {
|
||||
PS.get().worlds.createSection(worldPath);
|
||||
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||
PlotSquared.get().worlds.createSection(worldPath);
|
||||
}
|
||||
ConfigurationSection worldSection =
|
||||
PS.get().worlds.getConfigurationSection(worldPath);
|
||||
PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||
for (ConfigurationNode step : steps) {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
PS.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
||||
PS.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PS.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
if (object.setupGenerator != null && !object.setupGenerator
|
||||
.equals(object.plotManager)) {
|
||||
PS.get().worlds
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".generator.init", object.setupGenerator);
|
||||
}
|
||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||
@ -147,11 +147,11 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
}
|
||||
case 0: {
|
||||
if (steps.length != 0) {
|
||||
if (!PS.get().worlds.contains(worldPath)) {
|
||||
PS.get().worlds.createSection(worldPath);
|
||||
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||
PlotSquared.get().worlds.createSection(worldPath);
|
||||
}
|
||||
ConfigurationSection worldSection =
|
||||
PS.get().worlds.getConfigurationSection(worldPath);
|
||||
PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||
for (ConfigurationNode step : steps) {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
@ -160,7 +160,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
}
|
||||
}
|
||||
try {
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -50,7 +50,7 @@ public class SendChunk {
|
||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
this.methodInitLighting = classChunk.getMethod("initLighting");
|
||||
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
//this works for 1.9.4 and 1.10
|
||||
tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class);
|
||||
} else {
|
||||
@ -118,7 +118,8 @@ public class SendChunk {
|
||||
chunks.remove(chunk);
|
||||
Object con = this.connection.of(entity).get();
|
||||
Object packet = null;
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
if (PlotSquared
|
||||
.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
|
||||
try {
|
||||
packet = this.mapChunk.create(c, 65535);
|
||||
} catch (Exception ignored) {
|
||||
@ -135,7 +136,7 @@ public class SendChunk {
|
||||
}
|
||||
}
|
||||
if (packet == null) {
|
||||
PS.debug("Error with PacketPlayOutMapChunk reflection.");
|
||||
PlotSquared.debug("Error with PacketPlayOutMapChunk reflection.");
|
||||
}
|
||||
this.send.of(con).call(packet);
|
||||
}
|
||||
@ -147,10 +148,11 @@ public class SendChunk {
|
||||
chunk.unload(true, false);
|
||||
} catch (Throwable ignored) {
|
||||
String worldName = chunk.getWorld().getName();
|
||||
PS.debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";"
|
||||
PlotSquared
|
||||
.debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";"
|
||||
+ chunk.getZ());
|
||||
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
PS.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||
PlotSquared.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
PlotSquared.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitAugmentedGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import org.bukkit.World;
|
||||
@ -16,7 +16,7 @@ public class SetGenCB {
|
||||
|
||||
public static void setGenerator(World world) throws Exception {
|
||||
SetupUtils.manager.updateGenerators();
|
||||
PS.get().removePlotAreas(world.getName());
|
||||
PlotSquared.get().removePlotAreas(world.getName());
|
||||
ChunkGenerator gen = world.getGenerator();
|
||||
if (gen == null) {
|
||||
return;
|
||||
@ -52,6 +52,6 @@ public class SetGenCB {
|
||||
}
|
||||
}
|
||||
}
|
||||
PS.get().loadWorld(world.getName(), PS.get().IMP.getGenerator(world.getName(), null));
|
||||
PlotSquared.get().loadWorld(world.getName(), PlotSquared.get().IMP.getGenerator(world.getName(), null));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||
@ -49,8 +49,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
PS.debug(C.PREFIX + "&6Starting player data caching for: " + world);
|
||||
File uuidFile = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
PlotSquared.debug(C.PREFIX + "&6Starting player data caching for: " + world);
|
||||
File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (uuidFile.exists()) {
|
||||
try {
|
||||
List<String> lines =
|
||||
@ -85,7 +85,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||
PS.debug("&aFast mode UUID caching enabled!");
|
||||
PlotSquared.debug("&aFast mode UUID caching enabled!");
|
||||
File playerDataFolder =
|
||||
new File(container, world + File.separator + "playerdata");
|
||||
String[] dat = playerDataFolder.list(new DatFileFilter());
|
||||
@ -101,7 +101,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
.fromStream(new FileInputStream(file),
|
||||
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||
if (!compound.containsKey("bukkit")) {
|
||||
PS.debug("ERROR: Player data (" + uuid.toString()
|
||||
PlotSquared.debug("ERROR: Player data (" + uuid.toString()
|
||||
+ ".dat) does not contain the the key \"bukkit\"");
|
||||
} else {
|
||||
NbtFactory.NbtCompound bukkit =
|
||||
@ -118,7 +118,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
PS.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
PlotSquared.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
PS.debug("Failed to cache: " + all.size()
|
||||
PlotSquared.debug("Failed to cache: " + all.size()
|
||||
+ " uuids - slowly processing all files");
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
UUID uuid = UUID.fromString(s);
|
||||
uuids.add(uuid);
|
||||
} catch (Exception ignored) {
|
||||
PS.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
||||
PlotSquared.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -175,7 +175,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
.fromStream(new FileInputStream(file),
|
||||
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||
if (!compound.containsKey("bukkit")) {
|
||||
PS.debug("ERROR: Player data (" + uuid.toString()
|
||||
PlotSquared.debug("ERROR: Player data (" + uuid.toString()
|
||||
+ ".dat) does not contain the the key \"bukkit\"");
|
||||
} else {
|
||||
NbtFactory.NbtCompound bukkit =
|
||||
@ -203,7 +203,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
PlotSquared.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
}
|
||||
}
|
||||
for (String name : names) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||
@ -82,7 +82,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
||||
return p.toArray(new Player[p.size()]);
|
||||
}
|
||||
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) {
|
||||
PS.debug("Failed to resolve online players");
|
||||
PlotSquared.debug("Failed to resolve online players");
|
||||
this.getOnline = null;
|
||||
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
return onlinePlayers.toArray(new Player[onlinePlayers.size()]);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
||||
@ -43,7 +43,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
public SQLUUIDHandler(UUIDWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.sqlite = new SQLite(MainUtil.getFile(PS.get().IMP.getDirectory(), "usercache.db"));
|
||||
this.sqlite = new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db"));
|
||||
try {
|
||||
this.sqlite.openConnection();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
@ -139,7 +139,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
connection.disconnect();
|
||||
}
|
||||
} catch (IOException | ParseException e) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)");
|
||||
}
|
||||
try {
|
||||
@ -166,7 +166,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
|
||||
@Override public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
PS.debug(C.PREFIX + "UUID for '" + name
|
||||
PlotSquared.debug(C.PREFIX + "UUID for '" + name
|
||||
+ "' was null. We'll cache this from the Mojang servers!");
|
||||
if (ifFetch == null) {
|
||||
return;
|
||||
@ -221,7 +221,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, name.toString());
|
||||
statement.execute();
|
||||
PS.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -244,7 +244,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, name.value);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.execute();
|
||||
PS.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ dependencies {
|
||||
compileOnly 'org.projectlombok:lombok:1.16.18'
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
|
||||
processResources {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.api;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
@ -29,7 +29,7 @@ import java.util.UUID;
|
||||
* <li>{@link Plot}</li>
|
||||
* <li>{@link com.github.intellectualsites.plotsquared.plot.object.Location}</li>
|
||||
* <li>{@link PlotArea}</li>
|
||||
* <li>{@link PS}</li>
|
||||
* <li>{@link PlotSquared}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @version 3.3.3
|
||||
@ -42,10 +42,10 @@ public class PlotAPI {
|
||||
* Get all plots.
|
||||
*
|
||||
* @return all plots
|
||||
* @see PS#getPlots()
|
||||
* @see PlotSquared#getPlots()
|
||||
*/
|
||||
public Set<Plot> getAllPlots() {
|
||||
return PS.get().getPlots();
|
||||
return PlotSquared.get().getPlots();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,47 +55,47 @@ public class PlotAPI {
|
||||
* @return all plots that a player owns
|
||||
*/
|
||||
public Set<Plot> getPlayerPlots(PlotPlayer player) {
|
||||
return PS.get().getPlots(player);
|
||||
return PlotSquared.get().getPlots(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a plot world.
|
||||
*
|
||||
* @param plotArea Plot World Object
|
||||
* @see PS#addPlotArea(PlotArea)
|
||||
* @see PlotSquared#addPlotArea(PlotArea)
|
||||
*/
|
||||
public void addPlotArea(PlotArea plotArea) {
|
||||
PS.get().addPlotArea(plotArea);
|
||||
PlotSquared.get().addPlotArea(plotArea);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PlotSquared configurations file.
|
||||
*
|
||||
* @return main configuration
|
||||
* @see PS#config
|
||||
* @see PlotSquared#config
|
||||
*/
|
||||
public YamlConfiguration getConfig() {
|
||||
return PS.get().config;
|
||||
return PlotSquared.get().config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotSquared storage file.
|
||||
*
|
||||
* @return storage configuration
|
||||
* @see PS#storage
|
||||
* @see PlotSquared#storage
|
||||
*/
|
||||
public YamlConfiguration getStorage() {
|
||||
return PS.get().storage;
|
||||
return PlotSquared.get().storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the main class for this plugin. Only use this if you really need it.
|
||||
*
|
||||
* @return PlotSquared PlotSquared Main Class
|
||||
* @see PS
|
||||
* @see PlotSquared
|
||||
*/
|
||||
public PS getMain() {
|
||||
return PS.get();
|
||||
public PlotSquared getMain() {
|
||||
return PlotSquared.get();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ public class PlotAPI {
|
||||
if (world == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return PS.get().getPlotAreas(world);
|
||||
return PlotSquared.get().getPlotAreas(world);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ public class PlotAPI {
|
||||
* @see MainUtil#sendConsoleMessage(C, String...)
|
||||
*/
|
||||
public void sendConsoleMessage(String message) {
|
||||
PS.log(message);
|
||||
PlotSquared.log(message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,10 +193,10 @@ public class PlotAPI {
|
||||
* Gets the PlotSquared class.
|
||||
*
|
||||
* @return PlotSquared Class
|
||||
* @see PS
|
||||
* @see PlotSquared
|
||||
*/
|
||||
public PS getPlotSquared() {
|
||||
return PS.get();
|
||||
public PlotSquared getPlotSquared() {
|
||||
return PlotSquared.get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
@ -166,7 +166,8 @@ public abstract class Command {
|
||||
options.put("usage", declaration.usage());
|
||||
options.put("confirmation", declaration.confirmation());
|
||||
boolean set = false;
|
||||
YamlConfiguration commands = PS.get() == null ? new YamlConfiguration() : PS.get().commands;
|
||||
YamlConfiguration commands = PlotSquared.get() == null ? new YamlConfiguration() : PlotSquared
|
||||
.get().commands;
|
||||
for (Map.Entry<String, Object> entry : options.entrySet()) {
|
||||
String key = this.getFullId() + "." + entry.getKey();
|
||||
if (!commands.contains(key)) {
|
||||
@ -174,9 +175,9 @@ public abstract class Command {
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
if (set && PS.get() != null) {
|
||||
if (set && PlotSquared.get() != null) {
|
||||
try {
|
||||
commands.save(PS.get().commandsFile);
|
||||
commands.save(PlotSquared.get().commandsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.configuration.file;
|
||||
import com.github.intellectualsites.plotsquared.configuration.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
@ -51,11 +51,11 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
||||
}
|
||||
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
PS.debug("&dCould not read: &7" + file);
|
||||
PS.debug("&dRenamed to: &7" + dest.getName());
|
||||
PS.debug("&c============ Full stacktrace ============");
|
||||
PlotSquared.debug("&dCould not read: &7" + file);
|
||||
PlotSquared.debug("&dRenamed to: &7" + dest.getName());
|
||||
PlotSquared.debug("&c============ Full stacktrace ============");
|
||||
ex.printStackTrace();
|
||||
PS.debug("&c=========================================");
|
||||
PlotSquared.debug("&c=========================================");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WESubscriber;
|
||||
import com.github.intellectualsites.plotsquared.plot.logger.DelegateLogger;
|
||||
import com.github.intellectualsites.plotsquared.plot.logger.ILogger;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.DefaultPlotAreaManager;
|
||||
@ -26,7 +25,11 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
@ -43,8 +46,10 @@ import java.util.zip.ZipInputStream;
|
||||
/**
|
||||
* An implementation of the core, with a static getter for easy access.
|
||||
*/
|
||||
public class PS {
|
||||
private static PS instance;
|
||||
@SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared {
|
||||
private static final Set<Plot> EMPTY_SET =
|
||||
Collections.unmodifiableSet(Collections.<Plot>emptySet());
|
||||
private static PlotSquared instance;
|
||||
// Implementation
|
||||
public final IPlotMain IMP;
|
||||
// Current thread
|
||||
@ -65,14 +70,15 @@ public class PS {
|
||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||
// Implementation logger
|
||||
private ILogger logger;
|
||||
@Setter @Getter private ILogger logger;
|
||||
// Platform / Version / Update URL
|
||||
private Updater updater;
|
||||
@Getter private Updater updater;
|
||||
private PlotVersion version;
|
||||
// Files and configuration
|
||||
@Getter
|
||||
private File jarFile = null; // This file
|
||||
private File storageFile;
|
||||
private PlotAreaManager manager;
|
||||
@Getter private PlotAreaManager plotAreaManager;
|
||||
|
||||
/**
|
||||
* Initialize PlotSquared with the desired Implementation class.
|
||||
@ -80,16 +86,21 @@ public class PS {
|
||||
* @param iPlotMain Implementation of {@link IPlotMain} used
|
||||
* @param platform The platform being used
|
||||
*/
|
||||
public PS(IPlotMain iPlotMain, String platform) {
|
||||
PS.instance = this;
|
||||
public PlotSquared(final IPlotMain iPlotMain, final String platform) {
|
||||
if (instance != null) {
|
||||
throw new IllegalStateException("Cannot re-initialize the PlotSquared singleton");
|
||||
}
|
||||
instance = this;
|
||||
|
||||
this.thread = Thread.currentThread();
|
||||
this.IMP = iPlotMain;
|
||||
this.logger = iPlotMain;
|
||||
Settings.PLATFORM = platform;
|
||||
|
||||
try {
|
||||
new ReflectionUtils(this.IMP.getNMSPackage());
|
||||
try {
|
||||
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
||||
URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
||||
this.jarFile = new File(
|
||||
new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
||||
.toURI().getPath());
|
||||
@ -102,7 +113,7 @@ public class PS {
|
||||
}
|
||||
}
|
||||
if (getJavaVersion() < 1.8) {
|
||||
PS.log(C.CONSOLE_JAVA_OUTDATED.f(IMP.getPluginName()));
|
||||
PlotSquared.log(C.CONSOLE_JAVA_OUTDATED.f(IMP.getPluginName()));
|
||||
}
|
||||
TaskManager.IMP = this.IMP.getTaskManager();
|
||||
setupConfigs();
|
||||
@ -111,11 +122,11 @@ public class PS {
|
||||
+ ".use_THIS.yml");
|
||||
C.load(this.translationFile);
|
||||
|
||||
// Setup manager
|
||||
// Setup plotAreaManager
|
||||
if (Settings.Enabled_Components.WORLDS) {
|
||||
this.manager = new SinglePlotAreaManager();
|
||||
this.plotAreaManager = new SinglePlotAreaManager();
|
||||
} else {
|
||||
this.manager = new DefaultPlotAreaManager();
|
||||
this.plotAreaManager = new DefaultPlotAreaManager();
|
||||
}
|
||||
|
||||
// Database
|
||||
@ -139,7 +150,7 @@ public class PS {
|
||||
if (Settings.Enabled_Components.METRICS) {
|
||||
this.IMP.startMetrics();
|
||||
} else {
|
||||
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
|
||||
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
|
||||
}
|
||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||
this.IMP.registerChunkProcessor();
|
||||
@ -183,7 +194,7 @@ public class PS {
|
||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||
try {
|
||||
if (this.IMP.initWorldEdit()) {
|
||||
PS.debug(IMP.getPluginName() + " hooked into WorldEdit.");
|
||||
PlotSquared.debug(IMP.getPluginName() + " hooked into WorldEdit.");
|
||||
this.worldedit = WorldEdit.getInstance();
|
||||
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
|
||||
if (Settings.Enabled_Components.COMMANDS) {
|
||||
@ -192,7 +203,7 @@ public class PS {
|
||||
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
|
||||
}
|
||||
}
|
||||
@ -200,7 +211,7 @@ public class PS {
|
||||
if (Settings.Enabled_Components.ECONOMY) {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override public void run() {
|
||||
EconHandler.manager = PS.this.IMP.getEconomyHandler();
|
||||
EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -244,7 +255,7 @@ public class PS {
|
||||
"&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml");
|
||||
debug(
|
||||
"&8 - &7Your world management plugin may be faulty (or non existent)");
|
||||
PS.this.IMP.setGenerator(world);
|
||||
PlotSquared.this.IMP.setGenerator(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,7 +274,8 @@ public class PS {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PS.log(C.ENABLED.f(IMP.getPluginName()));
|
||||
|
||||
PlotSquared.log(C.ENABLED.f(IMP.getPluginName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -271,8 +283,8 @@ public class PS {
|
||||
*
|
||||
* @return instance of PlotSquared
|
||||
*/
|
||||
public static PS get() {
|
||||
return PS.instance;
|
||||
public static PlotSquared get() {
|
||||
return PlotSquared.instance;
|
||||
}
|
||||
|
||||
public static IPlotMain imp() {
|
||||
@ -292,7 +304,7 @@ public class PS {
|
||||
if (message == null || message.toString().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PS.get().getLogger().log(StringMan.getString(message));
|
||||
PlotSquared.get().getLogger().log(StringMan.getString(message));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,45 +313,12 @@ public class PS {
|
||||
* @param message Message to log
|
||||
* @see IPlotMain#log(String)
|
||||
*/
|
||||
public static void debug(Object message) {
|
||||
public static void debug(@Nullable Object message) {
|
||||
if (Settings.DEBUG) {
|
||||
PS.log(message);
|
||||
PlotSquared.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current logger.
|
||||
*
|
||||
* @return The assigned logger
|
||||
*/
|
||||
public ILogger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Logger.
|
||||
*
|
||||
* @param logger the logger the plugin should use
|
||||
* @see DelegateLogger
|
||||
* @see #getLogger()
|
||||
*/
|
||||
public void setLogger(ILogger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* The plugin updater
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Updater getUpdater() {
|
||||
return updater;
|
||||
}
|
||||
|
||||
public PlotAreaManager getPlotAreaManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
private void startUuidCatching() {
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
@ -379,14 +358,15 @@ public class PS {
|
||||
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
|
||||
TaskManager.IMP.taskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
if (PS.this.IMP.initPlotMeConverter()) {
|
||||
PS.log("&c=== IMPORTANT ===");
|
||||
PS.log(
|
||||
if (PlotSquared.this.IMP.initPlotMeConverter()) {
|
||||
PlotSquared.log("&c=== IMPORTANT ===");
|
||||
PlotSquared.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(
|
||||
PlotSquared
|
||||
.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
||||
PlotSquared.log(
|
||||
"&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
"&c - After the conversion is finished, please set 'plotme-converter' to false in the "
|
||||
+ "'settings.yml'");
|
||||
}
|
||||
@ -403,8 +383,8 @@ public class PS {
|
||||
/**
|
||||
* Check if `version` is >= `version2`.
|
||||
*
|
||||
* @param version
|
||||
* @param version2
|
||||
* @param version First version
|
||||
* @param version2 Second version
|
||||
* @return true if `version` is >= `version2`
|
||||
*/
|
||||
public boolean checkVersion(int[] version, int... version2) {
|
||||
@ -490,7 +470,7 @@ public class PS {
|
||||
cluster.setArea(plotArea);
|
||||
}
|
||||
}
|
||||
manager.addPlotArea(plotArea);
|
||||
plotAreaManager.addPlotArea(plotArea);
|
||||
plotArea.setupBorder();
|
||||
}
|
||||
|
||||
@ -500,7 +480,7 @@ public class PS {
|
||||
* @param area the {@code PlotArea} to remove
|
||||
*/
|
||||
public void removePlotArea(PlotArea area) {
|
||||
manager.removePlotArea(area);
|
||||
plotAreaManager.removePlotArea(area);
|
||||
setPlotsTmp(area);
|
||||
}
|
||||
|
||||
@ -531,11 +511,11 @@ public class PS {
|
||||
}
|
||||
|
||||
public Set<PlotCluster> getClusters(String world) {
|
||||
HashSet<PlotCluster> set = new HashSet<>();
|
||||
Set<PlotCluster> set = new HashSet<>();
|
||||
for (PlotArea area : getPlotAreas(world)) {
|
||||
set.addAll(area.getClusters());
|
||||
}
|
||||
return set;
|
||||
return Collections.unmodifiableSet(set);
|
||||
|
||||
}
|
||||
|
||||
@ -558,7 +538,7 @@ public class PS {
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public List<Plot> sortPlotsByTemp(Collection<Plot> plots) {
|
||||
@ -776,11 +756,11 @@ public class PS {
|
||||
HashMap<PlotArea, Collection<Plot>> map = new HashMap<>();
|
||||
int totalSize = getPlotCount();
|
||||
if (plots.size() == totalSize) {
|
||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
||||
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||
map.put(area, area.getPlots());
|
||||
}
|
||||
} else {
|
||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
||||
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||
map.put(area, new ArrayList<Plot>(0));
|
||||
}
|
||||
Collection<Plot> lastList = null;
|
||||
@ -795,7 +775,7 @@ public class PS {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PlotArea> areas = Arrays.asList(manager.getAllPlotAreas());
|
||||
List<PlotArea> areas = Arrays.asList(plotAreaManager.getAllPlotAreas());
|
||||
Collections.sort(areas, new Comparator<PlotArea>() {
|
||||
@Override public int compare(PlotArea a, PlotArea b) {
|
||||
if (priorityArea != null && StringMan.isEqual(a.toString(), b.toString())) {
|
||||
@ -904,7 +884,7 @@ public class PS {
|
||||
* @return Set of Plot
|
||||
*/
|
||||
public Set<Plot> getPlots(String world, String player) {
|
||||
UUID uuid = UUIDHandler.getUUID(player, null);
|
||||
final UUID uuid = UUIDHandler.getUUID(player, null);
|
||||
return getPlots(world, uuid);
|
||||
}
|
||||
|
||||
@ -950,15 +930,13 @@ public class PS {
|
||||
* @return Set of plot
|
||||
*/
|
||||
public Set<Plot> getPlots(String world, UUID uuid) {
|
||||
ArrayList<Plot> myPlots = new ArrayList<>();
|
||||
for (Plot plot : getPlots(world)) {
|
||||
if (plot.hasOwner()) {
|
||||
if (plot.isOwnerAbs(uuid)) {
|
||||
myPlots.add(plot);
|
||||
}
|
||||
final Set<Plot> plots = new HashSet<>();
|
||||
for (final Plot plot : getPlots(world)) {
|
||||
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
|
||||
plots.add(plot);
|
||||
}
|
||||
}
|
||||
return new HashSet<>(myPlots);
|
||||
return Collections.unmodifiableSet(plots);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -969,7 +947,7 @@ public class PS {
|
||||
* @return Set of plots
|
||||
*/
|
||||
public Set<Plot> getPlots(PlotArea area, UUID uuid) {
|
||||
final HashSet<Plot> plots = new HashSet<>();
|
||||
final Set<Plot> plots = new HashSet<>();
|
||||
for (Plot plot : getPlots(area)) {
|
||||
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
|
||||
plots.add(plot);
|
||||
@ -986,11 +964,11 @@ public class PS {
|
||||
* @see #getPlotAreaByString(String) to get the PlotArea object
|
||||
*/
|
||||
public boolean hasPlotArea(String world) {
|
||||
return manager.getPlotAreas(world, null).length != 0;
|
||||
return plotAreaManager.getPlotAreas(world, null).length != 0;
|
||||
}
|
||||
|
||||
public Collection<Plot> getPlots(String world) {
|
||||
final HashSet<Plot> set = new HashSet<>();
|
||||
final Set<Plot> set = new HashSet<>();
|
||||
foreachPlotArea(world, new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea value) {
|
||||
set.addAll(value.getPlots());
|
||||
@ -1010,7 +988,7 @@ public class PS {
|
||||
}
|
||||
|
||||
public Collection<Plot> getPlots(PlotArea area) {
|
||||
return area == null ? new HashSet<Plot>() : area.getPlots();
|
||||
return area == null ? EMPTY_SET : area.getPlots();
|
||||
}
|
||||
|
||||
public Plot getPlot(PlotArea area, PlotId id) {
|
||||
@ -1028,19 +1006,19 @@ public class PS {
|
||||
* @return Set of Plot's owned by the player
|
||||
*/
|
||||
public Set<Plot> getPlots(final UUID uuid) {
|
||||
final ArrayList<Plot> myPlots = new ArrayList<>();
|
||||
final Set<Plot> plots = new HashSet<>();
|
||||
foreachPlot(new RunnableVal<Plot>() {
|
||||
@Override public void run(Plot value) {
|
||||
if (value.isOwnerAbs(uuid)) {
|
||||
myPlots.add(value);
|
||||
plots.add(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new HashSet<>(myPlots);
|
||||
return Collections.unmodifiableSet(plots);
|
||||
}
|
||||
|
||||
public boolean hasPlot(final UUID uuid) {
|
||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
||||
for (final PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||
if (area.hasPlot(uuid))
|
||||
return true;
|
||||
}
|
||||
@ -1048,15 +1026,15 @@ public class PS {
|
||||
}
|
||||
|
||||
public Set<Plot> getBasePlots(final UUID uuid) {
|
||||
final ArrayList<Plot> myplots = new ArrayList<>();
|
||||
final Set<Plot> plots = new HashSet<>();
|
||||
foreachBasePlot(new RunnableVal<Plot>() {
|
||||
@Override public void run(Plot value) {
|
||||
if (value.isOwner(uuid)) {
|
||||
myplots.add(value);
|
||||
plots.add(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new HashSet<>(myplots);
|
||||
return Collections.unmodifiableSet(plots);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1066,15 +1044,15 @@ public class PS {
|
||||
* @return Set of Plot
|
||||
*/
|
||||
public Set<Plot> getPlotsAbs(final UUID uuid) {
|
||||
final ArrayList<Plot> myPlots = new ArrayList<>();
|
||||
final Set<Plot> plots = new HashSet<>();
|
||||
foreachPlot(new RunnableVal<Plot>() {
|
||||
@Override public void run(Plot value) {
|
||||
if (value.isOwnerAbs(uuid)) {
|
||||
myPlots.add(value);
|
||||
plots.add(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new HashSet<>(myPlots);
|
||||
return Collections.unmodifiableSet(plots);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1125,7 +1103,7 @@ public class PS {
|
||||
if (world.equals("CheckingPlotSquaredGenerator")) {
|
||||
return;
|
||||
}
|
||||
this.manager.addWorld(world);
|
||||
this.plotAreaManager.addWorld(world);
|
||||
Set<String> worlds;
|
||||
if (this.worlds.contains("worlds")) {
|
||||
worlds = this.worlds.getConfigurationSection("worlds").getKeys(false);
|
||||
@ -1141,7 +1119,7 @@ public class PS {
|
||||
type = 0;
|
||||
}
|
||||
if (type == 0) {
|
||||
if (manager.getPlotAreas(world, null).length != 0) {
|
||||
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||
debug("World possibly already loaded: " + world);
|
||||
return;
|
||||
}
|
||||
@ -1170,10 +1148,10 @@ public class PS {
|
||||
// Conventional plot generator
|
||||
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
||||
PlotManager plotManager = plotGenerator.getNewPlotManager();
|
||||
PS.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
|
||||
PS.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
PS.log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName());
|
||||
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
|
||||
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName());
|
||||
if (!this.worlds.contains(path)) {
|
||||
this.worlds.createSection(path);
|
||||
worldSection = this.worlds.getConfigurationSection(path);
|
||||
@ -1194,11 +1172,11 @@ public class PS {
|
||||
}
|
||||
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
||||
if (areasSection == null) {
|
||||
if (manager.getPlotAreas(world, null).length != 0) {
|
||||
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||
debug("World possibly already loaded: " + world);
|
||||
return;
|
||||
}
|
||||
PS.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName());
|
||||
if (type == 2) {
|
||||
Set<PlotCluster> clusters = this.clusters_tmp != null ?
|
||||
@ -1216,7 +1194,7 @@ public class PS {
|
||||
worldSection.createSection("areas." + fullId);
|
||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
||||
|
||||
PS.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
|
||||
PlotSquared.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
|
||||
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string);
|
||||
if (areaGen == null) {
|
||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||
@ -1230,10 +1208,11 @@ public class PS {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
PS.log(C.PREFIX + "&c | &9manager: &7" + pa);
|
||||
PS.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
|
||||
PlotSquared
|
||||
.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa);
|
||||
PlotSquared.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
|
||||
+ " (invalid or old configuration?)");
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
@ -1256,9 +1235,9 @@ public class PS {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PS.log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
||||
PS.log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager());
|
||||
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
||||
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1269,7 +1248,7 @@ public class PS {
|
||||
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
|
||||
}
|
||||
for (String areaId : areasSection.getKeys(false)) {
|
||||
PS.log(C.PREFIX + "&3 - " + areaId);
|
||||
PlotSquared.log(C.PREFIX + "&3 - " + areaId);
|
||||
String[] split = areaId.split("(?<=[^;-])-");
|
||||
if (split.length != 3) {
|
||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||
@ -1331,10 +1310,10 @@ public class PS {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PS.log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
||||
PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
PS.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
||||
PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
||||
PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1361,7 +1340,7 @@ public class PS {
|
||||
for (String element : split) {
|
||||
String[] pair = element.split("=");
|
||||
if (pair.length != 2) {
|
||||
PS.log("&cNo value provided for: &7" + element);
|
||||
PlotSquared.log("&cNo value provided for: &7" + element);
|
||||
return false;
|
||||
}
|
||||
String key = pair[0].toLowerCase();
|
||||
@ -1411,12 +1390,12 @@ public class PS {
|
||||
Configuration.BLOCK.parseString(value).toString());
|
||||
break;
|
||||
default:
|
||||
PS.log("&cKey not found: &7" + element);
|
||||
PlotSquared.log("&cKey not found: &7" + element);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
PS.log("&cInvalid value: &7" + value + " in arg " + element);
|
||||
PlotSquared.log("&cInvalid value: &7" + value + " in arg " + element);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1433,26 +1412,21 @@ public class PS {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canUpdate(String current, String other) {
|
||||
String s1 = normalisedVersion(current);
|
||||
String s2 = normalisedVersion(other);
|
||||
int cmp = s1.compareTo(s2);
|
||||
return cmp < 0;
|
||||
public boolean canUpdate(@NonNull final String current, @NonNull final String other) {
|
||||
final String s1 = normalisedVersion(current);
|
||||
final String s2 = normalisedVersion(other);
|
||||
return s1.compareTo(s2) < 0;
|
||||
}
|
||||
|
||||
public String normalisedVersion(String version) {
|
||||
String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : split) {
|
||||
public String normalisedVersion(@NonNull final String version) {
|
||||
final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (final String s : split) {
|
||||
sb.append(String.format("%" + 4 + 's', s));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public File getJarFile() {
|
||||
return jarFile;
|
||||
}
|
||||
|
||||
public boolean update(PlotPlayer sender, URL url) {
|
||||
try {
|
||||
String name = this.jarFile.getName();
|
||||
@ -1478,9 +1452,9 @@ public class PS {
|
||||
} catch (IOException e) {
|
||||
MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
|
||||
MainUtil.sendMessage(sender, " - Please update manually");
|
||||
PS.log("============ Stacktrace ============");
|
||||
PlotSquared.log("============ Stacktrace ============");
|
||||
e.printStackTrace();
|
||||
PS.log("====================================");
|
||||
PlotSquared.log("====================================");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1536,13 +1510,13 @@ public class PS {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
PS.log("&cCould not save " + file);
|
||||
PlotSquared.log("&cCould not save " + file);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Map<PlotId, Plot>> getPlotsRaw() {
|
||||
HashMap<String, Map<PlotId, Plot>> map = new HashMap<>();
|
||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
||||
for (PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
Map<PlotId, Plot> map2 = map.get(area.toString());
|
||||
if (map2 == null) {
|
||||
map.put(area.toString(), area.getPlotsRaw());
|
||||
@ -1572,7 +1546,7 @@ public class PS {
|
||||
UUIDHandler.handleShutdown();
|
||||
} catch (NullPointerException ignored) {
|
||||
ignored.printStackTrace();
|
||||
PS.log("&cCould not close database connection!");
|
||||
PlotSquared.log("&cCould not close database connection!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1586,21 +1560,20 @@ public class PS {
|
||||
}
|
||||
Database database;
|
||||
if (Storage.MySQL.USE) {
|
||||
database = new MySQL(Storage.MySQL.HOST,
|
||||
Storage.MySQL.PORT, Storage.MySQL.DATABASE, Storage.MySQL.USER,
|
||||
Storage.MySQL.PASSWORD);
|
||||
database = new MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE,
|
||||
Storage.MySQL.USER, Storage.MySQL.PASSWORD);
|
||||
} else if (Storage.SQLite.USE) {
|
||||
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
||||
database = new SQLite(file);
|
||||
} else {
|
||||
PS.log(C.PREFIX + "&cNo storage type is set!");
|
||||
PlotSquared.log(C.PREFIX + "&cNo storage type is set!");
|
||||
this.IMP.disable();
|
||||
return;
|
||||
}
|
||||
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false);
|
||||
this.plots_tmp = DBFunc.getPlots();
|
||||
if (manager instanceof SinglePlotAreaManager) {
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||
if (plotAreaManager instanceof SinglePlotAreaManager) {
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) plotAreaManager).getArea();
|
||||
addPlotArea(area);
|
||||
ConfigurationSection section = worlds.getConfigurationSection("worlds.*");
|
||||
if (section == null) {
|
||||
@ -1611,17 +1584,18 @@ public class PS {
|
||||
}
|
||||
this.clusters_tmp = DBFunc.getClusters();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
||||
if (Storage.MySQL.USE) {
|
||||
PS.log("$4MYSQL");
|
||||
PlotSquared.log("$4MYSQL");
|
||||
} else if (Storage.SQLite.USE) {
|
||||
PS.log("$4SQLITE");
|
||||
PlotSquared.log("$4SQLITE");
|
||||
}
|
||||
PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ===");
|
||||
PlotSquared.log(
|
||||
"&d==== Here is an ugly stacktrace, if you are interested in those things ===");
|
||||
e.printStackTrace();
|
||||
PS.log("&d==== End of stacktrace ====");
|
||||
PS.log("&6Please go to the " + IMP.getPluginName()
|
||||
PlotSquared.log("&d==== End of stacktrace ====");
|
||||
PlotSquared.log("&6Please go to the " + IMP.getPluginName()
|
||||
+ " 'storage.yml' and configure the database correctly.");
|
||||
this.IMP.disable();
|
||||
}
|
||||
@ -1646,7 +1620,7 @@ public class PS {
|
||||
try {
|
||||
worlds.save(worldsFile);
|
||||
} catch (IOException e) {
|
||||
PS.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
|
||||
PlotSquared.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1681,28 +1655,29 @@ public class PS {
|
||||
public void setupConfigs() {
|
||||
File folder = new File(this.IMP.getDirectory(), "config");
|
||||
if (!folder.exists() && !folder.mkdirs()) {
|
||||
PS.log(C.PREFIX
|
||||
PlotSquared.log(C.PREFIX
|
||||
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||
}
|
||||
try {
|
||||
this.worldsFile = new File(folder, "worlds.yml");
|
||||
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
||||
PS.log("Could not create the worlds file, please create \"worlds.yml\" manually.");
|
||||
PlotSquared.log(
|
||||
"Could not create the worlds file, please create \"worlds.yml\" manually.");
|
||||
}
|
||||
this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile);
|
||||
} catch (IOException ignored) {
|
||||
PS.log("Failed to save settings.yml");
|
||||
PlotSquared.log("Failed to save settings.yml");
|
||||
}
|
||||
try {
|
||||
this.configFile = new File(folder, "settings.yml");
|
||||
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
"Could not create the settings file, please create \"settings.yml\" manually.");
|
||||
}
|
||||
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
||||
setupConfig();
|
||||
} catch (IOException ignored) {
|
||||
PS.log("Failed to save settings.yml");
|
||||
PlotSquared.log("Failed to save settings.yml");
|
||||
}
|
||||
try {
|
||||
this.styleFile = MainUtil.getFile(IMP.getDirectory(),
|
||||
@ -1712,7 +1687,7 @@ public class PS {
|
||||
this.styleFile.getParentFile().mkdirs();
|
||||
}
|
||||
if (!this.styleFile.createNewFile()) {
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
"Could not create the style file, please create \"translations/style.yml\" manually");
|
||||
}
|
||||
}
|
||||
@ -1720,34 +1695,34 @@ public class PS {
|
||||
setupStyle();
|
||||
} catch (IOException err) {
|
||||
err.printStackTrace();
|
||||
PS.log("failed to save style.yml");
|
||||
PlotSquared.log("failed to save style.yml");
|
||||
}
|
||||
try {
|
||||
this.storageFile = new File(folder, "storage.yml");
|
||||
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
"Could not the storage settings file, please create \"storage.yml\" manually.");
|
||||
}
|
||||
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
|
||||
setupStorage();
|
||||
} catch (IOException ignored) {
|
||||
PS.log("Failed to save storage.yml");
|
||||
PlotSquared.log("Failed to save storage.yml");
|
||||
}
|
||||
try {
|
||||
this.commandsFile = new File(folder, "commands.yml");
|
||||
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
|
||||
PS.log(
|
||||
PlotSquared.log(
|
||||
"Could not the storage settings file, please create \"commands.yml\" manually.");
|
||||
}
|
||||
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
|
||||
} catch (IOException ignored) {
|
||||
PS.log("Failed to save commands.yml");
|
||||
PlotSquared.log("Failed to save commands.yml");
|
||||
}
|
||||
try {
|
||||
this.style.save(this.styleFile);
|
||||
this.commands.save(this.commandsFile);
|
||||
} catch (IOException e) {
|
||||
PS.log("Configuration file saving failed");
|
||||
PlotSquared.log("Configuration file saving failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1768,8 +1743,9 @@ public class PS {
|
||||
if (Settings.DEBUG) {
|
||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||
for (Entry<String, Object> component : components.entrySet()) {
|
||||
PS.log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
|
||||
component.getValue()));
|
||||
PlotSquared.log(C.PREFIX + String
|
||||
.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
|
||||
component.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1802,83 +1778,71 @@ public class PS {
|
||||
return Double.parseDouble(System.getProperty("java.specification.version"));
|
||||
}
|
||||
|
||||
public void foreachPlotArea(RunnableVal<PlotArea> runnable) {
|
||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
||||
public void foreachPlotArea(@NonNull final RunnableVal<PlotArea> runnable) {
|
||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
runnable.run(area);
|
||||
}
|
||||
}
|
||||
|
||||
public void foreachPlotArea(String world, RunnableVal<PlotArea> runnable) {
|
||||
PlotArea[] array = this.manager.getPlotAreas(world, null);
|
||||
public void foreachPlotArea(@NonNull final String world, @NonNull final RunnableVal<PlotArea> runnable) {
|
||||
final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null);
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
for (PlotArea area : array) {
|
||||
for (final PlotArea area : array) {
|
||||
runnable.run(area);
|
||||
}
|
||||
}
|
||||
|
||||
public void foreachPlot(RunnableVal<Plot> runnable) {
|
||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
||||
for (Plot plot : area.getPlots()) {
|
||||
runnable.run(plot);
|
||||
}
|
||||
public void foreachPlot(@NonNull final RunnableVal<Plot> runnable) {
|
||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
area.getPlots().forEach(runnable::run);
|
||||
}
|
||||
}
|
||||
|
||||
public void foreachPlotRaw(RunnableVal<Plot> runnable) {
|
||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
||||
for (Plot plot : area.getPlots()) {
|
||||
runnable.run(plot);
|
||||
}
|
||||
public void foreachPlotRaw(@NonNull final RunnableVal<Plot> runnable) {
|
||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
area.getPlots().forEach(runnable::run);
|
||||
}
|
||||
if (this.plots_tmp != null) {
|
||||
for (HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
|
||||
for (Plot entry2 : entry.values()) {
|
||||
runnable.run(entry2);
|
||||
}
|
||||
for (final HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
|
||||
entry.values().forEach(runnable::run);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void foreachBasePlot(RunnableVal<Plot> run) {
|
||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
||||
public void foreachBasePlot(@NonNull final RunnableVal<Plot> run) {
|
||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
area.foreachBasePlot(run);
|
||||
}
|
||||
}
|
||||
|
||||
public PlotArea getFirstPlotArea() {
|
||||
PlotArea[] areas = manager.getAllPlotAreas();
|
||||
PlotArea[] areas = plotAreaManager.getAllPlotAreas();
|
||||
return areas.length > 0 ? areas[0] : null;
|
||||
}
|
||||
|
||||
public int getPlotAreaCount() {
|
||||
return this.manager.getAllPlotAreas().length;
|
||||
return this.plotAreaManager.getAllPlotAreas().length;
|
||||
}
|
||||
|
||||
public int getPlotCount() {
|
||||
int count = 0;
|
||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
count += area.getPlotCount();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public Set<PlotArea> getPlotAreas() {
|
||||
HashSet<PlotArea> set = new HashSet<>();
|
||||
Collections.addAll(set, manager.getAllPlotAreas());
|
||||
return set;
|
||||
final Set<PlotArea> set = new HashSet<>();
|
||||
Collections.addAll(set, plotAreaManager.getAllPlotAreas());
|
||||
return Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
public boolean isAugmented(String world) {
|
||||
PlotArea[] areas = manager.getPlotAreas(world, null);
|
||||
if (areas == null) {
|
||||
return false;
|
||||
}
|
||||
if (areas.length > 1) {
|
||||
return true;
|
||||
}
|
||||
return areas[0].TYPE != 0;
|
||||
public boolean isAugmented(@NonNull final String world) {
|
||||
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, null);
|
||||
return areas != null && (areas.length > 1 || areas[0].TYPE != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1887,9 +1851,9 @@ public class PS {
|
||||
* @param world the world
|
||||
* @return Collection of PlotArea objects
|
||||
*/
|
||||
public Set<PlotArea> getPlotAreas(String world) {
|
||||
Set<PlotArea> set = new HashSet<>();
|
||||
Collections.addAll(set, manager.getPlotAreas(world, null));
|
||||
public Set<PlotArea> getPlotAreas(@NonNull final String world) {
|
||||
final Set<PlotArea> set = new HashSet<>();
|
||||
Collections.addAll(set, plotAreaManager.getPlotAreas(world, null));
|
||||
return set;
|
||||
}
|
||||
|
||||
@ -1906,12 +1870,12 @@ public class PS {
|
||||
* @param location the location
|
||||
* @return
|
||||
*/
|
||||
public PlotArea getApplicablePlotArea(Location location) {
|
||||
return manager.getApplicablePlotArea(location);
|
||||
public PlotArea getApplicablePlotArea(@NonNull final Location location) {
|
||||
return plotAreaManager.getApplicablePlotArea(location);
|
||||
}
|
||||
|
||||
public PlotArea getPlotArea(String world, String id) {
|
||||
return manager.getPlotArea(world, id);
|
||||
public PlotArea getPlotArea(@NonNull final String world, @NonNull final String id) {
|
||||
return plotAreaManager.getPlotArea(world, id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1924,15 +1888,15 @@ public class PS {
|
||||
* @param location the location
|
||||
* @return the {@link PlotArea} in the location, null if non existent
|
||||
*/
|
||||
public PlotArea getPlotAreaAbs(Location location) {
|
||||
return manager.getPlotArea(location);
|
||||
public PlotArea getPlotAreaAbs(@NonNull final Location location) {
|
||||
return plotAreaManager.getPlotArea(location);
|
||||
}
|
||||
|
||||
public PlotArea getPlotAreaByString(String search) {
|
||||
String[] split = search.split(";|,");
|
||||
PlotArea[] areas = manager.getPlotAreas(split[0], null);
|
||||
public PlotArea getPlotAreaByString(@NonNull final String search) {
|
||||
String[] split = search.split("[;,]");
|
||||
PlotArea[] areas = plotAreaManager.getPlotAreas(split[0], null);
|
||||
if (areas == null) {
|
||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
||||
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||
if (area.worldname.equalsIgnoreCase(split[0])) {
|
||||
if (area.id == null || split.length == 2 && area.id
|
||||
.equalsIgnoreCase(split[1])) {
|
||||
@ -1963,26 +1927,24 @@ public class PS {
|
||||
* @param worldname to filter alias to a specific world [optional] null means all worlds
|
||||
* @return Set<{@link Plot}> empty if nothing found
|
||||
*/
|
||||
public Set<Plot> getPlotsByAlias(String alias, String worldname) {
|
||||
Set<Plot> result = new HashSet<>();
|
||||
|
||||
public Set<Plot> getPlotsByAlias(@Nullable final String alias, @NonNull final String worldname) {
|
||||
final Set<Plot> result = new HashSet<>();
|
||||
if (alias != null) {
|
||||
for (Plot plot : getPlots()) {
|
||||
for (final Plot plot : getPlots()) {
|
||||
if (alias.equals(plot.getAlias()) && (worldname == null || worldname
|
||||
.equals(plot.getWorldName()))) {
|
||||
result.add(plot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public Set<PlotArea> getPlotAreas(String world, RegionWrapper region) {
|
||||
PlotArea[] areas = manager.getPlotAreas(world, region);
|
||||
Set<PlotArea> set = new HashSet<>();
|
||||
public Set<PlotArea> getPlotAreas(final String world, final RegionWrapper region) {
|
||||
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, region);
|
||||
final Set<PlotArea> set = new HashSet<>();
|
||||
Collections.addAll(set, areas);
|
||||
return set;
|
||||
return Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
public enum SortType {
|
@ -18,7 +18,7 @@ public class Updater {
|
||||
public String getChanges() {
|
||||
if (changes == null) {
|
||||
try (Scanner scanner = new Scanner(new URL(
|
||||
"http://empcraft.com/plots/cl?" + Integer.toHexString(PS.get().getVersion().hash))
|
||||
"http://empcraft.com/plots/cl?" + Integer.toHexString(PlotSquared.get().getVersion().hash))
|
||||
.openStream(), "UTF-8")) {
|
||||
changes = scanner.useDelimiter("\\A").next();
|
||||
} catch (IOException e) {
|
||||
@ -50,7 +50,7 @@ public class Updater {
|
||||
URL download = new URL(downloadUrl.replaceAll("%platform%", platform)
|
||||
.replaceAll("%version%", versionString));
|
||||
try (ReadableByteChannel rbc = Channels.newChannel(download.openStream())) {
|
||||
File jarFile = PS.get().getJarFile();
|
||||
File jarFile = PlotSquared.get().getJarFile();
|
||||
|
||||
File finalFile = new File(jarFile.getParent(),
|
||||
"update" + File.separator + jarFile.getName());
|
||||
@ -69,7 +69,7 @@ public class Updater {
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
}
|
||||
outFile.renameTo(finalFile);
|
||||
PS.debug("Updated PlotSquared to " + versionString);
|
||||
PlotSquared.debug("Updated PlotSquared to " + versionString);
|
||||
MainUtil.sendAdmin(
|
||||
"&7Restart to update PlotSquared with these changes: &c/plot changelog &7or&c "
|
||||
+ "http://empcraft.com/plots/cl?" + Integer
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -88,13 +88,13 @@ public class Alias extends SubCommand {
|
||||
C.NOT_VALID_VALUE.send(player);
|
||||
return false;
|
||||
}
|
||||
for (Plot p : PS.get().getPlots(plot.getArea())) {
|
||||
for (Plot p : PlotSquared.get().getPlots(plot.getArea())) {
|
||||
if (p.getAlias().equalsIgnoreCase(alias)) {
|
||||
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PS.get().hasPlotArea(alias)) {
|
||||
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get().hasPlotArea(alias)) {
|
||||
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
||||
return false;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
||||
@ -81,7 +81,8 @@ public class Area extends SubCommand {
|
||||
final int offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||
final int offsetZ = bz - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||
final RegionWrapper region = new RegionWrapper(bx, tx, bz, tz);
|
||||
Set<PlotArea> areas = PS.get().getPlotAreas(area.worldname, region);
|
||||
Set<PlotArea> areas = PlotSquared
|
||||
.get().getPlotAreas(area.worldname, region);
|
||||
if (!areas.isEmpty()) {
|
||||
C.CLUSTER_INTERSECTION
|
||||
.send(player, areas.iterator().next().toString());
|
||||
@ -94,8 +95,8 @@ public class Area extends SubCommand {
|
||||
object.type = area.TYPE;
|
||||
object.min = new PlotId(1, 1);
|
||||
object.max = new PlotId(numX, numZ);
|
||||
object.plotManager = PS.imp().getPluginName();
|
||||
object.setupGenerator = PS.imp().getPluginName();
|
||||
object.plotManager = PlotSquared.imp().getPluginName();
|
||||
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||
object.step = area.getSettingNodes();
|
||||
final String path =
|
||||
"worlds." + area.worldname + ".areas." + area.id + '-'
|
||||
@ -103,14 +104,14 @@ public class Area extends SubCommand {
|
||||
Runnable run = new Runnable() {
|
||||
@Override public void run() {
|
||||
if (offsetX != 0) {
|
||||
PS.get().worlds.set(path + ".road.offset.x", offsetX);
|
||||
PlotSquared.get().worlds.set(path + ".road.offset.x", offsetX);
|
||||
}
|
||||
if (offsetZ != 0) {
|
||||
PS.get().worlds.set(path + ".road.offset.z", offsetZ);
|
||||
PlotSquared.get().worlds.set(path + ".road.offset.z", offsetZ);
|
||||
}
|
||||
final String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
PS.get().loadWorld(world, null);
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
C.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
if (area.TERRAIN != 3) {
|
||||
@ -149,13 +150,13 @@ public class Area extends SubCommand {
|
||||
}
|
||||
object.world = split[0];
|
||||
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id,
|
||||
PS.get().IMP.getDefaultGenerator(), null, null);
|
||||
PlotArea other = PS.get().getPlotArea(pa.worldname, id);
|
||||
PlotSquared.get().IMP.getDefaultGenerator(), null, null);
|
||||
PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id);
|
||||
if (other != null && Objects.equals(pa.id, other.id)) {
|
||||
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
||||
return false;
|
||||
}
|
||||
Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname);
|
||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(pa.worldname);
|
||||
if (!areas.isEmpty()) {
|
||||
PlotArea area = areas.iterator().next();
|
||||
pa.TYPE = area.TYPE;
|
||||
@ -224,15 +225,15 @@ public class Area extends SubCommand {
|
||||
Runnable run = new Runnable() {
|
||||
@Override public void run() {
|
||||
String path = "worlds." + pa.worldname;
|
||||
if (!PS.get().worlds.contains(path)) {
|
||||
PS.get().worlds.createSection(path);
|
||||
if (!PlotSquared.get().worlds.contains(path)) {
|
||||
PlotSquared.get().worlds.createSection(path);
|
||||
}
|
||||
ConfigurationSection section =
|
||||
PS.get().worlds.getConfigurationSection(path);
|
||||
PlotSquared.get().worlds.getConfigurationSection(path);
|
||||
pa.saveConfiguration(section);
|
||||
pa.loadConfiguration(section);
|
||||
object.plotManager = PS.imp().getPluginName();
|
||||
object.setupGenerator = PS.imp().getPluginName();
|
||||
object.plotManager = PlotSquared.imp().getPluginName();
|
||||
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||
String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
C.SETUP_FINISHED.send(player);
|
||||
@ -243,7 +244,7 @@ public class Area extends SubCommand {
|
||||
+ pa.worldname);
|
||||
}
|
||||
try {
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -291,7 +292,7 @@ public class Area extends SubCommand {
|
||||
area = player.getApplicablePlotArea();
|
||||
break;
|
||||
case 2:
|
||||
area = PS.get().getPlotAreaByString(args[1]);
|
||||
area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||
break;
|
||||
default:
|
||||
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
||||
@ -351,7 +352,7 @@ public class Area extends SubCommand {
|
||||
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
||||
return false;
|
||||
}
|
||||
ArrayList<PlotArea> areas = new ArrayList<>(PS.get().getPlotAreas());
|
||||
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
|
||||
paginate(player, areas, 8, page,
|
||||
new RunnableVal3<Integer, PlotArea, PlotMessage>() {
|
||||
@Override public void run(Integer i, PlotArea area, PlotMessage message) {
|
||||
@ -435,7 +436,7 @@ public class Area extends SubCommand {
|
||||
C.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
||||
return false;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||
return false;
|
||||
@ -457,7 +458,7 @@ public class Area extends SubCommand {
|
||||
case "remove":
|
||||
MainUtil.sendMessage(player,
|
||||
"$1World creation settings may be stored in multiple locations:"
|
||||
+ "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PS.imp().getPluginName()
|
||||
+ "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PlotSquared.imp().getPluginName()
|
||||
+ " settings.yml"
|
||||
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
|
||||
+ "\n$1Stop the server and delete it from these locations.");
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
@ -138,7 +138,7 @@ public class Auto extends SubCommand {
|
||||
PlotArea plotarea = player.getApplicablePlotArea();
|
||||
if (plotarea == null) {
|
||||
if (EconHandler.manager != null) {
|
||||
for (PlotArea area : PS.get().getPlotAreaManager().getAllPlotAreas()) {
|
||||
for (PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
|
||||
if (EconHandler.manager
|
||||
.hasPermission(area.worldname, player.getName(), "plots.auto")) {
|
||||
if (plotarea != null) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.Updater;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -15,11 +15,11 @@ import java.util.Scanner;
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
try {
|
||||
Updater updater = PS.get().getUpdater();
|
||||
Updater updater = PlotSquared.get().getUpdater();
|
||||
String changes = updater != null ? updater.getChanges() : null;
|
||||
if (changes == null) {
|
||||
try (Scanner scanner = new Scanner(new URL("http://empcraft.com/plots/cl?" + Integer
|
||||
.toHexString(PS.get().getVersion().hash)).openStream(), "UTF-8")) {
|
||||
.toHexString(PlotSquared.get().getVersion().hash)).openStream(), "UTF-8")) {
|
||||
changes = scanner.useDelimiter("\\A").next();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
@ -379,7 +379,7 @@ public class Cluster extends SubCommand {
|
||||
MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName());
|
||||
}
|
||||
for (Plot plot : new ArrayList<>(
|
||||
PS.get().getPlots(player2.getLocation().getWorld(), uuid))) {
|
||||
PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) {
|
||||
PlotCluster current = plot.getCluster();
|
||||
if (current != null && current.equals(cluster)) {
|
||||
plot.unclaim();
|
||||
@ -433,7 +433,7 @@ public class Cluster extends SubCommand {
|
||||
DBFunc.removeInvited(cluster, uuid);
|
||||
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
||||
for (Plot plot : new ArrayList<>(
|
||||
PS.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
||||
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
||||
PlotCluster current = plot.getCluster();
|
||||
if (current != null && current.equals(cluster)) {
|
||||
player.getLocation().getWorld();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
@ -25,7 +25,7 @@ public class Condense extends SubCommand {
|
||||
MainUtil.sendMessage(player, "/plot condense <area> <start|stop|info> [radius]");
|
||||
return false;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||
MainUtil.sendMessage(player, "INVALID AREA");
|
||||
return false;
|
||||
@ -46,7 +46,7 @@ public class Condense extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
int radius = Integer.parseInt(args[2]);
|
||||
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots(area));
|
||||
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots(area));
|
||||
// remove non base plots
|
||||
Iterator<Plot> iterator = plots.iterator();
|
||||
int maxSize = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.MySQL;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.SQLManager;
|
||||
@ -57,12 +57,12 @@ public class Database extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
List<Plot> plots;
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||
if (area != null) {
|
||||
plots = PS.get().sortPlotsByTemp(area.getPlots());
|
||||
plots = PlotSquared.get().sortPlotsByTemp(area.getPlots());
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
} else {
|
||||
plots = PS.get().sortPlotsByTemp(PS.get().getPlots());
|
||||
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots());
|
||||
}
|
||||
if (args.length < 1) {
|
||||
MainUtil.sendMessage(player, "/plot database [world] <sqlite|mysql|import>");
|
||||
@ -79,7 +79,7 @@ public class Database extends SubCommand {
|
||||
.sendMessage(player, "/plot database import <sqlite file> [prefix]");
|
||||
return false;
|
||||
}
|
||||
File file = MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
args[1].endsWith(".db") ? args[1] : args[1] + ".db");
|
||||
if (!file.exists()) {
|
||||
MainUtil.sendMessage(player, "&6Database does not exist: " + file);
|
||||
@ -93,7 +93,7 @@ public class Database extends SubCommand {
|
||||
plots = new ArrayList<>();
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
||||
String areaname = entry.getKey();
|
||||
PlotArea pa = PS.get().getPlotAreaByString(areaname);
|
||||
PlotArea pa = PlotSquared.get().getPlotAreaByString(areaname);
|
||||
if (pa != null) {
|
||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||
Plot plot = entry2.getValue();
|
||||
@ -103,11 +103,11 @@ public class Database extends SubCommand {
|
||||
if (newPlot != null) {
|
||||
PlotId newId = newPlot.getId();
|
||||
PlotId id = plot.getId();
|
||||
File worldFile = new File(PS.imp().getWorldContainer(),
|
||||
File worldFile = new File(PlotSquared.imp().getWorldContainer(),
|
||||
id.toCommaSeparatedString());
|
||||
if (worldFile.exists()) {
|
||||
File newFile =
|
||||
new File(PS.imp().getWorldContainer(),
|
||||
new File(PlotSquared.imp().getWorldContainer(),
|
||||
newId.toCommaSeparatedString());
|
||||
worldFile.renameTo(newFile);
|
||||
}
|
||||
@ -127,10 +127,10 @@ public class Database extends SubCommand {
|
||||
plots.add(plot);
|
||||
}
|
||||
} else {
|
||||
HashMap<PlotId, Plot> plotmap = PS.get().plots_tmp.get(areaname);
|
||||
HashMap<PlotId, Plot> plotmap = PlotSquared.get().plots_tmp.get(areaname);
|
||||
if (plotmap == null) {
|
||||
plotmap = new HashMap<>();
|
||||
PS.get().plots_tmp.put(areaname, plotmap);
|
||||
PlotSquared.get().plots_tmp.put(areaname, plotmap);
|
||||
}
|
||||
plotmap.putAll(entry.getValue());
|
||||
}
|
||||
@ -161,7 +161,7 @@ public class Database extends SubCommand {
|
||||
return MainUtil.sendMessage(player, "/plot database sqlite [file]");
|
||||
}
|
||||
File sqliteFile =
|
||||
MainUtil.getFile(PS.get().IMP.getDirectory(), args[1] + ".db");
|
||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1] + ".db");
|
||||
implementation = new SQLite(sqliteFile);
|
||||
break;
|
||||
default:
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -26,8 +26,8 @@ public class Debug extends SubCommand {
|
||||
information.append(header);
|
||||
information.append(getSection(section, "PlotArea"));
|
||||
information
|
||||
.append(getLine(line, "Plot Worlds", StringMan.join(PS.get().getPlotAreas(), ", ")));
|
||||
information.append(getLine(line, "Owned Plots", PS.get().getPlots().size()));
|
||||
.append(getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
|
||||
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
|
||||
information.append(getSection(section, "Messages"));
|
||||
information.append(getLine(line, "Total Messages", C.values().length));
|
||||
information.append(getLine(line, "View all captions", "/plot debug msg"));
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -26,7 +26,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
"If you accidentally delete your database, this command will attempt to restore all plots based on the data from the "
|
||||
+ "plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
||||
return false;
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
@ -31,13 +31,13 @@ import java.util.*;
|
||||
|
||||
public DebugExec() {
|
||||
try {
|
||||
if (PS.get() != null) {
|
||||
File file = new File(PS.get().IMP.getDirectory(),
|
||||
if (PlotSquared.get() != null) {
|
||||
File file = new File(PlotSquared.get().IMP.getDirectory(),
|
||||
Settings.Paths.SCRIPTS + File.separator + "start.js");
|
||||
if (file.exists()) {
|
||||
init();
|
||||
String script = StringMan.join(Files.readLines(new File(new File(
|
||||
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
|
||||
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
|
||||
"start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator"));
|
||||
this.scope.put("THIS", this);
|
||||
this.scope.put("PlotPlayer", ConsolePlayer.getConsole());
|
||||
@ -87,10 +87,10 @@ import java.util.*;
|
||||
this.scope.put("RunnableVal", RunnableVal.class);
|
||||
|
||||
// Instances
|
||||
this.scope.put("PS", PS.get());
|
||||
this.scope.put("PS", PlotSquared.get());
|
||||
this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP);
|
||||
this.scope.put("ExpireManager", ExpireManager.IMP);
|
||||
if (PS.get().worldedit != null) {
|
||||
if (PlotSquared.get().worldedit != null) {
|
||||
this.scope.put("WEManager", new WEManager());
|
||||
}
|
||||
this.scope.put("TaskManager", TaskManager.IMP);
|
||||
@ -105,7 +105,7 @@ import java.util.*;
|
||||
this.scope.put("UUIDHandler", UUIDHandler.implementation);
|
||||
this.scope.put("DBFunc", DBFunc.dbManager);
|
||||
this.scope.put("HybridUtils", HybridUtils.manager);
|
||||
this.scope.put("IMP", PS.get().IMP);
|
||||
this.scope.put("IMP", PlotSquared.get().IMP);
|
||||
this.scope.put("MainCommand", MainCommand.getInstance());
|
||||
|
||||
// enums
|
||||
@ -180,7 +180,7 @@ import java.util.*;
|
||||
return false;
|
||||
}
|
||||
String flag = args[1];
|
||||
for (Plot plot : PS.get().getBasePlots()) {
|
||||
for (Plot plot : PlotSquared.get().getBasePlots()) {
|
||||
Flag<?> flag1 = FlagManager.getFlag(flag);
|
||||
if (plot.getFlag(flag1).isPresent()) {
|
||||
plot.removeFlag(flag1);
|
||||
@ -193,7 +193,7 @@ import java.util.*;
|
||||
"&cInvalid syntax: /plot debugexec start-rgar <world>");
|
||||
return false;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]);
|
||||
return false;
|
||||
@ -261,7 +261,7 @@ import java.util.*;
|
||||
case "addcmd":
|
||||
try {
|
||||
final String cmd = StringMan.join(Files.readLines(MainUtil.getFile(new File(
|
||||
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
|
||||
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
|
||||
args[1]), StandardCharsets.UTF_8),
|
||||
System.getProperty("line.separator"));
|
||||
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
|
||||
@ -291,7 +291,7 @@ import java.util.*;
|
||||
case "run":
|
||||
try {
|
||||
script = StringMan.join(Files.readLines(MainUtil.getFile(new File(
|
||||
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
|
||||
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
|
||||
args[1]), StandardCharsets.UTF_8),
|
||||
System.getProperty("line.separator"));
|
||||
if (args.length > 2) {
|
||||
@ -308,7 +308,7 @@ import java.util.*;
|
||||
break;
|
||||
case "list-scripts":
|
||||
String path =
|
||||
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS;
|
||||
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS;
|
||||
File folder = new File(path);
|
||||
File[] filesArray = folder.listFiles();
|
||||
|
||||
@ -350,7 +350,7 @@ import java.util.*;
|
||||
if ("true".equals(args[1])) {
|
||||
Location loc = player.getMeta("location");
|
||||
Plot plot = player.getMeta("lastplot");
|
||||
for (Plot current : PS.get().getBasePlots()) {
|
||||
for (Plot current : PlotSquared.get().getBasePlots()) {
|
||||
player.setMeta("location", current.getBottomAbs());
|
||||
player.setMeta("lastplot", current);
|
||||
cmd.execute(player, params, null, null);
|
||||
@ -398,7 +398,7 @@ import java.util.*;
|
||||
}
|
||||
init();
|
||||
this.scope.put("PlotPlayer", player);
|
||||
PS.debug("> " + script);
|
||||
PlotSquared.debug("> " + script);
|
||||
try {
|
||||
if (async) {
|
||||
final String toExec = script;
|
||||
@ -411,13 +411,13 @@ import java.util.*;
|
||||
} catch (ScriptException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||
PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
long start = System.currentTimeMillis();
|
||||
Object result = this.engine.eval(script, this.scope);
|
||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||
PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||
}
|
||||
return true;
|
||||
} catch (ScriptException e) {
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
@ -24,7 +24,7 @@ public class DebugFixFlags extends SubCommand {
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]);
|
||||
return false;
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
@ -27,14 +27,14 @@ public class DebugImportWorlds extends Command {
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
|
||||
PlotAreaManager pam = PS.get().getPlotAreaManager();
|
||||
PlotAreaManager pam = PlotSquared.get().getPlotAreaManager();
|
||||
if (!(pam instanceof SinglePlotAreaManager)) {
|
||||
player.sendMessage("Must be a single plot area!");
|
||||
return;
|
||||
}
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea();
|
||||
PlotId id = new PlotId(0, 0);
|
||||
File container = PS.imp().getWorldContainer();
|
||||
File container = PlotSquared.imp().getWorldContainer();
|
||||
for (File folder : container.listFiles()) {
|
||||
String name = folder.getName();
|
||||
if (!WorldUtil.IMP.isWorld(name) && PlotId.fromString(name) == null) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
|
||||
@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
public class DebugLoadTest extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
PS.get().plots_tmp = DBFunc.getPlots();
|
||||
PlotSquared.get().plots_tmp = DBFunc.getPlots();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -20,13 +20,13 @@ public class DebugPaste extends SubCommand {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
String settingsYML = HastebinUtility.upload(PS.get().configFile);
|
||||
String worldsYML = HastebinUtility.upload(PS.get().worldsFile);
|
||||
String commandsYML = HastebinUtility.upload(PS.get().commandsFile);
|
||||
String settingsYML = HastebinUtility.upload(PlotSquared.get().configFile);
|
||||
String worldsYML = HastebinUtility.upload(PlotSquared.get().worldsFile);
|
||||
String commandsYML = HastebinUtility.upload(PlotSquared.get().commandsFile);
|
||||
String latestLOG;
|
||||
try {
|
||||
latestLOG = HastebinUtility
|
||||
.upload(new File(PS.get().IMP.getDirectory(), "../../logs/latest.log"));
|
||||
.upload(new File(PlotSquared.get().IMP.getDirectory(), "../../logs/latest.log"));
|
||||
} catch (IOException ignored) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&clatest.log is too big to be pasted, will ignore");
|
||||
@ -41,13 +41,13 @@ public class DebugPaste extends SubCommand {
|
||||
b.append("links.commands_yml: ").append(commandsYML).append('\n');
|
||||
b.append("links.latest_log: ").append(latestLOG).append('\n');
|
||||
b.append("\n# Server Information\n");
|
||||
int[] sVersion = PS.get().IMP.getServerVersion();
|
||||
int[] sVersion = PlotSquared.get().IMP.getServerVersion();
|
||||
b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1])
|
||||
.append('.').append(sVersion[2]).append('\n');
|
||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
|
||||
.append(!Settings.UUID.OFFLINE).append('\n');
|
||||
b.append("plugins:");
|
||||
for (String id : PS.get().IMP.getPluginIds()) {
|
||||
for (String id : PlotSquared.get().IMP.getPluginIds()) {
|
||||
String[] split = id.split(":");
|
||||
String[] split2 = split[0].split(";");
|
||||
String enabled = split.length == 2 ? split[1] : "unknown";
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -14,7 +14,7 @@ public class DebugSaveTest extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
ArrayList<Plot> plots = new ArrayList<Plot>();
|
||||
plots.addAll(PS.get().getPlots());
|
||||
plots.addAll(PlotSquared.get().getPlots());
|
||||
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
|
||||
DBFunc.createPlotsAndData(plots, new Runnable() {
|
||||
@Override public void run() {
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
@ -99,7 +99,7 @@ public class Deny extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.YOU_GOT_DENIED);
|
||||
if (plot.equals(spawn.getPlot())) {
|
||||
Location newSpawn =
|
||||
WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||
if (plot.equals(newSpawn.getPlot())) {
|
||||
// Kick from server if you can't be teleported to spawn
|
||||
player.kick(C.YOU_GOT_DENIED.s());
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
@ -19,7 +19,7 @@ public class Download extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
String world = player.getLocation().getWorld();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
@ -27,7 +27,7 @@ public class FlagCmd extends SubCommand {
|
||||
int numeric = Integer.parseInt(value);
|
||||
perm = perm.substring(0, perm.length() - value.length() - 1);
|
||||
if (numeric > 0) {
|
||||
int checkRange = PS.get().getPlatform().equalsIgnoreCase("bukkit") ?
|
||||
int checkRange = PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ?
|
||||
numeric :
|
||||
Settings.Limit.MAX_PLOTS;
|
||||
return player.hasPermissionRange(perm, checkRange) >= numeric;
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
@ -76,7 +76,7 @@ public class Kick extends SubCommand {
|
||||
C.YOU_GOT_KICKED.send(player2);
|
||||
if (plot.equals(spawn.getPlot())) {
|
||||
Location newSpawn =
|
||||
WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||
if (plot.equals(newSpawn.getPlot())) {
|
||||
// Kick from server if you can't be teleported to spawn
|
||||
player2.kick(C.YOU_GOT_KICKED.s());
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS.SortType;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -98,7 +98,7 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
sort = false;
|
||||
plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player));
|
||||
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player));
|
||||
break;
|
||||
case "shared":
|
||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
|
||||
@ -106,7 +106,7 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>();
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
if (plot.getTrusted().contains(player.getUUID()) || plot.getMembers()
|
||||
.contains(player.getUUID())) {
|
||||
plots.add(plot);
|
||||
@ -123,7 +123,7 @@ public class ListCmd extends SubCommand {
|
||||
C.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PS.get().getPlots(world));
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
||||
break;
|
||||
case "expired":
|
||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
|
||||
@ -151,7 +151,7 @@ public class ListCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL);
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PS.get().getPlots());
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||
break;
|
||||
case "done":
|
||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
|
||||
@ -159,7 +159,7 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>();
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
Optional<String> flag = plot.getFlag(Flags.DONE);
|
||||
if (!flag.isPresent()) {
|
||||
continue;
|
||||
@ -186,7 +186,7 @@ public class ListCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PS.get().getPlots());
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||
Collections.sort(plots, new Comparator<Plot>() {
|
||||
@Override public int compare(Plot p1, Plot p2) {
|
||||
double v1 = 0;
|
||||
@ -226,7 +226,7 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
}
|
||||
plots = new ArrayList<>();
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
Optional<Double> price = plot.getFlag(Flags.PRICE);
|
||||
if (price.isPresent()) {
|
||||
plots.add(plot);
|
||||
@ -239,7 +239,7 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>();
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
if (plot.owner == null) {
|
||||
plots.add(plot);
|
||||
}
|
||||
@ -251,7 +251,7 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>();
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
if (plot.owner == null) {
|
||||
continue;
|
||||
}
|
||||
@ -279,7 +279,7 @@ public class ListCmd extends SubCommand {
|
||||
sort = false;
|
||||
break;
|
||||
default:
|
||||
if (PS.get().hasPlotArea(args[0])) {
|
||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
|
||||
return false;
|
||||
@ -290,7 +290,7 @@ public class ListCmd extends SubCommand {
|
||||
C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PS.get().getPlots(args[0]));
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
|
||||
break;
|
||||
}
|
||||
UUID uuid = UUIDHandler.getUUID(args[0], null);
|
||||
@ -306,7 +306,7 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
sort = false;
|
||||
plots = PS.get().sortPlotsByTemp(PS.get().getPlots(uuid));
|
||||
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots(uuid));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -336,7 +336,7 @@ public class ListCmd extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (sort) {
|
||||
plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, area);
|
||||
plots = PlotSquared.get().sortPlots(plots, SortType.CREATION_DATE, area);
|
||||
}
|
||||
this.paginate(player, plots, pageSize, page,
|
||||
new RunnableVal3<Integer, Plot, PlotMessage>() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -20,7 +20,7 @@ public class Load extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
String world = player.getLocation().getWorld();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||
@ -185,7 +185,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* @Deprecated legacy
|
||||
*/ public void addCommand(SubCommand command) {
|
||||
PS.debug("Command registration is now done during instantiation");
|
||||
PlotSquared.debug("Command registration is now done during instantiation");
|
||||
}
|
||||
|
||||
@Override public void execute(final PlotPlayer player, String[] args,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -34,7 +34,7 @@ public class Move extends SubCommand {
|
||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
||||
return false;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||
Plot plot2;
|
||||
if (area == null) {
|
||||
plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.json.JSONObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.HttpUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -15,8 +15,8 @@ public class PluginCmd extends SubCommand {
|
||||
TaskManager.IMP.taskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
MainUtil.sendMessage(player, String
|
||||
.format("$2>> $1&l" + PS.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
|
||||
PS.get().getVersion()));
|
||||
.format("$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
|
||||
PlotSquared.get().getVersion()));
|
||||
MainUtil.sendMessage(player,
|
||||
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev");
|
||||
MainUtil.sendMessage(player,
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||
@ -45,7 +45,7 @@ public class Purge extends SubCommand {
|
||||
break;
|
||||
case "area":
|
||||
case "a":
|
||||
area = PS.get().getPlotAreaByString(split[1]);
|
||||
area = PlotSquared.get().getPlotAreaByString(split[1]);
|
||||
if (area == null) {
|
||||
C.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
||||
return false;
|
||||
@ -86,7 +86,7 @@ public class Purge extends SubCommand {
|
||||
}
|
||||
}
|
||||
final HashSet<Plot> toDelete = new HashSet<>();
|
||||
for (Plot plot : PS.get().getBasePlots()) {
|
||||
for (Plot plot : PlotSquared.get().getBasePlots()) {
|
||||
if (world != null && !plot.getWorldName().equalsIgnoreCase(world)) {
|
||||
continue;
|
||||
}
|
||||
@ -109,8 +109,8 @@ public class Purge extends SubCommand {
|
||||
toDelete.add(current);
|
||||
}
|
||||
}
|
||||
if (PS.get().plots_tmp != null) {
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : PS.get().plots_tmp.entrySet()) {
|
||||
if (PlotSquared.get().plots_tmp != null) {
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : PlotSquared.get().plots_tmp.entrySet()) {
|
||||
String worldName = entry.getKey();
|
||||
if (world != null && !world.equalsIgnoreCase(worldName)) {
|
||||
continue;
|
||||
@ -141,7 +141,7 @@ public class Purge extends SubCommand {
|
||||
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
||||
Runnable run = new Runnable() {
|
||||
@Override public void run() {
|
||||
PS.debug("Calculating plots to purge, please wait...");
|
||||
PlotSquared.debug("Calculating plots to purge, please wait...");
|
||||
HashSet<Integer> ids = new HashSet<>();
|
||||
for (Plot plot : toDelete) {
|
||||
if (plot.temp != Integer.MAX_VALUE) {
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
@ -20,7 +20,7 @@ public class Rate extends SubCommand {
|
||||
if (args.length == 1) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "next": {
|
||||
ArrayList<Plot> plots = new ArrayList<>(PS.get().getBasePlots());
|
||||
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getBasePlots());
|
||||
Collections.sort(plots, new Comparator<Plot>() {
|
||||
@Override public int compare(Plot p1, Plot p2) {
|
||||
double v1 = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
@ -33,7 +33,7 @@ public class RegenAllRoads extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
||||
return false;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||
if (area == null) {
|
||||
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
||||
return false;
|
||||
|
@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -21,12 +21,12 @@ public class Reload extends SubCommand {
|
||||
try {
|
||||
// The following won't affect world generation, as that has to be
|
||||
// loaded during startup unfortunately.
|
||||
PS.get().setupConfigs();
|
||||
C.load(PS.get().translationFile);
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().setupConfigs();
|
||||
C.load(PlotSquared.get().translationFile);
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea area) {
|
||||
ConfigurationSection worldSection =
|
||||
PS.get().worlds.getConfigurationSection("worlds." + area.worldname);
|
||||
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname);
|
||||
if (worldSection == null) {
|
||||
return;
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class Reload extends SubCommand {
|
||||
}
|
||||
}
|
||||
});
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
MainUtil.sendMessage(player, C.RELOADED_CONFIGS);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -20,7 +20,7 @@ public class Save extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
String world = player.getLocation().getWorld();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -141,7 +141,7 @@ public class SchematicCmd extends SubCommand {
|
||||
"&cNeed world argument. Use &7/plot sch exportall <area>");
|
||||
return false;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||
return false;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
@ -26,7 +26,7 @@ import java.util.Map.Entry;
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("&6What generator do you want?");
|
||||
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
|
||||
if (entry.getKey().equals(PS.imp().getPluginName())) {
|
||||
if (entry.getKey().equals(PlotSquared.imp().getPluginName())) {
|
||||
message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
|
||||
} else if (entry.getValue().isFull()) {
|
||||
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
|
||||
@ -74,7 +74,7 @@ import java.util.Map.Entry;
|
||||
MainUtil.sendMessage(player,
|
||||
"&cYou must choose a generator!" + prefix + StringMan
|
||||
.join(SetupUtils.generators.keySet(), prefix)
|
||||
.replaceAll(PS.imp().getPluginName(), "&2" + PS.imp().getPluginName()));
|
||||
.replaceAll(PlotSquared.imp().getPluginName(), "&2" + PlotSquared.imp().getPluginName()));
|
||||
sendMessage(player, C.SETUP_INIT);
|
||||
return false;
|
||||
}
|
||||
@ -142,7 +142,7 @@ import java.util.Map.Entry;
|
||||
SetupUtils.generators.get(object.plotManager).getPlotGenerator()
|
||||
.processSetup(object);
|
||||
} else {
|
||||
object.plotManager = PS.imp().getPluginName();
|
||||
object.plotManager = PlotSquared.imp().getPluginName();
|
||||
MainUtil.sendMessage(player,
|
||||
"&c[WARNING] The specified generator does not identify as BukkitPlotGenerator");
|
||||
MainUtil.sendMessage(player,
|
||||
@ -170,7 +170,7 @@ import java.util.Map.Entry;
|
||||
MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!");
|
||||
return false;
|
||||
}
|
||||
for (PlotArea area : PS.get().getPlotAreas()) {
|
||||
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
|
||||
if (area.id != null && area.id.equalsIgnoreCase(args[0])) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&cYou must choose an area id that is not in use!");
|
||||
@ -270,13 +270,13 @@ import java.util.Map.Entry;
|
||||
return false;
|
||||
}
|
||||
if (WorldUtil.IMP.isWorld(args[0])) {
|
||||
if (PS.get().hasPlotArea(args[0])) {
|
||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||
MainUtil.sendMessage(player, "&cThat world name is already taken!");
|
||||
return false;
|
||||
}
|
||||
MainUtil.sendMessage(player,
|
||||
"&cThe world you specified already exists. After restarting, new terrain will use "
|
||||
+ PS.imp().getPluginName() + ", however you may need to "
|
||||
+ PlotSquared.imp().getPluginName() + ", however you may need to "
|
||||
+ "reset the world for it to generate correctly!");
|
||||
}
|
||||
object.world = args[0];
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -26,7 +26,7 @@ public class Target extends SubCommand {
|
||||
Plot target = null;
|
||||
if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) {
|
||||
int distance = Integer.MAX_VALUE;
|
||||
for (Plot plot : PS.get().getPlots(location.getWorld())) {
|
||||
for (Plot plot : PlotSquared.get().getPlots(location.getWorld())) {
|
||||
double current = plot.getCenter().getEuclideanDistanceSquared(location);
|
||||
if (current < distance) {
|
||||
distance = (int) current;
|
||||
|
@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -26,12 +26,12 @@ public class Template extends SubCommand {
|
||||
|
||||
public static boolean extractAllFiles(String world, String template) {
|
||||
try {
|
||||
File folder = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
|
||||
File folder = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
|
||||
if (!folder.exists()) {
|
||||
return false;
|
||||
}
|
||||
File input = new File(folder + File.separator + template + ".template");
|
||||
File output = PS.get().IMP.getDirectory();
|
||||
File output = PlotSquared.get().IMP.getDirectory();
|
||||
if (!output.exists()) {
|
||||
output.mkdirs();
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class Template extends SubCommand {
|
||||
|
||||
public static byte[] getBytes(PlotArea plotArea) {
|
||||
ConfigurationSection section =
|
||||
PS.get().worlds.getConfigurationSection("worlds." + plotArea.worldname);
|
||||
PlotSquared.get().worlds.getConfigurationSection("worlds." + plotArea.worldname);
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
String generator = SetupUtils.manager.getGenerator(plotArea);
|
||||
if (generator != null) {
|
||||
@ -84,7 +84,7 @@ public class Template extends SubCommand {
|
||||
}
|
||||
|
||||
public static void zipAll(String world, Set<FileBytes> files) throws IOException {
|
||||
File output = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
|
||||
File output = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
|
||||
output.mkdirs();
|
||||
try (FileOutputStream fos = new FileOutputStream(
|
||||
output + File.separator + world + ".template");
|
||||
@ -123,7 +123,7 @@ public class Template extends SubCommand {
|
||||
"/plot template import <world> <template>");
|
||||
return false;
|
||||
}
|
||||
if (PS.get().hasPlotArea(world)) {
|
||||
if (PlotSquared.get().hasPlotArea(world)) {
|
||||
MainUtil.sendMessage(player, C.SETUP_WORLD_TAKEN, world);
|
||||
return false;
|
||||
}
|
||||
@ -133,18 +133,18 @@ public class Template extends SubCommand {
|
||||
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
|
||||
return false;
|
||||
}
|
||||
File worldFile = MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
File worldFile = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml");
|
||||
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
|
||||
PS.get().worlds.set("worlds." + world, worldConfig.get(""));
|
||||
PlotSquared.get().worlds.set("worlds." + world, worldConfig.get(""));
|
||||
try {
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PS.get().worlds.load(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
PlotSquared.get().worlds.load(PlotSquared.get().worldsFile);
|
||||
} catch (InvalidConfigurationException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String manager =
|
||||
worldConfig.getString("generator.plugin", PS.imp().getPluginName());
|
||||
worldConfig.getString("generator.plugin", PlotSquared.imp().getPluginName());
|
||||
String generator = worldConfig.getString("generator.init", manager);
|
||||
int type = worldConfig.getInt("generator.type");
|
||||
int terrain = worldConfig.getInt("generator.terrain");
|
||||
@ -170,7 +170,7 @@ public class Template extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export <world>");
|
||||
return false;
|
||||
}
|
||||
final PlotArea area = PS.get().getPlotAreaByString(world);
|
||||
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
|
||||
if (area == null) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
||||
return false;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
@ -37,7 +37,7 @@ public class Trim extends SubCommand {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
String directory = world + File.separator + "region";
|
||||
File folder = new File(PS.get().IMP.getWorldContainer(), directory);
|
||||
File folder = new File(PlotSquared.get().IMP.getWorldContainer(), directory);
|
||||
File[] regionFiles = folder.listFiles();
|
||||
for (File file : regionFiles) {
|
||||
String name = file.getName();
|
||||
@ -72,7 +72,7 @@ public class Trim extends SubCommand {
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
empty.add(loc);
|
||||
} catch (NumberFormatException ignored) {
|
||||
PS.debug("INVALID MCA: " + name);
|
||||
PlotSquared.debug("INVALID MCA: " + name);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -94,7 +94,7 @@ public class Trim extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(null, "Collecting region data...");
|
||||
ArrayList<Plot> plots = new ArrayList<>();
|
||||
plots.addAll(PS.get().getPlots(world));
|
||||
plots.addAll(PlotSquared.get().getPlots(world));
|
||||
if (ExpireManager.IMP != null) {
|
||||
plots.removeAll(ExpireManager.IMP.getPendingExpired());
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class Trim extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final String world = args[0];
|
||||
if (!WorldUtil.IMP.isWorld(world) || !PS.get().hasPlotArea(world)) {
|
||||
if (!WorldUtil.IMP.isWorld(world) || !PlotSquared.get().hasPlotArea(world)) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_WORLD);
|
||||
return false;
|
||||
}
|
||||
@ -144,9 +144,9 @@ public class Trim extends SubCommand {
|
||||
@Override public void run(Set<ChunkLoc> viable, final Set<ChunkLoc> nonViable) {
|
||||
Runnable regenTask;
|
||||
if (regen) {
|
||||
PS.log("Starting regen task:");
|
||||
PS.log(" - This is a VERY slow command");
|
||||
PS.log(" - It will say `Trim done!` when complete");
|
||||
PlotSquared.log("Starting regen task:");
|
||||
PlotSquared.log(" - This is a VERY slow command");
|
||||
PlotSquared.log(" - It will say `Trim done!` when complete");
|
||||
regenTask = new Runnable() {
|
||||
@Override public void run() {
|
||||
if (nonViable.isEmpty()) {
|
||||
@ -170,7 +170,7 @@ public class Trim extends SubCommand {
|
||||
int bx = cbx << 4;
|
||||
int bz = cbz << 4;
|
||||
RegionWrapper region = new RegionWrapper(bx, bx + 511, bz, bz + 511);
|
||||
for (Plot plot : PS.get().getPlots(world)) {
|
||||
for (Plot plot : PlotSquared.get().getPlots(world)) {
|
||||
Location bot = plot.getBottomAbs();
|
||||
Location top = plot.getExtendedTopAbs();
|
||||
RegionWrapper plotReg =
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -46,7 +46,7 @@ import java.util.*;
|
||||
page = Integer.parseInt(args[2]);
|
||||
case 2:
|
||||
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
||||
sortByArea = PS.get().getPlotAreaByString(args[1]);
|
||||
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||
if (sortByArea == null) {
|
||||
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
||||
@ -57,22 +57,22 @@ import java.util.*;
|
||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
||||
return;
|
||||
}
|
||||
unsorted = PS.get().getBasePlots(user);
|
||||
unsorted = PlotSquared.get().getBasePlots(user);
|
||||
shouldSortByArea = true;
|
||||
break;
|
||||
}
|
||||
page = Integer.parseInt(args[1]);
|
||||
case 1:
|
||||
UUID user = args[0].length() >= 2 ? UUIDHandler.getUUIDFromString(args[0]) : null;
|
||||
if (user != null && !PS.get().hasPlot(user))
|
||||
if (user != null && !PlotSquared.get().hasPlot(user))
|
||||
user = null;
|
||||
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
|
||||
page = Integer.parseInt(args[0]);
|
||||
unsorted = PS.get().getBasePlots(player);
|
||||
unsorted = PlotSquared.get().getBasePlots(player);
|
||||
break;
|
||||
}
|
||||
if (user != null) {
|
||||
unsorted = PS.get().getBasePlots(user);
|
||||
unsorted = PlotSquared.get().getBasePlots(user);
|
||||
} else {
|
||||
Plot plot = MainUtil.getPlotFromString(player, args[0], true);
|
||||
if (plot != null) {
|
||||
@ -82,7 +82,7 @@ import java.util.*;
|
||||
break;
|
||||
case 0:
|
||||
page = 1;
|
||||
unsorted = PS.get().getPlots(player);
|
||||
unsorted = PlotSquared.get().getPlots(player);
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -106,9 +106,10 @@ import java.util.*;
|
||||
}
|
||||
List<Plot> plots;
|
||||
if (shouldSortByArea) {
|
||||
plots = PS.get().sortPlots(unsorted, PS.SortType.CREATION_DATE, sortByArea);
|
||||
plots = PlotSquared
|
||||
.get().sortPlots(unsorted, PlotSquared.SortType.CREATION_DATE, sortByArea);
|
||||
} else {
|
||||
plots = PS.get().sortPlotsByTemp(unsorted);
|
||||
plots = PlotSquared.get().sortPlotsByTemp(unsorted);
|
||||
}
|
||||
final Plot plot = plots.get(page - 1);
|
||||
if (!plot.hasOwner()) {
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.config;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.io.File;
|
||||
@ -757,7 +757,7 @@ public enum C {
|
||||
changed = true;
|
||||
yml.set(remove, null);
|
||||
}
|
||||
ConfigurationSection config = PS.get().style.getConfigurationSection("color");
|
||||
ConfigurationSection config = PlotSquared.get().style.getConfigurationSection("color");
|
||||
Set<String> styles = config.getKeys(false);
|
||||
// HashMap<String, String> replacements = new HashMap<>();
|
||||
replacements.clear();
|
||||
@ -819,7 +819,7 @@ public enum C {
|
||||
public void send(CommandCaller caller, Object... args) {
|
||||
String msg = format(this, args);
|
||||
if (caller == null) {
|
||||
PS.log(msg);
|
||||
PlotSquared.log(msg);
|
||||
} else {
|
||||
caller.sendMessage(msg);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.config;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.io.File;
|
||||
@ -40,7 +40,7 @@ public class Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
PS.debug("Failed to get config option: " + key);
|
||||
PlotSquared.debug("Failed to get config option: " + key);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -68,13 +68,14 @@ public class Config {
|
||||
field.set(instance, value);
|
||||
return;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("Invalid configuration value: " + key + ": " + value + " in " + root
|
||||
PlotSquared
|
||||
.debug("Invalid configuration value: " + key + ": " + value + " in " + root
|
||||
.getSimpleName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
PS.debug("Failed to set config option: " + key + ": " + value + " | " + instance);
|
||||
PlotSquared.debug("Failed to set config option: " + key + ": " + value + " | " + instance);
|
||||
}
|
||||
|
||||
public static boolean load(File file, Class root) {
|
||||
@ -261,7 +262,7 @@ public class Config {
|
||||
setAccessible(field);
|
||||
return field;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(
|
||||
PlotSquared.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(
|
||||
instance.getClass().getSimpleName()));
|
||||
return null;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.database;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
@ -304,12 +304,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
try {
|
||||
task.run();
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be corrected on shutdown");
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||
PlotSquared.debug("There was an error updating the database.");
|
||||
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||
PlotSquared.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("========================================");
|
||||
}
|
||||
}
|
||||
commit();
|
||||
@ -359,12 +359,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
lastTask = task;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be corrected on shutdown");
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||
PlotSquared.debug("There was an error updating the database.");
|
||||
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||
PlotSquared.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("========================================");
|
||||
}
|
||||
}
|
||||
if (statement != null && task != null) {
|
||||
@ -404,12 +404,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
lastTask = task;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be corrected on shutdown");
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||
PlotSquared.debug("There was an error updating the database.");
|
||||
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||
PlotSquared.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("========================================");
|
||||
}
|
||||
}
|
||||
if (statement != null && task != null) {
|
||||
@ -450,12 +450,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
lastTask = task;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be corrected on shutdown");
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||
PlotSquared.debug("There was an error updating the database.");
|
||||
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||
PlotSquared.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("========================================");
|
||||
}
|
||||
}
|
||||
if (statement != null && task != null) {
|
||||
@ -479,12 +479,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
this.plotTasks.clear();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be corrected on shutdown");
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||
PlotSquared.debug("There was an error updating the database.");
|
||||
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||
PlotSquared.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
PlotSquared.debug("========================================");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -584,7 +584,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
});
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&7[WARN] Failed to set all helpers for plots");
|
||||
PlotSquared.debug("&7[WARN] Failed to set all helpers for plots");
|
||||
try {
|
||||
SQLManager.this.connection.commit();
|
||||
} catch (SQLException e1) {
|
||||
@ -595,7 +595,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&7[WARN] Failed to set all helpers for plots");
|
||||
PlotSquared.debug("&7[WARN] Failed to set all helpers for plots");
|
||||
try {
|
||||
SQLManager.this.connection.commit();
|
||||
} catch (SQLException e1) {
|
||||
@ -754,7 +754,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
last = subList.size();
|
||||
preparedStmt.addBatch();
|
||||
}
|
||||
PS.debug("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
|
||||
PlotSquared.debug("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
|
||||
preparedStmt.executeBatch();
|
||||
preparedStmt.clearParameters();
|
||||
preparedStmt.close();
|
||||
@ -765,7 +765,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
} catch (SQLException e) {
|
||||
if (this.mySQL) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&cERROR 1: | " + objList.get(0).getClass().getCanonicalName());
|
||||
PlotSquared.debug("&cERROR 1: | " + objList.get(0).getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
try {
|
||||
@ -797,25 +797,25 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
last = subList.size();
|
||||
preparedStmt.addBatch();
|
||||
}
|
||||
PS.debug("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
|
||||
PlotSquared.debug("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
|
||||
preparedStmt.executeBatch();
|
||||
preparedStmt.clearParameters();
|
||||
preparedStmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
|
||||
PS.debug("&6[WARN] Could not bulk save!");
|
||||
PlotSquared.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
|
||||
PlotSquared.debug("&6[WARN] Could not bulk save!");
|
||||
try (PreparedStatement preparedStmt = this.connection
|
||||
.prepareStatement(mod.getCreateSQL())) {
|
||||
for (T obj : objList) {
|
||||
mod.setSQL(preparedStmt, obj);
|
||||
preparedStmt.addBatch();
|
||||
}
|
||||
PS.debug("&aBatch 3");
|
||||
PlotSquared.debug("&aBatch 3");
|
||||
preparedStmt.executeBatch();
|
||||
} catch (SQLException e3) {
|
||||
e3.printStackTrace();
|
||||
PS.debug("&c[ERROR] Failed to save all!");
|
||||
PlotSquared.debug("&c[ERROR] Failed to save all!");
|
||||
}
|
||||
}
|
||||
if (whenDone != null) {
|
||||
@ -1114,7 +1114,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
return;
|
||||
}
|
||||
boolean addConstraint = create == tables.length;
|
||||
PS.debug("Creating tables");
|
||||
PlotSquared.debug("Creating tables");
|
||||
try (Statement stmt = this.connection.createStatement()) {
|
||||
if (this.mySQL) {
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` ("
|
||||
@ -1347,7 +1347,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @param plot
|
||||
*/
|
||||
@Override public void delete(final Plot plot) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"Deleting plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
|
||||
+ plot.owner + " Index: " + plot.temp);
|
||||
deleteSettings(plot);
|
||||
@ -1375,7 +1375,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @param plot
|
||||
*/
|
||||
@Override public void createPlotSettings(final int id, Plot plot) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"Creating plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
|
||||
+ plot.owner + " Index: " + id);
|
||||
addPlotTask(plot, new UniqueStatement("createPlotSettings") {
|
||||
@ -1469,7 +1469,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Override public void updateTables(int[] oldVersion) {
|
||||
try {
|
||||
if (this.mySQL && !PS.get().checkVersion(oldVersion, 3, 3, 2)) {
|
||||
if (this.mySQL && !PlotSquared.get().checkVersion(oldVersion, 3, 3, 2)) {
|
||||
try (Statement stmt = this.connection.createStatement()) {
|
||||
stmt.executeUpdate(
|
||||
"ALTER TABLE `" + this.prefix + "plots` DROP INDEX `unique_alias`");
|
||||
@ -1535,7 +1535,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
"SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table
|
||||
+ " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
|
||||
if (result.next()) {
|
||||
PS.debug("BACKING UP: " + this.prefix + table);
|
||||
PlotSquared.debug("BACKING UP: " + this.prefix + table);
|
||||
result.close();
|
||||
statement.executeUpdate(
|
||||
"CREATE TABLE " + this.prefix + table + "_tmp AS SELECT * FROM "
|
||||
@ -1545,7 +1545,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
"CREATE TABLE " + this.prefix + table + " AS SELECT * FROM "
|
||||
+ this.prefix + table + "_tmp");
|
||||
statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
|
||||
PS.debug("RESTORING: " + this.prefix + table);
|
||||
PlotSquared.debug("RESTORING: " + this.prefix + table);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e2) {
|
||||
@ -1599,9 +1599,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
HashMap<Integer, Plot> plots = new HashMap<>();
|
||||
try {
|
||||
HashSet<String> areas = new HashSet<>();
|
||||
if (PS.get().worlds.contains("worlds")) {
|
||||
if (PlotSquared.get().worlds.contains("worlds")) {
|
||||
ConfigurationSection worldSection =
|
||||
PS.get().worlds.getConfigurationSection("worlds");
|
||||
PlotSquared.get().worlds.getConfigurationSection("worlds");
|
||||
if (worldSection != null) {
|
||||
for (String worldKey : worldSection.getKeys(false)) {
|
||||
areas.add(worldKey);
|
||||
@ -1677,7 +1677,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
|
||||
.getTime();
|
||||
} catch (ParseException e) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"Could not parse date for plot: #" + id + "(" + areaid + ";"
|
||||
+ plot_id + ") (" + parsable + ")");
|
||||
time = System.currentTimeMillis() + id;
|
||||
@ -1693,7 +1693,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||
toDelete.add(last.temp);
|
||||
} else {
|
||||
PS.debug("&cPLOT #" + id + "(" + last + ") in `" + this.prefix
|
||||
PlotSquared.debug("&cPLOT #" + id + "(" + last + ") in `" + this.prefix
|
||||
+ "plot` is a duplicate. Delete this plot or set `database-purger: true` in the settings.yml.");
|
||||
}
|
||||
}
|
||||
@ -1725,7 +1725,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||
toDelete.add(id);
|
||||
} else {
|
||||
PS.debug("&cENTRY #" + id + "(" + plot
|
||||
PlotSquared.debug("&cENTRY #" + id + "(" + plot
|
||||
+ ") in `plot_rating` does not exist. Create this plot or set `database-purger: true` in the "
|
||||
+ "settings.yml.");
|
||||
}
|
||||
@ -1754,7 +1754,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||
toDelete.add(id);
|
||||
} else {
|
||||
PS.debug("&cENTRY #" + id + "(" + plot
|
||||
PlotSquared.debug("&cENTRY #" + id + "(" + plot
|
||||
+ ") in `plot_helpers` does not exist. Create this plot or set `database-purger: true` in the settings"
|
||||
+ ".yml.");
|
||||
}
|
||||
@ -1782,7 +1782,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||
toDelete.add(id);
|
||||
} else {
|
||||
PS.debug("&cENTRY #" + id + "(" + plot
|
||||
PlotSquared.debug("&cENTRY #" + id + "(" + plot
|
||||
+ ") in `plot_trusted` does not exist. Create this plot or set `database-purger: true` in the settings"
|
||||
+ ".yml.");
|
||||
}
|
||||
@ -1810,7 +1810,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||
toDelete.add(id);
|
||||
} else {
|
||||
PS.debug("&cENTRY " + id
|
||||
PlotSquared.debug("&cENTRY " + id
|
||||
+ " in `plot_denied` does not exist. Create this plot or set `database-purger: true` in the settings.yml.");
|
||||
}
|
||||
}
|
||||
@ -1884,21 +1884,21 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
} else {
|
||||
PS.debug("INVALID FLAG: " + element);
|
||||
PlotSquared.debug("INVALID FLAG: " + element);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exception) {
|
||||
PS.debug("&cPlot #" + id + "(" + plot + ") | " + plot
|
||||
PlotSquared.debug("&cPlot #" + id + "(" + plot + ") | " + plot
|
||||
+ " had an invalid flag. A fix has been attempted.");
|
||||
PS.debug("&c" + myflags);
|
||||
PlotSquared.debug("&c" + myflags);
|
||||
this.setFlags(plot, flags);
|
||||
}
|
||||
plot.getSettings().flags = flags;
|
||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||
toDelete.add(id);
|
||||
} else {
|
||||
PS.debug("&cENTRY #" + id + "(" + plot
|
||||
PlotSquared.debug("&cENTRY #" + id + "(" + plot
|
||||
+ ") in `plot_settings` does not exist. Create this plot or set `database-purger: true` in the settings"
|
||||
+ ".yml.");
|
||||
}
|
||||
@ -1916,15 +1916,15 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
for (Entry<String, AtomicInteger> entry : noExist.entrySet()) {
|
||||
String worldName = entry.getKey();
|
||||
invalidPlot = true;
|
||||
PS.debug("&c[WARNING] Found " + entry.getValue().intValue()
|
||||
PlotSquared.debug("&c[WARNING] Found " + entry.getValue().intValue()
|
||||
+ " plots in DB for non existent world; '" + worldName + "'.");
|
||||
}
|
||||
if (invalidPlot) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"&c[WARNING] - Please create the world/s or remove the plots using the purge command");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
PS.debug("&7[WARN] Failed to load plots.");
|
||||
PlotSquared.debug("&7[WARN] Failed to load plots.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return newPlots;
|
||||
@ -2045,7 +2045,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
int count = 0;
|
||||
int last = -1;
|
||||
for (int j = 0; j <= amount; j++) {
|
||||
PS.debug("Purging " + (j * packet) + " / " + size);
|
||||
PlotSquared.debug("Purging " + (j * packet) + " / " + size);
|
||||
List<Integer> subList =
|
||||
uniqueIdsList.subList(j * packet, Math.min(size, (j + 1) * packet));
|
||||
if (subList.isEmpty()) {
|
||||
@ -2092,11 +2092,11 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&c[ERROR] FAILED TO PURGE PLOTS!");
|
||||
PlotSquared.debug("&c[ERROR] FAILED TO PURGE PLOTS!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
PS.debug("&6[INFO] SUCCESSFULLY PURGED " + uniqueIds.size() + " PLOTS!");
|
||||
PlotSquared.debug("&6[INFO] SUCCESSFULLY PURGED " + uniqueIds.size() + " PLOTS!");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2122,7 +2122,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
purgeIds(ids);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&c[ERROR] FAILED TO PURGE AREA '" + area + "'!");
|
||||
PlotSquared.debug("&c[ERROR] FAILED TO PURGE AREA '" + area + "'!");
|
||||
}
|
||||
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
|
||||
PlotId plotId = iterator.next();
|
||||
@ -2378,7 +2378,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
PS.debug("&7[WARN] Failed to fetch rating for plot " + plot.getId().toString());
|
||||
PlotSquared.debug("&7[WARN] Failed to fetch rating for plot " + plot.getId().toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
@ -2534,9 +2534,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
HashMap<Integer, PlotCluster> clusters = new HashMap<>();
|
||||
try {
|
||||
HashSet<String> areas = new HashSet<>();
|
||||
if (PS.get().worlds.contains("worlds")) {
|
||||
if (PlotSquared.get().worlds.contains("worlds")) {
|
||||
ConfigurationSection worldSection =
|
||||
PS.get().worlds.getConfigurationSection("worlds");
|
||||
PlotSquared.get().worlds.getConfigurationSection("worlds");
|
||||
if (worldSection != null) {
|
||||
for (String worldKey : worldSection.getKeys(false)) {
|
||||
areas.add(worldKey);
|
||||
@ -2609,7 +2609,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (cluster != null) {
|
||||
cluster.helpers.add(user);
|
||||
} else {
|
||||
PS.debug("&cCluster #" + id + "(" + cluster
|
||||
PlotSquared.debug("&cCluster #" + id + "(" + cluster
|
||||
+ ") in cluster_helpers does not exist. Please create the cluster or remove this entry.");
|
||||
}
|
||||
}
|
||||
@ -2628,7 +2628,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (cluster != null) {
|
||||
cluster.invited.add(user);
|
||||
} else {
|
||||
PS.debug("&cCluster #" + id + "(" + cluster
|
||||
PlotSquared.debug("&cCluster #" + id + "(" + cluster
|
||||
+ ") in cluster_invited does not exist. Please create the cluster or remove this entry.");
|
||||
}
|
||||
}
|
||||
@ -2698,7 +2698,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
cluster.settings.flags = flags;
|
||||
} else {
|
||||
PS.debug("&cCluster #" + id + "(" + cluster
|
||||
PlotSquared.debug("&cCluster #" + id + "(" + cluster
|
||||
+ ") in cluster_settings does not exist. Please create the cluster or remove this entry.");
|
||||
}
|
||||
}
|
||||
@ -2708,15 +2708,15 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
for (Entry<String, Integer> entry : noExist.entrySet()) {
|
||||
String a = entry.getKey();
|
||||
invalidPlot = true;
|
||||
PS.debug("&c[WARNING] Found " + noExist.get(a)
|
||||
PlotSquared.debug("&c[WARNING] Found " + noExist.get(a)
|
||||
+ " clusters in DB for non existent area; '" + a + "'.");
|
||||
}
|
||||
if (invalidPlot) {
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
PS.debug("&7[WARN] Failed to load clusters.");
|
||||
PlotSquared.debug("&7[WARN] Failed to load clusters.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return newClusters;
|
||||
@ -2935,7 +2935,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (!isValid()) {
|
||||
reconnect();
|
||||
}
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"$1All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
|
||||
commit();
|
||||
while (true) {
|
||||
@ -2958,19 +2958,19 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
}
|
||||
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
||||
if (worldPlots == null) {
|
||||
PS.debug("&8 - &7Creating plot (1): " + plot);
|
||||
PlotSquared.debug("&8 - &7Creating plot (1): " + plot);
|
||||
toCreate.add(plot);
|
||||
continue;
|
||||
}
|
||||
Plot dataPlot = worldPlots.remove(plot.getId());
|
||||
if (dataPlot == null) {
|
||||
PS.debug("&8 - &7Creating plot (2): " + plot);
|
||||
PlotSquared.debug("&8 - &7Creating plot (2): " + plot);
|
||||
toCreate.add(plot);
|
||||
continue;
|
||||
}
|
||||
// owner
|
||||
if (!plot.owner.equals(dataPlot.owner)) {
|
||||
PS.debug("&8 - &7Setting owner: " + plot + " -> " + MainUtil.getName(plot.owner));
|
||||
PlotSquared.debug("&8 - &7Setting owner: " + plot + " -> " + MainUtil.getName(plot.owner));
|
||||
setOwner(plot, plot.owner);
|
||||
}
|
||||
// trusted
|
||||
@ -2979,7 +2979,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getTrusted().clone();
|
||||
toRemove.removeAll(plot.getTrusted());
|
||||
toAdd.removeAll(dataPlot.getTrusted());
|
||||
PS.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " trusted for: "
|
||||
PlotSquared.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " trusted for: "
|
||||
+ plot);
|
||||
if (!toRemove.isEmpty()) {
|
||||
for (UUID uuid : toRemove) {
|
||||
@ -2997,7 +2997,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getMembers().clone();
|
||||
toRemove.removeAll(plot.getMembers());
|
||||
toAdd.removeAll(dataPlot.getMembers());
|
||||
PS.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " members for: "
|
||||
PlotSquared.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " members for: "
|
||||
+ plot);
|
||||
if (!toRemove.isEmpty()) {
|
||||
for (UUID uuid : toRemove) {
|
||||
@ -3015,7 +3015,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getDenied().clone();
|
||||
toRemove.removeAll(plot.getDenied());
|
||||
toAdd.removeAll(dataPlot.getDenied());
|
||||
PS.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " denied for: "
|
||||
PlotSquared.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " denied for: "
|
||||
+ plot);
|
||||
if (!toRemove.isEmpty()) {
|
||||
for (UUID uuid : toRemove) {
|
||||
@ -3031,7 +3031,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
boolean[] pm = plot.getMerged();
|
||||
boolean[] dm = dataPlot.getMerged();
|
||||
if (pm[0] != dm[0] || pm[1] != dm[1]) {
|
||||
PS.debug("&8 - &7Correcting merge for: " + plot);
|
||||
PlotSquared.debug("&8 - &7Correcting merge for: " + plot);
|
||||
setMerged(dataPlot, plot.getMerged());
|
||||
}
|
||||
HashMap<Flag<?>, Object> pf = plot.getFlags();
|
||||
@ -3040,7 +3040,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (pf.size() != df.size() || !StringMan
|
||||
.isEqual(StringMan.joinOrdered(pf.values(), ","),
|
||||
StringMan.joinOrdered(df.values(), ","))) {
|
||||
PS.debug("&8 - &7Correcting flags for: " + plot);
|
||||
PlotSquared.debug("&8 - &7Correcting flags for: " + plot);
|
||||
setFlags(plot, pf);
|
||||
}
|
||||
}
|
||||
@ -3050,7 +3050,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
HashMap<PlotId, Plot> map = entry.getValue();
|
||||
if (!map.isEmpty()) {
|
||||
for (Entry<PlotId, Plot> entry2 : map.entrySet()) {
|
||||
PS.debug("$1Plot was deleted: " + entry2.getValue().toString()
|
||||
PlotSquared.debug("$1Plot was deleted: " + entry2.getValue().toString()
|
||||
+ "// TODO implement this when sure safe");
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.database;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -27,15 +27,15 @@ public class SQLite extends Database {
|
||||
if (checkConnection()) {
|
||||
return this.connection;
|
||||
}
|
||||
if (!PS.get().IMP.getDirectory().exists()) {
|
||||
PS.get().IMP.getDirectory().mkdirs();
|
||||
if (!PlotSquared.get().IMP.getDirectory().exists()) {
|
||||
PlotSquared.get().IMP.getDirectory().mkdirs();
|
||||
}
|
||||
File file = new File(this.dbLocation);
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException ignored) {
|
||||
PS.debug("&cUnable to create database!");
|
||||
PlotSquared.debug("&cUnable to create database!");
|
||||
}
|
||||
}
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
@ -37,7 +37,7 @@ public class FlagManager {
|
||||
public static <V> Optional<V> getPlotFlag(Plot plot, Flag<V> key) {
|
||||
V value = FlagManager.getPlotFlagRaw(plot, key);
|
||||
if (value != null) {
|
||||
if (PS.get().isMainThread(Thread.currentThread())) {
|
||||
if (PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||
try {
|
||||
MUTABLE_OPTIONAL_FIELD.set(MUTABLE_OPTIONAL, value);
|
||||
return MUTABLE_OPTIONAL;
|
||||
@ -117,7 +117,7 @@ public class FlagManager {
|
||||
.replaceAll(",", "´"));
|
||||
i++;
|
||||
} catch (Exception e) {
|
||||
PS.debug("Failed to parse flag: " + entry.getKey() + "->" + entry.getValue());
|
||||
PlotSquared.debug("Failed to parse flag: " + entry.getKey() + "->" + entry.getValue());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
@ -136,7 +136,7 @@ public final class Flags {
|
||||
}
|
||||
Flag flag = (Flag) fieldValue;
|
||||
if (!flag.getName().equals(fieldName)) {
|
||||
PS.debug(Flags.class + "Field doesn't match: " + fieldName + " != " + flag
|
||||
PlotSquared.debug(Flags.class + "Field doesn't match: " + fieldName + " != " + flag
|
||||
.getName());
|
||||
}
|
||||
flags.put(flag.getName(), flag);
|
||||
@ -162,7 +162,7 @@ public final class Flags {
|
||||
public static void registerFlag(final Flag<?> flag) {
|
||||
final Flag<?> duplicate = flags.put(flag.getName(), flag);
|
||||
if (duplicate != null) {
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea value) {
|
||||
Object remove;
|
||||
if (value.DEFAULT_FLAGS.containsKey(duplicate)) {
|
||||
@ -182,7 +182,7 @@ public final class Flags {
|
||||
}
|
||||
}
|
||||
});
|
||||
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
|
||||
PlotSquared.get().foreachPlotRaw(new RunnableVal<Plot>() {
|
||||
@Override public void run(Plot value) {
|
||||
if (value.getFlags().containsKey(duplicate)) {
|
||||
Object remove = value.getFlags().remove(duplicate);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
@ -28,7 +28,7 @@ public class AugmentedUtils {
|
||||
final int bx = cx << 4;
|
||||
final int bz = cz << 4;
|
||||
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
|
||||
Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
|
||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(world, region);
|
||||
if (areas.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
@ -15,7 +15,7 @@ import java.util.Map.Entry;
|
||||
public class HybridGen extends IndependentPlotGenerator {
|
||||
|
||||
@Override public String getName() {
|
||||
return PS.imp().getPluginName();
|
||||
return PlotSquared.imp().getPluginName();
|
||||
}
|
||||
|
||||
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX,
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.Template;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -31,18 +31,18 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
+ File.separator;
|
||||
try {
|
||||
File sideroad =
|
||||
MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "sideroad.schematic");
|
||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schematic");
|
||||
if (sideroad.exists()) {
|
||||
files.add(new FileBytes(newDir + "sideroad.schematic",
|
||||
Files.readAllBytes(sideroad.toPath())));
|
||||
}
|
||||
File intersection =
|
||||
MainUtil.getFile(PS.get().IMP.getDirectory(), "intersection.schematic");
|
||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schematic");
|
||||
if (intersection.exists()) {
|
||||
files.add(new FileBytes(newDir + "intersection.schematic",
|
||||
Files.readAllBytes(intersection.toPath())));
|
||||
}
|
||||
File plot = MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "plot.schematic");
|
||||
File plot = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schematic");
|
||||
if (plot.exists()) {
|
||||
files.add(
|
||||
new FileBytes(newDir + "plot.schematic", Files.readAllBytes(plot.toPath())));
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||
import com.github.intellectualsites.plotsquared.jnbt.Tag;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -173,7 +173,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
try {
|
||||
setupSchematics();
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c - road schematics are disabled for this world.");
|
||||
PlotSquared.debug("&c - road schematics are disabled for this world.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,11 +186,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
|
||||
public void setupSchematics() {
|
||||
this.G_SCH = new HashMap<>();
|
||||
File schematic1File = MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
File schematic1File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/sideroad.schematic");
|
||||
File schematic2File = MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
File schematic2File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/intersection.schematic");
|
||||
File schem3File = MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
File schem3File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/plot.schematic");
|
||||
SchematicHandler.Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
||||
SchematicHandler.Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
||||
@ -270,7 +270,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
}
|
||||
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
||||
PS.debug(C.PREFIX + "&3 - schematic: &7false");
|
||||
PlotSquared.debug(C.PREFIX + "&3 - schematic: &7false");
|
||||
return;
|
||||
}
|
||||
this.ROAD_SCHEMATIC_ENABLED = true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
@ -207,16 +207,16 @@ public abstract class HybridUtils {
|
||||
regenerateRoad(area, chunk, extend);
|
||||
ChunkManager.manager.unloadChunk(area.worldname, chunk, true, true);
|
||||
}
|
||||
PS.debug("&cCancelled road task");
|
||||
PlotSquared.debug("&cCancelled road task");
|
||||
return;
|
||||
}
|
||||
count.incrementAndGet();
|
||||
if (count.intValue() % 20 == 0) {
|
||||
PS.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%");
|
||||
PlotSquared.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%");
|
||||
}
|
||||
if (regions.isEmpty() && chunks.isEmpty()) {
|
||||
HybridUtils.UPDATE = false;
|
||||
PS.debug(C.PREFIX.s() + "Finished road conversion");
|
||||
PlotSquared.debug(C.PREFIX.s() + "Finished road conversion");
|
||||
// CANCEL TASK
|
||||
} else {
|
||||
final Runnable task = this;
|
||||
@ -230,9 +230,9 @@ public abstract class HybridUtils {
|
||||
Iterator<ChunkLoc> iterator = regions.iterator();
|
||||
ChunkLoc loc = iterator.next();
|
||||
iterator.remove();
|
||||
PS.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
|
||||
PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
|
||||
+ " (aprrox 1024 chunks)");
|
||||
PS.debug(" - Remaining: " + regions.size());
|
||||
PlotSquared.debug(" - Remaining: " + regions.size());
|
||||
chunks.addAll(getChunks(loc));
|
||||
System.gc();
|
||||
}
|
||||
@ -256,7 +256,7 @@ public abstract class HybridUtils {
|
||||
Iterator<ChunkLoc> iterator = regions.iterator();
|
||||
ChunkLoc loc = iterator.next();
|
||||
iterator.remove();
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
"&c[ERROR]&7 Could not update '" + area.worldname + "/region/r."
|
||||
+ loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
|
||||
int sx = loc.x << 5;
|
||||
@ -268,8 +268,8 @@ public abstract class HybridUtils {
|
||||
true);
|
||||
}
|
||||
}
|
||||
PS.debug("&d - Potentially skipping 1024 chunks");
|
||||
PS.debug("&d - TODO: recommend chunkster if corrupt");
|
||||
PlotSquared.debug("&d - Potentially skipping 1024 chunks");
|
||||
PlotSquared.debug("&d - TODO: recommend chunkster if corrupt");
|
||||
}
|
||||
GlobalBlockQueue.IMP.addTask(new Runnable() {
|
||||
@Override public void run() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
|
||||
@ -76,7 +76,7 @@ public abstract class IndependentPlotGenerator {
|
||||
* @return
|
||||
*/
|
||||
public <T> GeneratorWrapper<T> specify(String world) {
|
||||
return (GeneratorWrapper<T>) PS.get().IMP.wrapPlotGenerator(world, this);
|
||||
return (GeneratorWrapper<T>) PlotSquared.get().IMP.wrapPlotGenerator(world, this);
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -196,9 +196,9 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
// northwest
|
||||
return plot.getMerged(7) ? id : null;
|
||||
}
|
||||
PS.debug("invalid location: " + Arrays.toString(merged));
|
||||
PlotSquared.debug("invalid location: " + Arrays.toString(merged));
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("Invalid plot / road width in settings.yml for world: " + plotArea.worldname);
|
||||
PlotSquared.debug("Invalid plot / road width in settings.yml for world: " + plotArea.worldname);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
|
||||
public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||
@ -18,7 +18,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||
|
||||
@Override public void loadConfiguration(ConfigurationSection config) {
|
||||
if (!config.contains("plot.height")) {
|
||||
PS.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ')');
|
||||
PlotSquared.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ')');
|
||||
}
|
||||
this.PLOT_WIDTH = config.getInt("plot.size");
|
||||
this.ROAD_WIDTH = config.getInt("road.width");
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
@ -96,7 +96,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
this.BScount++;
|
||||
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
|
||||
this.BSblocked = true;
|
||||
PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
|
||||
PlotSquared
|
||||
.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
|
||||
+ location.getBlockZ());
|
||||
}
|
||||
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
||||
@ -243,7 +244,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
this.Ecount++;
|
||||
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||
this.Eblocked = true;
|
||||
PS.debug(
|
||||
PlotSquared.debug(
|
||||
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location
|
||||
.getBlockZ());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -36,7 +36,7 @@ public class WEManager {
|
||||
UUID uuid = player.getUUID();
|
||||
Location location = player.getLocation();
|
||||
String world = location.getWorld();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
regions.add(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE,
|
||||
Integer.MAX_VALUE));
|
||||
return regions;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -23,7 +23,7 @@ import java.util.HashSet;
|
||||
public class WESubscriber {
|
||||
|
||||
@Subscribe(priority = Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) {
|
||||
WorldEdit worldedit = PS.get().worldedit;
|
||||
WorldEdit worldedit = PlotSquared.get().worldedit;
|
||||
if (worldedit == null) {
|
||||
WorldEdit.getInstance().getEventBus().unregister(this);
|
||||
return;
|
||||
@ -55,19 +55,19 @@ public class WESubscriber {
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
if (PS.get().hasPlotArea(world)) {
|
||||
if (PlotSquared.get().hasPlotArea(world)) {
|
||||
event.setExtent(new NullExtent());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||
if (PS.get().hasPlotArea(world)) {
|
||||
if (PlotSquared.get().hasPlotArea(world)) {
|
||||
event.setExtent(
|
||||
new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(),
|
||||
event.getExtent()));
|
||||
}
|
||||
} else if (PS.get().hasPlotArea(world)) {
|
||||
} else if (PlotSquared.get().hasPlotArea(world)) {
|
||||
event.setExtent(new WEExtent(mask, event.getExtent()));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@ -61,7 +61,7 @@ public class BO3 {
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
return MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
Settings.Paths.BO3 + File.separator + getWorld() + File.separator + getFilename());
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
@ -13,7 +13,7 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
private static ConsolePlayer instance;
|
||||
|
||||
private ConsolePlayer() {
|
||||
PlotArea area = PS.get().getFirstPlotArea();
|
||||
PlotArea area = PlotSquared.get().getFirstPlotArea();
|
||||
Location loc;
|
||||
if (area != null) {
|
||||
RegionWrapper region = area.getRegion();
|
||||
@ -62,7 +62,7 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
}
|
||||
|
||||
@Override public void sendMessage(String message) {
|
||||
PS.log(message);
|
||||
PlotSquared.log(message);
|
||||
}
|
||||
|
||||
@Override public void teleport(Location location) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.DebugExec;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||
|
||||
@ -41,7 +41,7 @@ public abstract class Expression<T> {
|
||||
try {
|
||||
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
|
||||
} catch (ScriptException e) {
|
||||
PS.debug("Invalid Expression: " + expression);
|
||||
PlotSquared.debug("Invalid Expression: " + expression);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0d;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
|
||||
public class Location implements Cloneable, Comparable<Location> {
|
||||
@ -66,11 +66,11 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
}
|
||||
|
||||
public PlotArea getPlotArea() {
|
||||
return PS.get().getPlotAreaAbs(this);
|
||||
return PlotSquared.get().getPlotAreaAbs(this);
|
||||
}
|
||||
|
||||
public Plot getOwnedPlot() {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||
if (area != null) {
|
||||
return area.getOwnedPlot(this);
|
||||
} else {
|
||||
@ -79,7 +79,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
}
|
||||
|
||||
public Plot getOwnedPlotAbs() {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||
if (area != null) {
|
||||
return area.getOwnedPlotAbs(this);
|
||||
} else {
|
||||
@ -88,16 +88,16 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
}
|
||||
|
||||
public boolean isPlotArea() {
|
||||
return PS.get().getPlotAreaAbs(this) != null;
|
||||
return PlotSquared.get().getPlotAreaAbs(this) != null;
|
||||
}
|
||||
|
||||
public boolean isPlotRoad() {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||
return area != null && area.getPlotAbs(this) == null;
|
||||
}
|
||||
|
||||
public boolean isUnownedPlotArea() {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||
return area != null && area.getOwnedPlotAbs(this) == null;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
}
|
||||
|
||||
public Plot getPlotAbs() {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||
if (area != null) {
|
||||
return area.getPlotAbs(this);
|
||||
} else {
|
||||
@ -120,7 +120,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||
if (area != null) {
|
||||
return area.getPlot(this);
|
||||
} else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -201,13 +201,13 @@ public class Plot {
|
||||
return id != null ? defaultArea.getPlotAbs(id) : null;
|
||||
}
|
||||
} else if (split.length == 3) {
|
||||
PlotArea pa = PS.get().getPlotArea(split[0], null);
|
||||
PlotArea pa = PlotSquared.get().getPlotArea(split[0], null);
|
||||
if (pa != null) {
|
||||
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||
return pa.getPlotAbs(id);
|
||||
}
|
||||
} else if (split.length == 4) {
|
||||
PlotArea pa = PS.get().getPlotArea(split[0], split[1]);
|
||||
PlotArea pa = PlotSquared.get().getPlotArea(split[0], split[1]);
|
||||
if (pa != null) {
|
||||
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||
return pa.getPlotAbs(id);
|
||||
@ -224,7 +224,7 @@ public class Plot {
|
||||
* @see PlotPlayer#getCurrentPlot() if a player is expected here.
|
||||
*/
|
||||
public static Plot getPlot(Location location) {
|
||||
PlotArea pa = PS.get().getPlotAreaAbs(location);
|
||||
PlotArea pa = PlotSquared.get().getPlotAreaAbs(location);
|
||||
if (pa != null) {
|
||||
return pa.getPlot(location);
|
||||
}
|
||||
@ -915,7 +915,7 @@ public class Plot {
|
||||
public void setSign(final String name) {
|
||||
if (!isLoaded())
|
||||
return;
|
||||
if (!PS.get().isMainThread(Thread.currentThread())) {
|
||||
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override public void run() {
|
||||
Plot.this.setSign(name);
|
||||
@ -1002,7 +1002,7 @@ public class Plot {
|
||||
/**
|
||||
* Delete a plot (use null for the runnable if you don't need to be notified on completion)
|
||||
*
|
||||
* @see PS#removePlot(Plot, boolean)
|
||||
* @see PlotSquared#removePlot(Plot, boolean)
|
||||
* @see #clear(Runnable) to simply clear a plot
|
||||
*/
|
||||
public boolean deletePlot(final Runnable whenDone) {
|
||||
@ -1544,12 +1544,12 @@ public class Plot {
|
||||
*/
|
||||
public boolean moveData(Plot plot, Runnable whenDone) {
|
||||
if (this.owner == null) {
|
||||
PS.debug(plot + " is unowned (single)");
|
||||
PlotSquared.debug(plot + " is unowned (single)");
|
||||
TaskManager.runTask(whenDone);
|
||||
return false;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
PS.debug(plot + " is unowned (multi)");
|
||||
PlotSquared.debug(plot + " is unowned (multi)");
|
||||
TaskManager.runTask(whenDone);
|
||||
return false;
|
||||
}
|
||||
@ -2352,7 +2352,7 @@ public class Plot {
|
||||
tmp = this.area.getPlotAbs(this.id.getRelative(0));
|
||||
if (!tmp.getMerged(2)) {
|
||||
// invalid merge
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(this.owner)) {
|
||||
tmp.getSettings().setMerged(2, true);
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
@ -2368,7 +2368,7 @@ public class Plot {
|
||||
tmp = this.area.getPlotAbs(this.id.getRelative(1));
|
||||
if (!tmp.getMerged(3)) {
|
||||
// invalid merge
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(this.owner)) {
|
||||
tmp.getSettings().setMerged(3, true);
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
@ -2384,7 +2384,7 @@ public class Plot {
|
||||
tmp = this.area.getPlotAbs(this.id.getRelative(2));
|
||||
if (!tmp.getMerged(0)) {
|
||||
// invalid merge
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(this.owner)) {
|
||||
tmp.getSettings().setMerged(0, true);
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
@ -2400,7 +2400,7 @@ public class Plot {
|
||||
tmp = this.area.getPlotAbs(this.id.getRelative(3));
|
||||
if (!tmp.getMerged(1)) {
|
||||
// invalid merge
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(this.owner)) {
|
||||
tmp.getSettings().setMerged(1, true);
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
@ -2417,7 +2417,7 @@ public class Plot {
|
||||
if (current.owner == null || current.settings == null) {
|
||||
// Invalid plot
|
||||
// merged onto unclaimed plot
|
||||
PS.debug("Ignoring invalid merged plot: " + current + " | " + current.owner);
|
||||
PlotSquared.debug("Ignoring invalid merged plot: " + current + " | " + current.owner);
|
||||
continue;
|
||||
}
|
||||
tmpSet.add(current);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -189,7 +189,7 @@ public abstract class PlotArea {
|
||||
* @return true if both areas are compatible
|
||||
*/
|
||||
public boolean isCompatible(PlotArea plotArea) {
|
||||
ConfigurationSection section = PS.get().worlds.getConfigurationSection("worlds");
|
||||
ConfigurationSection section = PlotSquared.get().worlds.getConfigurationSection("worlds");
|
||||
for (ConfigurationNode setting : plotArea.getSettingNodes()) {
|
||||
Object constant = section.get(plotArea.worldname + '.' + setting.getConstant());
|
||||
if (constant == null || !constant
|
||||
@ -305,7 +305,7 @@ public abstract class PlotArea {
|
||||
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan
|
||||
PlotSquared.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan
|
||||
.join(flags, ","));
|
||||
this.DEFAULT_FLAGS = new HashMap<>();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
||||
@ -13,7 +13,9 @@ public class PlotMessage {
|
||||
try {
|
||||
reset(ChatManager.manager);
|
||||
} catch (Throwable e) {
|
||||
PS.debug(PS.imp().getPluginName() + " doesn't support fancy chat for " + PS.get().IMP
|
||||
PlotSquared.debug(
|
||||
PlotSquared.imp().getPluginName() + " doesn't support fancy chat for " + PlotSquared
|
||||
.get().IMP
|
||||
.getServerVersion());
|
||||
ChatManager.manager = new PlainChatManager();
|
||||
reset(ChatManager.manager);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -40,7 +40,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
* @return
|
||||
*/
|
||||
public static PlotPlayer wrap(Object player) {
|
||||
return PS.get().IMP.wrapPlayer(player);
|
||||
return PlotSquared.get().IMP.wrapPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,7 +183,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
}
|
||||
final AtomicInteger count = new AtomicInteger(0);
|
||||
final UUID uuid = getUUID();
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea value) {
|
||||
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
||||
for (Plot plot : value.getPlotsAbs(uuid)) {
|
||||
@ -205,7 +205,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
}
|
||||
final AtomicInteger count = new AtomicInteger(0);
|
||||
final UUID uuid = getUUID();
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea value) {
|
||||
for (PlotCluster cluster : value.getClusters()) {
|
||||
if (cluster.isOwner(getUUID())) {
|
||||
@ -226,7 +226,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
public int getPlotCount(String world) {
|
||||
UUID uuid = getUUID();
|
||||
int count = 0;
|
||||
for (PlotArea area : PS.get().getPlotAreas(world)) {
|
||||
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
|
||||
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
||||
for (Plot plot : area.getPlotsAbs(uuid)) {
|
||||
if (!plot.getFlag(Flags.DONE).isPresent()) {
|
||||
@ -243,7 +243,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
public int getClusterCount(String world) {
|
||||
UUID uuid = getUUID();
|
||||
int count = 0;
|
||||
for (PlotArea area : PS.get().getPlotAreas(world)) {
|
||||
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
|
||||
for (PlotCluster cluster : area.getClusters()) {
|
||||
if (cluster.isOwner(getUUID())) {
|
||||
count++;
|
||||
@ -257,11 +257,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
* Get a {@code Set} of plots owned by this player.
|
||||
*
|
||||
* @return a {@code Set} of plots owned by the player
|
||||
* @see PS for more searching functions
|
||||
* @see PlotSquared for more searching functions
|
||||
* @see #getPlotCount() for the number of plots
|
||||
*/
|
||||
public Set<Plot> getPlots() {
|
||||
return PS.get().getPlots(this);
|
||||
return PlotSquared.get().getPlots(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -270,11 +270,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
* @return
|
||||
*/
|
||||
public PlotArea getPlotAreaAbs() {
|
||||
return PS.get().getPlotAreaAbs(getLocation());
|
||||
return PlotSquared.get().getPlotAreaAbs(getLocation());
|
||||
}
|
||||
|
||||
public PlotArea getApplicablePlotArea() {
|
||||
return PS.get().getApplicablePlotArea(getLocation());
|
||||
return PlotSquared.get().getApplicablePlotArea(getLocation());
|
||||
}
|
||||
|
||||
@Override public RequiredType getSuperCaller() {
|
||||
@ -462,7 +462,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
|
||||
for (Plot owned : getPlots()) {
|
||||
owned.deletePlot(null);
|
||||
PS.debug(String
|
||||
PlotSquared.debug(String
|
||||
.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned",
|
||||
plot.getId(), getName()));
|
||||
}
|
||||
@ -472,7 +472,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis());
|
||||
}
|
||||
UUIDHandler.getPlayers().remove(name);
|
||||
PS.get().IMP.unregister(this);
|
||||
PlotSquared.get().IMP.unregister(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -484,7 +484,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
public int getPlayerClusterCount(String world) {
|
||||
UUID uuid = getUUID();
|
||||
int count = 0;
|
||||
for (PlotCluster cluster : PS.get().getClusters(world)) {
|
||||
for (PlotCluster cluster : PlotSquared.get().getClusters(world)) {
|
||||
if (uuid.equals(cluster.owner)) {
|
||||
count += cluster.getArea();
|
||||
}
|
||||
@ -499,7 +499,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
*/
|
||||
public int getPlayerClusterCount() {
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea value) {
|
||||
count.addAndGet(value.getClusters().size());
|
||||
}
|
||||
@ -516,7 +516,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
public Set<Plot> getPlots(String world) {
|
||||
UUID uuid = getUUID();
|
||||
HashSet<Plot> plots = new HashSet<>();
|
||||
for (Plot plot : PS.get().getPlots(world)) {
|
||||
for (Plot plot : PlotSquared.get().getPlots(world)) {
|
||||
if (plot.isOwner(uuid)) {
|
||||
plots.add(plot);
|
||||
}
|
||||
@ -532,7 +532,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
PlotPlayer.this.metaMap = value;
|
||||
if (!value.isEmpty()) {
|
||||
if (Settings.Enabled_Components.PERSISTENT_META) {
|
||||
PlotAreaManager manager = PS.get().getPlotAreaManager();
|
||||
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||
if (manager instanceof SinglePlotAreaManager) {
|
||||
PlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||
byte[] arr = PlotPlayer.this.getPersistentMeta("quitLoc");
|
||||
@ -562,7 +562,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (!PS.get()
|
||||
} else if (!PlotSquared.get()
|
||||
.isMainThread(Thread.currentThread())) {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
if (plot.teleportPlayer(PlotPlayer.this)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
@ -28,7 +28,7 @@ public class SinglePlotManager extends PlotManager {
|
||||
|
||||
@Override public boolean clearPlot(PlotArea plotArea, Plot plot, final Runnable whenDone) {
|
||||
SetupUtils.manager.unload(plot.getWorldName(), false);
|
||||
final File worldFolder = new File(PS.get().IMP.getWorldContainer(), plot.getWorldName());
|
||||
final File worldFolder = new File(PlotSquared.get().IMP.getWorldContainer(), plot.getWorldName());
|
||||
TaskManager.IMP.taskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
MainUtil.deleteDirectory(worldFolder);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
@ -34,7 +34,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
|
||||
}
|
||||
|
||||
@Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||
return ((SinglePlotAreaManager) PS.get().getPlotAreaManager()).getArea();
|
||||
return ((SinglePlotAreaManager) PlotSquared.get().getPlotAreaManager()).getArea();
|
||||
}
|
||||
|
||||
@Override public PlotManager getNewPlotManager() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
|
||||
@ -287,10 +287,10 @@ public class BO3Handler {
|
||||
}
|
||||
|
||||
public static File getBaseFile(String category) {
|
||||
File base = MainUtil.getFile(PS.get().IMP.getDirectory(),
|
||||
File base = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||
Settings.Paths.BO3 + File.separator + category + File.separator + "base.yml");
|
||||
if (!base.exists()) {
|
||||
PS.get().copyFile("base.yml", Settings.Paths.BO3 + File.separator + category);
|
||||
PlotSquared.get().copyFile("base.yml", Settings.Paths.BO3 + File.separator + category);
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
@ -27,7 +27,7 @@ public abstract class ChunkManager {
|
||||
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
|
||||
RunnableVal<ScopedLocalBlockQueue> add, String world, ChunkLoc loc) {
|
||||
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||
if (PS.get().isAugmented(world)) {
|
||||
if (PlotSquared.get().isAugmented(world)) {
|
||||
int bx = loc.x << 4;
|
||||
int bz = loc.z << 4;
|
||||
ScopedLocalBlockQueue scoped =
|
||||
@ -209,7 +209,7 @@ public abstract class ChunkManager {
|
||||
public abstract void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe);
|
||||
|
||||
public Set<ChunkLoc> getChunkChunks(String world) {
|
||||
File folder = new File(PS.get().IMP.getWorldContainer(), world + File.separator + "region");
|
||||
File folder = new File(PlotSquared.get().IMP.getWorldContainer(), world + File.separator + "region");
|
||||
File[] regionFiles = folder.listFiles();
|
||||
HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||
if (regionFiles == null) {
|
||||
@ -244,8 +244,8 @@ public abstract class ChunkManager {
|
||||
String directory =
|
||||
world + File.separator + "region" + File.separator + "r." + loc.x + "."
|
||||
+ loc.z + ".mca";
|
||||
File file = new File(PS.get().IMP.getWorldContainer(), directory);
|
||||
PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory);
|
||||
PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -15,7 +15,7 @@ public abstract class EconHandler {
|
||||
return manager;
|
||||
}
|
||||
initialized = true;
|
||||
return manager = PS.get().IMP.getEconomyHandler();
|
||||
return manager = PlotSquared.get().IMP.getEconomyHandler();
|
||||
}
|
||||
|
||||
public double getMoney(PlotPlayer player) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
@ -57,7 +57,7 @@ public abstract class EventUtil {
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.handleJoin(player);
|
||||
}
|
||||
if (PS.get().worldedit != null) {
|
||||
if (PlotSquared.get().worldedit != null) {
|
||||
if (player.getAttribute("worldedit")) {
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public abstract class EventUtil {
|
||||
|
||||
public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type,
|
||||
Location location, LazyBlock block, boolean notifyPerms) {
|
||||
PlotArea area = PS.get().getPlotAreaAbs(location);
|
||||
PlotArea area = PlotSquared.get().getPlotAreaAbs(location);
|
||||
Plot plot;
|
||||
if (area != null) {
|
||||
plot = area.getPlot(location);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
@ -86,13 +86,13 @@ public class MainUtil {
|
||||
player.sendMessage(C.color(s));
|
||||
}
|
||||
}
|
||||
PS.debug(s);
|
||||
PlotSquared.debug(s);
|
||||
}
|
||||
|
||||
public static void upload(UUID uuid, String file, String extension,
|
||||
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
|
||||
if (writeTask == null) {
|
||||
PS.debug("&cWrite task cannot be null");
|
||||
PlotSquared.debug("&cWrite task cannot be null");
|
||||
TaskManager.runTask(whenDone);
|
||||
return;
|
||||
}
|
||||
@ -403,7 +403,7 @@ public class MainUtil {
|
||||
if (id != null) {
|
||||
continue;
|
||||
}
|
||||
area = PS.get().getPlotAreaByString(term);
|
||||
area = PlotSquared.get().getPlotAreaByString(term);
|
||||
if (area == null) {
|
||||
alias = term;
|
||||
}
|
||||
@ -415,7 +415,7 @@ public class MainUtil {
|
||||
plotList.add(new ArrayList<Plot>());
|
||||
}
|
||||
|
||||
for (Plot plot : PS.get().getPlots()) {
|
||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||
int count = 0;
|
||||
if (!uuids.isEmpty()) {
|
||||
for (UUID uuid : uuids) {
|
||||
@ -463,7 +463,7 @@ public class MainUtil {
|
||||
if (arg == null) {
|
||||
if (player == null) {
|
||||
if (message) {
|
||||
PS.log(C.NOT_VALID_PLOT_WORLD);
|
||||
PlotSquared.log(C.NOT_VALID_PLOT_WORLD);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -471,7 +471,7 @@ public class MainUtil {
|
||||
}
|
||||
PlotArea area;
|
||||
if (player != null) {
|
||||
area = PS.get().getPlotAreaByString(arg);
|
||||
area = PlotSquared.get().getPlotAreaByString(arg);
|
||||
if (area == null) {
|
||||
area = player.getApplicablePlotArea();
|
||||
}
|
||||
@ -481,17 +481,17 @@ public class MainUtil {
|
||||
String[] split = arg.split(";|,");
|
||||
PlotId id;
|
||||
if (split.length == 4) {
|
||||
area = PS.get().getPlotAreaByString(split[0] + ';' + split[1]);
|
||||
area = PlotSquared.get().getPlotAreaByString(split[0] + ';' + split[1]);
|
||||
id = PlotId.fromString(split[2] + ';' + split[3]);
|
||||
} else if (split.length == 3) {
|
||||
area = PS.get().getPlotAreaByString(split[0]);
|
||||
area = PlotSquared.get().getPlotAreaByString(split[0]);
|
||||
id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||
} else if (split.length == 2) {
|
||||
id = PlotId.fromString(arg);
|
||||
} else {
|
||||
Collection<Plot> plots;
|
||||
if (area == null) {
|
||||
plots = PS.get().getPlots();
|
||||
plots = PlotSquared.get().getPlots();
|
||||
} else {
|
||||
plots = area.getPlots();
|
||||
}
|
||||
@ -592,7 +592,7 @@ public class MainUtil {
|
||||
if (!msg.isEmpty()) {
|
||||
if (player == null) {
|
||||
String message = (prefix ? C.PREFIX.s() : "") + msg;
|
||||
PS.log(message);
|
||||
PlotSquared.log(message);
|
||||
} else {
|
||||
player.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
|
||||
}
|
||||
@ -627,7 +627,7 @@ public class MainUtil {
|
||||
@Override public void run() {
|
||||
String m = C.format(caption, args);
|
||||
if (player == null) {
|
||||
PS.log(m);
|
||||
PlotSquared.log(m);
|
||||
} else {
|
||||
player.sendMessage(m);
|
||||
}
|
||||
@ -816,7 +816,7 @@ public class MainUtil {
|
||||
if (file.isDirectory()) {
|
||||
deleteDirectory(files[i]);
|
||||
} else {
|
||||
PS.debug("Deleting file: " + file + " | " + file.delete());
|
||||
PlotSquared.debug("Deleting file: " + file + " | " + file.delete());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user