mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +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.bukkit.uuid.*;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
@ -124,8 +124,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
||||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||||
return new int[] {1, 13, 0};
|
return new int[] {1, 13, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,12 +138,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
this.pluginName = getDescription().getName();
|
this.pluginName = getDescription().getName();
|
||||||
getServer().getName();
|
getServer().getName();
|
||||||
new PS(this, "Bukkit");
|
new PlotSquared(this, "Bukkit");
|
||||||
if (Settings.Enabled_Components.METRICS) {
|
if (Settings.Enabled_Components.METRICS) {
|
||||||
new Metrics(this).start();
|
new Metrics(this).start();
|
||||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||||
} else {
|
} else {
|
||||||
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
TaskManager.IMP.taskRepeat(new Runnable() {
|
TaskManager.IMP.taskRepeat(new Runnable() {
|
||||||
@ -171,7 +171,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
ignore.printStackTrace();
|
ignore.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final PlotAreaManager manager = PS.get().getPlotAreaManager();
|
final PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||||
if (manager instanceof SinglePlotAreaManager) {
|
if (manager instanceof SinglePlotAreaManager) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
final SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
final SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||||
@ -200,7 +200,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
final Chunk[] chunks = world.getLoadedChunks();
|
final Chunk[] chunks = world.getLoadedChunks();
|
||||||
if (chunks.length == 0) {
|
if (chunks.length == 0) {
|
||||||
if (!Bukkit.unloadWorld(world, true)) {
|
if (!Bukkit.unloadWorld(world, true)) {
|
||||||
PS.debug("Failed to unload " + world.getName());
|
PlotSquared.debug("Failed to unload " + world.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -236,7 +236,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onDisable() {
|
@Override public void onDisable() {
|
||||||
PS.get().disable();
|
PlotSquared.get().disable();
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,10 +291,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
||||||
PS.log(C.PREFIX + "KillAllEntities started.");
|
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea plotArea) {
|
@Override public void run(PlotArea plotArea) {
|
||||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||||
try {
|
try {
|
||||||
@ -522,7 +522,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
if (currentPlotId != null) {
|
if (currentPlotId != null) {
|
||||||
entity.setMetadata("plot",
|
entity.setMetadata("plot",
|
||||||
new FixedMetadataValue(
|
new FixedMetadataValue(
|
||||||
(Plugin) PS.get().IMP,
|
(Plugin) PlotSquared.get().IMP,
|
||||||
currentPlotId));
|
currentPlotId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -549,8 +549,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
if (id != null && id.equalsIgnoreCase("single")) {
|
if (id != null && id.equalsIgnoreCase("single")) {
|
||||||
result = new SingleWorldGenerator();
|
result = new SingleWorldGenerator();
|
||||||
} else {
|
} else {
|
||||||
result = PS.get().IMP.getDefaultGenerator();
|
result = PlotSquared.get().IMP.getDefaultGenerator();
|
||||||
if (!PS.get().setupPlotWorld(world, id, result)) {
|
if (!PlotSquared.get().setupPlotWorld(world, id, result)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,30 +565,30 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
Class.forName("org.bukkit.event.entity.EntitySpawnEvent");
|
Class.forName("org.bukkit.event.entity.EntitySpawnEvent");
|
||||||
getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this);
|
getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this);
|
||||||
} catch (final NoSuchMethodException | ClassNotFoundException ignored) {
|
} 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 {
|
try {
|
||||||
getServer().getPluginManager().registerEvents(new EntityPortal_1_7_9(), this);
|
getServer().getPluginManager().registerEvents(new EntityPortal_1_7_9(), this);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
||||||
try {
|
try {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
||||||
try {
|
try {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents183(), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents183(), this);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||||
try {
|
try {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@ -604,7 +604,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
@Override public void registerPlotPlusEvents() {
|
@Override public void registerPlotPlusEvents() {
|
||||||
PlotPlusListener.startRunnable(this);
|
PlotPlusListener.startRunnable(this);
|
||||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), 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);
|
getServer().getPluginManager().registerEvents(new PlotPlusListener_1_12(), this);
|
||||||
} else {
|
} else {
|
||||||
getServer().getPluginManager().registerEvents(new PlotPlusListener_Legacy(), this);
|
getServer().getPluginManager().registerEvents(new PlotPlusListener_Legacy(), this);
|
||||||
@ -629,7 +629,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
return econ;
|
return econ;
|
||||||
}
|
}
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
PS.debug("No economy detected!");
|
PlotSquared.debug("No economy detected!");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -639,20 +639,20 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
new SendChunk();
|
new SendChunk();
|
||||||
MainUtil.canSendChunk = true;
|
MainUtil.canSendChunk = true;
|
||||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||||
MainUtil.canSendChunk = false;
|
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);
|
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);
|
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);
|
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_8.class, BukkitLocalQueue.class);
|
||||||
}
|
}
|
||||||
return QueueProvider.of(BukkitLocalQueue_1_7.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);
|
return new BukkitPlotGenerator(world, gen);
|
||||||
} else {
|
} 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;
|
Settings.UUID.OFFLINE = true;
|
||||||
}
|
}
|
||||||
if (!checkVersion) {
|
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.");
|
+ " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||||
Settings.TITLES = false;
|
Settings.TITLES = false;
|
||||||
} else {
|
} else {
|
||||||
@ -733,11 +733,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.UUID.OFFLINE) {
|
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 "
|
+ " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
|
||||||
+ "Bukkit");
|
+ "Bukkit");
|
||||||
} else {
|
} 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) {
|
if (Settings.UUID.USE_SQLUUIDHANDLER) {
|
||||||
return new SQLUUIDHandler(wrapper);
|
return new SQLUUIDHandler(wrapper);
|
||||||
@ -776,7 +776,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
@Override public void startMetrics() {
|
@Override public void startMetrics() {
|
||||||
new Metrics(this).start();
|
new Metrics(this).start();
|
||||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setGenerator(@NonNull final String worldName) {
|
@Override public void setGenerator(@NonNull final String worldName) {
|
||||||
@ -784,7 +784,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
if (world == null) {
|
if (world == null) {
|
||||||
// create world
|
// create world
|
||||||
ConfigurationSection worldConfig =
|
ConfigurationSection worldConfig =
|
||||||
PS.get().worlds.getConfigurationSection("worlds." + worldName);
|
PlotSquared.get().worlds.getConfigurationSection("worlds." + worldName);
|
||||||
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
||||||
SetupObject setup = new SetupObject();
|
SetupObject setup = new SetupObject();
|
||||||
setup.plotManager = manager;
|
setup.plotManager = manager;
|
||||||
@ -797,22 +797,22 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
world = Bukkit.getWorld(worldName);
|
world = Bukkit.getWorld(worldName);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (!PS.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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);
|
Bukkit.getServer().unloadWorld(world, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChunkGenerator gen = world.getGenerator();
|
ChunkGenerator gen = world.getGenerator();
|
||||||
if (gen instanceof BukkitPlotGenerator) {
|
if (gen instanceof BukkitPlotGenerator) {
|
||||||
PS.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
PlotSquared.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
||||||
} else if (gen != null) {
|
} else if (gen != null) {
|
||||||
PS.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
|
PlotSquared.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
|
||||||
} else if (PS.get().worlds.contains("worlds." + worldName)) {
|
} else if (PlotSquared.get().worlds.contains("worlds." + worldName)) {
|
||||||
PS.get().loadWorld(worldName, null);
|
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.bukkit.uuid.OfflineUUIDWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.commands.Argument;
|
import com.github.intellectualsites.plotsquared.commands.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.CommandCategory;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.SubCommand;
|
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)");
|
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()) {
|
if (file.exists()) {
|
||||||
try {
|
try {
|
||||||
List<String> lines =
|
List<String> lines =
|
||||||
@ -220,7 +220,7 @@ public class DebugUUID extends SubCommand {
|
|||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Updating plot objects");
|
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);
|
UUID value = uCMap.get(plot.owner);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
plot.owner = value;
|
plot.owner = value;
|
||||||
@ -239,13 +239,13 @@ public class DebugUUID extends SubCommand {
|
|||||||
DBFunc.createTables();
|
DBFunc.createTables();
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, "&cConversion failed! Attempting recovery");
|
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);
|
UUID value = uCReverse.get(plot.owner);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
plot.owner = value;
|
plot.owner = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.createPlotsAndData(new ArrayList<>(PS.get().getPlots()),
|
DBFunc.createPlotsAndData(new ArrayList<>(PlotSquared.get().getPlots()),
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
MainUtil.sendMessage(player, "&6Recovery was successful!");
|
MainUtil.sendMessage(player, "&6Recovery was successful!");
|
||||||
@ -259,14 +259,14 @@ public class DebugUUID extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newWrapper instanceof OfflineUUIDWrapper) {
|
if (newWrapper instanceof OfflineUUIDWrapper) {
|
||||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
PlotSquared.get().worlds.set("UUID.force-lowercase", false);
|
||||||
PS.get().worlds.set("UUID.offline", true);
|
PlotSquared.get().worlds.set("UUID.offline", true);
|
||||||
} else if (newWrapper instanceof DefaultUUIDWrapper) {
|
} else if (newWrapper instanceof DefaultUUIDWrapper) {
|
||||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
PlotSquared.get().worlds.set("UUID.force-lowercase", false);
|
||||||
PS.get().worlds.set("UUID.offline", false);
|
PlotSquared.get().worlds.set("UUID.offline", false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"Could not save configuration. It will need to be manual set!");
|
"Could not save configuration. It will need to be manual set!");
|
||||||
@ -276,7 +276,7 @@ public class DebugUUID extends SubCommand {
|
|||||||
|
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@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() {
|
DBFunc.createPlotsAndData(plots, new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
MainUtil.sendMessage(player, "&aConversion complete!");
|
MainUtil.sendMessage(player, "&aConversion complete!");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
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.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
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) {
|
public void copyConfig(FileConfiguration plotConfig, String world, String actualWorldName) {
|
||||||
int pathWidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
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"); //
|
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"); //
|
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"); //
|
String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
||||||
PS.get().worlds
|
PlotSquared.get().worlds
|
||||||
.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
||||||
String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
||||||
PS.get().worlds
|
PlotSquared.get().worlds
|
||||||
.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
||||||
String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
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"); //
|
int height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) {
|
public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
||||||
@ -68,8 +68,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
if (!plots.containsKey(world)) {
|
if (!plots.containsKey(world)) {
|
||||||
plots.put(world, new HashMap<PlotId, Plot>());
|
plots.put(world, new HashMap<PlotId, Plot>());
|
||||||
if (merge) {
|
if (merge) {
|
||||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width");
|
||||||
plotWidth.put(world, plot);
|
plotWidth.put(world, plot);
|
||||||
roadWidth.put(world, path);
|
roadWidth.put(world, path);
|
||||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
merges.put(world, new HashMap<PlotId, boolean[]>());
|
||||||
@ -113,7 +113,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
PlotSquared
|
||||||
|
.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||||
missing++;
|
missing++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -127,10 +128,10 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
plots.get(world).put(id, plot);
|
plots.get(world).put(id, plot);
|
||||||
}
|
}
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
PS.log("&cSome names could not be identified:");
|
PlotSquared.log("&cSome names could not be identified:");
|
||||||
PS.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
PlotSquared.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");
|
PlotSquared.log("&7 - Names you have never seen before could be from people mistyping commands");
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"&7 - Converting from a non-uuid version of PlotMe can't identify owners if the playerdata files are deleted (these plots will "
|
"&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)");
|
+ "remain unknown until the player connects)");
|
||||||
}
|
}
|
||||||
@ -151,7 +152,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
PS.log(" - " + this.prefix + "Denied");
|
PlotSquared.log(" - " + this.prefix + "Denied");
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Denied`");
|
statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Denied`");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (denied == null) {
|
if (denied == null) {
|
||||||
PS.log("&6Could not identify denied for plot: " + id);
|
PlotSquared.log("&6Could not identify denied for plot: " + id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +210,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (helper == null) {
|
if (helper == null) {
|
||||||
PS.log("&6Could not identify helper for plot: " + id);
|
PlotSquared.log("&6Could not identify helper for plot: " + id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +232,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean accepts(String version) {
|
@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);
|
.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.MemorySection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -47,7 +47,7 @@ public class LikePlotMeConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(String message) {
|
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() {
|
public String getPlotMePath() {
|
||||||
@ -96,7 +96,7 @@ public class LikePlotMeConverter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
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-DefaultGenerator", pluginName);
|
||||||
content = content.replace("PlotMe", pluginName);
|
content = content.replace("PlotMe", pluginName);
|
||||||
content = content.replace("AthionPlots", pluginName);
|
content = content.replace("AthionPlots", pluginName);
|
||||||
@ -110,32 +110,32 @@ public class LikePlotMeConverter {
|
|||||||
String actualWorldName = getWorld(world);
|
String actualWorldName = getWorld(world);
|
||||||
String plotMeWorldName = world.toLowerCase();
|
String plotMeWorldName = world.toLowerCase();
|
||||||
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
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",
|
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight",
|
||||||
plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); //
|
plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); //
|
||||||
PS.get().worlds.set("worlds." + world + ".road.height", height);
|
PlotSquared.get().worlds.set("worlds." + world + ".road.height", height);
|
||||||
PS.get().worlds.set("worlds." + world + ".wall.height", height);
|
PlotSquared.get().worlds.set("worlds." + world + ".wall.height", height);
|
||||||
PS.get().worlds.set("worlds." + world + ".plot.height", height);
|
PlotSquared.get().worlds.set("worlds." + world + ".plot.height", height);
|
||||||
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
|
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",
|
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".UnclaimedBorder",
|
||||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44")); //
|
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 =
|
String claimed =
|
||||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".ProtectedWallBlock", "44:1"); //
|
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 =
|
String floor =
|
||||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
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"); //
|
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
|
||||||
PS.get().worlds
|
PlotSquared.get().worlds
|
||||||
.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
||||||
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
||||||
PS.get().worlds.set("worlds." + world + ".road.block", road);
|
PlotSquared.get().worlds.set("worlds." + world + ".road.block", road);
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean run(APlotMeConnector connector) {
|
public boolean run(APlotMeConnector connector) {
|
||||||
@ -154,7 +154,7 @@ public class LikePlotMeConverter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PS.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
PlotSquared.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
||||||
|
|
||||||
Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder);
|
Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder);
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ public class LikePlotMeConverter {
|
|||||||
try {
|
try {
|
||||||
String actualWorldName = getWorld(world);
|
String actualWorldName = getWorld(world);
|
||||||
connector.copyConfig(plotConfig, world, actualWorldName);
|
connector.copyConfig(plotConfig, world, actualWorldName);
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sendMessage("&c-- &lFailed to save configuration for world '" + world
|
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()) {
|
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||||
String world = entry.getKey();
|
String world = entry.getKey();
|
||||||
PlotArea area = PS.get().getPlotArea(world, null);
|
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||||
int duplicate = 0;
|
int duplicate = 0;
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
@ -235,13 +235,13 @@ public class LikePlotMeConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (duplicate > 0) {
|
if (duplicate > 0) {
|
||||||
PS.debug("&c[WARNING] Found " + duplicate
|
PlotSquared.debug("&c[WARNING] Found " + duplicate
|
||||||
+ " duplicate plots already in DB for world: '" + world
|
+ " duplicate plots already in DB for world: '" + world
|
||||||
+ "'. Have you run the converter already?");
|
+ "'. Have you run the converter already?");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (PS.get().plots_tmp != null) {
|
if (PlotSquared.get().plots_tmp != null) {
|
||||||
HashMap<PlotId, Plot> map = PS.get().plots_tmp.get(world);
|
HashMap<PlotId, Plot> map = PlotSquared.get().plots_tmp.get(world);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
if (map.containsKey(entry2.getKey())) {
|
if (map.containsKey(entry2.getKey())) {
|
||||||
@ -251,7 +251,7 @@ public class LikePlotMeConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (duplicate > 0) {
|
if (duplicate > 0) {
|
||||||
PS.debug("&c[WARNING] Found " + duplicate
|
PlotSquared.debug("&c[WARNING] Found " + duplicate
|
||||||
+ " duplicate plots already in DB for world: '" + world
|
+ " duplicate plots already in DB for world: '" + world
|
||||||
+ "'. Have you run the converter already?");
|
+ "'. Have you run the converter already?");
|
||||||
}
|
}
|
||||||
@ -269,13 +269,13 @@ public class LikePlotMeConverter {
|
|||||||
if (done.get()) {
|
if (done.get()) {
|
||||||
done();
|
done();
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
sendMessage("&aDatabase conversion is now complete!");
|
||||||
PS.debug("&c - Stop the server");
|
PlotSquared.debug("&c - Stop the server");
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
"&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");
|
"&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");
|
||||||
PS.get().setPlots(DBFunc.getPlots());
|
PlotSquared.get().setPlots(DBFunc.getPlots());
|
||||||
} else {
|
} else {
|
||||||
sendMessage(
|
sendMessage(
|
||||||
"&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
"&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...");
|
sendMessage("Saving configuration...");
|
||||||
try {
|
try {
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
sendMessage(" - &cFailed to save configuration.");
|
sendMessage(" - &cFailed to save configuration.");
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ public class LikePlotMeConverter {
|
|||||||
sendMessage(
|
sendMessage(
|
||||||
"&cYou need to stop the server to reload this world properly");
|
"&cYou need to stop the server to reload this world properly");
|
||||||
} else {
|
} else {
|
||||||
PS.get().removePlotAreas(actualWorldName);
|
PlotSquared.get().removePlotAreas(actualWorldName);
|
||||||
if (mv) {
|
if (mv) {
|
||||||
// unload world with MV
|
// unload world with MV
|
||||||
Bukkit.getServer()
|
Bukkit.getServer()
|
||||||
@ -330,7 +330,7 @@ public class LikePlotMeConverter {
|
|||||||
// load world with MV
|
// load world with MV
|
||||||
Bukkit.getServer()
|
Bukkit.getServer()
|
||||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv import " + actualWorldName + " normal -g " + PS
|
"mv import " + actualWorldName + " normal -g " + PlotSquared
|
||||||
.imp().getPluginName());
|
.imp().getPluginName());
|
||||||
} else if (mw) {
|
} else if (mw) {
|
||||||
// unload world with MW
|
// unload world with MW
|
||||||
@ -345,14 +345,15 @@ public class LikePlotMeConverter {
|
|||||||
// load world with MW
|
// load world with MW
|
||||||
Bukkit.getServer()
|
Bukkit.getServer()
|
||||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mw create " + actualWorldName + " plugin:" + PS.imp()
|
"mw create " + actualWorldName + " plugin:" + PlotSquared
|
||||||
|
.imp()
|
||||||
.getPluginName());
|
.getPluginName());
|
||||||
} else {
|
} else {
|
||||||
// Load using Bukkit API
|
// Load using Bukkit API
|
||||||
// - User must set generator manually
|
// - User must set generator manually
|
||||||
Bukkit.getServer().unloadWorld(world, true);
|
Bukkit.getServer().unloadWorld(world, true);
|
||||||
World myWorld = WorldCreator.name(actualWorldName).generator(
|
World myWorld = WorldCreator.name(actualWorldName).generator(
|
||||||
new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator()))
|
new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator()))
|
||||||
.createWorld();
|
.createWorld();
|
||||||
myWorld.save();
|
myWorld.save();
|
||||||
}
|
}
|
||||||
@ -364,12 +365,12 @@ public class LikePlotMeConverter {
|
|||||||
if (done.get()) {
|
if (done.get()) {
|
||||||
done();
|
done();
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
sendMessage("&aDatabase conversion is now complete!");
|
||||||
PS.debug("&c - Stop the server");
|
PlotSquared.debug("&c - Stop the server");
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
"&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");
|
"&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 {
|
} else {
|
||||||
sendMessage(
|
sendMessage(
|
||||||
"&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
"&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) {
|
} catch (InterruptedException | SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("&/end/");
|
PlotSquared.debug("&/end/");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void done() {
|
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;
|
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
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`");
|
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_plots`");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
PS.debug("========= Table does not exist =========");
|
PlotSquared.debug("========= Table does not exist =========");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("=======================================");
|
PlotSquared.debug("=======================================");
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"&8 - &7The database does not match the version specified in the PlotMe config");
|
"&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;
|
return null;
|
||||||
}
|
}
|
||||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
||||||
@ -70,8 +70,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
String name = resultSet.getString("owner");
|
String name = resultSet.getString("owner");
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
||||||
if (!plots.containsKey(world) && merge) {
|
if (!plots.containsKey(world) && merge) {
|
||||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width");
|
||||||
plotWidth.put(world, plot);
|
plotWidth.put(world, plot);
|
||||||
roadWidth.put(world, path);
|
roadWidth.put(world, path);
|
||||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
merges.put(world, new HashMap<PlotId, boolean[]>());
|
||||||
@ -111,7 +111,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"&cCould not identify owner for plot: " + id + " -> '" + name + '\'');
|
"&cCould not identify owner for plot: " + id + " -> '" + name + '\'');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
resultSet.close();
|
resultSet.close();
|
||||||
statement.close();
|
statement.close();
|
||||||
try {
|
try {
|
||||||
PS.log(" - " + this.plugin + "core_denied");
|
PlotSquared.log(" - " + this.plugin + "core_denied");
|
||||||
statement =
|
statement =
|
||||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_denied`");
|
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_denied`");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
@ -142,7 +142,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
int key = resultSet.getInt("plot_id");
|
int key = resultSet.getInt("plot_id");
|
||||||
Plot plot = plots.get(key);
|
Plot plot = plots.get(key);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
PS.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
PlotSquared.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String player = resultSet.getString("player");
|
String player = resultSet.getString("player");
|
||||||
@ -150,7 +150,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
plot.getDenied().add(denied);
|
plot.getDenied().add(denied);
|
||||||
}
|
}
|
||||||
|
|
||||||
PS.log(" - " + this.plugin + "core_allowed");
|
PlotSquared.log(" - " + this.plugin + "core_allowed");
|
||||||
statement =
|
statement =
|
||||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_allowed`");
|
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_allowed`");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
@ -159,7 +159,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
int key = resultSet.getInt("plot_id");
|
int key = resultSet.getInt("plot_id");
|
||||||
Plot plot = plots.get(key);
|
Plot plot = plots.get(key);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
PS.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
PlotSquared.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String player = resultSet.getString("player");
|
String player = resultSet.getString("player");
|
||||||
@ -189,6 +189,6 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
if (version == null) {
|
if (version == null) {
|
||||||
return false;
|
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.BukkitUtil;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk;
|
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.GeneratorWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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;
|
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());
|
ChunkWrapper wrap = new ChunkWrapper(area.worldname, c.getX(), c.getZ());
|
||||||
ScopedLocalBlockQueue chunk = queue.getForChunk(wrap.x, wrap.z);
|
ScopedLocalBlockQueue chunk = queue.getForChunk(wrap.x, wrap.z);
|
||||||
if (BukkitPlotGenerator.this.plotGenerator
|
if (BukkitPlotGenerator.this.plotGenerator
|
||||||
@ -98,7 +98,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
+ " is already a BukkitPlotGenerator!");
|
+ " is already a BukkitPlotGenerator!");
|
||||||
}
|
}
|
||||||
this.full = false;
|
this.full = false;
|
||||||
PS.debug("BukkitPlotGenerator does not fully support: " + cg);
|
PlotSquared.debug("BukkitPlotGenerator does not fully support: " + cg);
|
||||||
this.platformGenerator = cg;
|
this.platformGenerator = cg;
|
||||||
this.plotGenerator = new IndependentPlotGenerator() {
|
this.plotGenerator = new IndependentPlotGenerator() {
|
||||||
@Override public void processSetup(SetupObject setup) {
|
@Override public void processSetup(SetupObject setup) {
|
||||||
@ -108,7 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotManager getNewPlotManager() {
|
@Override public PlotManager getNewPlotManager() {
|
||||||
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
|
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getName() {
|
@Override public String getName() {
|
||||||
@ -117,7 +117,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
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
|
@Override
|
||||||
@ -199,8 +199,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
try {
|
try {
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
String name = world.getName();
|
String name = world.getName();
|
||||||
PS.get().loadWorld(name, this);
|
PlotSquared.get().loadWorld(name, this);
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(name);
|
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(name);
|
||||||
if (!areas.isEmpty()) {
|
if (!areas.isEmpty()) {
|
||||||
PlotArea area = areas.iterator().next();
|
PlotArea area = areas.iterator().next();
|
||||||
if (!area.MOB_SPAWNING) {
|
if (!area.MOB_SPAWNING) {
|
||||||
@ -276,7 +276,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
// Load if improperly loaded
|
// Load if improperly loaded
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
String name = world.getName();
|
String name = world.getName();
|
||||||
PS.get().loadWorld(name, this);
|
PlotSquared.get().loadWorld(name, this);
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
}
|
}
|
||||||
// Set random seed
|
// Set random seed
|
||||||
@ -285,7 +285,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
if (ChunkManager.preProcessChunk(result)) {
|
if (ChunkManager.preProcessChunk(result)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
||||||
try {
|
try {
|
||||||
this.plotGenerator.generateChunk(this.chunkSetter, area, this.random);
|
this.plotGenerator.generateChunk(this.chunkSetter, area, this.random);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -47,7 +47,7 @@ public class ChunkListener implements Listener {
|
|||||||
this.mustSave = classChunk.getField("mustSave");
|
this.mustSave = classChunk.getField("mustSave");
|
||||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
PS.debug(PS.imp().getPluginName()
|
PlotSquared.debug(PlotSquared.imp().getPluginName()
|
||||||
+ "/Server not compatible for chunk processor trim/gc");
|
+ "/Server not compatible for chunk processor trim/gc");
|
||||||
Settings.Chunk_Processor.AUTO_TRIM = false;
|
Settings.Chunk_Processor.AUTO_TRIM = false;
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ public class ChunkListener implements Listener {
|
|||||||
HashSet<Chunk> toUnload = new HashSet<>();
|
HashSet<Chunk> toUnload = new HashSet<>();
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
String worldName = world.getName();
|
String worldName = world.getName();
|
||||||
if (!PS.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
|
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
|
||||||
@ -153,7 +153,7 @@ public class ChunkListener implements Listener {
|
|||||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
||||||
Chunk chunk = event.getChunk();
|
Chunk chunk = event.getChunk();
|
||||||
String world = chunk.getWorld().getName();
|
String world = chunk.getWorld().getName();
|
||||||
if (PS.get().hasPlotArea(world)) {
|
if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
if (unloadChunk(world, chunk, true)) {
|
if (unloadChunk(world, chunk, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ public class ChunkListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
@ -205,7 +205,7 @@ public class ChunkListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
@ -226,7 +226,7 @@ public class ChunkListener implements Listener {
|
|||||||
if (!chunk.isLoaded()) {
|
if (!chunk.isLoaded()) {
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(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);
|
chunk.unload(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ public class ChunkListener implements Listener {
|
|||||||
if (tiles.length == 0) {
|
if (tiles.length == 0) {
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(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);
|
chunk.unload(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ public class ChunkListener implements Listener {
|
|||||||
if (i >= tiles.length) {
|
if (i >= tiles.length) {
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(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);
|
chunk.unload(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ public class ChunkListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean processChunk(Chunk chunk, boolean unload) {
|
public boolean processChunk(Chunk chunk, boolean unload) {
|
||||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
@ -268,12 +268,14 @@ public class ChunkListener implements Listener {
|
|||||||
ent.remove();
|
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));
|
+ "," + (chunk.getX() << 4));
|
||||||
}
|
}
|
||||||
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
||||||
if (unload) {
|
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));
|
chunk.getX() << 4));
|
||||||
cleanChunk(chunk);
|
cleanChunk(chunk);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
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.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
@ -28,9 +28,9 @@ public class EntityPortal_1_7_9 implements Listener {
|
|||||||
List<MetadataValue> meta = entity.getMetadata("plotworld");
|
List<MetadataValue> meta = entity.getMetadata("plotworld");
|
||||||
World world = entity.getLocation().getWorld();
|
World world = entity.getLocation().getWorld();
|
||||||
if (meta == null || meta.isEmpty()) {
|
if (meta == null || meta.isEmpty()) {
|
||||||
if (PS.get().hasPlotArea(world.getName())) {
|
if (PlotSquared.get().hasPlotArea(world.getName())) {
|
||||||
entity.setMetadata("plotworld",
|
entity.setMetadata("plotworld",
|
||||||
new FixedMetadataValue((Plugin) PS.get().IMP, entity.getLocation()));
|
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Location origin = (Location) meta.get(0).value();
|
Location origin = (Location) meta.get(0).value();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -54,7 +54,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
case SHULKER:
|
case SHULKER:
|
||||||
if (!entity.hasMetadata("plot")) {
|
if (!entity.hasMetadata("plot")) {
|
||||||
entity.setMetadata("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.object.BukkitPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
@ -66,7 +66,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
private Field fieldPlayer;
|
private Field fieldPlayer;
|
||||||
private PlayerMoveEvent moveTmp;
|
private PlayerMoveEvent moveTmp;
|
||||||
private boolean v112 =
|
private boolean v112 =
|
||||||
PS.get().checkVersion(PS.imp().getServerVersion(), BukkitVersion.v1_12_0);
|
PlotSquared.get().checkVersion(PlotSquared.imp().getServerVersion(), BukkitVersion.v1_12_0);
|
||||||
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -483,7 +483,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location l = BukkitUtil.getLocation(entity);
|
Location l = BukkitUtil.getLocation(entity);
|
||||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
@ -497,7 +497,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||||
Projectile entity = event.getEntity();
|
Projectile entity = event.getEntity();
|
||||||
Location loc = BukkitUtil.getLocation(entity);
|
Location loc = BukkitUtil.getLocation(entity);
|
||||||
if (!PS.get().hasPlotArea(loc.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
@ -685,7 +685,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlotPlayer pp = PlotPlayer.wrap(player);
|
PlotPlayer pp = PlotPlayer.wrap(player);
|
||||||
Location loc = BukkitUtil.getLocation(to);
|
Location loc = BukkitUtil.getLocation(to);
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(loc);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(loc);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -776,7 +776,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (toPlot != null) {
|
} else if (toPlot != null) {
|
||||||
vehicle.setMetadata("plot",
|
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);
|
player.sendMessage(spyMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS.debug(full);
|
PlotSquared.debug(full);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
|
@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)) {
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PS.get().worldedit != null && pp.getAttribute("worldedit")) {
|
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||||
if (player.getItemInHand().getTypeId() == PS.get().worldedit
|
if (player.getItemInHand().getTypeId() == PlotSquared.get().worldedit
|
||||||
.getConfiguration().wandItem) {
|
.getConfiguration().wandItem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1036,7 +1036,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Location location = BukkitUtil.getLocation(event.getLocation());
|
Location location = BukkitUtil.getLocation(event.getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Iterator<Block> iterator = event.blockList().iterator();
|
Iterator<Block> iterator = event.blockList().iterator();
|
||||||
@ -1066,7 +1066,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
.equals(EntityType.MINECART_TNT)) {
|
.equals(EntityType.MINECART_TNT)) {
|
||||||
if (!near.hasMetadata("plot")) {
|
if (!near.hasMetadata("plot")) {
|
||||||
near.setMetadata("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) {
|
if (plot != null) {
|
||||||
plotExit(pp, plot);
|
plotExit(pp, plot);
|
||||||
}
|
}
|
||||||
if (PS.get().worldedit != null) {
|
if (PlotSquared.get().worldedit != null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
||||||
if (pp.getAttribute("worldedit")) {
|
if (pp.getAttribute("worldedit")) {
|
||||||
pp.removeAttribute("worldedit");
|
pp.removeAttribute("worldedit");
|
||||||
@ -1108,7 +1108,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
pp.deleteMeta("perm");
|
pp.deleteMeta("perm");
|
||||||
}
|
}
|
||||||
Location loc = pp.getLocation();
|
Location loc = pp.getLocation();
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(loc);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(loc);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1136,7 +1136,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityBlockForm(EntityBlockFormEvent event) {
|
public void onEntityBlockForm(EntityBlockFormEvent event) {
|
||||||
String world = event.getBlock().getWorld().getName();
|
String world = event.getBlock().getWorld().getName();
|
||||||
if (!PS.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
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());
|
Vector relative = new Vector(face.getModX(), face.getModY(), face.getModZ());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Block b : event.getBlocks()) {
|
for (Block b : event.getBlocks()) {
|
||||||
@ -1419,7 +1419,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.pistonBlocks) {
|
if (this.pistonBlocks) {
|
||||||
@ -1512,7 +1512,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onStructureGrow(StructureGrowEvent event) {
|
public void onStructureGrow(StructureGrowEvent event) {
|
||||||
if (!PS.get().hasPlotArea(event.getWorld().getName())) {
|
if (!PlotSquared.get().hasPlotArea(event.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<BlockState> blocks = event.getBlocks();
|
List<BlockState> blocks = event.getBlocks();
|
||||||
@ -1761,8 +1761,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PS.get().worldedit != null && pp.getAttribute("worldedit")) {
|
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||||
if (player.getItemInHand().getTypeId() == PS.get().worldedit
|
if (player.getItemInHand().getTypeId() == PlotSquared.get().worldedit
|
||||||
.getConfiguration().wandItem) {
|
.getConfiguration().wandItem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1832,7 +1832,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
World world = block.getWorld();
|
World world = block.getWorld();
|
||||||
String worldName = world.getName();
|
String worldName = world.getName();
|
||||||
if (!PS.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
@ -1858,7 +1858,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (event.getTo() == Material.AIR) {
|
} else if (event.getTo() == Material.AIR) {
|
||||||
event.getEntity()
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
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) {
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
ThrownPotion damager = event.getPotion();
|
ThrownPotion damager = event.getPotion();
|
||||||
Location l = BukkitUtil.getLocation(damager);
|
Location l = BukkitUtil.getLocation(damager);
|
||||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -2332,7 +2332,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||||
EntityDamageByEntityEvent eventChange = null;
|
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(),
|
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
||||||
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
||||||
} else {
|
} else {
|
||||||
@ -2359,7 +2359,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
Entity damager = event.getDamager();
|
Entity damager = event.getDamager();
|
||||||
Location l = BukkitUtil.getLocation(damager);
|
Location l = BukkitUtil.getLocation(damager);
|
||||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity victim = event.getEntity();
|
Entity victim = event.getEntity();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
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.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -20,7 +20,7 @@ public class PlayerEvents183 implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
String world = location.getWorld();
|
String world = location.getWorld();
|
||||||
if (!PS.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
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.config.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||||
@ -42,7 +42,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HumanEntity entity = event.getWhoClicked();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
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 com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import org.bukkit.entity.LingeringPotion;
|
import org.bukkit.entity.LingeringPotion;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -21,7 +21,7 @@ public class PlayerEvents_1_9 implements Listener {
|
|||||||
public void onPotionSplash(LingeringPotionSplashEvent event) {
|
public void onPotionSplash(LingeringPotionSplashEvent event) {
|
||||||
LingeringPotion entity = event.getEntity();
|
LingeringPotion entity = event.getEntity();
|
||||||
Location l = BukkitUtil.getLocation(entity);
|
Location l = BukkitUtil.getLocation(entity);
|
||||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!parent.onProjectileHit(event)) {
|
if (!parent.onProjectileHit(event)) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
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.PlotAreaManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
|
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
|
||||||
@ -58,7 +58,7 @@ public class SingleWorldListener implements Listener {
|
|||||||
private void handle(ChunkEvent event) {
|
private void handle(ChunkEvent event) {
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
String name = world.getName();
|
String name = world.getName();
|
||||||
PlotAreaManager man = PS.get().getPlotAreaManager();
|
PlotAreaManager man = PlotSquared.get().getPlotAreaManager();
|
||||||
if (!(man instanceof SinglePlotAreaManager))
|
if (!(man instanceof SinglePlotAreaManager))
|
||||||
return;
|
return;
|
||||||
if (!isPlotId(name))
|
if (!isPlotId(name))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
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.generator.GeneratorWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||||
@ -18,7 +18,7 @@ public class WorldEvents implements Listener {
|
|||||||
public void onWorldInit(WorldInitEvent event) {
|
public void onWorldInit(WorldInitEvent event) {
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
String name = world.getName();
|
String name = world.getName();
|
||||||
PlotAreaManager manager = PS.get().getPlotAreaManager();
|
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||||
if (manager instanceof SinglePlotAreaManager) {
|
if (manager instanceof SinglePlotAreaManager) {
|
||||||
SinglePlotAreaManager single = (SinglePlotAreaManager) manager;
|
SinglePlotAreaManager single = (SinglePlotAreaManager) manager;
|
||||||
if (single.isWorld(name)) {
|
if (single.isWorld(name)) {
|
||||||
@ -28,9 +28,9 @@ public class WorldEvents implements Listener {
|
|||||||
}
|
}
|
||||||
ChunkGenerator gen = world.getGenerator();
|
ChunkGenerator gen = world.getGenerator();
|
||||||
if (gen instanceof GeneratorWrapper) {
|
if (gen instanceof GeneratorWrapper) {
|
||||||
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||||
} else {
|
} 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;
|
package com.github.intellectualsites.plotsquared.bukkit.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
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.config.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -76,7 +76,7 @@ public class BukkitPlayer extends PlotPlayer {
|
|||||||
private void callEvent(final Event event) {
|
private void callEvent(final Event event) {
|
||||||
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||||
for (RegisteredListener listener : listeners) {
|
for (RegisteredListener listener : listeners) {
|
||||||
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
|
if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
|
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion;
|
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.*;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
@ -53,7 +53,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
if (depth == 1) {
|
if (depth == 1) {
|
||||||
return;
|
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) {
|
|| entity instanceof ArmorStand) {
|
||||||
if (!entity.hasGravity()) {
|
if (!entity.hasGravity()) {
|
||||||
this.noGravity = true;
|
this.noGravity = true;
|
||||||
@ -62,7 +62,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case ARROW:
|
case ARROW:
|
||||||
case BOAT:
|
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 boat = (Boat) entity;
|
||||||
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
// Do this stuff later
|
// Do this stuff later
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||||
return;
|
return;
|
||||||
// MISC //
|
// MISC //
|
||||||
case DROPPED_ITEM:
|
case DROPPED_ITEM:
|
||||||
@ -322,7 +323,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
|
|
||||||
void restoreEquipment(LivingEntity entity) {
|
void restoreEquipment(LivingEntity entity) {
|
||||||
EntityEquipment equipment = entity.getEquipment();
|
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.setItemInMainHand(this.lived.mainHand);
|
||||||
equipment.setItemInOffHand(this.lived.offHand);
|
equipment.setItemInOffHand(this.lived.offHand);
|
||||||
} else {
|
} else {
|
||||||
@ -338,7 +339,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
try {
|
try {
|
||||||
entity.getInventory().setContents(this.inventory);
|
entity.getInventory().setContents(this.inventory);
|
||||||
} catch (IllegalArgumentException e) {
|
} 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) {
|
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.mainHand = equipment.getItemInMainHand().clone();
|
||||||
this.lived.offHand = equipment.getItemInOffHand().clone();
|
this.lived.offHand = equipment.getItemInOffHand().clone();
|
||||||
} else {
|
} else {
|
||||||
@ -458,7 +459,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
if (this.depth == 1) {
|
if (this.depth == 1) {
|
||||||
return entity;
|
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) {
|
|| entity instanceof ArmorStand) {
|
||||||
if (this.noGravity) {
|
if (this.noGravity) {
|
||||||
entity.setGravity(false);
|
entity.setGravity(false);
|
||||||
@ -467,7 +468,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case ARROW:
|
case ARROW:
|
||||||
case BOAT:
|
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 boat = (Boat) entity;
|
||||||
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
||||||
}
|
}
|
||||||
@ -512,7 +514,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
// Do this stuff later
|
// Do this stuff later
|
||||||
return entity;
|
return entity;
|
||||||
default:
|
default:
|
||||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||||
return entity;
|
return entity;
|
||||||
// MISC //
|
// MISC //
|
||||||
case ITEM_FRAME:
|
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.object.BukkitPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion;
|
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.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
|
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -12,7 +12,8 @@ import org.bukkit.entity.Player;
|
|||||||
private final boolean valid;
|
private final boolean valid;
|
||||||
|
|
||||||
public DefaultTitle_111() {
|
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
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.titles;
|
package com.github.intellectualsites.plotsquared.bukkit.titles;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
|
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);
|
HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
|
||||||
title.send(((BukkitPlayer) player).player);
|
title.send(((BukkitPlayer) player).player);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
PS.debug("&cYour server version does not support titles!");
|
PlotSquared.debug("&cYour server version does not support titles!");
|
||||||
Settings.TITLES = false;
|
Settings.TITLES = false;
|
||||||
AbstractTitle.TITLE_CLASS = null;
|
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.EntityWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper;
|
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.generator.AugmentedUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
@ -344,7 +344,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
@SuppressWarnings("deprecation") @Override
|
@SuppressWarnings("deprecation") @Override
|
||||||
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
|
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
|
||||||
final boolean safe) {
|
final boolean safe) {
|
||||||
if (!PS.get().isMainThread(Thread.currentThread())) {
|
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@SuppressWarnings("deprecation") @Override public void run() {
|
@SuppressWarnings("deprecation") @Override public void run() {
|
||||||
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
||||||
@ -700,7 +700,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
try {
|
try {
|
||||||
entity.spawn(world, xOffset, zOffset);
|
entity.spawn(world, xOffset, zOffset);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
PS.debug("Failed to restore entity (e): " + e.toString());
|
PlotSquared.debug("Failed to restore entity (e): " + e.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -719,12 +719,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
chest.getInventory().setContents(blockLocEntry.getValue());
|
chest.getInventory().setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -744,12 +744,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
}
|
}
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundsException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -765,12 +765,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setContents(blockLocEntry.getValue());
|
.setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -786,12 +786,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setContents(blockLocEntry.getValue());
|
.setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -807,12 +807,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setContents(blockLocEntry.getValue());
|
.setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -827,13 +827,13 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
((Jukebox) state).setPlaying(blockLocMaterialEntry.getValue());
|
((Jukebox) state).setPlaying(blockLocMaterialEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ','
|
||||||
+ blockLocMaterialEntry.getKey().y + ',' + (
|
+ blockLocMaterialEntry.getKey().y + ',' + (
|
||||||
blockLocMaterialEntry.getKey().z + zOffset));
|
blockLocMaterialEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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
|
blockLocMaterialEntry.getKey().x + xOffset) + ',' + blockLocMaterialEntry
|
||||||
.getKey().y + ',' + (blockLocMaterialEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocMaterialEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -853,12 +853,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
((Skull) state).setSkullType((SkullType) data[3]);
|
((Skull) state).setSkullType((SkullType) data[3]);
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -875,12 +875,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setContents(blockLocEntry.getValue());
|
.setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -894,12 +894,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
((NoteBlock) state).setNote(blockLocNoteEntry.getValue());
|
((NoteBlock) state).setNote(blockLocNoteEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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
|
blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry
|
||||||
.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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().x + xOffset) + ',' + blockLocNoteEntry.getKey().y
|
||||||
+ ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
+ ',' + (blockLocNoteEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -912,12 +912,14 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
if (state instanceof BrewingStand) {
|
if (state instanceof BrewingStand) {
|
||||||
((BrewingStand) state).setBrewingTime(blockLocShortEntry.getValue());
|
((BrewingStand) state).setBrewingTime(blockLocShortEntry.getValue());
|
||||||
} else {
|
} 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
|
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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
|
blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry
|
||||||
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -934,13 +936,13 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setSpawnedType(blockLocEntityTypeEntry.getValue());
|
.setSpawnedType(blockLocEntityTypeEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ','
|
||||||
+ blockLocEntityTypeEntry.getKey().y + ',' + (
|
+ blockLocEntityTypeEntry.getKey().y + ',' + (
|
||||||
blockLocEntityTypeEntry.getKey().z + zOffset));
|
blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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().x + xOffset) + ','
|
||||||
+ blockLocEntityTypeEntry.getKey().y + ',' + (
|
+ blockLocEntityTypeEntry.getKey().y + ',' + (
|
||||||
blockLocEntityTypeEntry.getKey().z + zOffset));
|
blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||||
@ -955,12 +957,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
((CommandBlock) state).setCommand(blockLocStringEntry.getValue());
|
((CommandBlock) state).setCommand(blockLocStringEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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
|
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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
|
blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry
|
||||||
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -977,12 +979,14 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setContents(blockLocEntry.getValue());
|
.setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -998,12 +1002,14 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
((Furnace) state).setBurnTime(time[0]);
|
((Furnace) state).setBurnTime(time[0]);
|
||||||
((Furnace) state).setCookTime(time[1]);
|
((Furnace) state).setCookTime(time[1]);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -1019,12 +1025,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
.setContents(blockLocEntry.getValue());
|
.setContents(blockLocEntry.getValue());
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||||
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
+ ',' + (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignored) {
|
} 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().x + xOffset) + ',' + blockLocEntry.getKey().y + ','
|
||||||
+ (blockLocEntry.getKey().z + zOffset));
|
+ (blockLocEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -1043,12 +1049,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
banner.setPatterns(patterns);
|
banner.setPatterns(patterns);
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} 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
|
blockLocByteEntry.getKey().x + xOffset) + ',' + blockLocByteEntry
|
||||||
.getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset));
|
.getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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().x + xOffset) + ',' + blockLocByteEntry.getKey().y
|
||||||
+ ',' + (blockLocByteEntry.getKey().z + zOffset));
|
+ ',' + (blockLocByteEntry.getKey().z + zOffset));
|
||||||
}
|
}
|
||||||
@ -1155,9 +1161,9 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
PS.debug("------------ FAILED TO DO SOMETHING --------");
|
PlotSquared.debug("------------ FAILED TO DO SOMETHING --------");
|
||||||
e.printStackTrace();
|
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.bukkit.generator.BukkitPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
@ -33,7 +33,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
if (plugin.isEnabled()) {
|
if (plugin.isEnabled()) {
|
||||||
ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
|
ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
PS.get().removePlotAreas(testWorld);
|
PlotSquared.get().removePlotAreas(testWorld);
|
||||||
String name = plugin.getDescription().getName();
|
String name = plugin.getDescription().getName();
|
||||||
GeneratorWrapper<?> wrapped;
|
GeneratorWrapper<?> wrapped;
|
||||||
if (generator instanceof GeneratorWrapper<?>) {
|
if (generator instanceof GeneratorWrapper<?>) {
|
||||||
@ -80,11 +80,11 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case 2: {
|
case 2: {
|
||||||
if (object.id != null) {
|
if (object.id != null) {
|
||||||
if (!PS.get().worlds.contains(worldPath)) {
|
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||||
PS.get().worlds.createSection(worldPath);
|
PlotSquared.get().worlds.createSection(worldPath);
|
||||||
}
|
}
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PS.get().worlds.getConfigurationSection(worldPath);
|
PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||||
String areaName = object.id + "-" + object.min + "-" + object.max;
|
String areaName = object.id + "-" + object.min + "-" + object.max;
|
||||||
String areaPath = "areas." + areaName;
|
String areaPath = "areas." + areaName;
|
||||||
if (!worldSection.contains(areaPath)) {
|
if (!worldSection.contains(areaPath)) {
|
||||||
@ -123,20 +123,20 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
if (!PS.get().worlds.contains(worldPath)) {
|
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||||
PS.get().worlds.createSection(worldPath);
|
PlotSquared.get().worlds.createSection(worldPath);
|
||||||
}
|
}
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PS.get().worlds.getConfigurationSection(worldPath);
|
PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||||
for (ConfigurationNode step : steps) {
|
for (ConfigurationNode step : steps) {
|
||||||
worldSection.set(step.getConstant(), step.getValue());
|
worldSection.set(step.getConstant(), step.getValue());
|
||||||
}
|
}
|
||||||
PS.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
PlotSquared.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
||||||
PS.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain);
|
PlotSquared.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.plugin", object.plotManager);
|
||||||
if (object.setupGenerator != null && !object.setupGenerator
|
if (object.setupGenerator != null && !object.setupGenerator
|
||||||
.equals(object.plotManager)) {
|
.equals(object.plotManager)) {
|
||||||
PS.get().worlds
|
PlotSquared.get().worlds
|
||||||
.set("worlds." + world + ".generator.init", object.setupGenerator);
|
.set("worlds." + world + ".generator.init", object.setupGenerator);
|
||||||
}
|
}
|
||||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||||
@ -147,11 +147,11 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
}
|
}
|
||||||
case 0: {
|
case 0: {
|
||||||
if (steps.length != 0) {
|
if (steps.length != 0) {
|
||||||
if (!PS.get().worlds.contains(worldPath)) {
|
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||||
PS.get().worlds.createSection(worldPath);
|
PlotSquared.get().worlds.createSection(worldPath);
|
||||||
}
|
}
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PS.get().worlds.getConfigurationSection(worldPath);
|
PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||||
for (ConfigurationNode step : steps) {
|
for (ConfigurationNode step : steps) {
|
||||||
worldSection.set(step.getConstant(), step.getValue());
|
worldSection.set(step.getConstant(), step.getValue());
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.util;
|
package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
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.ChunkLoc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -50,7 +50,7 @@ public class SendChunk {
|
|||||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
this.methodInitLighting = classChunk.getMethod("initLighting");
|
this.methodInitLighting = classChunk.getMethod("initLighting");
|
||||||
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
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
|
//this works for 1.9.4 and 1.10
|
||||||
tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class);
|
tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class);
|
||||||
} else {
|
} else {
|
||||||
@ -118,7 +118,8 @@ public class SendChunk {
|
|||||||
chunks.remove(chunk);
|
chunks.remove(chunk);
|
||||||
Object con = this.connection.of(entity).get();
|
Object con = this.connection.of(entity).get();
|
||||||
Object packet = null;
|
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 {
|
try {
|
||||||
packet = this.mapChunk.create(c, 65535);
|
packet = this.mapChunk.create(c, 65535);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
@ -135,7 +136,7 @@ public class SendChunk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packet == null) {
|
if (packet == null) {
|
||||||
PS.debug("Error with PacketPlayOutMapChunk reflection.");
|
PlotSquared.debug("Error with PacketPlayOutMapChunk reflection.");
|
||||||
}
|
}
|
||||||
this.send.of(con).call(packet);
|
this.send.of(con).call(packet);
|
||||||
}
|
}
|
||||||
@ -147,10 +148,11 @@ public class SendChunk {
|
|||||||
chunk.unload(true, false);
|
chunk.unload(true, false);
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
String worldName = chunk.getWorld().getName();
|
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());
|
+ chunk.getZ());
|
||||||
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
PlotSquared.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||||
PS.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
PlotSquared.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||||
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.util;
|
package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitAugmentedGenerator;
|
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.generator.GeneratorWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -16,7 +16,7 @@ public class SetGenCB {
|
|||||||
|
|
||||||
public static void setGenerator(World world) throws Exception {
|
public static void setGenerator(World world) throws Exception {
|
||||||
SetupUtils.manager.updateGenerators();
|
SetupUtils.manager.updateGenerators();
|
||||||
PS.get().removePlotAreas(world.getName());
|
PlotSquared.get().removePlotAreas(world.getName());
|
||||||
ChunkGenerator gen = world.getGenerator();
|
ChunkGenerator gen = world.getGenerator();
|
||||||
if (gen == null) {
|
if (gen == null) {
|
||||||
return;
|
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;
|
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||||
@ -49,8 +49,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
PS.debug(C.PREFIX + "&6Starting player data caching for: " + world);
|
PlotSquared.debug(C.PREFIX + "&6Starting player data caching for: " + world);
|
||||||
File uuidFile = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
|
||||||
if (uuidFile.exists()) {
|
if (uuidFile.exists()) {
|
||||||
try {
|
try {
|
||||||
List<String> lines =
|
List<String> lines =
|
||||||
@ -85,7 +85,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||||
PS.debug("&aFast mode UUID caching enabled!");
|
PlotSquared.debug("&aFast mode UUID caching enabled!");
|
||||||
File playerDataFolder =
|
File playerDataFolder =
|
||||||
new File(container, world + File.separator + "playerdata");
|
new File(container, world + File.separator + "playerdata");
|
||||||
String[] dat = playerDataFolder.list(new DatFileFilter());
|
String[] dat = playerDataFolder.list(new DatFileFilter());
|
||||||
@ -101,7 +101,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
.fromStream(new FileInputStream(file),
|
.fromStream(new FileInputStream(file),
|
||||||
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||||
if (!compound.containsKey("bukkit")) {
|
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\"");
|
+ ".dat) does not contain the the key \"bukkit\"");
|
||||||
} else {
|
} else {
|
||||||
NbtFactory.NbtCompound bukkit =
|
NbtFactory.NbtCompound bukkit =
|
||||||
@ -118,7 +118,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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;
|
return;
|
||||||
} else {
|
} else {
|
||||||
PS.debug("Failed to cache: " + all.size()
|
PlotSquared.debug("Failed to cache: " + all.size()
|
||||||
+ " uuids - slowly processing all files");
|
+ " uuids - slowly processing all files");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
UUID uuid = UUID.fromString(s);
|
UUID uuid = UUID.fromString(s);
|
||||||
uuids.add(uuid);
|
uuids.add(uuid);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
PS.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
PlotSquared.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -175,7 +175,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
.fromStream(new FileInputStream(file),
|
.fromStream(new FileInputStream(file),
|
||||||
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||||
if (!compound.containsKey("bukkit")) {
|
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\"");
|
+ ".dat) does not contain the the key \"bukkit\"");
|
||||||
} else {
|
} else {
|
||||||
NbtFactory.NbtCompound bukkit =
|
NbtFactory.NbtCompound bukkit =
|
||||||
@ -203,7 +203,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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) {
|
for (String name : names) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer;
|
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.OfflinePlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||||
@ -82,7 +82,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
|||||||
return p.toArray(new Player[p.size()]);
|
return p.toArray(new Player[p.size()]);
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) {
|
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) {
|
||||||
PS.debug("Failed to resolve online players");
|
PlotSquared.debug("Failed to resolve online players");
|
||||||
this.getOnline = null;
|
this.getOnline = null;
|
||||||
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
||||||
return onlinePlayers.toArray(new Player[onlinePlayers.size()]);
|
return onlinePlayers.toArray(new Player[onlinePlayers.size()]);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
||||||
@ -43,7 +43,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
|
|
||||||
public SQLUUIDHandler(UUIDWrapper wrapper) {
|
public SQLUUIDHandler(UUIDWrapper wrapper) {
|
||||||
super(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 {
|
try {
|
||||||
this.sqlite.openConnection();
|
this.sqlite.openConnection();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
@ -139,7 +139,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
} catch (IOException | ParseException e) {
|
} catch (IOException | ParseException e) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)");
|
"Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -166,7 +166,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
@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!");
|
+ "' was null. We'll cache this from the Mojang servers!");
|
||||||
if (ifFetch == null) {
|
if (ifFetch == null) {
|
||||||
return;
|
return;
|
||||||
@ -221,7 +221,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
statement.setString(1, uuid.toString());
|
statement.setString(1, uuid.toString());
|
||||||
statement.setString(2, name.toString());
|
statement.setString(2, name.toString());
|
||||||
statement.execute();
|
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) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -244,7 +244,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
statement.setString(1, name.value);
|
statement.setString(1, name.value);
|
||||||
statement.setString(2, uuid.toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.execute();
|
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) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ dependencies {
|
|||||||
compileOnly 'org.projectlombok:lombok:1.16.18'
|
compileOnly 'org.projectlombok:lombok:1.16.18'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.7
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.7
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.api;
|
package com.github.intellectualsites.plotsquared.api;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
@ -29,7 +29,7 @@ import java.util.UUID;
|
|||||||
* <li>{@link Plot}</li>
|
* <li>{@link Plot}</li>
|
||||||
* <li>{@link com.github.intellectualsites.plotsquared.plot.object.Location}</li>
|
* <li>{@link com.github.intellectualsites.plotsquared.plot.object.Location}</li>
|
||||||
* <li>{@link PlotArea}</li>
|
* <li>{@link PlotArea}</li>
|
||||||
* <li>{@link PS}</li>
|
* <li>{@link PlotSquared}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @version 3.3.3
|
* @version 3.3.3
|
||||||
@ -42,10 +42,10 @@ public class PlotAPI {
|
|||||||
* Get all plots.
|
* Get all plots.
|
||||||
*
|
*
|
||||||
* @return all plots
|
* @return all plots
|
||||||
* @see PS#getPlots()
|
* @see PlotSquared#getPlots()
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getAllPlots() {
|
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
|
* @return all plots that a player owns
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlayerPlots(PlotPlayer player) {
|
public Set<Plot> getPlayerPlots(PlotPlayer player) {
|
||||||
return PS.get().getPlots(player);
|
return PlotSquared.get().getPlots(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a plot world.
|
* Add a plot world.
|
||||||
*
|
*
|
||||||
* @param plotArea Plot World Object
|
* @param plotArea Plot World Object
|
||||||
* @see PS#addPlotArea(PlotArea)
|
* @see PlotSquared#addPlotArea(PlotArea)
|
||||||
*/
|
*/
|
||||||
public void addPlotArea(PlotArea plotArea) {
|
public void addPlotArea(PlotArea plotArea) {
|
||||||
PS.get().addPlotArea(plotArea);
|
PlotSquared.get().addPlotArea(plotArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the PlotSquared configurations file.
|
* Returns the PlotSquared configurations file.
|
||||||
*
|
*
|
||||||
* @return main configuration
|
* @return main configuration
|
||||||
* @see PS#config
|
* @see PlotSquared#config
|
||||||
*/
|
*/
|
||||||
public YamlConfiguration getConfig() {
|
public YamlConfiguration getConfig() {
|
||||||
return PS.get().config;
|
return PlotSquared.get().config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PlotSquared storage file.
|
* Get the PlotSquared storage file.
|
||||||
*
|
*
|
||||||
* @return storage configuration
|
* @return storage configuration
|
||||||
* @see PS#storage
|
* @see PlotSquared#storage
|
||||||
*/
|
*/
|
||||||
public YamlConfiguration getStorage() {
|
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.
|
* Get the main class for this plugin. Only use this if you really need it.
|
||||||
*
|
*
|
||||||
* @return PlotSquared PlotSquared Main Class
|
* @return PlotSquared PlotSquared Main Class
|
||||||
* @see PS
|
* @see PlotSquared
|
||||||
*/
|
*/
|
||||||
public PS getMain() {
|
public PlotSquared getMain() {
|
||||||
return PS.get();
|
return PlotSquared.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +156,7 @@ public class PlotAPI {
|
|||||||
if (world == null) {
|
if (world == null) {
|
||||||
return Collections.emptySet();
|
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...)
|
* @see MainUtil#sendConsoleMessage(C, String...)
|
||||||
*/
|
*/
|
||||||
public void sendConsoleMessage(String message) {
|
public void sendConsoleMessage(String message) {
|
||||||
PS.log(message);
|
PlotSquared.log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,10 +193,10 @@ public class PlotAPI {
|
|||||||
* Gets the PlotSquared class.
|
* Gets the PlotSquared class.
|
||||||
*
|
*
|
||||||
* @return PlotSquared Class
|
* @return PlotSquared Class
|
||||||
* @see PS
|
* @see PlotSquared
|
||||||
*/
|
*/
|
||||||
public PS getPlotSquared() {
|
public PlotSquared getPlotSquared() {
|
||||||
return PS.get();
|
return PlotSquared.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.commands;
|
package com.github.intellectualsites.plotsquared.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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.CommandCategory;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||||
@ -166,7 +166,8 @@ public abstract class Command {
|
|||||||
options.put("usage", declaration.usage());
|
options.put("usage", declaration.usage());
|
||||||
options.put("confirmation", declaration.confirmation());
|
options.put("confirmation", declaration.confirmation());
|
||||||
boolean set = false;
|
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()) {
|
for (Map.Entry<String, Object> entry : options.entrySet()) {
|
||||||
String key = this.getFullId() + "." + entry.getKey();
|
String key = this.getFullId() + "." + entry.getKey();
|
||||||
if (!commands.contains(key)) {
|
if (!commands.contains(key)) {
|
||||||
@ -174,9 +175,9 @@ public abstract class Command {
|
|||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (set && PS.get() != null) {
|
if (set && PlotSquared.get() != null) {
|
||||||
try {
|
try {
|
||||||
commands.save(PS.get().commandsFile);
|
commands.save(PlotSquared.get().commandsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
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.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
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.DumperOptions;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
@ -51,11 +51,11 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
||||||
}
|
}
|
||||||
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
PS.debug("&dCould not read: &7" + file);
|
PlotSquared.debug("&dCould not read: &7" + file);
|
||||||
PS.debug("&dRenamed to: &7" + dest.getName());
|
PlotSquared.debug("&dRenamed to: &7" + dest.getName());
|
||||||
PS.debug("&c============ Full stacktrace ============");
|
PlotSquared.debug("&c============ Full stacktrace ============");
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
PS.debug("&c=========================================");
|
PlotSquared.debug("&c=========================================");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
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.HybridUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.WESubscriber;
|
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.logger.ILogger;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.DefaultPlotAreaManager;
|
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.ExpireManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask;
|
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URISyntaxException;
|
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.
|
* An implementation of the core, with a static getter for easy access.
|
||||||
*/
|
*/
|
||||||
public class PS {
|
@SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared {
|
||||||
private static PS instance;
|
private static final Set<Plot> EMPTY_SET =
|
||||||
|
Collections.unmodifiableSet(Collections.<Plot>emptySet());
|
||||||
|
private static PlotSquared instance;
|
||||||
// Implementation
|
// Implementation
|
||||||
public final IPlotMain IMP;
|
public final IPlotMain IMP;
|
||||||
// Current thread
|
// Current thread
|
||||||
@ -65,14 +70,15 @@ public class PS {
|
|||||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||||
// Implementation logger
|
// Implementation logger
|
||||||
private ILogger logger;
|
@Setter @Getter private ILogger logger;
|
||||||
// Platform / Version / Update URL
|
// Platform / Version / Update URL
|
||||||
private Updater updater;
|
@Getter private Updater updater;
|
||||||
private PlotVersion version;
|
private PlotVersion version;
|
||||||
// Files and configuration
|
// Files and configuration
|
||||||
|
@Getter
|
||||||
private File jarFile = null; // This file
|
private File jarFile = null; // This file
|
||||||
private File storageFile;
|
private File storageFile;
|
||||||
private PlotAreaManager manager;
|
@Getter private PlotAreaManager plotAreaManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize PlotSquared with the desired Implementation class.
|
* Initialize PlotSquared with the desired Implementation class.
|
||||||
@ -80,16 +86,21 @@ public class PS {
|
|||||||
* @param iPlotMain Implementation of {@link IPlotMain} used
|
* @param iPlotMain Implementation of {@link IPlotMain} used
|
||||||
* @param platform The platform being used
|
* @param platform The platform being used
|
||||||
*/
|
*/
|
||||||
public PS(IPlotMain iPlotMain, String platform) {
|
public PlotSquared(final IPlotMain iPlotMain, final String platform) {
|
||||||
PS.instance = this;
|
if (instance != null) {
|
||||||
|
throw new IllegalStateException("Cannot re-initialize the PlotSquared singleton");
|
||||||
|
}
|
||||||
|
instance = this;
|
||||||
|
|
||||||
this.thread = Thread.currentThread();
|
this.thread = Thread.currentThread();
|
||||||
this.IMP = iPlotMain;
|
this.IMP = iPlotMain;
|
||||||
this.logger = iPlotMain;
|
this.logger = iPlotMain;
|
||||||
Settings.PLATFORM = platform;
|
Settings.PLATFORM = platform;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new ReflectionUtils(this.IMP.getNMSPackage());
|
new ReflectionUtils(this.IMP.getNMSPackage());
|
||||||
try {
|
try {
|
||||||
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
||||||
this.jarFile = new File(
|
this.jarFile = new File(
|
||||||
new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
||||||
.toURI().getPath());
|
.toURI().getPath());
|
||||||
@ -102,7 +113,7 @@ public class PS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getJavaVersion() < 1.8) {
|
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();
|
TaskManager.IMP = this.IMP.getTaskManager();
|
||||||
setupConfigs();
|
setupConfigs();
|
||||||
@ -111,11 +122,11 @@ public class PS {
|
|||||||
+ ".use_THIS.yml");
|
+ ".use_THIS.yml");
|
||||||
C.load(this.translationFile);
|
C.load(this.translationFile);
|
||||||
|
|
||||||
// Setup manager
|
// Setup plotAreaManager
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
this.manager = new SinglePlotAreaManager();
|
this.plotAreaManager = new SinglePlotAreaManager();
|
||||||
} else {
|
} else {
|
||||||
this.manager = new DefaultPlotAreaManager();
|
this.plotAreaManager = new DefaultPlotAreaManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
@ -139,7 +150,7 @@ public class PS {
|
|||||||
if (Settings.Enabled_Components.METRICS) {
|
if (Settings.Enabled_Components.METRICS) {
|
||||||
this.IMP.startMetrics();
|
this.IMP.startMetrics();
|
||||||
} else {
|
} 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) {
|
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
this.IMP.registerChunkProcessor();
|
this.IMP.registerChunkProcessor();
|
||||||
@ -183,7 +194,7 @@ public class PS {
|
|||||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||||
try {
|
try {
|
||||||
if (this.IMP.initWorldEdit()) {
|
if (this.IMP.initWorldEdit()) {
|
||||||
PS.debug(IMP.getPluginName() + " hooked into WorldEdit.");
|
PlotSquared.debug(IMP.getPluginName() + " hooked into WorldEdit.");
|
||||||
this.worldedit = WorldEdit.getInstance();
|
this.worldedit = WorldEdit.getInstance();
|
||||||
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
|
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
|
||||||
if (Settings.Enabled_Components.COMMANDS) {
|
if (Settings.Enabled_Components.COMMANDS) {
|
||||||
@ -192,7 +203,7 @@ public class PS {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
|
"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) {
|
if (Settings.Enabled_Components.ECONOMY) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override public void run() {
|
@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");
|
"&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml");
|
||||||
debug(
|
debug(
|
||||||
"&8 - &7Your world management plugin may be faulty (or non existent)");
|
"&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) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
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
|
* @return instance of PlotSquared
|
||||||
*/
|
*/
|
||||||
public static PS get() {
|
public static PlotSquared get() {
|
||||||
return PS.instance;
|
return PlotSquared.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPlotMain imp() {
|
public static IPlotMain imp() {
|
||||||
@ -292,7 +304,7 @@ public class PS {
|
|||||||
if (message == null || message.toString().isEmpty()) {
|
if (message == null || message.toString().isEmpty()) {
|
||||||
return;
|
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
|
* @param message Message to log
|
||||||
* @see IPlotMain#log(String)
|
* @see IPlotMain#log(String)
|
||||||
*/
|
*/
|
||||||
public static void debug(Object message) {
|
public static void debug(@Nullable Object message) {
|
||||||
if (Settings.DEBUG) {
|
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() {
|
private void startUuidCatching() {
|
||||||
TaskManager.runTaskLater(new Runnable() {
|
TaskManager.runTaskLater(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
@ -379,14 +358,15 @@ public class PS {
|
|||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
|
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
|
||||||
TaskManager.IMP.taskAsync(new Runnable() {
|
TaskManager.IMP.taskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (PS.this.IMP.initPlotMeConverter()) {
|
if (PlotSquared.this.IMP.initPlotMeConverter()) {
|
||||||
PS.log("&c=== IMPORTANT ===");
|
PlotSquared.log("&c=== IMPORTANT ===");
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PlotMe!");
|
"&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PlotMe!");
|
||||||
PS.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
PlotSquared
|
||||||
PS.log(
|
.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!");
|
"&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 "
|
"&c - After the conversion is finished, please set 'plotme-converter' to false in the "
|
||||||
+ "'settings.yml'");
|
+ "'settings.yml'");
|
||||||
}
|
}
|
||||||
@ -403,8 +383,8 @@ public class PS {
|
|||||||
/**
|
/**
|
||||||
* Check if `version` is >= `version2`.
|
* Check if `version` is >= `version2`.
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version First version
|
||||||
* @param version2
|
* @param version2 Second version
|
||||||
* @return true if `version` is >= `version2`
|
* @return true if `version` is >= `version2`
|
||||||
*/
|
*/
|
||||||
public boolean checkVersion(int[] version, int... version2) {
|
public boolean checkVersion(int[] version, int... version2) {
|
||||||
@ -490,7 +470,7 @@ public class PS {
|
|||||||
cluster.setArea(plotArea);
|
cluster.setArea(plotArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manager.addPlotArea(plotArea);
|
plotAreaManager.addPlotArea(plotArea);
|
||||||
plotArea.setupBorder();
|
plotArea.setupBorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +480,7 @@ public class PS {
|
|||||||
* @param area the {@code PlotArea} to remove
|
* @param area the {@code PlotArea} to remove
|
||||||
*/
|
*/
|
||||||
public void removePlotArea(PlotArea area) {
|
public void removePlotArea(PlotArea area) {
|
||||||
manager.removePlotArea(area);
|
plotAreaManager.removePlotArea(area);
|
||||||
setPlotsTmp(area);
|
setPlotsTmp(area);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,11 +511,11 @@ public class PS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotCluster> getClusters(String world) {
|
public Set<PlotCluster> getClusters(String world) {
|
||||||
HashSet<PlotCluster> set = new HashSet<>();
|
Set<PlotCluster> set = new HashSet<>();
|
||||||
for (PlotArea area : getPlotAreas(world)) {
|
for (PlotArea area : getPlotAreas(world)) {
|
||||||
set.addAll(area.getClusters());
|
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) {
|
public List<Plot> sortPlotsByTemp(Collection<Plot> plots) {
|
||||||
@ -776,11 +756,11 @@ public class PS {
|
|||||||
HashMap<PlotArea, Collection<Plot>> map = new HashMap<>();
|
HashMap<PlotArea, Collection<Plot>> map = new HashMap<>();
|
||||||
int totalSize = getPlotCount();
|
int totalSize = getPlotCount();
|
||||||
if (plots.size() == totalSize) {
|
if (plots.size() == totalSize) {
|
||||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||||
map.put(area, area.getPlots());
|
map.put(area, area.getPlots());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||||
map.put(area, new ArrayList<Plot>(0));
|
map.put(area, new ArrayList<Plot>(0));
|
||||||
}
|
}
|
||||||
Collection<Plot> lastList = null;
|
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>() {
|
Collections.sort(areas, new Comparator<PlotArea>() {
|
||||||
@Override public int compare(PlotArea a, PlotArea b) {
|
@Override public int compare(PlotArea a, PlotArea b) {
|
||||||
if (priorityArea != null && StringMan.isEqual(a.toString(), b.toString())) {
|
if (priorityArea != null && StringMan.isEqual(a.toString(), b.toString())) {
|
||||||
@ -904,7 +884,7 @@ public class PS {
|
|||||||
* @return Set of Plot
|
* @return Set of Plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(String world, String player) {
|
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);
|
return getPlots(world, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,15 +930,13 @@ public class PS {
|
|||||||
* @return Set of plot
|
* @return Set of plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(String world, UUID uuid) {
|
public Set<Plot> getPlots(String world, UUID uuid) {
|
||||||
ArrayList<Plot> myPlots = new ArrayList<>();
|
final Set<Plot> plots = new HashSet<>();
|
||||||
for (Plot plot : getPlots(world)) {
|
for (final Plot plot : getPlots(world)) {
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
|
||||||
if (plot.isOwnerAbs(uuid)) {
|
plots.add(plot);
|
||||||
myPlots.add(plot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new HashSet<>(myPlots);
|
return Collections.unmodifiableSet(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -969,7 +947,7 @@ public class PS {
|
|||||||
* @return Set of plots
|
* @return Set of plots
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(PlotArea area, UUID uuid) {
|
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)) {
|
for (Plot plot : getPlots(area)) {
|
||||||
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
|
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
@ -986,11 +964,11 @@ public class PS {
|
|||||||
* @see #getPlotAreaByString(String) to get the PlotArea object
|
* @see #getPlotAreaByString(String) to get the PlotArea object
|
||||||
*/
|
*/
|
||||||
public boolean hasPlotArea(String world) {
|
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) {
|
public Collection<Plot> getPlots(String world) {
|
||||||
final HashSet<Plot> set = new HashSet<>();
|
final Set<Plot> set = new HashSet<>();
|
||||||
foreachPlotArea(world, new RunnableVal<PlotArea>() {
|
foreachPlotArea(world, new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea value) {
|
@Override public void run(PlotArea value) {
|
||||||
set.addAll(value.getPlots());
|
set.addAll(value.getPlots());
|
||||||
@ -1010,7 +988,7 @@ public class PS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Plot> getPlots(PlotArea area) {
|
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) {
|
public Plot getPlot(PlotArea area, PlotId id) {
|
||||||
@ -1028,19 +1006,19 @@ public class PS {
|
|||||||
* @return Set of Plot's owned by the player
|
* @return Set of Plot's owned by the player
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(final UUID uuid) {
|
public Set<Plot> getPlots(final UUID uuid) {
|
||||||
final ArrayList<Plot> myPlots = new ArrayList<>();
|
final Set<Plot> plots = new HashSet<>();
|
||||||
foreachPlot(new RunnableVal<Plot>() {
|
foreachPlot(new RunnableVal<Plot>() {
|
||||||
@Override public void run(Plot value) {
|
@Override public void run(Plot value) {
|
||||||
if (value.isOwnerAbs(uuid)) {
|
if (value.isOwnerAbs(uuid)) {
|
||||||
myPlots.add(value);
|
plots.add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return new HashSet<>(myPlots);
|
return Collections.unmodifiableSet(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPlot(final UUID uuid) {
|
public boolean hasPlot(final UUID uuid) {
|
||||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
for (final PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||||
if (area.hasPlot(uuid))
|
if (area.hasPlot(uuid))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1048,15 +1026,15 @@ public class PS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<Plot> getBasePlots(final UUID uuid) {
|
public Set<Plot> getBasePlots(final UUID uuid) {
|
||||||
final ArrayList<Plot> myplots = new ArrayList<>();
|
final Set<Plot> plots = new HashSet<>();
|
||||||
foreachBasePlot(new RunnableVal<Plot>() {
|
foreachBasePlot(new RunnableVal<Plot>() {
|
||||||
@Override public void run(Plot value) {
|
@Override public void run(Plot value) {
|
||||||
if (value.isOwner(uuid)) {
|
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
|
* @return Set of Plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlotsAbs(final UUID uuid) {
|
public Set<Plot> getPlotsAbs(final UUID uuid) {
|
||||||
final ArrayList<Plot> myPlots = new ArrayList<>();
|
final Set<Plot> plots = new HashSet<>();
|
||||||
foreachPlot(new RunnableVal<Plot>() {
|
foreachPlot(new RunnableVal<Plot>() {
|
||||||
@Override public void run(Plot value) {
|
@Override public void run(Plot value) {
|
||||||
if (value.isOwnerAbs(uuid)) {
|
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")) {
|
if (world.equals("CheckingPlotSquaredGenerator")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.manager.addWorld(world);
|
this.plotAreaManager.addWorld(world);
|
||||||
Set<String> worlds;
|
Set<String> worlds;
|
||||||
if (this.worlds.contains("worlds")) {
|
if (this.worlds.contains("worlds")) {
|
||||||
worlds = this.worlds.getConfigurationSection("worlds").getKeys(false);
|
worlds = this.worlds.getConfigurationSection("worlds").getKeys(false);
|
||||||
@ -1141,7 +1119,7 @@ public class PS {
|
|||||||
type = 0;
|
type = 0;
|
||||||
}
|
}
|
||||||
if (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);
|
debug("World possibly already loaded: " + world);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1170,10 +1148,10 @@ public class PS {
|
|||||||
// Conventional plot generator
|
// Conventional plot generator
|
||||||
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
||||||
PlotManager plotManager = plotGenerator.getNewPlotManager();
|
PlotManager plotManager = plotGenerator.getNewPlotManager();
|
||||||
PS.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||||
PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
|
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
|
||||||
PS.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||||
PS.log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName());
|
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName());
|
||||||
if (!this.worlds.contains(path)) {
|
if (!this.worlds.contains(path)) {
|
||||||
this.worlds.createSection(path);
|
this.worlds.createSection(path);
|
||||||
worldSection = this.worlds.getConfigurationSection(path);
|
worldSection = this.worlds.getConfigurationSection(path);
|
||||||
@ -1194,11 +1172,11 @@ public class PS {
|
|||||||
}
|
}
|
||||||
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
||||||
if (areasSection == null) {
|
if (areasSection == null) {
|
||||||
if (manager.getPlotAreas(world, null).length != 0) {
|
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||||
debug("World possibly already loaded: " + world);
|
debug("World possibly already loaded: " + world);
|
||||||
return;
|
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());
|
String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName());
|
||||||
if (type == 2) {
|
if (type == 2) {
|
||||||
Set<PlotCluster> clusters = this.clusters_tmp != null ?
|
Set<PlotCluster> clusters = this.clusters_tmp != null ?
|
||||||
@ -1216,7 +1194,7 @@ public class PS {
|
|||||||
worldSection.createSection("areas." + fullId);
|
worldSection.createSection("areas." + fullId);
|
||||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
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);
|
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string);
|
||||||
if (areaGen == null) {
|
if (areaGen == null) {
|
||||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||||
@ -1230,10 +1208,11 @@ public class PS {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
PlotSquared
|
||||||
PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||||
PS.log(C.PREFIX + "&c | &9manager: &7" + pa);
|
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||||
PS.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
|
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa);
|
||||||
|
PlotSquared.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
|
||||||
+ " (invalid or old configuration?)");
|
+ " (invalid or old configuration?)");
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
@ -1256,9 +1235,9 @@ public class PS {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||||
PS.log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
||||||
PS.log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager());
|
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -1269,7 +1248,7 @@ public class PS {
|
|||||||
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
|
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
|
||||||
}
|
}
|
||||||
for (String areaId : areasSection.getKeys(false)) {
|
for (String areaId : areasSection.getKeys(false)) {
|
||||||
PS.log(C.PREFIX + "&3 - " + areaId);
|
PlotSquared.log(C.PREFIX + "&3 - " + areaId);
|
||||||
String[] split = areaId.split("(?<=[^;-])-");
|
String[] split = areaId.split("(?<=[^;-])-");
|
||||||
if (split.length != 3) {
|
if (split.length != 3) {
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||||
@ -1331,10 +1310,10 @@ public class PS {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
PS.log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
||||||
PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||||
PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||||
PS.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -1361,7 +1340,7 @@ public class PS {
|
|||||||
for (String element : split) {
|
for (String element : split) {
|
||||||
String[] pair = element.split("=");
|
String[] pair = element.split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
PS.log("&cNo value provided for: &7" + element);
|
PlotSquared.log("&cNo value provided for: &7" + element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String key = pair[0].toLowerCase();
|
String key = pair[0].toLowerCase();
|
||||||
@ -1411,12 +1390,12 @@ public class PS {
|
|||||||
Configuration.BLOCK.parseString(value).toString());
|
Configuration.BLOCK.parseString(value).toString());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PS.log("&cKey not found: &7" + element);
|
PlotSquared.log("&cKey not found: &7" + element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.log("&cInvalid value: &7" + value + " in arg " + element);
|
PlotSquared.log("&cInvalid value: &7" + value + " in arg " + element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1433,26 +1412,21 @@ public class PS {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUpdate(String current, String other) {
|
public boolean canUpdate(@NonNull final String current, @NonNull final String other) {
|
||||||
String s1 = normalisedVersion(current);
|
final String s1 = normalisedVersion(current);
|
||||||
String s2 = normalisedVersion(other);
|
final String s2 = normalisedVersion(other);
|
||||||
int cmp = s1.compareTo(s2);
|
return s1.compareTo(s2) < 0;
|
||||||
return cmp < 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String normalisedVersion(String version) {
|
public String normalisedVersion(@NonNull final String version) {
|
||||||
String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
|
final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
|
||||||
StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
for (String s : split) {
|
for (final String s : split) {
|
||||||
sb.append(String.format("%" + 4 + 's', s));
|
sb.append(String.format("%" + 4 + 's', s));
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getJarFile() {
|
|
||||||
return jarFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean update(PlotPlayer sender, URL url) {
|
public boolean update(PlotPlayer sender, URL url) {
|
||||||
try {
|
try {
|
||||||
String name = this.jarFile.getName();
|
String name = this.jarFile.getName();
|
||||||
@ -1478,9 +1452,9 @@ public class PS {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
|
MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
|
||||||
MainUtil.sendMessage(sender, " - Please update manually");
|
MainUtil.sendMessage(sender, " - Please update manually");
|
||||||
PS.log("============ Stacktrace ============");
|
PlotSquared.log("============ Stacktrace ============");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.log("====================================");
|
PlotSquared.log("====================================");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1536,13 +1510,13 @@ public class PS {
|
|||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.log("&cCould not save " + file);
|
PlotSquared.log("&cCould not save " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Map<PlotId, Plot>> getPlotsRaw() {
|
private Map<String, Map<PlotId, Plot>> getPlotsRaw() {
|
||||||
HashMap<String, Map<PlotId, Plot>> map = new HashMap<>();
|
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());
|
Map<PlotId, Plot> map2 = map.get(area.toString());
|
||||||
if (map2 == null) {
|
if (map2 == null) {
|
||||||
map.put(area.toString(), area.getPlotsRaw());
|
map.put(area.toString(), area.getPlotsRaw());
|
||||||
@ -1572,7 +1546,7 @@ public class PS {
|
|||||||
UUIDHandler.handleShutdown();
|
UUIDHandler.handleShutdown();
|
||||||
} catch (NullPointerException ignored) {
|
} catch (NullPointerException ignored) {
|
||||||
ignored.printStackTrace();
|
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;
|
Database database;
|
||||||
if (Storage.MySQL.USE) {
|
if (Storage.MySQL.USE) {
|
||||||
database = new MySQL(Storage.MySQL.HOST,
|
database = new MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE,
|
||||||
Storage.MySQL.PORT, Storage.MySQL.DATABASE, Storage.MySQL.USER,
|
Storage.MySQL.USER, Storage.MySQL.PASSWORD);
|
||||||
Storage.MySQL.PASSWORD);
|
|
||||||
} else if (Storage.SQLite.USE) {
|
} else if (Storage.SQLite.USE) {
|
||||||
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
|
||||||
database = new SQLite(file);
|
database = new SQLite(file);
|
||||||
} else {
|
} else {
|
||||||
PS.log(C.PREFIX + "&cNo storage type is set!");
|
PlotSquared.log(C.PREFIX + "&cNo storage type is set!");
|
||||||
this.IMP.disable();
|
this.IMP.disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false);
|
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false);
|
||||||
this.plots_tmp = DBFunc.getPlots();
|
this.plots_tmp = DBFunc.getPlots();
|
||||||
if (manager instanceof SinglePlotAreaManager) {
|
if (plotAreaManager instanceof SinglePlotAreaManager) {
|
||||||
SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
SinglePlotArea area = ((SinglePlotAreaManager) plotAreaManager).getArea();
|
||||||
addPlotArea(area);
|
addPlotArea(area);
|
||||||
ConfigurationSection section = worlds.getConfigurationSection("worlds.*");
|
ConfigurationSection section = worlds.getConfigurationSection("worlds.*");
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
@ -1611,17 +1584,18 @@ public class PS {
|
|||||||
}
|
}
|
||||||
this.clusters_tmp = DBFunc.getClusters();
|
this.clusters_tmp = DBFunc.getClusters();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
||||||
if (Storage.MySQL.USE) {
|
if (Storage.MySQL.USE) {
|
||||||
PS.log("$4MYSQL");
|
PlotSquared.log("$4MYSQL");
|
||||||
} else if (Storage.SQLite.USE) {
|
} 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();
|
e.printStackTrace();
|
||||||
PS.log("&d==== End of stacktrace ====");
|
PlotSquared.log("&d==== End of stacktrace ====");
|
||||||
PS.log("&6Please go to the " + IMP.getPluginName()
|
PlotSquared.log("&6Please go to the " + IMP.getPluginName()
|
||||||
+ " 'storage.yml' and configure the database correctly.");
|
+ " 'storage.yml' and configure the database correctly.");
|
||||||
this.IMP.disable();
|
this.IMP.disable();
|
||||||
}
|
}
|
||||||
@ -1646,7 +1620,7 @@ public class PS {
|
|||||||
try {
|
try {
|
||||||
worlds.save(worldsFile);
|
worlds.save(worldsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
PS.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
|
PlotSquared.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1681,28 +1655,29 @@ public class PS {
|
|||||||
public void setupConfigs() {
|
public void setupConfigs() {
|
||||||
File folder = new File(this.IMP.getDirectory(), "config");
|
File folder = new File(this.IMP.getDirectory(), "config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
PS.log(C.PREFIX
|
PlotSquared.log(C.PREFIX
|
||||||
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
|
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.worldsFile = new File(folder, "worlds.yml");
|
this.worldsFile = new File(folder, "worlds.yml");
|
||||||
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
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);
|
this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile);
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.log("Failed to save settings.yml");
|
PlotSquared.log("Failed to save settings.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.configFile = new File(folder, "settings.yml");
|
this.configFile = new File(folder, "settings.yml");
|
||||||
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"Could not create the settings file, please create \"settings.yml\" manually.");
|
"Could not create the settings file, please create \"settings.yml\" manually.");
|
||||||
}
|
}
|
||||||
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
||||||
setupConfig();
|
setupConfig();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.log("Failed to save settings.yml");
|
PlotSquared.log("Failed to save settings.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.styleFile = MainUtil.getFile(IMP.getDirectory(),
|
this.styleFile = MainUtil.getFile(IMP.getDirectory(),
|
||||||
@ -1712,7 +1687,7 @@ public class PS {
|
|||||||
this.styleFile.getParentFile().mkdirs();
|
this.styleFile.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
if (!this.styleFile.createNewFile()) {
|
if (!this.styleFile.createNewFile()) {
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"Could not create the style file, please create \"translations/style.yml\" manually");
|
"Could not create the style file, please create \"translations/style.yml\" manually");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1720,34 +1695,34 @@ public class PS {
|
|||||||
setupStyle();
|
setupStyle();
|
||||||
} catch (IOException err) {
|
} catch (IOException err) {
|
||||||
err.printStackTrace();
|
err.printStackTrace();
|
||||||
PS.log("failed to save style.yml");
|
PlotSquared.log("failed to save style.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.storageFile = new File(folder, "storage.yml");
|
this.storageFile = new File(folder, "storage.yml");
|
||||||
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"Could not the storage settings file, please create \"storage.yml\" manually.");
|
"Could not the storage settings file, please create \"storage.yml\" manually.");
|
||||||
}
|
}
|
||||||
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
|
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
|
||||||
setupStorage();
|
setupStorage();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.log("Failed to save storage.yml");
|
PlotSquared.log("Failed to save storage.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.commandsFile = new File(folder, "commands.yml");
|
this.commandsFile = new File(folder, "commands.yml");
|
||||||
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
|
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
|
||||||
PS.log(
|
PlotSquared.log(
|
||||||
"Could not the storage settings file, please create \"commands.yml\" manually.");
|
"Could not the storage settings file, please create \"commands.yml\" manually.");
|
||||||
}
|
}
|
||||||
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
|
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.log("Failed to save commands.yml");
|
PlotSquared.log("Failed to save commands.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.style.save(this.styleFile);
|
this.style.save(this.styleFile);
|
||||||
this.commands.save(this.commandsFile);
|
this.commands.save(this.commandsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
PS.log("Configuration file saving failed");
|
PlotSquared.log("Configuration file saving failed");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1768,8 +1743,9 @@ public class PS {
|
|||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||||
for (Entry<String, Object> component : components.entrySet()) {
|
for (Entry<String, Object> component : components.entrySet()) {
|
||||||
PS.log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
|
PlotSquared.log(C.PREFIX + String
|
||||||
component.getValue()));
|
.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"));
|
return Double.parseDouble(System.getProperty("java.specification.version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void foreachPlotArea(RunnableVal<PlotArea> runnable) {
|
public void foreachPlotArea(@NonNull final RunnableVal<PlotArea> runnable) {
|
||||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
runnable.run(area);
|
runnable.run(area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void foreachPlotArea(String world, RunnableVal<PlotArea> runnable) {
|
public void foreachPlotArea(@NonNull final String world, @NonNull final RunnableVal<PlotArea> runnable) {
|
||||||
PlotArea[] array = this.manager.getPlotAreas(world, null);
|
final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null);
|
||||||
if (array == null) {
|
if (array == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (PlotArea area : array) {
|
for (final PlotArea area : array) {
|
||||||
runnable.run(area);
|
runnable.run(area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void foreachPlot(RunnableVal<Plot> runnable) {
|
public void foreachPlot(@NonNull final RunnableVal<Plot> runnable) {
|
||||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
for (Plot plot : area.getPlots()) {
|
area.getPlots().forEach(runnable::run);
|
||||||
runnable.run(plot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void foreachPlotRaw(RunnableVal<Plot> runnable) {
|
public void foreachPlotRaw(@NonNull final RunnableVal<Plot> runnable) {
|
||||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
for (Plot plot : area.getPlots()) {
|
area.getPlots().forEach(runnable::run);
|
||||||
runnable.run(plot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (this.plots_tmp != null) {
|
if (this.plots_tmp != null) {
|
||||||
for (HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
|
for (final HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
|
||||||
for (Plot entry2 : entry.values()) {
|
entry.values().forEach(runnable::run);
|
||||||
runnable.run(entry2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void foreachBasePlot(RunnableVal<Plot> run) {
|
public void foreachBasePlot(@NonNull final RunnableVal<Plot> run) {
|
||||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
area.foreachBasePlot(run);
|
area.foreachBasePlot(run);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getFirstPlotArea() {
|
public PlotArea getFirstPlotArea() {
|
||||||
PlotArea[] areas = manager.getAllPlotAreas();
|
PlotArea[] areas = plotAreaManager.getAllPlotAreas();
|
||||||
return areas.length > 0 ? areas[0] : null;
|
return areas.length > 0 ? areas[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPlotAreaCount() {
|
public int getPlotAreaCount() {
|
||||||
return this.manager.getAllPlotAreas().length;
|
return this.plotAreaManager.getAllPlotAreas().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPlotCount() {
|
public int getPlotCount() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (PlotArea area : this.manager.getAllPlotAreas()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
count += area.getPlotCount();
|
count += area.getPlotCount();
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotArea> getPlotAreas() {
|
public Set<PlotArea> getPlotAreas() {
|
||||||
HashSet<PlotArea> set = new HashSet<>();
|
final Set<PlotArea> set = new HashSet<>();
|
||||||
Collections.addAll(set, manager.getAllPlotAreas());
|
Collections.addAll(set, plotAreaManager.getAllPlotAreas());
|
||||||
return set;
|
return Collections.unmodifiableSet(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAugmented(String world) {
|
public boolean isAugmented(@NonNull final String world) {
|
||||||
PlotArea[] areas = manager.getPlotAreas(world, null);
|
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, null);
|
||||||
if (areas == null) {
|
return areas != null && (areas.length > 1 || areas[0].TYPE != 0);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (areas.length > 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return areas[0].TYPE != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1887,9 +1851,9 @@ public class PS {
|
|||||||
* @param world the world
|
* @param world the world
|
||||||
* @return Collection of PlotArea objects
|
* @return Collection of PlotArea objects
|
||||||
*/
|
*/
|
||||||
public Set<PlotArea> getPlotAreas(String world) {
|
public Set<PlotArea> getPlotAreas(@NonNull final String world) {
|
||||||
Set<PlotArea> set = new HashSet<>();
|
final Set<PlotArea> set = new HashSet<>();
|
||||||
Collections.addAll(set, manager.getPlotAreas(world, null));
|
Collections.addAll(set, plotAreaManager.getPlotAreas(world, null));
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1906,12 +1870,12 @@ public class PS {
|
|||||||
* @param location the location
|
* @param location the location
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PlotArea getApplicablePlotArea(Location location) {
|
public PlotArea getApplicablePlotArea(@NonNull final Location location) {
|
||||||
return manager.getApplicablePlotArea(location);
|
return plotAreaManager.getApplicablePlotArea(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getPlotArea(String world, String id) {
|
public PlotArea getPlotArea(@NonNull final String world, @NonNull final String id) {
|
||||||
return manager.getPlotArea(world, id);
|
return plotAreaManager.getPlotArea(world, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1924,15 +1888,15 @@ public class PS {
|
|||||||
* @param location the location
|
* @param location the location
|
||||||
* @return the {@link PlotArea} in the location, null if non existent
|
* @return the {@link PlotArea} in the location, null if non existent
|
||||||
*/
|
*/
|
||||||
public PlotArea getPlotAreaAbs(Location location) {
|
public PlotArea getPlotAreaAbs(@NonNull final Location location) {
|
||||||
return manager.getPlotArea(location);
|
return plotAreaManager.getPlotArea(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getPlotAreaByString(String search) {
|
public PlotArea getPlotAreaByString(@NonNull final String search) {
|
||||||
String[] split = search.split(";|,");
|
String[] split = search.split("[;,]");
|
||||||
PlotArea[] areas = manager.getPlotAreas(split[0], null);
|
PlotArea[] areas = plotAreaManager.getPlotAreas(split[0], null);
|
||||||
if (areas == null) {
|
if (areas == null) {
|
||||||
for (PlotArea area : manager.getAllPlotAreas()) {
|
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||||
if (area.worldname.equalsIgnoreCase(split[0])) {
|
if (area.worldname.equalsIgnoreCase(split[0])) {
|
||||||
if (area.id == null || split.length == 2 && area.id
|
if (area.id == null || split.length == 2 && area.id
|
||||||
.equalsIgnoreCase(split[1])) {
|
.equalsIgnoreCase(split[1])) {
|
||||||
@ -1963,26 +1927,24 @@ public class PS {
|
|||||||
* @param worldname to filter alias to a specific world [optional] null means all worlds
|
* @param worldname to filter alias to a specific world [optional] null means all worlds
|
||||||
* @return Set<{@link Plot}> empty if nothing found
|
* @return Set<{@link Plot}> empty if nothing found
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlotsByAlias(String alias, String worldname) {
|
public Set<Plot> getPlotsByAlias(@Nullable final String alias, @NonNull final String worldname) {
|
||||||
Set<Plot> result = new HashSet<>();
|
final Set<Plot> result = new HashSet<>();
|
||||||
|
|
||||||
if (alias != null) {
|
if (alias != null) {
|
||||||
for (Plot plot : getPlots()) {
|
for (final Plot plot : getPlots()) {
|
||||||
if (alias.equals(plot.getAlias()) && (worldname == null || worldname
|
if (alias.equals(plot.getAlias()) && (worldname == null || worldname
|
||||||
.equals(plot.getWorldName()))) {
|
.equals(plot.getWorldName()))) {
|
||||||
result.add(plot);
|
result.add(plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Collections.unmodifiableSet(result);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotArea> getPlotAreas(String world, RegionWrapper region) {
|
public Set<PlotArea> getPlotAreas(final String world, final RegionWrapper region) {
|
||||||
PlotArea[] areas = manager.getPlotAreas(world, region);
|
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, region);
|
||||||
Set<PlotArea> set = new HashSet<>();
|
final Set<PlotArea> set = new HashSet<>();
|
||||||
Collections.addAll(set, areas);
|
Collections.addAll(set, areas);
|
||||||
return set;
|
return Collections.unmodifiableSet(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SortType {
|
public enum SortType {
|
@ -18,7 +18,7 @@ public class Updater {
|
|||||||
public String getChanges() {
|
public String getChanges() {
|
||||||
if (changes == null) {
|
if (changes == null) {
|
||||||
try (Scanner scanner = new Scanner(new URL(
|
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")) {
|
.openStream(), "UTF-8")) {
|
||||||
changes = scanner.useDelimiter("\\A").next();
|
changes = scanner.useDelimiter("\\A").next();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -50,7 +50,7 @@ public class Updater {
|
|||||||
URL download = new URL(downloadUrl.replaceAll("%platform%", platform)
|
URL download = new URL(downloadUrl.replaceAll("%platform%", platform)
|
||||||
.replaceAll("%version%", versionString));
|
.replaceAll("%version%", versionString));
|
||||||
try (ReadableByteChannel rbc = Channels.newChannel(download.openStream())) {
|
try (ReadableByteChannel rbc = Channels.newChannel(download.openStream())) {
|
||||||
File jarFile = PS.get().getJarFile();
|
File jarFile = PlotSquared.get().getJarFile();
|
||||||
|
|
||||||
File finalFile = new File(jarFile.getParent(),
|
File finalFile = new File(jarFile.getParent(),
|
||||||
"update" + File.separator + jarFile.getName());
|
"update" + File.separator + jarFile.getName());
|
||||||
@ -69,7 +69,7 @@ public class Updater {
|
|||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||||
}
|
}
|
||||||
outFile.renameTo(finalFile);
|
outFile.renameTo(finalFile);
|
||||||
PS.debug("Updated PlotSquared to " + versionString);
|
PlotSquared.debug("Updated PlotSquared to " + versionString);
|
||||||
MainUtil.sendAdmin(
|
MainUtil.sendAdmin(
|
||||||
"&7Restart to update PlotSquared with these changes: &c/plot changelog &7or&c "
|
"&7Restart to update PlotSquared with these changes: &c/plot changelog &7or&c "
|
||||||
+ "http://empcraft.com/plots/cl?" + Integer
|
+ "http://empcraft.com/plots/cl?" + Integer
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -88,13 +88,13 @@ public class Alias extends SubCommand {
|
|||||||
C.NOT_VALID_VALUE.send(player);
|
C.NOT_VALID_VALUE.send(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Plot p : PS.get().getPlots(plot.getArea())) {
|
for (Plot p : PlotSquared.get().getPlots(plot.getArea())) {
|
||||||
if (p.getAlias().equalsIgnoreCase(alias)) {
|
if (p.getAlias().equalsIgnoreCase(alias)) {
|
||||||
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
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);
|
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
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.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
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 offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||||
final int offsetZ = bz - (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);
|
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()) {
|
if (!areas.isEmpty()) {
|
||||||
C.CLUSTER_INTERSECTION
|
C.CLUSTER_INTERSECTION
|
||||||
.send(player, areas.iterator().next().toString());
|
.send(player, areas.iterator().next().toString());
|
||||||
@ -94,8 +95,8 @@ public class Area extends SubCommand {
|
|||||||
object.type = area.TYPE;
|
object.type = area.TYPE;
|
||||||
object.min = new PlotId(1, 1);
|
object.min = new PlotId(1, 1);
|
||||||
object.max = new PlotId(numX, numZ);
|
object.max = new PlotId(numX, numZ);
|
||||||
object.plotManager = PS.imp().getPluginName();
|
object.plotManager = PlotSquared.imp().getPluginName();
|
||||||
object.setupGenerator = PS.imp().getPluginName();
|
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||||
object.step = area.getSettingNodes();
|
object.step = area.getSettingNodes();
|
||||||
final String path =
|
final String path =
|
||||||
"worlds." + area.worldname + ".areas." + area.id + '-'
|
"worlds." + area.worldname + ".areas." + area.id + '-'
|
||||||
@ -103,14 +104,14 @@ public class Area extends SubCommand {
|
|||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (offsetX != 0) {
|
if (offsetX != 0) {
|
||||||
PS.get().worlds.set(path + ".road.offset.x", offsetX);
|
PlotSquared.get().worlds.set(path + ".road.offset.x", offsetX);
|
||||||
}
|
}
|
||||||
if (offsetZ != 0) {
|
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);
|
final String world = SetupUtils.manager.setupWorld(object);
|
||||||
if (WorldUtil.IMP.isWorld(world)) {
|
if (WorldUtil.IMP.isWorld(world)) {
|
||||||
PS.get().loadWorld(world, null);
|
PlotSquared.get().loadWorld(world, null);
|
||||||
C.SETUP_FINISHED.send(player);
|
C.SETUP_FINISHED.send(player);
|
||||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||||
if (area.TERRAIN != 3) {
|
if (area.TERRAIN != 3) {
|
||||||
@ -149,13 +150,13 @@ public class Area extends SubCommand {
|
|||||||
}
|
}
|
||||||
object.world = split[0];
|
object.world = split[0];
|
||||||
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id,
|
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id,
|
||||||
PS.get().IMP.getDefaultGenerator(), null, null);
|
PlotSquared.get().IMP.getDefaultGenerator(), null, null);
|
||||||
PlotArea other = PS.get().getPlotArea(pa.worldname, id);
|
PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id);
|
||||||
if (other != null && Objects.equals(pa.id, other.id)) {
|
if (other != null && Objects.equals(pa.id, other.id)) {
|
||||||
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname);
|
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(pa.worldname);
|
||||||
if (!areas.isEmpty()) {
|
if (!areas.isEmpty()) {
|
||||||
PlotArea area = areas.iterator().next();
|
PlotArea area = areas.iterator().next();
|
||||||
pa.TYPE = area.TYPE;
|
pa.TYPE = area.TYPE;
|
||||||
@ -224,15 +225,15 @@ public class Area extends SubCommand {
|
|||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
String path = "worlds." + pa.worldname;
|
String path = "worlds." + pa.worldname;
|
||||||
if (!PS.get().worlds.contains(path)) {
|
if (!PlotSquared.get().worlds.contains(path)) {
|
||||||
PS.get().worlds.createSection(path);
|
PlotSquared.get().worlds.createSection(path);
|
||||||
}
|
}
|
||||||
ConfigurationSection section =
|
ConfigurationSection section =
|
||||||
PS.get().worlds.getConfigurationSection(path);
|
PlotSquared.get().worlds.getConfigurationSection(path);
|
||||||
pa.saveConfiguration(section);
|
pa.saveConfiguration(section);
|
||||||
pa.loadConfiguration(section);
|
pa.loadConfiguration(section);
|
||||||
object.plotManager = PS.imp().getPluginName();
|
object.plotManager = PlotSquared.imp().getPluginName();
|
||||||
object.setupGenerator = PS.imp().getPluginName();
|
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||||
String world = SetupUtils.manager.setupWorld(object);
|
String world = SetupUtils.manager.setupWorld(object);
|
||||||
if (WorldUtil.IMP.isWorld(world)) {
|
if (WorldUtil.IMP.isWorld(world)) {
|
||||||
C.SETUP_FINISHED.send(player);
|
C.SETUP_FINISHED.send(player);
|
||||||
@ -243,7 +244,7 @@ public class Area extends SubCommand {
|
|||||||
+ pa.worldname);
|
+ pa.worldname);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -291,7 +292,7 @@ public class Area extends SubCommand {
|
|||||||
area = player.getApplicablePlotArea();
|
area = player.getApplicablePlotArea();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
area = PS.get().getPlotAreaByString(args[1]);
|
area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
||||||
@ -351,7 +352,7 @@ public class Area extends SubCommand {
|
|||||||
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ArrayList<PlotArea> areas = new ArrayList<>(PS.get().getPlotAreas());
|
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
|
||||||
paginate(player, areas, 8, page,
|
paginate(player, areas, 8, page,
|
||||||
new RunnableVal3<Integer, PlotArea, PlotMessage>() {
|
new RunnableVal3<Integer, PlotArea, PlotMessage>() {
|
||||||
@Override public void run(Integer i, PlotArea area, PlotMessage message) {
|
@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]");
|
C.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
return false;
|
return false;
|
||||||
@ -457,7 +458,7 @@ public class Area extends SubCommand {
|
|||||||
case "remove":
|
case "remove":
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"$1World creation settings may be stored in multiple locations:"
|
"$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"
|
+ " settings.yml"
|
||||||
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
|
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
|
||||||
+ "\n$1Stop the server and delete it from these locations.");
|
+ "\n$1Stop the server and delete it from these locations.");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
@ -138,7 +138,7 @@ public class Auto extends SubCommand {
|
|||||||
PlotArea plotarea = player.getApplicablePlotArea();
|
PlotArea plotarea = player.getApplicablePlotArea();
|
||||||
if (plotarea == null) {
|
if (plotarea == null) {
|
||||||
if (EconHandler.manager != null) {
|
if (EconHandler.manager != null) {
|
||||||
for (PlotArea area : PS.get().getPlotAreaManager().getAllPlotAreas()) {
|
for (PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
|
||||||
if (EconHandler.manager
|
if (EconHandler.manager
|
||||||
.hasPermission(area.worldname, player.getName(), "plots.auto")) {
|
.hasPermission(area.worldname, player.getName(), "plots.auto")) {
|
||||||
if (plotarea != null) {
|
if (plotarea != null) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Updater;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -15,11 +15,11 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
try {
|
try {
|
||||||
Updater updater = PS.get().getUpdater();
|
Updater updater = PlotSquared.get().getUpdater();
|
||||||
String changes = updater != null ? updater.getChanges() : null;
|
String changes = updater != null ? updater.getChanges() : null;
|
||||||
if (changes == null) {
|
if (changes == null) {
|
||||||
try (Scanner scanner = new Scanner(new URL("http://empcraft.com/plots/cl?" + Integer
|
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();
|
changes = scanner.useDelimiter("\\A").next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
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());
|
MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName());
|
||||||
}
|
}
|
||||||
for (Plot plot : new ArrayList<>(
|
for (Plot plot : new ArrayList<>(
|
||||||
PS.get().getPlots(player2.getLocation().getWorld(), uuid))) {
|
PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) {
|
||||||
PlotCluster current = plot.getCluster();
|
PlotCluster current = plot.getCluster();
|
||||||
if (current != null && current.equals(cluster)) {
|
if (current != null && current.equals(cluster)) {
|
||||||
plot.unclaim();
|
plot.unclaim();
|
||||||
@ -433,7 +433,7 @@ public class Cluster extends SubCommand {
|
|||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
||||||
for (Plot plot : new ArrayList<>(
|
for (Plot plot : new ArrayList<>(
|
||||||
PS.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
||||||
PlotCluster current = plot.getCluster();
|
PlotCluster current = plot.getCluster();
|
||||||
if (current != null && current.equals(cluster)) {
|
if (current != null && current.equals(cluster)) {
|
||||||
player.getLocation().getWorld();
|
player.getLocation().getWorld();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
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]");
|
MainUtil.sendMessage(player, "/plot condense <area> <start|stop|info> [radius]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||||
MainUtil.sendMessage(player, "INVALID AREA");
|
MainUtil.sendMessage(player, "INVALID AREA");
|
||||||
return false;
|
return false;
|
||||||
@ -46,7 +46,7 @@ public class Condense extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int radius = Integer.parseInt(args[2]);
|
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
|
// remove non base plots
|
||||||
Iterator<Plot> iterator = plots.iterator();
|
Iterator<Plot> iterator = plots.iterator();
|
||||||
int maxSize = 0;
|
int maxSize = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.MySQL;
|
import com.github.intellectualsites.plotsquared.plot.database.MySQL;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLManager;
|
import com.github.intellectualsites.plotsquared.plot.database.SQLManager;
|
||||||
@ -57,12 +57,12 @@ public class Database extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Plot> plots;
|
List<Plot> plots;
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
plots = PS.get().sortPlotsByTemp(area.getPlots());
|
plots = PlotSquared.get().sortPlotsByTemp(area.getPlots());
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
} else {
|
} else {
|
||||||
plots = PS.get().sortPlotsByTemp(PS.get().getPlots());
|
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots());
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
MainUtil.sendMessage(player, "/plot database [world] <sqlite|mysql|import>");
|
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]");
|
.sendMessage(player, "/plot database import <sqlite file> [prefix]");
|
||||||
return false;
|
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");
|
args[1].endsWith(".db") ? args[1] : args[1] + ".db");
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
MainUtil.sendMessage(player, "&6Database does not exist: " + file);
|
MainUtil.sendMessage(player, "&6Database does not exist: " + file);
|
||||||
@ -93,7 +93,7 @@ public class Database extends SubCommand {
|
|||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
||||||
String areaname = entry.getKey();
|
String areaname = entry.getKey();
|
||||||
PlotArea pa = PS.get().getPlotAreaByString(areaname);
|
PlotArea pa = PlotSquared.get().getPlotAreaByString(areaname);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
Plot plot = entry2.getValue();
|
Plot plot = entry2.getValue();
|
||||||
@ -103,11 +103,11 @@ public class Database extends SubCommand {
|
|||||||
if (newPlot != null) {
|
if (newPlot != null) {
|
||||||
PlotId newId = newPlot.getId();
|
PlotId newId = newPlot.getId();
|
||||||
PlotId id = plot.getId();
|
PlotId id = plot.getId();
|
||||||
File worldFile = new File(PS.imp().getWorldContainer(),
|
File worldFile = new File(PlotSquared.imp().getWorldContainer(),
|
||||||
id.toCommaSeparatedString());
|
id.toCommaSeparatedString());
|
||||||
if (worldFile.exists()) {
|
if (worldFile.exists()) {
|
||||||
File newFile =
|
File newFile =
|
||||||
new File(PS.imp().getWorldContainer(),
|
new File(PlotSquared.imp().getWorldContainer(),
|
||||||
newId.toCommaSeparatedString());
|
newId.toCommaSeparatedString());
|
||||||
worldFile.renameTo(newFile);
|
worldFile.renameTo(newFile);
|
||||||
}
|
}
|
||||||
@ -127,10 +127,10 @@ public class Database extends SubCommand {
|
|||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
HashMap<PlotId, Plot> plotmap = PS.get().plots_tmp.get(areaname);
|
HashMap<PlotId, Plot> plotmap = PlotSquared.get().plots_tmp.get(areaname);
|
||||||
if (plotmap == null) {
|
if (plotmap == null) {
|
||||||
plotmap = new HashMap<>();
|
plotmap = new HashMap<>();
|
||||||
PS.get().plots_tmp.put(areaname, plotmap);
|
PlotSquared.get().plots_tmp.put(areaname, plotmap);
|
||||||
}
|
}
|
||||||
plotmap.putAll(entry.getValue());
|
plotmap.putAll(entry.getValue());
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class Database extends SubCommand {
|
|||||||
return MainUtil.sendMessage(player, "/plot database sqlite [file]");
|
return MainUtil.sendMessage(player, "/plot database sqlite [file]");
|
||||||
}
|
}
|
||||||
File sqliteFile =
|
File sqliteFile =
|
||||||
MainUtil.getFile(PS.get().IMP.getDirectory(), args[1] + ".db");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1] + ".db");
|
||||||
implementation = new SQLite(sqliteFile);
|
implementation = new SQLite(sqliteFile);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -26,8 +26,8 @@ public class Debug extends SubCommand {
|
|||||||
information.append(header);
|
information.append(header);
|
||||||
information.append(getSection(section, "PlotArea"));
|
information.append(getSection(section, "PlotArea"));
|
||||||
information
|
information
|
||||||
.append(getLine(line, "Plot Worlds", StringMan.join(PS.get().getPlotAreas(), ", ")));
|
.append(getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
|
||||||
information.append(getLine(line, "Owned Plots", PS.get().getPlots().size()));
|
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
|
||||||
information.append(getSection(section, "Messages"));
|
information.append(getSection(section, "Messages"));
|
||||||
information.append(getLine(line, "Total Messages", C.values().length));
|
information.append(getLine(line, "Total Messages", C.values().length));
|
||||||
information.append(getLine(line, "View all captions", "/plot debug msg"));
|
information.append(getLine(line, "View all captions", "/plot debug msg"));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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 "
|
"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}");
|
+ "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)) {
|
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
||||||
return false;
|
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.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
@ -31,13 +31,13 @@ import java.util.*;
|
|||||||
|
|
||||||
public DebugExec() {
|
public DebugExec() {
|
||||||
try {
|
try {
|
||||||
if (PS.get() != null) {
|
if (PlotSquared.get() != null) {
|
||||||
File file = new File(PS.get().IMP.getDirectory(),
|
File file = new File(PlotSquared.get().IMP.getDirectory(),
|
||||||
Settings.Paths.SCRIPTS + File.separator + "start.js");
|
Settings.Paths.SCRIPTS + File.separator + "start.js");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
init();
|
init();
|
||||||
String script = StringMan.join(Files.readLines(new File(new File(
|
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"));
|
"start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator"));
|
||||||
this.scope.put("THIS", this);
|
this.scope.put("THIS", this);
|
||||||
this.scope.put("PlotPlayer", ConsolePlayer.getConsole());
|
this.scope.put("PlotPlayer", ConsolePlayer.getConsole());
|
||||||
@ -87,10 +87,10 @@ import java.util.*;
|
|||||||
this.scope.put("RunnableVal", RunnableVal.class);
|
this.scope.put("RunnableVal", RunnableVal.class);
|
||||||
|
|
||||||
// Instances
|
// Instances
|
||||||
this.scope.put("PS", PS.get());
|
this.scope.put("PS", PlotSquared.get());
|
||||||
this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP);
|
this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP);
|
||||||
this.scope.put("ExpireManager", ExpireManager.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("WEManager", new WEManager());
|
||||||
}
|
}
|
||||||
this.scope.put("TaskManager", TaskManager.IMP);
|
this.scope.put("TaskManager", TaskManager.IMP);
|
||||||
@ -105,7 +105,7 @@ import java.util.*;
|
|||||||
this.scope.put("UUIDHandler", UUIDHandler.implementation);
|
this.scope.put("UUIDHandler", UUIDHandler.implementation);
|
||||||
this.scope.put("DBFunc", DBFunc.dbManager);
|
this.scope.put("DBFunc", DBFunc.dbManager);
|
||||||
this.scope.put("HybridUtils", HybridUtils.manager);
|
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());
|
this.scope.put("MainCommand", MainCommand.getInstance());
|
||||||
|
|
||||||
// enums
|
// enums
|
||||||
@ -180,7 +180,7 @@ import java.util.*;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String flag = args[1];
|
String flag = args[1];
|
||||||
for (Plot plot : PS.get().getBasePlots()) {
|
for (Plot plot : PlotSquared.get().getBasePlots()) {
|
||||||
Flag<?> flag1 = FlagManager.getFlag(flag);
|
Flag<?> flag1 = FlagManager.getFlag(flag);
|
||||||
if (plot.getFlag(flag1).isPresent()) {
|
if (plot.getFlag(flag1).isPresent()) {
|
||||||
plot.removeFlag(flag1);
|
plot.removeFlag(flag1);
|
||||||
@ -193,7 +193,7 @@ import java.util.*;
|
|||||||
"&cInvalid syntax: /plot debugexec start-rgar <world>");
|
"&cInvalid syntax: /plot debugexec start-rgar <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]);
|
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]);
|
||||||
return false;
|
return false;
|
||||||
@ -261,7 +261,7 @@ import java.util.*;
|
|||||||
case "addcmd":
|
case "addcmd":
|
||||||
try {
|
try {
|
||||||
final String cmd = StringMan.join(Files.readLines(MainUtil.getFile(new File(
|
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),
|
args[1]), StandardCharsets.UTF_8),
|
||||||
System.getProperty("line.separator"));
|
System.getProperty("line.separator"));
|
||||||
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
|
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
|
||||||
@ -291,7 +291,7 @@ import java.util.*;
|
|||||||
case "run":
|
case "run":
|
||||||
try {
|
try {
|
||||||
script = StringMan.join(Files.readLines(MainUtil.getFile(new File(
|
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),
|
args[1]), StandardCharsets.UTF_8),
|
||||||
System.getProperty("line.separator"));
|
System.getProperty("line.separator"));
|
||||||
if (args.length > 2) {
|
if (args.length > 2) {
|
||||||
@ -308,7 +308,7 @@ import java.util.*;
|
|||||||
break;
|
break;
|
||||||
case "list-scripts":
|
case "list-scripts":
|
||||||
String path =
|
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 folder = new File(path);
|
||||||
File[] filesArray = folder.listFiles();
|
File[] filesArray = folder.listFiles();
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ import java.util.*;
|
|||||||
if ("true".equals(args[1])) {
|
if ("true".equals(args[1])) {
|
||||||
Location loc = player.getMeta("location");
|
Location loc = player.getMeta("location");
|
||||||
Plot plot = player.getMeta("lastplot");
|
Plot plot = player.getMeta("lastplot");
|
||||||
for (Plot current : PS.get().getBasePlots()) {
|
for (Plot current : PlotSquared.get().getBasePlots()) {
|
||||||
player.setMeta("location", current.getBottomAbs());
|
player.setMeta("location", current.getBottomAbs());
|
||||||
player.setMeta("lastplot", current);
|
player.setMeta("lastplot", current);
|
||||||
cmd.execute(player, params, null, null);
|
cmd.execute(player, params, null, null);
|
||||||
@ -398,7 +398,7 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
init();
|
init();
|
||||||
this.scope.put("PlotPlayer", player);
|
this.scope.put("PlotPlayer", player);
|
||||||
PS.debug("> " + script);
|
PlotSquared.debug("> " + script);
|
||||||
try {
|
try {
|
||||||
if (async) {
|
if (async) {
|
||||||
final String toExec = script;
|
final String toExec = script;
|
||||||
@ -411,13 +411,13 @@ import java.util.*;
|
|||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Object result = this.engine.eval(script, this.scope);
|
Object result = this.engine.eval(script, this.scope);
|
||||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (ScriptException e) {
|
} 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.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
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) {
|
@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)) {
|
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]);
|
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]);
|
||||||
return false;
|
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.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.PlotId;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||||
@ -27,14 +27,14 @@ public class DebugImportWorlds extends Command {
|
|||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
|
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
|
||||||
PlotAreaManager pam = PS.get().getPlotAreaManager();
|
PlotAreaManager pam = PlotSquared.get().getPlotAreaManager();
|
||||||
if (!(pam instanceof SinglePlotAreaManager)) {
|
if (!(pam instanceof SinglePlotAreaManager)) {
|
||||||
player.sendMessage("Must be a single plot area!");
|
player.sendMessage("Must be a single plot area!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea();
|
SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea();
|
||||||
PlotId id = new PlotId(0, 0);
|
PlotId id = new PlotId(0, 0);
|
||||||
File container = PS.imp().getWorldContainer();
|
File container = PlotSquared.imp().getWorldContainer();
|
||||||
for (File folder : container.listFiles()) {
|
for (File folder : container.listFiles()) {
|
||||||
String name = folder.getName();
|
String name = folder.getName();
|
||||||
if (!WorldUtil.IMP.isWorld(name) && PlotId.fromString(name) == null) {
|
if (!WorldUtil.IMP.isWorld(name) && PlotId.fromString(name) == null) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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 {
|
public class DebugLoadTest extends SubCommand {
|
||||||
|
|
||||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
PS.get().plots_tmp = DBFunc.getPlots();
|
PlotSquared.get().plots_tmp = DBFunc.getPlots();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -20,13 +20,13 @@ public class DebugPaste extends SubCommand {
|
|||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
try {
|
try {
|
||||||
String settingsYML = HastebinUtility.upload(PS.get().configFile);
|
String settingsYML = HastebinUtility.upload(PlotSquared.get().configFile);
|
||||||
String worldsYML = HastebinUtility.upload(PS.get().worldsFile);
|
String worldsYML = HastebinUtility.upload(PlotSquared.get().worldsFile);
|
||||||
String commandsYML = HastebinUtility.upload(PS.get().commandsFile);
|
String commandsYML = HastebinUtility.upload(PlotSquared.get().commandsFile);
|
||||||
String latestLOG;
|
String latestLOG;
|
||||||
try {
|
try {
|
||||||
latestLOG = HastebinUtility
|
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) {
|
} catch (IOException ignored) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&clatest.log is too big to be pasted, will ignore");
|
"&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.commands_yml: ").append(commandsYML).append('\n');
|
||||||
b.append("links.latest_log: ").append(latestLOG).append('\n');
|
b.append("links.latest_log: ").append(latestLOG).append('\n');
|
||||||
b.append("\n# Server Information\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])
|
b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1])
|
||||||
.append('.').append(sVersion[2]).append('\n');
|
.append('.').append(sVersion[2]).append('\n');
|
||||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
|
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
|
||||||
.append(!Settings.UUID.OFFLINE).append('\n');
|
.append(!Settings.UUID.OFFLINE).append('\n');
|
||||||
b.append("plugins:");
|
b.append("plugins:");
|
||||||
for (String id : PS.get().IMP.getPluginIds()) {
|
for (String id : PlotSquared.get().IMP.getPluginIds()) {
|
||||||
String[] split = id.split(":");
|
String[] split = id.split(":");
|
||||||
String[] split2 = split[0].split(";");
|
String[] split2 = split[0].split(";");
|
||||||
String enabled = split.length == 2 ? split[1] : "unknown";
|
String enabled = split.length == 2 ? split[1] : "unknown";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
ArrayList<Plot> plots = new ArrayList<Plot>();
|
ArrayList<Plot> plots = new ArrayList<Plot>();
|
||||||
plots.addAll(PS.get().getPlots());
|
plots.addAll(PlotSquared.get().getPlots());
|
||||||
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
|
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
|
||||||
DBFunc.createPlotsAndData(plots, new Runnable() {
|
DBFunc.createPlotsAndData(plots, new Runnable() {
|
||||||
@Override public void run() {
|
@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.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -99,7 +99,7 @@ public class Deny extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, C.YOU_GOT_DENIED);
|
MainUtil.sendMessage(player, C.YOU_GOT_DENIED);
|
||||||
if (plot.equals(spawn.getPlot())) {
|
if (plot.equals(spawn.getPlot())) {
|
||||||
Location newSpawn =
|
Location newSpawn =
|
||||||
WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]);
|
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||||
if (plot.equals(newSpawn.getPlot())) {
|
if (plot.equals(newSpawn.getPlot())) {
|
||||||
// Kick from server if you can't be teleported to spawn
|
// Kick from server if you can't be teleported to spawn
|
||||||
player.kick(C.YOU_GOT_DENIED.s());
|
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.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PS.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
@ -27,7 +27,7 @@ public class FlagCmd extends SubCommand {
|
|||||||
int numeric = Integer.parseInt(value);
|
int numeric = Integer.parseInt(value);
|
||||||
perm = perm.substring(0, perm.length() - value.length() - 1);
|
perm = perm.substring(0, perm.length() - value.length() - 1);
|
||||||
if (numeric > 0) {
|
if (numeric > 0) {
|
||||||
int checkRange = PS.get().getPlatform().equalsIgnoreCase("bukkit") ?
|
int checkRange = PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ?
|
||||||
numeric :
|
numeric :
|
||||||
Settings.Limit.MAX_PLOTS;
|
Settings.Limit.MAX_PLOTS;
|
||||||
return player.hasPermissionRange(perm, checkRange) >= numeric;
|
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.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
@ -76,7 +76,7 @@ public class Kick extends SubCommand {
|
|||||||
C.YOU_GOT_KICKED.send(player2);
|
C.YOU_GOT_KICKED.send(player2);
|
||||||
if (plot.equals(spawn.getPlot())) {
|
if (plot.equals(spawn.getPlot())) {
|
||||||
Location newSpawn =
|
Location newSpawn =
|
||||||
WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]);
|
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
|
||||||
if (plot.equals(newSpawn.getPlot())) {
|
if (plot.equals(newSpawn.getPlot())) {
|
||||||
// Kick from server if you can't be teleported to spawn
|
// Kick from server if you can't be teleported to spawn
|
||||||
player2.kick(C.YOU_GOT_KICKED.s());
|
player2.kick(C.YOU_GOT_KICKED.s());
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.PS.SortType;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -98,7 +98,7 @@ public class ListCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort = false;
|
sort = false;
|
||||||
plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player));
|
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player));
|
||||||
break;
|
break;
|
||||||
case "shared":
|
case "shared":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
|
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
|
||||||
@ -106,7 +106,7 @@ public class ListCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
if (plot.getTrusted().contains(player.getUUID()) || plot.getMembers()
|
if (plot.getTrusted().contains(player.getUUID()) || plot.getMembers()
|
||||||
.contains(player.getUUID())) {
|
.contains(player.getUUID())) {
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
@ -123,7 +123,7 @@ public class ListCmd extends SubCommand {
|
|||||||
C.PERMISSION_LIST_WORLD_NAME.f(world));
|
C.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PS.get().getPlots(world));
|
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
||||||
break;
|
break;
|
||||||
case "expired":
|
case "expired":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_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);
|
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PS.get().getPlots());
|
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||||
break;
|
break;
|
||||||
case "done":
|
case "done":
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
|
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
|
||||||
@ -159,7 +159,7 @@ public class ListCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
Optional<String> flag = plot.getFlag(Flags.DONE);
|
Optional<String> flag = plot.getFlag(Flags.DONE);
|
||||||
if (!flag.isPresent()) {
|
if (!flag.isPresent()) {
|
||||||
continue;
|
continue;
|
||||||
@ -186,7 +186,7 @@ public class ListCmd extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
|
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PS.get().getPlots());
|
plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||||
Collections.sort(plots, new Comparator<Plot>() {
|
Collections.sort(plots, new Comparator<Plot>() {
|
||||||
@Override public int compare(Plot p1, Plot p2) {
|
@Override public int compare(Plot p1, Plot p2) {
|
||||||
double v1 = 0;
|
double v1 = 0;
|
||||||
@ -226,7 +226,7 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
Optional<Double> price = plot.getFlag(Flags.PRICE);
|
Optional<Double> price = plot.getFlag(Flags.PRICE);
|
||||||
if (price.isPresent()) {
|
if (price.isPresent()) {
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
@ -239,7 +239,7 @@ public class ListCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
if (plot.owner == null) {
|
if (plot.owner == null) {
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ public class ListCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
if (plot.owner == null) {
|
if (plot.owner == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ public class ListCmd extends SubCommand {
|
|||||||
sort = false;
|
sort = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (PS.get().hasPlotArea(args[0])) {
|
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||||
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
|
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
|
||||||
return false;
|
return false;
|
||||||
@ -290,7 +290,7 @@ public class ListCmd extends SubCommand {
|
|||||||
C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>(PS.get().getPlots(args[0]));
|
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
UUID uuid = UUIDHandler.getUUID(args[0], null);
|
UUID uuid = UUIDHandler.getUUID(args[0], null);
|
||||||
@ -306,7 +306,7 @@ public class ListCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort = false;
|
sort = false;
|
||||||
plots = PS.get().sortPlotsByTemp(PS.get().getPlots(uuid));
|
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots(uuid));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sort) {
|
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,
|
this.paginate(player, plots, pageSize, page,
|
||||||
new RunnableVal3<Integer, Plot, PlotMessage>() {
|
new RunnableVal3<Integer, Plot, PlotMessage>() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PS.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
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.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||||
@ -185,7 +185,7 @@ import java.util.Arrays;
|
|||||||
/**
|
/**
|
||||||
* @Deprecated legacy
|
* @Deprecated legacy
|
||||||
*/ public void addCommand(SubCommand command) {
|
*/ 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,
|
@Override public void execute(final PlotPlayer player, String[] args,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -34,7 +34,7 @@ public class Move extends SubCommand {
|
|||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
C.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
Plot plot2;
|
Plot plot2;
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
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.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.json.JSONObject;
|
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.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.HttpUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.HttpUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -15,8 +15,8 @@ public class PluginCmd extends SubCommand {
|
|||||||
TaskManager.IMP.taskAsync(new Runnable() {
|
TaskManager.IMP.taskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
MainUtil.sendMessage(player, String
|
MainUtil.sendMessage(player, String
|
||||||
.format("$2>> $1&l" + PS.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
|
.format("$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
|
||||||
PS.get().getVersion()));
|
PlotSquared.get().getVersion()));
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev");
|
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev");
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||||
@ -45,7 +45,7 @@ public class Purge extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "area":
|
case "area":
|
||||||
case "a":
|
case "a":
|
||||||
area = PS.get().getPlotAreaByString(split[1]);
|
area = PlotSquared.get().getPlotAreaByString(split[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
C.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
||||||
return false;
|
return false;
|
||||||
@ -86,7 +86,7 @@ public class Purge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final HashSet<Plot> toDelete = new HashSet<>();
|
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)) {
|
if (world != null && !plot.getWorldName().equalsIgnoreCase(world)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -109,8 +109,8 @@ public class Purge extends SubCommand {
|
|||||||
toDelete.add(current);
|
toDelete.add(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PS.get().plots_tmp != null) {
|
if (PlotSquared.get().plots_tmp != null) {
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : PS.get().plots_tmp.entrySet()) {
|
for (Entry<String, HashMap<PlotId, Plot>> entry : PlotSquared.get().plots_tmp.entrySet()) {
|
||||||
String worldName = entry.getKey();
|
String worldName = entry.getKey();
|
||||||
if (world != null && !world.equalsIgnoreCase(worldName)) {
|
if (world != null && !world.equalsIgnoreCase(worldName)) {
|
||||||
continue;
|
continue;
|
||||||
@ -141,7 +141,7 @@ public class Purge extends SubCommand {
|
|||||||
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@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<>();
|
HashSet<Integer> ids = new HashSet<>();
|
||||||
for (Plot plot : toDelete) {
|
for (Plot plot : toDelete) {
|
||||||
if (plot.temp != Integer.MAX_VALUE) {
|
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.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
@ -20,7 +20,7 @@ public class Rate extends SubCommand {
|
|||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "next": {
|
case "next": {
|
||||||
ArrayList<Plot> plots = new ArrayList<>(PS.get().getBasePlots());
|
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getBasePlots());
|
||||||
Collections.sort(plots, new Comparator<Plot>() {
|
Collections.sort(plots, new Comparator<Plot>() {
|
||||||
@Override public int compare(Plot p1, Plot p2) {
|
@Override public int compare(Plot p1, Plot p2) {
|
||||||
double v1 = 0;
|
double v1 = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
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]");
|
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
||||||
return false;
|
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.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -21,12 +21,12 @@ public class Reload extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
// The following won't affect world generation, as that has to be
|
// The following won't affect world generation, as that has to be
|
||||||
// loaded during startup unfortunately.
|
// loaded during startup unfortunately.
|
||||||
PS.get().setupConfigs();
|
PlotSquared.get().setupConfigs();
|
||||||
C.load(PS.get().translationFile);
|
C.load(PlotSquared.get().translationFile);
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea area) {
|
@Override public void run(PlotArea area) {
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PS.get().worlds.getConfigurationSection("worlds." + area.worldname);
|
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname);
|
||||||
if (worldSection == null) {
|
if (worldSection == null) {
|
||||||
return;
|
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);
|
MainUtil.sendMessage(player, C.RELOADED_CONFIGS);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
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.commands.CommandDeclaration;
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
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) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PS.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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>");
|
"&cNeed world argument. Use &7/plot sch exportall <area>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||||
@ -26,7 +26,7 @@ import java.util.Map.Entry;
|
|||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append("&6What generator do you want?");
|
message.append("&6What generator do you want?");
|
||||||
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
|
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)");
|
message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
|
||||||
} else if (entry.getValue().isFull()) {
|
} else if (entry.getValue().isFull()) {
|
||||||
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
|
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
|
||||||
@ -74,7 +74,7 @@ import java.util.Map.Entry;
|
|||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&cYou must choose a generator!" + prefix + StringMan
|
"&cYou must choose a generator!" + prefix + StringMan
|
||||||
.join(SetupUtils.generators.keySet(), prefix)
|
.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);
|
sendMessage(player, C.SETUP_INIT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ import java.util.Map.Entry;
|
|||||||
SetupUtils.generators.get(object.plotManager).getPlotGenerator()
|
SetupUtils.generators.get(object.plotManager).getPlotGenerator()
|
||||||
.processSetup(object);
|
.processSetup(object);
|
||||||
} else {
|
} else {
|
||||||
object.plotManager = PS.imp().getPluginName();
|
object.plotManager = PlotSquared.imp().getPluginName();
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&c[WARNING] The specified generator does not identify as BukkitPlotGenerator");
|
"&c[WARNING] The specified generator does not identify as BukkitPlotGenerator");
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
@ -170,7 +170,7 @@ import java.util.Map.Entry;
|
|||||||
MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!");
|
MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PlotArea area : PS.get().getPlotAreas()) {
|
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
|
||||||
if (area.id != null && area.id.equalsIgnoreCase(args[0])) {
|
if (area.id != null && area.id.equalsIgnoreCase(args[0])) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&cYou must choose an area id that is not in use!");
|
"&cYou must choose an area id that is not in use!");
|
||||||
@ -270,13 +270,13 @@ import java.util.Map.Entry;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (WorldUtil.IMP.isWorld(args[0])) {
|
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!");
|
MainUtil.sendMessage(player, "&cThat world name is already taken!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&cThe world you specified already exists. After restarting, new terrain will use "
|
"&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!");
|
+ "reset the world for it to generate correctly!");
|
||||||
}
|
}
|
||||||
object.world = args[0];
|
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.Argument;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -26,7 +26,7 @@ public class Target extends SubCommand {
|
|||||||
Plot target = null;
|
Plot target = null;
|
||||||
if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) {
|
if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) {
|
||||||
int distance = Integer.MAX_VALUE;
|
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);
|
double current = plot.getCenter().getEuclideanDistanceSquared(location);
|
||||||
if (current < distance) {
|
if (current < distance) {
|
||||||
distance = (int) current;
|
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.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
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) {
|
public static boolean extractAllFiles(String world, String template) {
|
||||||
try {
|
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()) {
|
if (!folder.exists()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
File input = new File(folder + File.separator + template + ".template");
|
File input = new File(folder + File.separator + template + ".template");
|
||||||
File output = PS.get().IMP.getDirectory();
|
File output = PlotSquared.get().IMP.getDirectory();
|
||||||
if (!output.exists()) {
|
if (!output.exists()) {
|
||||||
output.mkdirs();
|
output.mkdirs();
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ public class Template extends SubCommand {
|
|||||||
|
|
||||||
public static byte[] getBytes(PlotArea plotArea) {
|
public static byte[] getBytes(PlotArea plotArea) {
|
||||||
ConfigurationSection section =
|
ConfigurationSection section =
|
||||||
PS.get().worlds.getConfigurationSection("worlds." + plotArea.worldname);
|
PlotSquared.get().worlds.getConfigurationSection("worlds." + plotArea.worldname);
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
String generator = SetupUtils.manager.getGenerator(plotArea);
|
String generator = SetupUtils.manager.getGenerator(plotArea);
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
@ -84,7 +84,7 @@ public class Template extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void zipAll(String world, Set<FileBytes> files) throws IOException {
|
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();
|
output.mkdirs();
|
||||||
try (FileOutputStream fos = new FileOutputStream(
|
try (FileOutputStream fos = new FileOutputStream(
|
||||||
output + File.separator + world + ".template");
|
output + File.separator + world + ".template");
|
||||||
@ -123,7 +123,7 @@ public class Template extends SubCommand {
|
|||||||
"/plot template import <world> <template>");
|
"/plot template import <world> <template>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (PS.get().hasPlotArea(world)) {
|
if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
MainUtil.sendMessage(player, C.SETUP_WORLD_TAKEN, world);
|
MainUtil.sendMessage(player, C.SETUP_WORLD_TAKEN, world);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -133,18 +133,18 @@ public class Template extends SubCommand {
|
|||||||
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
|
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
|
||||||
return false;
|
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");
|
Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml");
|
||||||
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
|
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
|
||||||
PS.get().worlds.set("worlds." + world, worldConfig.get(""));
|
PlotSquared.get().worlds.set("worlds." + world, worldConfig.get(""));
|
||||||
try {
|
try {
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||||
PS.get().worlds.load(PS.get().worldsFile);
|
PlotSquared.get().worlds.load(PlotSquared.get().worldsFile);
|
||||||
} catch (InvalidConfigurationException | IOException e) {
|
} catch (InvalidConfigurationException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String manager =
|
String manager =
|
||||||
worldConfig.getString("generator.plugin", PS.imp().getPluginName());
|
worldConfig.getString("generator.plugin", PlotSquared.imp().getPluginName());
|
||||||
String generator = worldConfig.getString("generator.init", manager);
|
String generator = worldConfig.getString("generator.init", manager);
|
||||||
int type = worldConfig.getInt("generator.type");
|
int type = worldConfig.getInt("generator.type");
|
||||||
int terrain = worldConfig.getInt("generator.terrain");
|
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>");
|
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotArea area = PS.get().getPlotAreaByString(world);
|
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.commands;
|
package com.github.intellectualsites.plotsquared.plot.commands;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
@ -37,7 +37,7 @@ public class Trim extends SubCommand {
|
|||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
String directory = world + File.separator + "region";
|
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();
|
File[] regionFiles = folder.listFiles();
|
||||||
for (File file : regionFiles) {
|
for (File file : regionFiles) {
|
||||||
String name = file.getName();
|
String name = file.getName();
|
||||||
@ -72,7 +72,7 @@ public class Trim extends SubCommand {
|
|||||||
ChunkLoc loc = new ChunkLoc(x, z);
|
ChunkLoc loc = new ChunkLoc(x, z);
|
||||||
empty.add(loc);
|
empty.add(loc);
|
||||||
} catch (NumberFormatException ignored) {
|
} 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...");
|
MainUtil.sendMessage(null, "Collecting region data...");
|
||||||
ArrayList<Plot> plots = new ArrayList<>();
|
ArrayList<Plot> plots = new ArrayList<>();
|
||||||
plots.addAll(PS.get().getPlots(world));
|
plots.addAll(PlotSquared.get().getPlots(world));
|
||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
plots.removeAll(ExpireManager.IMP.getPendingExpired());
|
plots.removeAll(ExpireManager.IMP.getPendingExpired());
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ public class Trim extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String world = args[0];
|
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);
|
MainUtil.sendMessage(player, C.NOT_VALID_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -144,9 +144,9 @@ public class Trim extends SubCommand {
|
|||||||
@Override public void run(Set<ChunkLoc> viable, final Set<ChunkLoc> nonViable) {
|
@Override public void run(Set<ChunkLoc> viable, final Set<ChunkLoc> nonViable) {
|
||||||
Runnable regenTask;
|
Runnable regenTask;
|
||||||
if (regen) {
|
if (regen) {
|
||||||
PS.log("Starting regen task:");
|
PlotSquared.log("Starting regen task:");
|
||||||
PS.log(" - This is a VERY slow command");
|
PlotSquared.log(" - This is a VERY slow command");
|
||||||
PS.log(" - It will say `Trim done!` when complete");
|
PlotSquared.log(" - It will say `Trim done!` when complete");
|
||||||
regenTask = new Runnable() {
|
regenTask = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (nonViable.isEmpty()) {
|
if (nonViable.isEmpty()) {
|
||||||
@ -170,7 +170,7 @@ public class Trim extends SubCommand {
|
|||||||
int bx = cbx << 4;
|
int bx = cbx << 4;
|
||||||
int bz = cbz << 4;
|
int bz = cbz << 4;
|
||||||
RegionWrapper region = new RegionWrapper(bx, bx + 511, bz, bz + 511);
|
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 bot = plot.getBottomAbs();
|
||||||
Location top = plot.getExtendedTopAbs();
|
Location top = plot.getExtendedTopAbs();
|
||||||
RegionWrapper plotReg =
|
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.Command;
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -46,7 +46,7 @@ import java.util.*;
|
|||||||
page = Integer.parseInt(args[2]);
|
page = Integer.parseInt(args[2]);
|
||||||
case 2:
|
case 2:
|
||||||
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
||||||
sortByArea = PS.get().getPlotAreaByString(args[1]);
|
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
|
||||||
if (sortByArea == null) {
|
if (sortByArea == null) {
|
||||||
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
C.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
@ -57,22 +57,22 @@ import java.util.*;
|
|||||||
C.COMMAND_SYNTAX.send(player, getUsage());
|
C.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsorted = PS.get().getBasePlots(user);
|
unsorted = PlotSquared.get().getBasePlots(user);
|
||||||
shouldSortByArea = true;
|
shouldSortByArea = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
page = Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
case 1:
|
case 1:
|
||||||
UUID user = args[0].length() >= 2 ? UUIDHandler.getUUIDFromString(args[0]) : null;
|
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;
|
user = null;
|
||||||
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
|
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
|
||||||
page = Integer.parseInt(args[0]);
|
page = Integer.parseInt(args[0]);
|
||||||
unsorted = PS.get().getBasePlots(player);
|
unsorted = PlotSquared.get().getBasePlots(player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
unsorted = PS.get().getBasePlots(user);
|
unsorted = PlotSquared.get().getBasePlots(user);
|
||||||
} else {
|
} else {
|
||||||
Plot plot = MainUtil.getPlotFromString(player, args[0], true);
|
Plot plot = MainUtil.getPlotFromString(player, args[0], true);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
@ -82,7 +82,7 @@ import java.util.*;
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
page = 1;
|
page = 1;
|
||||||
unsorted = PS.get().getPlots(player);
|
unsorted = PlotSquared.get().getPlots(player);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@ -106,9 +106,10 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
List<Plot> plots;
|
List<Plot> plots;
|
||||||
if (shouldSortByArea) {
|
if (shouldSortByArea) {
|
||||||
plots = PS.get().sortPlots(unsorted, PS.SortType.CREATION_DATE, sortByArea);
|
plots = PlotSquared
|
||||||
|
.get().sortPlots(unsorted, PlotSquared.SortType.CREATION_DATE, sortByArea);
|
||||||
} else {
|
} else {
|
||||||
plots = PS.get().sortPlotsByTemp(unsorted);
|
plots = PlotSquared.get().sortPlotsByTemp(unsorted);
|
||||||
}
|
}
|
||||||
final Plot plot = plots.get(page - 1);
|
final Plot plot = plots.get(page - 1);
|
||||||
if (!plot.hasOwner()) {
|
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.commands.CommandCaller;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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 com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -757,7 +757,7 @@ public enum C {
|
|||||||
changed = true;
|
changed = true;
|
||||||
yml.set(remove, null);
|
yml.set(remove, null);
|
||||||
}
|
}
|
||||||
ConfigurationSection config = PS.get().style.getConfigurationSection("color");
|
ConfigurationSection config = PlotSquared.get().style.getConfigurationSection("color");
|
||||||
Set<String> styles = config.getKeys(false);
|
Set<String> styles = config.getKeys(false);
|
||||||
// HashMap<String, String> replacements = new HashMap<>();
|
// HashMap<String, String> replacements = new HashMap<>();
|
||||||
replacements.clear();
|
replacements.clear();
|
||||||
@ -819,7 +819,7 @@ public enum C {
|
|||||||
public void send(CommandCaller caller, Object... args) {
|
public void send(CommandCaller caller, Object... args) {
|
||||||
String msg = format(this, args);
|
String msg = format(this, args);
|
||||||
if (caller == null) {
|
if (caller == null) {
|
||||||
PS.log(msg);
|
PlotSquared.log(msg);
|
||||||
} else {
|
} else {
|
||||||
caller.sendMessage(msg);
|
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.MemorySection;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
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 com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
|
|
||||||
import java.io.File;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +68,14 @@ public class Config {
|
|||||||
field.set(instance, value);
|
field.set(instance, value);
|
||||||
return;
|
return;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("Invalid configuration value: " + key + ": " + value + " in " + root
|
PlotSquared
|
||||||
|
.debug("Invalid configuration value: " + key + ": " + value + " in " + root
|
||||||
.getSimpleName());
|
.getSimpleName());
|
||||||
e.printStackTrace();
|
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) {
|
public static boolean load(File file, Class root) {
|
||||||
@ -261,7 +262,7 @@ public class Config {
|
|||||||
setAccessible(field);
|
setAccessible(field);
|
||||||
return field;
|
return field;
|
||||||
} catch (Throwable e) {
|
} 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()));
|
instance.getClass().getSimpleName()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.database;
|
package com.github.intellectualsites.plotsquared.plot.database;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
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.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
@ -304,12 +304,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
try {
|
try {
|
||||||
task.run();
|
task.run();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("============ DATABASE ERROR ============");
|
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||||
PS.debug("There was an error updating the database.");
|
PlotSquared.debug("There was an error updating the database.");
|
||||||
PS.debug(" - It will be corrected on shutdown");
|
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commit();
|
commit();
|
||||||
@ -359,12 +359,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("============ DATABASE ERROR ============");
|
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||||
PS.debug("There was an error updating the database.");
|
PlotSquared.debug("There was an error updating the database.");
|
||||||
PS.debug(" - It will be corrected on shutdown");
|
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -404,12 +404,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("============ DATABASE ERROR ============");
|
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||||
PS.debug("There was an error updating the database.");
|
PlotSquared.debug("There was an error updating the database.");
|
||||||
PS.debug(" - It will be corrected on shutdown");
|
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -450,12 +450,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("============ DATABASE ERROR ============");
|
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||||
PS.debug("There was an error updating the database.");
|
PlotSquared.debug("There was an error updating the database.");
|
||||||
PS.debug(" - It will be corrected on shutdown");
|
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -479,12 +479,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
this.plotTasks.clear();
|
this.plotTasks.clear();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
PS.debug("============ DATABASE ERROR ============");
|
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||||
PS.debug("There was an error updating the database.");
|
PlotSquared.debug("There was an error updating the database.");
|
||||||
PS.debug(" - It will be corrected on shutdown");
|
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -584,7 +584,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
});
|
});
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
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 {
|
try {
|
||||||
SQLManager.this.connection.commit();
|
SQLManager.this.connection.commit();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -595,7 +595,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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 {
|
try {
|
||||||
SQLManager.this.connection.commit();
|
SQLManager.this.connection.commit();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -754,7 +754,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
last = subList.size();
|
last = subList.size();
|
||||||
preparedStmt.addBatch();
|
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.executeBatch();
|
||||||
preparedStmt.clearParameters();
|
preparedStmt.clearParameters();
|
||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
@ -765,7 +765,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
if (this.mySQL) {
|
if (this.mySQL) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("&cERROR 1: | " + objList.get(0).getClass().getCanonicalName());
|
PlotSquared.debug("&cERROR 1: | " + objList.get(0).getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -797,25 +797,25 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
last = subList.size();
|
last = subList.size();
|
||||||
preparedStmt.addBatch();
|
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.executeBatch();
|
||||||
preparedStmt.clearParameters();
|
preparedStmt.clearParameters();
|
||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
|
PlotSquared.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
|
||||||
PS.debug("&6[WARN] Could not bulk save!");
|
PlotSquared.debug("&6[WARN] Could not bulk save!");
|
||||||
try (PreparedStatement preparedStmt = this.connection
|
try (PreparedStatement preparedStmt = this.connection
|
||||||
.prepareStatement(mod.getCreateSQL())) {
|
.prepareStatement(mod.getCreateSQL())) {
|
||||||
for (T obj : objList) {
|
for (T obj : objList) {
|
||||||
mod.setSQL(preparedStmt, obj);
|
mod.setSQL(preparedStmt, obj);
|
||||||
preparedStmt.addBatch();
|
preparedStmt.addBatch();
|
||||||
}
|
}
|
||||||
PS.debug("&aBatch 3");
|
PlotSquared.debug("&aBatch 3");
|
||||||
preparedStmt.executeBatch();
|
preparedStmt.executeBatch();
|
||||||
} catch (SQLException e3) {
|
} catch (SQLException e3) {
|
||||||
e3.printStackTrace();
|
e3.printStackTrace();
|
||||||
PS.debug("&c[ERROR] Failed to save all!");
|
PlotSquared.debug("&c[ERROR] Failed to save all!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
@ -1114,7 +1114,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean addConstraint = create == tables.length;
|
boolean addConstraint = create == tables.length;
|
||||||
PS.debug("Creating tables");
|
PlotSquared.debug("Creating tables");
|
||||||
try (Statement stmt = this.connection.createStatement()) {
|
try (Statement stmt = this.connection.createStatement()) {
|
||||||
if (this.mySQL) {
|
if (this.mySQL) {
|
||||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` ("
|
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` ("
|
||||||
@ -1347,7 +1347,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@Override public void delete(final Plot plot) {
|
@Override public void delete(final Plot plot) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"Deleting plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
|
"Deleting plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
|
||||||
+ plot.owner + " Index: " + plot.temp);
|
+ plot.owner + " Index: " + plot.temp);
|
||||||
deleteSettings(plot);
|
deleteSettings(plot);
|
||||||
@ -1375,7 +1375,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@Override public void createPlotSettings(final int id, Plot plot) {
|
@Override public void createPlotSettings(final int id, Plot plot) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"Creating plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
|
"Creating plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
|
||||||
+ plot.owner + " Index: " + id);
|
+ plot.owner + " Index: " + id);
|
||||||
addPlotTask(plot, new UniqueStatement("createPlotSettings") {
|
addPlotTask(plot, new UniqueStatement("createPlotSettings") {
|
||||||
@ -1469,7 +1469,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
@Override public void updateTables(int[] oldVersion) {
|
@Override public void updateTables(int[] oldVersion) {
|
||||||
try {
|
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()) {
|
try (Statement stmt = this.connection.createStatement()) {
|
||||||
stmt.executeUpdate(
|
stmt.executeUpdate(
|
||||||
"ALTER TABLE `" + this.prefix + "plots` DROP INDEX `unique_alias`");
|
"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
|
"SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table
|
||||||
+ " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
|
+ " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
|
||||||
if (result.next()) {
|
if (result.next()) {
|
||||||
PS.debug("BACKING UP: " + this.prefix + table);
|
PlotSquared.debug("BACKING UP: " + this.prefix + table);
|
||||||
result.close();
|
result.close();
|
||||||
statement.executeUpdate(
|
statement.executeUpdate(
|
||||||
"CREATE TABLE " + this.prefix + table + "_tmp AS SELECT * FROM "
|
"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 "
|
"CREATE TABLE " + this.prefix + table + " AS SELECT * FROM "
|
||||||
+ this.prefix + table + "_tmp");
|
+ this.prefix + table + "_tmp");
|
||||||
statement.executeUpdate("DROP TABLE " + 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) {
|
} catch (SQLException e2) {
|
||||||
@ -1599,9 +1599,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
HashMap<Integer, Plot> plots = new HashMap<>();
|
HashMap<Integer, Plot> plots = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
HashSet<String> areas = new HashSet<>();
|
HashSet<String> areas = new HashSet<>();
|
||||||
if (PS.get().worlds.contains("worlds")) {
|
if (PlotSquared.get().worlds.contains("worlds")) {
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PS.get().worlds.getConfigurationSection("worlds");
|
PlotSquared.get().worlds.getConfigurationSection("worlds");
|
||||||
if (worldSection != null) {
|
if (worldSection != null) {
|
||||||
for (String worldKey : worldSection.getKeys(false)) {
|
for (String worldKey : worldSection.getKeys(false)) {
|
||||||
areas.add(worldKey);
|
areas.add(worldKey);
|
||||||
@ -1677,7 +1677,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
|
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
|
||||||
.getTime();
|
.getTime();
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"Could not parse date for plot: #" + id + "(" + areaid + ";"
|
"Could not parse date for plot: #" + id + "(" + areaid + ";"
|
||||||
+ plot_id + ") (" + parsable + ")");
|
+ plot_id + ") (" + parsable + ")");
|
||||||
time = System.currentTimeMillis() + id;
|
time = System.currentTimeMillis() + id;
|
||||||
@ -1693,7 +1693,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(last.temp);
|
toDelete.add(last.temp);
|
||||||
} else {
|
} 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.");
|
+ "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) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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 "
|
+ ") in `plot_rating` does not exist. Create this plot or set `database-purger: true` in the "
|
||||||
+ "settings.yml.");
|
+ "settings.yml.");
|
||||||
}
|
}
|
||||||
@ -1754,7 +1754,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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"
|
+ ") in `plot_helpers` does not exist. Create this plot or set `database-purger: true` in the settings"
|
||||||
+ ".yml.");
|
+ ".yml.");
|
||||||
}
|
}
|
||||||
@ -1782,7 +1782,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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"
|
+ ") in `plot_trusted` does not exist. Create this plot or set `database-purger: true` in the settings"
|
||||||
+ ".yml.");
|
+ ".yml.");
|
||||||
}
|
}
|
||||||
@ -1810,7 +1810,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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.");
|
+ " 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(""));
|
flags.put(flag, flag.parseValue(""));
|
||||||
} else {
|
} else {
|
||||||
PS.debug("INVALID FLAG: " + element);
|
PlotSquared.debug("INVALID FLAG: " + element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exception) {
|
if (exception) {
|
||||||
PS.debug("&cPlot #" + id + "(" + plot + ") | " + plot
|
PlotSquared.debug("&cPlot #" + id + "(" + plot + ") | " + plot
|
||||||
+ " had an invalid flag. A fix has been attempted.");
|
+ " had an invalid flag. A fix has been attempted.");
|
||||||
PS.debug("&c" + myflags);
|
PlotSquared.debug("&c" + myflags);
|
||||||
this.setFlags(plot, flags);
|
this.setFlags(plot, flags);
|
||||||
}
|
}
|
||||||
plot.getSettings().flags = flags;
|
plot.getSettings().flags = flags;
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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"
|
+ ") in `plot_settings` does not exist. Create this plot or set `database-purger: true` in the settings"
|
||||||
+ ".yml.");
|
+ ".yml.");
|
||||||
}
|
}
|
||||||
@ -1916,15 +1916,15 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
for (Entry<String, AtomicInteger> entry : noExist.entrySet()) {
|
for (Entry<String, AtomicInteger> entry : noExist.entrySet()) {
|
||||||
String worldName = entry.getKey();
|
String worldName = entry.getKey();
|
||||||
invalidPlot = true;
|
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 + "'.");
|
+ " plots in DB for non existent world; '" + worldName + "'.");
|
||||||
}
|
}
|
||||||
if (invalidPlot) {
|
if (invalidPlot) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"&c[WARNING] - Please create the world/s or remove the plots using the purge command");
|
"&c[WARNING] - Please create the world/s or remove the plots using the purge command");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
PS.debug("&7[WARN] Failed to load plots.");
|
PlotSquared.debug("&7[WARN] Failed to load plots.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return newPlots;
|
return newPlots;
|
||||||
@ -2045,7 +2045,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int last = -1;
|
int last = -1;
|
||||||
for (int j = 0; j <= amount; j++) {
|
for (int j = 0; j <= amount; j++) {
|
||||||
PS.debug("Purging " + (j * packet) + " / " + size);
|
PlotSquared.debug("Purging " + (j * packet) + " / " + size);
|
||||||
List<Integer> subList =
|
List<Integer> subList =
|
||||||
uniqueIdsList.subList(j * packet, Math.min(size, (j + 1) * packet));
|
uniqueIdsList.subList(j * packet, Math.min(size, (j + 1) * packet));
|
||||||
if (subList.isEmpty()) {
|
if (subList.isEmpty()) {
|
||||||
@ -2092,11 +2092,11 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("&c[ERROR] FAILED TO PURGE PLOTS!");
|
PlotSquared.debug("&c[ERROR] FAILED TO PURGE PLOTS!");
|
||||||
return;
|
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);
|
purgeIds(ids);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
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(); ) {
|
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
|
||||||
PlotId plotId = iterator.next();
|
PlotId plotId = iterator.next();
|
||||||
@ -2378,7 +2378,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@ -2534,9 +2534,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
HashMap<Integer, PlotCluster> clusters = new HashMap<>();
|
HashMap<Integer, PlotCluster> clusters = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
HashSet<String> areas = new HashSet<>();
|
HashSet<String> areas = new HashSet<>();
|
||||||
if (PS.get().worlds.contains("worlds")) {
|
if (PlotSquared.get().worlds.contains("worlds")) {
|
||||||
ConfigurationSection worldSection =
|
ConfigurationSection worldSection =
|
||||||
PS.get().worlds.getConfigurationSection("worlds");
|
PlotSquared.get().worlds.getConfigurationSection("worlds");
|
||||||
if (worldSection != null) {
|
if (worldSection != null) {
|
||||||
for (String worldKey : worldSection.getKeys(false)) {
|
for (String worldKey : worldSection.getKeys(false)) {
|
||||||
areas.add(worldKey);
|
areas.add(worldKey);
|
||||||
@ -2609,7 +2609,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.helpers.add(user);
|
cluster.helpers.add(user);
|
||||||
} else {
|
} 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.");
|
+ ") 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) {
|
if (cluster != null) {
|
||||||
cluster.invited.add(user);
|
cluster.invited.add(user);
|
||||||
} else {
|
} 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.");
|
+ ") 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;
|
cluster.settings.flags = flags;
|
||||||
} else {
|
} 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.");
|
+ ") 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()) {
|
for (Entry<String, Integer> entry : noExist.entrySet()) {
|
||||||
String a = entry.getKey();
|
String a = entry.getKey();
|
||||||
invalidPlot = true;
|
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 + "'.");
|
+ " clusters in DB for non existent area; '" + a + "'.");
|
||||||
}
|
}
|
||||||
if (invalidPlot) {
|
if (invalidPlot) {
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
|
"&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
PS.debug("&7[WARN] Failed to load clusters.");
|
PlotSquared.debug("&7[WARN] Failed to load clusters.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return newClusters;
|
return newClusters;
|
||||||
@ -2935,7 +2935,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
reconnect();
|
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)");
|
"$1All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
|
||||||
commit();
|
commit();
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -2958,19 +2958,19 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
||||||
if (worldPlots == null) {
|
if (worldPlots == null) {
|
||||||
PS.debug("&8 - &7Creating plot (1): " + plot);
|
PlotSquared.debug("&8 - &7Creating plot (1): " + plot);
|
||||||
toCreate.add(plot);
|
toCreate.add(plot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Plot dataPlot = worldPlots.remove(plot.getId());
|
Plot dataPlot = worldPlots.remove(plot.getId());
|
||||||
if (dataPlot == null) {
|
if (dataPlot == null) {
|
||||||
PS.debug("&8 - &7Creating plot (2): " + plot);
|
PlotSquared.debug("&8 - &7Creating plot (2): " + plot);
|
||||||
toCreate.add(plot);
|
toCreate.add(plot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// owner
|
// owner
|
||||||
if (!plot.owner.equals(dataPlot.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);
|
setOwner(plot, plot.owner);
|
||||||
}
|
}
|
||||||
// trusted
|
// trusted
|
||||||
@ -2979,7 +2979,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getTrusted().clone();
|
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getTrusted().clone();
|
||||||
toRemove.removeAll(plot.getTrusted());
|
toRemove.removeAll(plot.getTrusted());
|
||||||
toAdd.removeAll(dataPlot.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);
|
+ plot);
|
||||||
if (!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
for (UUID uuid : toRemove) {
|
for (UUID uuid : toRemove) {
|
||||||
@ -2997,7 +2997,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getMembers().clone();
|
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getMembers().clone();
|
||||||
toRemove.removeAll(plot.getMembers());
|
toRemove.removeAll(plot.getMembers());
|
||||||
toAdd.removeAll(dataPlot.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);
|
+ plot);
|
||||||
if (!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
for (UUID uuid : toRemove) {
|
for (UUID uuid : toRemove) {
|
||||||
@ -3015,7 +3015,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getDenied().clone();
|
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getDenied().clone();
|
||||||
toRemove.removeAll(plot.getDenied());
|
toRemove.removeAll(plot.getDenied());
|
||||||
toAdd.removeAll(dataPlot.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);
|
+ plot);
|
||||||
if (!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
for (UUID uuid : toRemove) {
|
for (UUID uuid : toRemove) {
|
||||||
@ -3031,7 +3031,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
boolean[] pm = plot.getMerged();
|
boolean[] pm = plot.getMerged();
|
||||||
boolean[] dm = dataPlot.getMerged();
|
boolean[] dm = dataPlot.getMerged();
|
||||||
if (pm[0] != dm[0] || pm[1] != dm[1]) {
|
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());
|
setMerged(dataPlot, plot.getMerged());
|
||||||
}
|
}
|
||||||
HashMap<Flag<?>, Object> pf = plot.getFlags();
|
HashMap<Flag<?>, Object> pf = plot.getFlags();
|
||||||
@ -3040,7 +3040,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
if (pf.size() != df.size() || !StringMan
|
if (pf.size() != df.size() || !StringMan
|
||||||
.isEqual(StringMan.joinOrdered(pf.values(), ","),
|
.isEqual(StringMan.joinOrdered(pf.values(), ","),
|
||||||
StringMan.joinOrdered(df.values(), ","))) {
|
StringMan.joinOrdered(df.values(), ","))) {
|
||||||
PS.debug("&8 - &7Correcting flags for: " + plot);
|
PlotSquared.debug("&8 - &7Correcting flags for: " + plot);
|
||||||
setFlags(plot, pf);
|
setFlags(plot, pf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3050,7 +3050,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
HashMap<PlotId, Plot> map = entry.getValue();
|
HashMap<PlotId, Plot> map = entry.getValue();
|
||||||
if (!map.isEmpty()) {
|
if (!map.isEmpty()) {
|
||||||
for (Entry<PlotId, Plot> entry2 : map.entrySet()) {
|
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");
|
+ "// TODO implement this when sure safe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.database;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -27,15 +27,15 @@ public class SQLite extends Database {
|
|||||||
if (checkConnection()) {
|
if (checkConnection()) {
|
||||||
return this.connection;
|
return this.connection;
|
||||||
}
|
}
|
||||||
if (!PS.get().IMP.getDirectory().exists()) {
|
if (!PlotSquared.get().IMP.getDirectory().exists()) {
|
||||||
PS.get().IMP.getDirectory().mkdirs();
|
PlotSquared.get().IMP.getDirectory().mkdirs();
|
||||||
}
|
}
|
||||||
File file = new File(this.dbLocation);
|
File file = new File(this.dbLocation);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
try {
|
try {
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.debug("&cUnable to create database!");
|
PlotSquared.debug("&cUnable to create database!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
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.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
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) {
|
public static <V> Optional<V> getPlotFlag(Plot plot, Flag<V> key) {
|
||||||
V value = FlagManager.getPlotFlagRaw(plot, key);
|
V value = FlagManager.getPlotFlagRaw(plot, key);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (PS.get().isMainThread(Thread.currentThread())) {
|
if (PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||||
try {
|
try {
|
||||||
MUTABLE_OPTIONAL_FIELD.set(MUTABLE_OPTIONAL, value);
|
MUTABLE_OPTIONAL_FIELD.set(MUTABLE_OPTIONAL, value);
|
||||||
return MUTABLE_OPTIONAL;
|
return MUTABLE_OPTIONAL;
|
||||||
@ -117,7 +117,7 @@ public class FlagManager {
|
|||||||
.replaceAll(",", "´"));
|
.replaceAll(",", "´"));
|
||||||
i++;
|
i++;
|
||||||
} catch (Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
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.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||||
@ -136,7 +136,7 @@ public final class Flags {
|
|||||||
}
|
}
|
||||||
Flag flag = (Flag) fieldValue;
|
Flag flag = (Flag) fieldValue;
|
||||||
if (!flag.getName().equals(fieldName)) {
|
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());
|
.getName());
|
||||||
}
|
}
|
||||||
flags.put(flag.getName(), flag);
|
flags.put(flag.getName(), flag);
|
||||||
@ -162,7 +162,7 @@ public final class Flags {
|
|||||||
public static void registerFlag(final Flag<?> flag) {
|
public static void registerFlag(final Flag<?> flag) {
|
||||||
final Flag<?> duplicate = flags.put(flag.getName(), flag);
|
final Flag<?> duplicate = flags.put(flag.getName(), flag);
|
||||||
if (duplicate != null) {
|
if (duplicate != null) {
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea value) {
|
@Override public void run(PlotArea value) {
|
||||||
Object remove;
|
Object remove;
|
||||||
if (value.DEFAULT_FLAGS.containsKey(duplicate)) {
|
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) {
|
@Override public void run(Plot value) {
|
||||||
if (value.getFlags().containsKey(duplicate)) {
|
if (value.getFlags().containsKey(duplicate)) {
|
||||||
Object remove = value.getFlags().remove(duplicate);
|
Object remove = value.getFlags().remove(duplicate);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||||
@ -28,7 +28,7 @@ public class AugmentedUtils {
|
|||||||
final int bx = cx << 4;
|
final int bx = cx << 4;
|
||||||
final int bz = cz << 4;
|
final int bz = cz << 4;
|
||||||
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
|
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
|
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(world, region);
|
||||||
if (areas.isEmpty()) {
|
if (areas.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||||
@ -15,7 +15,7 @@ import java.util.Map.Entry;
|
|||||||
public class HybridGen extends IndependentPlotGenerator {
|
public class HybridGen extends IndependentPlotGenerator {
|
||||||
|
|
||||||
@Override public String getName() {
|
@Override public String getName() {
|
||||||
return PS.imp().getPluginName();
|
return PlotSquared.imp().getPluginName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX,
|
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
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.commands.Template;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -31,18 +31,18 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
+ File.separator;
|
+ File.separator;
|
||||||
try {
|
try {
|
||||||
File sideroad =
|
File sideroad =
|
||||||
MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "sideroad.schematic");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schematic");
|
||||||
if (sideroad.exists()) {
|
if (sideroad.exists()) {
|
||||||
files.add(new FileBytes(newDir + "sideroad.schematic",
|
files.add(new FileBytes(newDir + "sideroad.schematic",
|
||||||
Files.readAllBytes(sideroad.toPath())));
|
Files.readAllBytes(sideroad.toPath())));
|
||||||
}
|
}
|
||||||
File intersection =
|
File intersection =
|
||||||
MainUtil.getFile(PS.get().IMP.getDirectory(), "intersection.schematic");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schematic");
|
||||||
if (intersection.exists()) {
|
if (intersection.exists()) {
|
||||||
files.add(new FileBytes(newDir + "intersection.schematic",
|
files.add(new FileBytes(newDir + "intersection.schematic",
|
||||||
Files.readAllBytes(intersection.toPath())));
|
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()) {
|
if (plot.exists()) {
|
||||||
files.add(
|
files.add(
|
||||||
new FileBytes(newDir + "plot.schematic", Files.readAllBytes(plot.toPath())));
|
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.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.Tag;
|
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.config.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -173,7 +173,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
try {
|
try {
|
||||||
setupSchematics();
|
setupSchematics();
|
||||||
} catch (Exception ignored) {
|
} 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() {
|
public void setupSchematics() {
|
||||||
this.G_SCH = new HashMap<>();
|
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");
|
"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");
|
"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");
|
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/plot.schematic");
|
||||||
SchematicHandler.Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
SchematicHandler.Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
||||||
SchematicHandler.Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
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) {
|
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
||||||
PS.debug(C.PREFIX + "&3 - schematic: &7false");
|
PlotSquared.debug(C.PREFIX + "&3 - schematic: &7false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.ROAD_SCHEMATIC_ENABLED = true;
|
this.ROAD_SCHEMATIC_ENABLED = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
@ -207,16 +207,16 @@ public abstract class HybridUtils {
|
|||||||
regenerateRoad(area, chunk, extend);
|
regenerateRoad(area, chunk, extend);
|
||||||
ChunkManager.manager.unloadChunk(area.worldname, chunk, true, true);
|
ChunkManager.manager.unloadChunk(area.worldname, chunk, true, true);
|
||||||
}
|
}
|
||||||
PS.debug("&cCancelled road task");
|
PlotSquared.debug("&cCancelled road task");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
count.incrementAndGet();
|
count.incrementAndGet();
|
||||||
if (count.intValue() % 20 == 0) {
|
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()) {
|
if (regions.isEmpty() && chunks.isEmpty()) {
|
||||||
HybridUtils.UPDATE = false;
|
HybridUtils.UPDATE = false;
|
||||||
PS.debug(C.PREFIX.s() + "Finished road conversion");
|
PlotSquared.debug(C.PREFIX.s() + "Finished road conversion");
|
||||||
// CANCEL TASK
|
// CANCEL TASK
|
||||||
} else {
|
} else {
|
||||||
final Runnable task = this;
|
final Runnable task = this;
|
||||||
@ -230,9 +230,9 @@ public abstract class HybridUtils {
|
|||||||
Iterator<ChunkLoc> iterator = regions.iterator();
|
Iterator<ChunkLoc> iterator = regions.iterator();
|
||||||
ChunkLoc loc = iterator.next();
|
ChunkLoc loc = iterator.next();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
PS.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
|
PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
|
||||||
+ " (aprrox 1024 chunks)");
|
+ " (aprrox 1024 chunks)");
|
||||||
PS.debug(" - Remaining: " + regions.size());
|
PlotSquared.debug(" - Remaining: " + regions.size());
|
||||||
chunks.addAll(getChunks(loc));
|
chunks.addAll(getChunks(loc));
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ public abstract class HybridUtils {
|
|||||||
Iterator<ChunkLoc> iterator = regions.iterator();
|
Iterator<ChunkLoc> iterator = regions.iterator();
|
||||||
ChunkLoc loc = iterator.next();
|
ChunkLoc loc = iterator.next();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
"&c[ERROR]&7 Could not update '" + area.worldname + "/region/r."
|
"&c[ERROR]&7 Could not update '" + area.worldname + "/region/r."
|
||||||
+ loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
|
+ loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
|
||||||
int sx = loc.x << 5;
|
int sx = loc.x << 5;
|
||||||
@ -268,8 +268,8 @@ public abstract class HybridUtils {
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS.debug("&d - Potentially skipping 1024 chunks");
|
PlotSquared.debug("&d - Potentially skipping 1024 chunks");
|
||||||
PS.debug("&d - TODO: recommend chunkster if corrupt");
|
PlotSquared.debug("&d - TODO: recommend chunkster if corrupt");
|
||||||
}
|
}
|
||||||
GlobalBlockQueue.IMP.addTask(new Runnable() {
|
GlobalBlockQueue.IMP.addTask(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public abstract class IndependentPlotGenerator {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public <T> GeneratorWrapper<T> specify(String world) {
|
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() {
|
@Override public String toString() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
@ -196,9 +196,9 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
// northwest
|
// northwest
|
||||||
return plot.getMerged(7) ? id : null;
|
return plot.getMerged(7) ? id : null;
|
||||||
}
|
}
|
||||||
PS.debug("invalid location: " + Arrays.toString(merged));
|
PlotSquared.debug("invalid location: " + Arrays.toString(merged));
|
||||||
} catch (Exception ignored) {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
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;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||||
|
|
||||||
public abstract class SquarePlotWorld extends GridPlotWorld {
|
public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||||
@ -18,7 +18,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
|||||||
|
|
||||||
@Override public void loadConfiguration(ConfigurationSection config) {
|
@Override public void loadConfiguration(ConfigurationSection config) {
|
||||||
if (!config.contains("plot.height")) {
|
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.PLOT_WIDTH = config.getInt("plot.size");
|
||||||
this.ROAD_WIDTH = config.getInt("road.width");
|
this.ROAD_WIDTH = config.getInt("road.width");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||||
@ -96,7 +96,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
this.BScount++;
|
this.BScount++;
|
||||||
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
|
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
|
||||||
this.BSblocked = true;
|
this.BSblocked = true;
|
||||||
PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
|
PlotSquared
|
||||||
|
.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
|
||||||
+ location.getBlockZ());
|
+ location.getBlockZ());
|
||||||
}
|
}
|
||||||
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
||||||
@ -243,7 +244,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
this.Ecount++;
|
this.Ecount++;
|
||||||
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
this.Eblocked = true;
|
this.Eblocked = true;
|
||||||
PS.debug(
|
PlotSquared.debug(
|
||||||
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location
|
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location
|
||||||
.getBlockZ());
|
.getBlockZ());
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
@ -36,7 +36,7 @@ public class WEManager {
|
|||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
String world = location.getWorld();
|
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,
|
regions.add(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE,
|
||||||
Integer.MAX_VALUE));
|
Integer.MAX_VALUE));
|
||||||
return regions;
|
return regions;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.listener;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
@ -23,7 +23,7 @@ import java.util.HashSet;
|
|||||||
public class WESubscriber {
|
public class WESubscriber {
|
||||||
|
|
||||||
@Subscribe(priority = Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) {
|
@Subscribe(priority = Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) {
|
||||||
WorldEdit worldedit = PS.get().worldedit;
|
WorldEdit worldedit = PlotSquared.get().worldedit;
|
||||||
if (worldedit == null) {
|
if (worldedit == null) {
|
||||||
WorldEdit.getInstance().getEventBus().unregister(this);
|
WorldEdit.getInstance().getEventBus().unregister(this);
|
||||||
return;
|
return;
|
||||||
@ -55,19 +55,19 @@ public class WESubscriber {
|
|||||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||||
}
|
}
|
||||||
if (PS.get().hasPlotArea(world)) {
|
if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
event.setExtent(new NullExtent());
|
event.setExtent(new NullExtent());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
if (PS.get().hasPlotArea(world)) {
|
if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
event.setExtent(
|
event.setExtent(
|
||||||
new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(),
|
new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(),
|
||||||
event.getExtent()));
|
event.getExtent()));
|
||||||
}
|
}
|
||||||
} else if (PS.get().hasPlotArea(world)) {
|
} else if (PlotSquared.get().hasPlotArea(world)) {
|
||||||
event.setExtent(new WEExtent(mask, event.getExtent()));
|
event.setExtent(new WEExtent(mask, event.getExtent()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class BO3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File getFile() {
|
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());
|
Settings.Paths.BO3 + File.separator + getWorld() + File.separator + getFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
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.commands.RequiredType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||||
@ -13,7 +13,7 @@ public class ConsolePlayer extends PlotPlayer {
|
|||||||
private static ConsolePlayer instance;
|
private static ConsolePlayer instance;
|
||||||
|
|
||||||
private ConsolePlayer() {
|
private ConsolePlayer() {
|
||||||
PlotArea area = PS.get().getFirstPlotArea();
|
PlotArea area = PlotSquared.get().getFirstPlotArea();
|
||||||
Location loc;
|
Location loc;
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
RegionWrapper region = area.getRegion();
|
RegionWrapper region = area.getRegion();
|
||||||
@ -62,7 +62,7 @@ public class ConsolePlayer extends PlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void sendMessage(String message) {
|
@Override public void sendMessage(String message) {
|
||||||
PS.log(message);
|
PlotSquared.log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void teleport(Location location) {
|
@Override public void teleport(Location location) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
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.DebugExec;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public abstract class Expression<T> {
|
|||||||
try {
|
try {
|
||||||
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
|
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
PS.debug("Invalid Expression: " + expression);
|
PlotSquared.debug("Invalid Expression: " + expression);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
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;
|
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||||
|
|
||||||
public class Location implements Cloneable, Comparable<Location> {
|
public class Location implements Cloneable, Comparable<Location> {
|
||||||
@ -66,11 +66,11 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getPlotArea() {
|
public PlotArea getPlotArea() {
|
||||||
return PS.get().getPlotAreaAbs(this);
|
return PlotSquared.get().getPlotAreaAbs(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plot getOwnedPlot() {
|
public Plot getOwnedPlot() {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getOwnedPlot(this);
|
return area.getOwnedPlot(this);
|
||||||
} else {
|
} else {
|
||||||
@ -79,7 +79,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plot getOwnedPlotAbs() {
|
public Plot getOwnedPlotAbs() {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getOwnedPlotAbs(this);
|
return area.getOwnedPlotAbs(this);
|
||||||
} else {
|
} else {
|
||||||
@ -88,16 +88,16 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlotArea() {
|
public boolean isPlotArea() {
|
||||||
return PS.get().getPlotAreaAbs(this) != null;
|
return PlotSquared.get().getPlotAreaAbs(this) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlotRoad() {
|
public boolean isPlotRoad() {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||||
return area != null && area.getPlotAbs(this) == null;
|
return area != null && area.getPlotAbs(this) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnownedPlotArea() {
|
public boolean isUnownedPlotArea() {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||||
return area != null && area.getOwnedPlotAbs(this) == null;
|
return area != null && area.getOwnedPlotAbs(this) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plot getPlotAbs() {
|
public Plot getPlotAbs() {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getPlotAbs(this);
|
return area.getPlotAbs(this);
|
||||||
} else {
|
} else {
|
||||||
@ -120,7 +120,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(this);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getPlot(this);
|
return area.getPlot(this);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
@ -201,13 +201,13 @@ public class Plot {
|
|||||||
return id != null ? defaultArea.getPlotAbs(id) : null;
|
return id != null ? defaultArea.getPlotAbs(id) : null;
|
||||||
}
|
}
|
||||||
} else if (split.length == 3) {
|
} else if (split.length == 3) {
|
||||||
PlotArea pa = PS.get().getPlotArea(split[0], null);
|
PlotArea pa = PlotSquared.get().getPlotArea(split[0], null);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||||
return pa.getPlotAbs(id);
|
return pa.getPlotAbs(id);
|
||||||
}
|
}
|
||||||
} else if (split.length == 4) {
|
} 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) {
|
if (pa != null) {
|
||||||
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||||
return pa.getPlotAbs(id);
|
return pa.getPlotAbs(id);
|
||||||
@ -224,7 +224,7 @@ public class Plot {
|
|||||||
* @see PlotPlayer#getCurrentPlot() if a player is expected here.
|
* @see PlotPlayer#getCurrentPlot() if a player is expected here.
|
||||||
*/
|
*/
|
||||||
public static Plot getPlot(Location location) {
|
public static Plot getPlot(Location location) {
|
||||||
PlotArea pa = PS.get().getPlotAreaAbs(location);
|
PlotArea pa = PlotSquared.get().getPlotAreaAbs(location);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
return pa.getPlot(location);
|
return pa.getPlot(location);
|
||||||
}
|
}
|
||||||
@ -915,7 +915,7 @@ public class Plot {
|
|||||||
public void setSign(final String name) {
|
public void setSign(final String name) {
|
||||||
if (!isLoaded())
|
if (!isLoaded())
|
||||||
return;
|
return;
|
||||||
if (!PS.get().isMainThread(Thread.currentThread())) {
|
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
Plot.this.setSign(name);
|
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)
|
* 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
|
* @see #clear(Runnable) to simply clear a plot
|
||||||
*/
|
*/
|
||||||
public boolean deletePlot(final Runnable whenDone) {
|
public boolean deletePlot(final Runnable whenDone) {
|
||||||
@ -1544,12 +1544,12 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public boolean moveData(Plot plot, Runnable whenDone) {
|
public boolean moveData(Plot plot, Runnable whenDone) {
|
||||||
if (this.owner == null) {
|
if (this.owner == null) {
|
||||||
PS.debug(plot + " is unowned (single)");
|
PlotSquared.debug(plot + " is unowned (single)");
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
PS.debug(plot + " is unowned (multi)");
|
PlotSquared.debug(plot + " is unowned (multi)");
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2352,7 +2352,7 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(0));
|
tmp = this.area.getPlotAbs(this.id.getRelative(0));
|
||||||
if (!tmp.getMerged(2)) {
|
if (!tmp.getMerged(2)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
PS.debug("Fixing invalid merge: " + this);
|
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||||
if (tmp.isOwnerAbs(this.owner)) {
|
if (tmp.isOwnerAbs(this.owner)) {
|
||||||
tmp.getSettings().setMerged(2, true);
|
tmp.getSettings().setMerged(2, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2368,7 +2368,7 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(1));
|
tmp = this.area.getPlotAbs(this.id.getRelative(1));
|
||||||
if (!tmp.getMerged(3)) {
|
if (!tmp.getMerged(3)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
PS.debug("Fixing invalid merge: " + this);
|
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||||
if (tmp.isOwnerAbs(this.owner)) {
|
if (tmp.isOwnerAbs(this.owner)) {
|
||||||
tmp.getSettings().setMerged(3, true);
|
tmp.getSettings().setMerged(3, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2384,7 +2384,7 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(2));
|
tmp = this.area.getPlotAbs(this.id.getRelative(2));
|
||||||
if (!tmp.getMerged(0)) {
|
if (!tmp.getMerged(0)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
PS.debug("Fixing invalid merge: " + this);
|
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||||
if (tmp.isOwnerAbs(this.owner)) {
|
if (tmp.isOwnerAbs(this.owner)) {
|
||||||
tmp.getSettings().setMerged(0, true);
|
tmp.getSettings().setMerged(0, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2400,7 +2400,7 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(3));
|
tmp = this.area.getPlotAbs(this.id.getRelative(3));
|
||||||
if (!tmp.getMerged(1)) {
|
if (!tmp.getMerged(1)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
PS.debug("Fixing invalid merge: " + this);
|
PlotSquared.debug("Fixing invalid merge: " + this);
|
||||||
if (tmp.isOwnerAbs(this.owner)) {
|
if (tmp.isOwnerAbs(this.owner)) {
|
||||||
tmp.getSettings().setMerged(1, true);
|
tmp.getSettings().setMerged(1, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2417,7 +2417,7 @@ public class Plot {
|
|||||||
if (current.owner == null || current.settings == null) {
|
if (current.owner == null || current.settings == null) {
|
||||||
// Invalid plot
|
// Invalid plot
|
||||||
// merged onto unclaimed plot
|
// merged onto unclaimed plot
|
||||||
PS.debug("Ignoring invalid merged plot: " + current + " | " + current.owner);
|
PlotSquared.debug("Ignoring invalid merged plot: " + current + " | " + current.owner);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmpSet.add(current);
|
tmpSet.add(current);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
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.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
@ -189,7 +189,7 @@ public abstract class PlotArea {
|
|||||||
* @return true if both areas are compatible
|
* @return true if both areas are compatible
|
||||||
*/
|
*/
|
||||||
public boolean isCompatible(PlotArea plotArea) {
|
public boolean isCompatible(PlotArea plotArea) {
|
||||||
ConfigurationSection section = PS.get().worlds.getConfigurationSection("worlds");
|
ConfigurationSection section = PlotSquared.get().worlds.getConfigurationSection("worlds");
|
||||||
for (ConfigurationNode setting : plotArea.getSettingNodes()) {
|
for (ConfigurationNode setting : plotArea.getSettingNodes()) {
|
||||||
Object constant = section.get(plotArea.worldname + '.' + setting.getConstant());
|
Object constant = section.get(plotArea.worldname + '.' + setting.getConstant());
|
||||||
if (constant == null || !constant
|
if (constant == null || !constant
|
||||||
@ -305,7 +305,7 @@ public abstract class PlotArea {
|
|||||||
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
|
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan
|
PlotSquared.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan
|
||||||
.join(flags, ","));
|
.join(flags, ","));
|
||||||
this.DEFAULT_FLAGS = new HashMap<>();
|
this.DEFAULT_FLAGS = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
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.config.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
|
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
||||||
@ -13,7 +13,9 @@ public class PlotMessage {
|
|||||||
try {
|
try {
|
||||||
reset(ChatManager.manager);
|
reset(ChatManager.manager);
|
||||||
} catch (Throwable e) {
|
} 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());
|
.getServerVersion());
|
||||||
ChatManager.manager = new PlainChatManager();
|
ChatManager.manager = new PlainChatManager();
|
||||||
reset(ChatManager.manager);
|
reset(ChatManager.manager);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
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.commands.RequiredType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
@ -40,7 +40,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static PlotPlayer wrap(Object player) {
|
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 AtomicInteger count = new AtomicInteger(0);
|
||||||
final UUID uuid = getUUID();
|
final UUID uuid = getUUID();
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea value) {
|
@Override public void run(PlotArea value) {
|
||||||
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
||||||
for (Plot plot : value.getPlotsAbs(uuid)) {
|
for (Plot plot : value.getPlotsAbs(uuid)) {
|
||||||
@ -205,7 +205,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
final AtomicInteger count = new AtomicInteger(0);
|
final AtomicInteger count = new AtomicInteger(0);
|
||||||
final UUID uuid = getUUID();
|
final UUID uuid = getUUID();
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea value) {
|
@Override public void run(PlotArea value) {
|
||||||
for (PlotCluster cluster : value.getClusters()) {
|
for (PlotCluster cluster : value.getClusters()) {
|
||||||
if (cluster.isOwner(getUUID())) {
|
if (cluster.isOwner(getUUID())) {
|
||||||
@ -226,7 +226,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
public int getPlotCount(String world) {
|
public int getPlotCount(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (PlotArea area : PS.get().getPlotAreas(world)) {
|
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
|
||||||
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
||||||
for (Plot plot : area.getPlotsAbs(uuid)) {
|
for (Plot plot : area.getPlotsAbs(uuid)) {
|
||||||
if (!plot.getFlag(Flags.DONE).isPresent()) {
|
if (!plot.getFlag(Flags.DONE).isPresent()) {
|
||||||
@ -243,7 +243,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
public int getClusterCount(String world) {
|
public int getClusterCount(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (PlotArea area : PS.get().getPlotAreas(world)) {
|
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
|
||||||
for (PlotCluster cluster : area.getClusters()) {
|
for (PlotCluster cluster : area.getClusters()) {
|
||||||
if (cluster.isOwner(getUUID())) {
|
if (cluster.isOwner(getUUID())) {
|
||||||
count++;
|
count++;
|
||||||
@ -257,11 +257,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
* Get a {@code Set} of plots owned by this player.
|
* Get a {@code Set} of plots owned by this player.
|
||||||
*
|
*
|
||||||
* @return a {@code Set} of plots owned by the 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
|
* @see #getPlotCount() for the number of plots
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots() {
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
public PlotArea getPlotAreaAbs() {
|
public PlotArea getPlotAreaAbs() {
|
||||||
return PS.get().getPlotAreaAbs(getLocation());
|
return PlotSquared.get().getPlotAreaAbs(getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getApplicablePlotArea() {
|
public PlotArea getApplicablePlotArea() {
|
||||||
return PS.get().getApplicablePlotArea(getLocation());
|
return PlotSquared.get().getApplicablePlotArea(getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public RequiredType getSuperCaller() {
|
@Override public RequiredType getSuperCaller() {
|
||||||
@ -462,7 +462,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
|
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
|
||||||
for (Plot owned : getPlots()) {
|
for (Plot owned : getPlots()) {
|
||||||
owned.deletePlot(null);
|
owned.deletePlot(null);
|
||||||
PS.debug(String
|
PlotSquared.debug(String
|
||||||
.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned",
|
.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned",
|
||||||
plot.getId(), getName()));
|
plot.getId(), getName()));
|
||||||
}
|
}
|
||||||
@ -472,7 +472,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis());
|
ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
UUIDHandler.getPlayers().remove(name);
|
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) {
|
public int getPlayerClusterCount(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (PlotCluster cluster : PS.get().getClusters(world)) {
|
for (PlotCluster cluster : PlotSquared.get().getClusters(world)) {
|
||||||
if (uuid.equals(cluster.owner)) {
|
if (uuid.equals(cluster.owner)) {
|
||||||
count += cluster.getArea();
|
count += cluster.getArea();
|
||||||
}
|
}
|
||||||
@ -499,7 +499,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
*/
|
*/
|
||||||
public int getPlayerClusterCount() {
|
public int getPlayerClusterCount() {
|
||||||
final AtomicInteger count = new AtomicInteger();
|
final AtomicInteger count = new AtomicInteger();
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run(PlotArea value) {
|
@Override public void run(PlotArea value) {
|
||||||
count.addAndGet(value.getClusters().size());
|
count.addAndGet(value.getClusters().size());
|
||||||
}
|
}
|
||||||
@ -516,7 +516,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
public Set<Plot> getPlots(String world) {
|
public Set<Plot> getPlots(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
HashSet<Plot> plots = new HashSet<>();
|
HashSet<Plot> plots = new HashSet<>();
|
||||||
for (Plot plot : PS.get().getPlots(world)) {
|
for (Plot plot : PlotSquared.get().getPlots(world)) {
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
}
|
}
|
||||||
@ -532,7 +532,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
PlotPlayer.this.metaMap = value;
|
PlotPlayer.this.metaMap = value;
|
||||||
if (!value.isEmpty()) {
|
if (!value.isEmpty()) {
|
||||||
if (Settings.Enabled_Components.PERSISTENT_META) {
|
if (Settings.Enabled_Components.PERSISTENT_META) {
|
||||||
PlotAreaManager manager = PS.get().getPlotAreaManager();
|
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||||
if (manager instanceof SinglePlotAreaManager) {
|
if (manager instanceof SinglePlotAreaManager) {
|
||||||
PlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
PlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||||
byte[] arr = PlotPlayer.this.getPersistentMeta("quitLoc");
|
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())) {
|
.isMainThread(Thread.currentThread())) {
|
||||||
if (getMeta("teleportOnLogin", true)) {
|
if (getMeta("teleportOnLogin", true)) {
|
||||||
if (plot.teleportPlayer(PlotPlayer.this)) {
|
if (plot.teleportPlayer(PlotPlayer.this)) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
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) {
|
@Override public boolean clearPlot(PlotArea plotArea, Plot plot, final Runnable whenDone) {
|
||||||
SetupUtils.manager.unload(plot.getWorldName(), false);
|
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() {
|
TaskManager.IMP.taskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
MainUtil.deleteDirectory(worldFolder);
|
MainUtil.deleteDirectory(worldFolder);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
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.generator.IndependentPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
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) {
|
@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() {
|
@Override public PlotManager getNewPlotManager() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
|
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
|
||||||
@ -287,10 +287,10 @@ public class BO3Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static File getBaseFile(String category) {
|
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");
|
Settings.Paths.BO3 + File.separator + category + File.separator + "base.yml");
|
||||||
if (!base.exists()) {
|
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;
|
return base;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||||
@ -27,7 +27,7 @@ public abstract class ChunkManager {
|
|||||||
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
|
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
|
||||||
RunnableVal<ScopedLocalBlockQueue> add, String world, ChunkLoc loc) {
|
RunnableVal<ScopedLocalBlockQueue> add, String world, ChunkLoc loc) {
|
||||||
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||||
if (PS.get().isAugmented(world)) {
|
if (PlotSquared.get().isAugmented(world)) {
|
||||||
int bx = loc.x << 4;
|
int bx = loc.x << 4;
|
||||||
int bz = loc.z << 4;
|
int bz = loc.z << 4;
|
||||||
ScopedLocalBlockQueue scoped =
|
ScopedLocalBlockQueue scoped =
|
||||||
@ -209,7 +209,7 @@ public abstract class ChunkManager {
|
|||||||
public abstract void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe);
|
public abstract void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe);
|
||||||
|
|
||||||
public Set<ChunkLoc> getChunkChunks(String world) {
|
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();
|
File[] regionFiles = folder.listFiles();
|
||||||
HashSet<ChunkLoc> chunks = new HashSet<>();
|
HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||||
if (regionFiles == null) {
|
if (regionFiles == null) {
|
||||||
@ -244,8 +244,8 @@ public abstract class ChunkManager {
|
|||||||
String directory =
|
String directory =
|
||||||
world + File.separator + "region" + File.separator + "r." + loc.x + "."
|
world + File.separator + "region" + File.separator + "r." + loc.x + "."
|
||||||
+ loc.z + ".mca";
|
+ loc.z + ".mca";
|
||||||
File file = new File(PS.get().IMP.getWorldContainer(), directory);
|
File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory);
|
||||||
PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.ConsolePlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -15,7 +15,7 @@ public abstract class EconHandler {
|
|||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
initialized = true;
|
initialized = true;
|
||||||
return manager = PS.get().IMP.getEconomyHandler();
|
return manager = PlotSquared.get().IMP.getEconomyHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMoney(PlotPlayer player) {
|
public double getMoney(PlotPlayer player) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
@ -57,7 +57,7 @@ public abstract class EventUtil {
|
|||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
ExpireManager.IMP.handleJoin(player);
|
ExpireManager.IMP.handleJoin(player);
|
||||||
}
|
}
|
||||||
if (PS.get().worldedit != null) {
|
if (PlotSquared.get().worldedit != null) {
|
||||||
if (player.getAttribute("worldedit")) {
|
if (player.getAttribute("worldedit")) {
|
||||||
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
|
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public abstract class EventUtil {
|
|||||||
|
|
||||||
public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type,
|
public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type,
|
||||||
Location location, LazyBlock block, boolean notifyPerms) {
|
Location location, LazyBlock block, boolean notifyPerms) {
|
||||||
PlotArea area = PS.get().getPlotAreaAbs(location);
|
PlotArea area = PlotSquared.get().getPlotAreaAbs(location);
|
||||||
Plot plot;
|
Plot plot;
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
plot = area.getPlot(location);
|
plot = area.getPlot(location);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
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.C;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
@ -86,13 +86,13 @@ public class MainUtil {
|
|||||||
player.sendMessage(C.color(s));
|
player.sendMessage(C.color(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS.debug(s);
|
PlotSquared.debug(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void upload(UUID uuid, String file, String extension,
|
public static void upload(UUID uuid, String file, String extension,
|
||||||
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
|
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
|
||||||
if (writeTask == null) {
|
if (writeTask == null) {
|
||||||
PS.debug("&cWrite task cannot be null");
|
PlotSquared.debug("&cWrite task cannot be null");
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ public class MainUtil {
|
|||||||
if (id != null) {
|
if (id != null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
area = PS.get().getPlotAreaByString(term);
|
area = PlotSquared.get().getPlotAreaByString(term);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
alias = term;
|
alias = term;
|
||||||
}
|
}
|
||||||
@ -415,7 +415,7 @@ public class MainUtil {
|
|||||||
plotList.add(new ArrayList<Plot>());
|
plotList.add(new ArrayList<Plot>());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (!uuids.isEmpty()) {
|
if (!uuids.isEmpty()) {
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
@ -463,7 +463,7 @@ public class MainUtil {
|
|||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
if (message) {
|
if (message) {
|
||||||
PS.log(C.NOT_VALID_PLOT_WORLD);
|
PlotSquared.log(C.NOT_VALID_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
PlotArea area;
|
PlotArea area;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
area = PS.get().getPlotAreaByString(arg);
|
area = PlotSquared.get().getPlotAreaByString(arg);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
area = player.getApplicablePlotArea();
|
area = player.getApplicablePlotArea();
|
||||||
}
|
}
|
||||||
@ -481,17 +481,17 @@ public class MainUtil {
|
|||||||
String[] split = arg.split(";|,");
|
String[] split = arg.split(";|,");
|
||||||
PlotId id;
|
PlotId id;
|
||||||
if (split.length == 4) {
|
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]);
|
id = PlotId.fromString(split[2] + ';' + split[3]);
|
||||||
} else if (split.length == 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]);
|
id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||||
} else if (split.length == 2) {
|
} else if (split.length == 2) {
|
||||||
id = PlotId.fromString(arg);
|
id = PlotId.fromString(arg);
|
||||||
} else {
|
} else {
|
||||||
Collection<Plot> plots;
|
Collection<Plot> plots;
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
plots = PS.get().getPlots();
|
plots = PlotSquared.get().getPlots();
|
||||||
} else {
|
} else {
|
||||||
plots = area.getPlots();
|
plots = area.getPlots();
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ public class MainUtil {
|
|||||||
if (!msg.isEmpty()) {
|
if (!msg.isEmpty()) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
String message = (prefix ? C.PREFIX.s() : "") + msg;
|
String message = (prefix ? C.PREFIX.s() : "") + msg;
|
||||||
PS.log(message);
|
PlotSquared.log(message);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
|
player.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
|
||||||
}
|
}
|
||||||
@ -627,7 +627,7 @@ public class MainUtil {
|
|||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
String m = C.format(caption, args);
|
String m = C.format(caption, args);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
PS.log(m);
|
PlotSquared.log(m);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(m);
|
player.sendMessage(m);
|
||||||
}
|
}
|
||||||
@ -816,7 +816,7 @@ public class MainUtil {
|
|||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
deleteDirectory(files[i]);
|
deleteDirectory(files[i]);
|
||||||
} else {
|
} 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