Refactor PS (and rename to PlotSquared)

This commit is contained in:
sauilitired
2018-11-14 14:19:56 +01:00
parent 16dbbe5244
commit 8df7f63931
133 changed files with 1122 additions and 1137 deletions

View File

@ -5,8 +5,8 @@ dependencies {
compileOnly 'org.projectlombok:lombok:1.16.18'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.api;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -29,7 +29,7 @@ import java.util.UUID;
* <li>{@link Plot}</li>
* <li>{@link com.github.intellectualsites.plotsquared.plot.object.Location}</li>
* <li>{@link PlotArea}</li>
* <li>{@link PS}</li>
* <li>{@link PlotSquared}</li>
* </ul>
*
* @version 3.3.3
@ -42,10 +42,10 @@ public class PlotAPI {
* Get all plots.
*
* @return all plots
* @see PS#getPlots()
* @see PlotSquared#getPlots()
*/
public Set<Plot> getAllPlots() {
return PS.get().getPlots();
return PlotSquared.get().getPlots();
}
/**
@ -55,47 +55,47 @@ public class PlotAPI {
* @return all plots that a player owns
*/
public Set<Plot> getPlayerPlots(PlotPlayer player) {
return PS.get().getPlots(player);
return PlotSquared.get().getPlots(player);
}
/**
* Add a plot world.
*
* @param plotArea Plot World Object
* @see PS#addPlotArea(PlotArea)
* @see PlotSquared#addPlotArea(PlotArea)
*/
public void addPlotArea(PlotArea plotArea) {
PS.get().addPlotArea(plotArea);
PlotSquared.get().addPlotArea(plotArea);
}
/**
* Returns the PlotSquared configurations file.
*
* @return main configuration
* @see PS#config
* @see PlotSquared#config
*/
public YamlConfiguration getConfig() {
return PS.get().config;
return PlotSquared.get().config;
}
/**
* Get the PlotSquared storage file.
*
* @return storage configuration
* @see PS#storage
* @see PlotSquared#storage
*/
public YamlConfiguration getStorage() {
return PS.get().storage;
return PlotSquared.get().storage;
}
/**
* Get the main class for this plugin. Only use this if you really need it.
*
* @return PlotSquared PlotSquared Main Class
* @see PS
* @see PlotSquared
*/
public PS getMain() {
return PS.get();
public PlotSquared getMain() {
return PlotSquared.get();
}
/**
@ -156,7 +156,7 @@ public class PlotAPI {
if (world == null) {
return Collections.emptySet();
}
return PS.get().getPlotAreas(world);
return PlotSquared.get().getPlotAreas(world);
}
/**
@ -166,7 +166,7 @@ public class PlotAPI {
* @see MainUtil#sendConsoleMessage(C, String...)
*/
public void sendConsoleMessage(String message) {
PS.log(message);
PlotSquared.log(message);
}
/**
@ -193,10 +193,10 @@ public class PlotAPI {
* Gets the PlotSquared class.
*
* @return PlotSquared Class
* @see PS
* @see PlotSquared
*/
public PS getPlotSquared() {
return PS.get();
public PlotSquared getPlotSquared() {
return PlotSquared.get();
}
/**

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.commands;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
@ -166,7 +166,8 @@ public abstract class Command {
options.put("usage", declaration.usage());
options.put("confirmation", declaration.confirmation());
boolean set = false;
YamlConfiguration commands = PS.get() == null ? new YamlConfiguration() : PS.get().commands;
YamlConfiguration commands = PlotSquared.get() == null ? new YamlConfiguration() : PlotSquared
.get().commands;
for (Map.Entry<String, Object> entry : options.entrySet()) {
String key = this.getFullId() + "." + entry.getKey();
if (!commands.contains(key)) {
@ -174,9 +175,9 @@ public abstract class Command {
set = true;
}
}
if (set && PS.get() != null) {
if (set && PlotSquared.get() != null) {
try {
commands.save(PS.get().commandsFile);
commands.save(PlotSquared.get().commandsFile);
} catch (IOException e) {
e.printStackTrace();

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.configuration.file;
import com.github.intellectualsites.plotsquared.configuration.Configuration;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
@ -51,11 +51,11 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
}
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
PS.debug("&dCould not read: &7" + file);
PS.debug("&dRenamed to: &7" + dest.getName());
PS.debug("&c============ Full stacktrace ============");
PlotSquared.debug("&dCould not read: &7" + file);
PlotSquared.debug("&dRenamed to: &7" + dest.getName());
PlotSquared.debug("&c============ Full stacktrace ============");
ex.printStackTrace();
PS.debug("&c=========================================");
PlotSquared.debug("&c=========================================");
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.listener.WESubscriber;
import com.github.intellectualsites.plotsquared.plot.logger.DelegateLogger;
import com.github.intellectualsites.plotsquared.plot.logger.ILogger;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.worlds.DefaultPlotAreaManager;
@ -26,7 +25,11 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask;
import com.sk89q.worldedit.WorldEdit;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import javax.annotation.Nullable;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
@ -43,8 +46,10 @@ import java.util.zip.ZipInputStream;
/**
* An implementation of the core, with a static getter for easy access.
*/
public class PS {
private static PS instance;
@SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared {
private static final Set<Plot> EMPTY_SET =
Collections.unmodifiableSet(Collections.<Plot>emptySet());
private static PlotSquared instance;
// Implementation
public final IPlotMain IMP;
// Current thread
@ -65,14 +70,15 @@ public class PS {
public HashMap<String, Set<PlotCluster>> clusters_tmp;
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
// Implementation logger
private ILogger logger;
@Setter @Getter private ILogger logger;
// Platform / Version / Update URL
private Updater updater;
@Getter private Updater updater;
private PlotVersion version;
// Files and configuration
@Getter
private File jarFile = null; // This file
private File storageFile;
private PlotAreaManager manager;
@Getter private PlotAreaManager plotAreaManager;
/**
* Initialize PlotSquared with the desired Implementation class.
@ -80,16 +86,21 @@ public class PS {
* @param iPlotMain Implementation of {@link IPlotMain} used
* @param platform The platform being used
*/
public PS(IPlotMain iPlotMain, String platform) {
PS.instance = this;
public PlotSquared(final IPlotMain iPlotMain, final String platform) {
if (instance != null) {
throw new IllegalStateException("Cannot re-initialize the PlotSquared singleton");
}
instance = this;
this.thread = Thread.currentThread();
this.IMP = iPlotMain;
this.logger = iPlotMain;
Settings.PLATFORM = platform;
try {
new ReflectionUtils(this.IMP.getNMSPackage());
try {
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
this.jarFile = new File(
new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
.toURI().getPath());
@ -102,7 +113,7 @@ public class PS {
}
}
if (getJavaVersion() < 1.8) {
PS.log(C.CONSOLE_JAVA_OUTDATED.f(IMP.getPluginName()));
PlotSquared.log(C.CONSOLE_JAVA_OUTDATED.f(IMP.getPluginName()));
}
TaskManager.IMP = this.IMP.getTaskManager();
setupConfigs();
@ -111,11 +122,11 @@ public class PS {
+ ".use_THIS.yml");
C.load(this.translationFile);
// Setup manager
// Setup plotAreaManager
if (Settings.Enabled_Components.WORLDS) {
this.manager = new SinglePlotAreaManager();
this.plotAreaManager = new SinglePlotAreaManager();
} else {
this.manager = new DefaultPlotAreaManager();
this.plotAreaManager = new DefaultPlotAreaManager();
}
// Database
@ -139,7 +150,7 @@ public class PS {
if (Settings.Enabled_Components.METRICS) {
this.IMP.startMetrics();
} else {
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
}
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
this.IMP.registerChunkProcessor();
@ -183,7 +194,7 @@ public class PS {
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try {
if (this.IMP.initWorldEdit()) {
PS.debug(IMP.getPluginName() + " hooked into WorldEdit.");
PlotSquared.debug(IMP.getPluginName() + " hooked into WorldEdit.");
this.worldedit = WorldEdit.getInstance();
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
if (Settings.Enabled_Components.COMMANDS) {
@ -192,7 +203,7 @@ public class PS {
}
} catch (Throwable e) {
PS.debug(
PlotSquared.debug(
"Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
}
}
@ -200,7 +211,7 @@ public class PS {
if (Settings.Enabled_Components.ECONOMY) {
TaskManager.runTask(new Runnable() {
@Override public void run() {
EconHandler.manager = PS.this.IMP.getEconomyHandler();
EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler();
}
});
}
@ -244,7 +255,7 @@ public class PS {
"&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml");
debug(
"&8 - &7Your world management plugin may be faulty (or non existent)");
PS.this.IMP.setGenerator(world);
PlotSquared.this.IMP.setGenerator(world);
}
}
}
@ -263,7 +274,8 @@ public class PS {
} catch (Throwable e) {
e.printStackTrace();
}
PS.log(C.ENABLED.f(IMP.getPluginName()));
PlotSquared.log(C.ENABLED.f(IMP.getPluginName()));
}
/**
@ -271,8 +283,8 @@ public class PS {
*
* @return instance of PlotSquared
*/
public static PS get() {
return PS.instance;
public static PlotSquared get() {
return PlotSquared.instance;
}
public static IPlotMain imp() {
@ -292,7 +304,7 @@ public class PS {
if (message == null || message.toString().isEmpty()) {
return;
}
PS.get().getLogger().log(StringMan.getString(message));
PlotSquared.get().getLogger().log(StringMan.getString(message));
}
/**
@ -301,45 +313,12 @@ public class PS {
* @param message Message to log
* @see IPlotMain#log(String)
*/
public static void debug(Object message) {
public static void debug(@Nullable Object message) {
if (Settings.DEBUG) {
PS.log(message);
PlotSquared.log(message);
}
}
/**
* Get the current logger.
*
* @return The assigned logger
*/
public ILogger getLogger() {
return logger;
}
/**
* Set the Logger.
*
* @param logger the logger the plugin should use
* @see DelegateLogger
* @see #getLogger()
*/
public void setLogger(ILogger logger) {
this.logger = logger;
}
/**
* The plugin updater
*
* @return
*/
public Updater getUpdater() {
return updater;
}
public PlotAreaManager getPlotAreaManager() {
return manager;
}
private void startUuidCatching() {
TaskManager.runTaskLater(new Runnable() {
@Override public void run() {
@ -379,14 +358,15 @@ public class PS {
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
TaskManager.IMP.taskAsync(new Runnable() {
@Override public void run() {
if (PS.this.IMP.initPlotMeConverter()) {
PS.log("&c=== IMPORTANT ===");
PS.log(
if (PlotSquared.this.IMP.initPlotMeConverter()) {
PlotSquared.log("&c=== IMPORTANT ===");
PlotSquared.log(
"&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PlotMe!");
PS.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
PS.log(
PlotSquared
.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
PlotSquared.log(
"&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
PS.log(
PlotSquared.log(
"&c - After the conversion is finished, please set 'plotme-converter' to false in the "
+ "'settings.yml'");
}
@ -403,8 +383,8 @@ public class PS {
/**
* Check if `version` is >= `version2`.
*
* @param version
* @param version2
* @param version First version
* @param version2 Second version
* @return true if `version` is >= `version2`
*/
public boolean checkVersion(int[] version, int... version2) {
@ -490,7 +470,7 @@ public class PS {
cluster.setArea(plotArea);
}
}
manager.addPlotArea(plotArea);
plotAreaManager.addPlotArea(plotArea);
plotArea.setupBorder();
}
@ -500,7 +480,7 @@ public class PS {
* @param area the {@code PlotArea} to remove
*/
public void removePlotArea(PlotArea area) {
manager.removePlotArea(area);
plotAreaManager.removePlotArea(area);
setPlotsTmp(area);
}
@ -531,11 +511,11 @@ public class PS {
}
public Set<PlotCluster> getClusters(String world) {
HashSet<PlotCluster> set = new HashSet<>();
Set<PlotCluster> set = new HashSet<>();
for (PlotArea area : getPlotAreas(world)) {
set.addAll(area.getClusters());
}
return set;
return Collections.unmodifiableSet(set);
}
@ -558,7 +538,7 @@ public class PS {
}
}
});
return result;
return Collections.unmodifiableSet(result);
}
public List<Plot> sortPlotsByTemp(Collection<Plot> plots) {
@ -776,11 +756,11 @@ public class PS {
HashMap<PlotArea, Collection<Plot>> map = new HashMap<>();
int totalSize = getPlotCount();
if (plots.size() == totalSize) {
for (PlotArea area : manager.getAllPlotAreas()) {
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
map.put(area, area.getPlots());
}
} else {
for (PlotArea area : manager.getAllPlotAreas()) {
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
map.put(area, new ArrayList<Plot>(0));
}
Collection<Plot> lastList = null;
@ -795,7 +775,7 @@ public class PS {
}
}
}
List<PlotArea> areas = Arrays.asList(manager.getAllPlotAreas());
List<PlotArea> areas = Arrays.asList(plotAreaManager.getAllPlotAreas());
Collections.sort(areas, new Comparator<PlotArea>() {
@Override public int compare(PlotArea a, PlotArea b) {
if (priorityArea != null && StringMan.isEqual(a.toString(), b.toString())) {
@ -904,7 +884,7 @@ public class PS {
* @return Set of Plot
*/
public Set<Plot> getPlots(String world, String player) {
UUID uuid = UUIDHandler.getUUID(player, null);
final UUID uuid = UUIDHandler.getUUID(player, null);
return getPlots(world, uuid);
}
@ -950,15 +930,13 @@ public class PS {
* @return Set of plot
*/
public Set<Plot> getPlots(String world, UUID uuid) {
ArrayList<Plot> myPlots = new ArrayList<>();
for (Plot plot : getPlots(world)) {
if (plot.hasOwner()) {
if (plot.isOwnerAbs(uuid)) {
myPlots.add(plot);
}
final Set<Plot> plots = new HashSet<>();
for (final Plot plot : getPlots(world)) {
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
plots.add(plot);
}
}
return new HashSet<>(myPlots);
return Collections.unmodifiableSet(plots);
}
/**
@ -969,7 +947,7 @@ public class PS {
* @return Set of plots
*/
public Set<Plot> getPlots(PlotArea area, UUID uuid) {
final HashSet<Plot> plots = new HashSet<>();
final Set<Plot> plots = new HashSet<>();
for (Plot plot : getPlots(area)) {
if (plot.hasOwner() && plot.isOwnerAbs(uuid)) {
plots.add(plot);
@ -986,11 +964,11 @@ public class PS {
* @see #getPlotAreaByString(String) to get the PlotArea object
*/
public boolean hasPlotArea(String world) {
return manager.getPlotAreas(world, null).length != 0;
return plotAreaManager.getPlotAreas(world, null).length != 0;
}
public Collection<Plot> getPlots(String world) {
final HashSet<Plot> set = new HashSet<>();
final Set<Plot> set = new HashSet<>();
foreachPlotArea(world, new RunnableVal<PlotArea>() {
@Override public void run(PlotArea value) {
set.addAll(value.getPlots());
@ -1010,7 +988,7 @@ public class PS {
}
public Collection<Plot> getPlots(PlotArea area) {
return area == null ? new HashSet<Plot>() : area.getPlots();
return area == null ? EMPTY_SET : area.getPlots();
}
public Plot getPlot(PlotArea area, PlotId id) {
@ -1028,19 +1006,19 @@ public class PS {
* @return Set of Plot's owned by the player
*/
public Set<Plot> getPlots(final UUID uuid) {
final ArrayList<Plot> myPlots = new ArrayList<>();
final Set<Plot> plots = new HashSet<>();
foreachPlot(new RunnableVal<Plot>() {
@Override public void run(Plot value) {
if (value.isOwnerAbs(uuid)) {
myPlots.add(value);
plots.add(value);
}
}
});
return new HashSet<>(myPlots);
return Collections.unmodifiableSet(plots);
}
public boolean hasPlot(final UUID uuid) {
for (PlotArea area : manager.getAllPlotAreas()) {
for (final PlotArea area : plotAreaManager.getAllPlotAreas()) {
if (area.hasPlot(uuid))
return true;
}
@ -1048,15 +1026,15 @@ public class PS {
}
public Set<Plot> getBasePlots(final UUID uuid) {
final ArrayList<Plot> myplots = new ArrayList<>();
final Set<Plot> plots = new HashSet<>();
foreachBasePlot(new RunnableVal<Plot>() {
@Override public void run(Plot value) {
if (value.isOwner(uuid)) {
myplots.add(value);
plots.add(value);
}
}
});
return new HashSet<>(myplots);
return Collections.unmodifiableSet(plots);
}
/**
@ -1066,15 +1044,15 @@ public class PS {
* @return Set of Plot
*/
public Set<Plot> getPlotsAbs(final UUID uuid) {
final ArrayList<Plot> myPlots = new ArrayList<>();
final Set<Plot> plots = new HashSet<>();
foreachPlot(new RunnableVal<Plot>() {
@Override public void run(Plot value) {
if (value.isOwnerAbs(uuid)) {
myPlots.add(value);
plots.add(value);
}
}
});
return new HashSet<>(myPlots);
return Collections.unmodifiableSet(plots);
}
/**
@ -1125,7 +1103,7 @@ public class PS {
if (world.equals("CheckingPlotSquaredGenerator")) {
return;
}
this.manager.addWorld(world);
this.plotAreaManager.addWorld(world);
Set<String> worlds;
if (this.worlds.contains("worlds")) {
worlds = this.worlds.getConfigurationSection("worlds").getKeys(false);
@ -1141,7 +1119,7 @@ public class PS {
type = 0;
}
if (type == 0) {
if (manager.getPlotAreas(world, null).length != 0) {
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
debug("World possibly already loaded: " + world);
return;
}
@ -1170,10 +1148,10 @@ public class PS {
// Conventional plot generator
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
PlotManager plotManager = plotGenerator.getNewPlotManager();
PS.log(C.PREFIX + "&aDetected world load for '" + world + "'");
PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
PS.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
PS.log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName());
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName());
if (!this.worlds.contains(path)) {
this.worlds.createSection(path);
worldSection = this.worlds.getConfigurationSection(path);
@ -1194,11 +1172,11 @@ public class PS {
}
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
if (areasSection == null) {
if (manager.getPlotAreas(world, null).length != 0) {
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
debug("World possibly already loaded: " + world);
return;
}
PS.log(C.PREFIX + "&aDetected world load for '" + world + "'");
PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'");
String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName());
if (type == 2) {
Set<PlotCluster> clusters = this.clusters_tmp != null ?
@ -1216,7 +1194,7 @@ public class PS {
worldSection.createSection("areas." + fullId);
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
PS.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
PlotSquared.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string);
if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
@ -1230,10 +1208,11 @@ public class PS {
} catch (IOException e) {
e.printStackTrace();
}
PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
PS.log(C.PREFIX + "&c | &9manager: &7" + pa);
PS.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
PlotSquared
.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa);
PlotSquared.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name
+ " (invalid or old configuration?)");
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
@ -1256,9 +1235,9 @@ public class PS {
} catch (IOException e) {
e.printStackTrace();
}
PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
PS.log(C.PREFIX + "&3 - plotworld: &7" + pa);
PS.log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager());
PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa);
PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -1269,7 +1248,7 @@ public class PS {
"Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
}
for (String areaId : areasSection.getKeys(false)) {
PS.log(C.PREFIX + "&3 - " + areaId);
PlotSquared.log(C.PREFIX + "&3 - " + areaId);
String[] split = areaId.split("(?<=[^;-])-");
if (split.length != 3) {
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
@ -1331,10 +1310,10 @@ public class PS {
} catch (IOException e) {
e.printStackTrace();
}
PS.log(C.PREFIX + "&aDetected area load for '" + world + "'");
PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
PS.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'");
PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa);
PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -1361,7 +1340,7 @@ public class PS {
for (String element : split) {
String[] pair = element.split("=");
if (pair.length != 2) {
PS.log("&cNo value provided for: &7" + element);
PlotSquared.log("&cNo value provided for: &7" + element);
return false;
}
String key = pair[0].toLowerCase();
@ -1411,12 +1390,12 @@ public class PS {
Configuration.BLOCK.parseString(value).toString());
break;
default:
PS.log("&cKey not found: &7" + element);
PlotSquared.log("&cKey not found: &7" + element);
return false;
}
} catch (Exception e) {
e.printStackTrace();
PS.log("&cInvalid value: &7" + value + " in arg " + element);
PlotSquared.log("&cInvalid value: &7" + value + " in arg " + element);
return false;
}
}
@ -1433,26 +1412,21 @@ public class PS {
return true;
}
public boolean canUpdate(String current, String other) {
String s1 = normalisedVersion(current);
String s2 = normalisedVersion(other);
int cmp = s1.compareTo(s2);
return cmp < 0;
public boolean canUpdate(@NonNull final String current, @NonNull final String other) {
final String s1 = normalisedVersion(current);
final String s2 = normalisedVersion(other);
return s1.compareTo(s2) < 0;
}
public String normalisedVersion(String version) {
String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
StringBuilder sb = new StringBuilder();
for (String s : split) {
public String normalisedVersion(@NonNull final String version) {
final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
final StringBuilder sb = new StringBuilder();
for (final String s : split) {
sb.append(String.format("%" + 4 + 's', s));
}
return sb.toString();
}
public File getJarFile() {
return jarFile;
}
public boolean update(PlotPlayer sender, URL url) {
try {
String name = this.jarFile.getName();
@ -1478,9 +1452,9 @@ public class PS {
} catch (IOException e) {
MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
MainUtil.sendMessage(sender, " - Please update manually");
PS.log("============ Stacktrace ============");
PlotSquared.log("============ Stacktrace ============");
e.printStackTrace();
PS.log("====================================");
PlotSquared.log("====================================");
}
return false;
}
@ -1536,13 +1510,13 @@ public class PS {
}
} catch (IOException e) {
e.printStackTrace();
PS.log("&cCould not save " + file);
PlotSquared.log("&cCould not save " + file);
}
}
private Map<String, Map<PlotId, Plot>> getPlotsRaw() {
HashMap<String, Map<PlotId, Plot>> map = new HashMap<>();
for (PlotArea area : this.manager.getAllPlotAreas()) {
for (PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
Map<PlotId, Plot> map2 = map.get(area.toString());
if (map2 == null) {
map.put(area.toString(), area.getPlotsRaw());
@ -1572,7 +1546,7 @@ public class PS {
UUIDHandler.handleShutdown();
} catch (NullPointerException ignored) {
ignored.printStackTrace();
PS.log("&cCould not close database connection!");
PlotSquared.log("&cCould not close database connection!");
}
}
@ -1586,21 +1560,20 @@ public class PS {
}
Database database;
if (Storage.MySQL.USE) {
database = new MySQL(Storage.MySQL.HOST,
Storage.MySQL.PORT, Storage.MySQL.DATABASE, Storage.MySQL.USER,
Storage.MySQL.PASSWORD);
database = new MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE,
Storage.MySQL.USER, Storage.MySQL.PASSWORD);
} else if (Storage.SQLite.USE) {
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
database = new SQLite(file);
} else {
PS.log(C.PREFIX + "&cNo storage type is set!");
PlotSquared.log(C.PREFIX + "&cNo storage type is set!");
this.IMP.disable();
return;
}
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false);
this.plots_tmp = DBFunc.getPlots();
if (manager instanceof SinglePlotAreaManager) {
SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
if (plotAreaManager instanceof SinglePlotAreaManager) {
SinglePlotArea area = ((SinglePlotAreaManager) plotAreaManager).getArea();
addPlotArea(area);
ConfigurationSection section = worlds.getConfigurationSection("worlds.*");
if (section == null) {
@ -1611,17 +1584,18 @@ public class PS {
}
this.clusters_tmp = DBFunc.getClusters();
} catch (ClassNotFoundException | SQLException e) {
PS.log(
PlotSquared.log(
C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
if (Storage.MySQL.USE) {
PS.log("$4MYSQL");
PlotSquared.log("$4MYSQL");
} else if (Storage.SQLite.USE) {
PS.log("$4SQLITE");
PlotSquared.log("$4SQLITE");
}
PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ===");
PlotSquared.log(
"&d==== Here is an ugly stacktrace, if you are interested in those things ===");
e.printStackTrace();
PS.log("&d==== End of stacktrace ====");
PS.log("&6Please go to the " + IMP.getPluginName()
PlotSquared.log("&d==== End of stacktrace ====");
PlotSquared.log("&6Please go to the " + IMP.getPluginName()
+ " 'storage.yml' and configure the database correctly.");
this.IMP.disable();
}
@ -1646,7 +1620,7 @@ public class PS {
try {
worlds.save(worldsFile);
} catch (IOException e) {
PS.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
PlotSquared.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
e.printStackTrace();
}
}
@ -1681,28 +1655,29 @@ public class PS {
public void setupConfigs() {
File folder = new File(this.IMP.getDirectory(), "config");
if (!folder.exists() && !folder.mkdirs()) {
PS.log(C.PREFIX
PlotSquared.log(C.PREFIX
+ "&cFailed to create the /plugins/config folder. Please create it manually.");
}
try {
this.worldsFile = new File(folder, "worlds.yml");
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
PS.log("Could not create the worlds file, please create \"worlds.yml\" manually.");
PlotSquared.log(
"Could not create the worlds file, please create \"worlds.yml\" manually.");
}
this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile);
} catch (IOException ignored) {
PS.log("Failed to save settings.yml");
PlotSquared.log("Failed to save settings.yml");
}
try {
this.configFile = new File(folder, "settings.yml");
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
PS.log(
PlotSquared.log(
"Could not create the settings file, please create \"settings.yml\" manually.");
}
this.config = YamlConfiguration.loadConfiguration(this.configFile);
setupConfig();
} catch (IOException ignored) {
PS.log("Failed to save settings.yml");
PlotSquared.log("Failed to save settings.yml");
}
try {
this.styleFile = MainUtil.getFile(IMP.getDirectory(),
@ -1712,7 +1687,7 @@ public class PS {
this.styleFile.getParentFile().mkdirs();
}
if (!this.styleFile.createNewFile()) {
PS.log(
PlotSquared.log(
"Could not create the style file, please create \"translations/style.yml\" manually");
}
}
@ -1720,34 +1695,34 @@ public class PS {
setupStyle();
} catch (IOException err) {
err.printStackTrace();
PS.log("failed to save style.yml");
PlotSquared.log("failed to save style.yml");
}
try {
this.storageFile = new File(folder, "storage.yml");
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
PS.log(
PlotSquared.log(
"Could not the storage settings file, please create \"storage.yml\" manually.");
}
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
setupStorage();
} catch (IOException ignored) {
PS.log("Failed to save storage.yml");
PlotSquared.log("Failed to save storage.yml");
}
try {
this.commandsFile = new File(folder, "commands.yml");
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
PS.log(
PlotSquared.log(
"Could not the storage settings file, please create \"commands.yml\" manually.");
}
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
} catch (IOException ignored) {
PS.log("Failed to save commands.yml");
PlotSquared.log("Failed to save commands.yml");
}
try {
this.style.save(this.styleFile);
this.commands.save(this.commandsFile);
} catch (IOException e) {
PS.log("Configuration file saving failed");
PlotSquared.log("Configuration file saving failed");
e.printStackTrace();
}
}
@ -1768,8 +1743,9 @@ public class PS {
if (Settings.DEBUG) {
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
for (Entry<String, Object> component : components.entrySet()) {
PS.log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
component.getValue()));
PlotSquared.log(C.PREFIX + String
.format("&cKey: &6%s&c, Value: &6%s", component.getKey(),
component.getValue()));
}
}
}
@ -1802,83 +1778,71 @@ public class PS {
return Double.parseDouble(System.getProperty("java.specification.version"));
}
public void foreachPlotArea(RunnableVal<PlotArea> runnable) {
for (PlotArea area : this.manager.getAllPlotAreas()) {
public void foreachPlotArea(@NonNull final RunnableVal<PlotArea> runnable) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
runnable.run(area);
}
}
public void foreachPlotArea(String world, RunnableVal<PlotArea> runnable) {
PlotArea[] array = this.manager.getPlotAreas(world, null);
public void foreachPlotArea(@NonNull final String world, @NonNull final RunnableVal<PlotArea> runnable) {
final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null);
if (array == null) {
return;
}
for (PlotArea area : array) {
for (final PlotArea area : array) {
runnable.run(area);
}
}
public void foreachPlot(RunnableVal<Plot> runnable) {
for (PlotArea area : this.manager.getAllPlotAreas()) {
for (Plot plot : area.getPlots()) {
runnable.run(plot);
}
public void foreachPlot(@NonNull final RunnableVal<Plot> runnable) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
area.getPlots().forEach(runnable::run);
}
}
public void foreachPlotRaw(RunnableVal<Plot> runnable) {
for (PlotArea area : this.manager.getAllPlotAreas()) {
for (Plot plot : area.getPlots()) {
runnable.run(plot);
}
public void foreachPlotRaw(@NonNull final RunnableVal<Plot> runnable) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
area.getPlots().forEach(runnable::run);
}
if (this.plots_tmp != null) {
for (HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
for (Plot entry2 : entry.values()) {
runnable.run(entry2);
}
for (final HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
entry.values().forEach(runnable::run);
}
}
}
public void foreachBasePlot(RunnableVal<Plot> run) {
for (PlotArea area : this.manager.getAllPlotAreas()) {
public void foreachBasePlot(@NonNull final RunnableVal<Plot> run) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
area.foreachBasePlot(run);
}
}
public PlotArea getFirstPlotArea() {
PlotArea[] areas = manager.getAllPlotAreas();
PlotArea[] areas = plotAreaManager.getAllPlotAreas();
return areas.length > 0 ? areas[0] : null;
}
public int getPlotAreaCount() {
return this.manager.getAllPlotAreas().length;
return this.plotAreaManager.getAllPlotAreas().length;
}
public int getPlotCount() {
int count = 0;
for (PlotArea area : this.manager.getAllPlotAreas()) {
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
count += area.getPlotCount();
}
return count;
}
public Set<PlotArea> getPlotAreas() {
HashSet<PlotArea> set = new HashSet<>();
Collections.addAll(set, manager.getAllPlotAreas());
return set;
final Set<PlotArea> set = new HashSet<>();
Collections.addAll(set, plotAreaManager.getAllPlotAreas());
return Collections.unmodifiableSet(set);
}
public boolean isAugmented(String world) {
PlotArea[] areas = manager.getPlotAreas(world, null);
if (areas == null) {
return false;
}
if (areas.length > 1) {
return true;
}
return areas[0].TYPE != 0;
public boolean isAugmented(@NonNull final String world) {
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, null);
return areas != null && (areas.length > 1 || areas[0].TYPE != 0);
}
/**
@ -1887,9 +1851,9 @@ public class PS {
* @param world the world
* @return Collection of PlotArea objects
*/
public Set<PlotArea> getPlotAreas(String world) {
Set<PlotArea> set = new HashSet<>();
Collections.addAll(set, manager.getPlotAreas(world, null));
public Set<PlotArea> getPlotAreas(@NonNull final String world) {
final Set<PlotArea> set = new HashSet<>();
Collections.addAll(set, plotAreaManager.getPlotAreas(world, null));
return set;
}
@ -1906,12 +1870,12 @@ public class PS {
* @param location the location
* @return
*/
public PlotArea getApplicablePlotArea(Location location) {
return manager.getApplicablePlotArea(location);
public PlotArea getApplicablePlotArea(@NonNull final Location location) {
return plotAreaManager.getApplicablePlotArea(location);
}
public PlotArea getPlotArea(String world, String id) {
return manager.getPlotArea(world, id);
public PlotArea getPlotArea(@NonNull final String world, @NonNull final String id) {
return plotAreaManager.getPlotArea(world, id);
}
/**
@ -1924,15 +1888,15 @@ public class PS {
* @param location the location
* @return the {@link PlotArea} in the location, null if non existent
*/
public PlotArea getPlotAreaAbs(Location location) {
return manager.getPlotArea(location);
public PlotArea getPlotAreaAbs(@NonNull final Location location) {
return plotAreaManager.getPlotArea(location);
}
public PlotArea getPlotAreaByString(String search) {
String[] split = search.split(";|,");
PlotArea[] areas = manager.getPlotAreas(split[0], null);
public PlotArea getPlotAreaByString(@NonNull final String search) {
String[] split = search.split("[;,]");
PlotArea[] areas = plotAreaManager.getPlotAreas(split[0], null);
if (areas == null) {
for (PlotArea area : manager.getAllPlotAreas()) {
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
if (area.worldname.equalsIgnoreCase(split[0])) {
if (area.id == null || split.length == 2 && area.id
.equalsIgnoreCase(split[1])) {
@ -1963,26 +1927,24 @@ public class PS {
* @param worldname to filter alias to a specific world [optional] null means all worlds
* @return Set<{@link Plot}> empty if nothing found
*/
public Set<Plot> getPlotsByAlias(String alias, String worldname) {
Set<Plot> result = new HashSet<>();
public Set<Plot> getPlotsByAlias(@Nullable final String alias, @NonNull final String worldname) {
final Set<Plot> result = new HashSet<>();
if (alias != null) {
for (Plot plot : getPlots()) {
for (final Plot plot : getPlots()) {
if (alias.equals(plot.getAlias()) && (worldname == null || worldname
.equals(plot.getWorldName()))) {
result.add(plot);
}
}
}
return result;
return Collections.unmodifiableSet(result);
}
public Set<PlotArea> getPlotAreas(String world, RegionWrapper region) {
PlotArea[] areas = manager.getPlotAreas(world, region);
Set<PlotArea> set = new HashSet<>();
public Set<PlotArea> getPlotAreas(final String world, final RegionWrapper region) {
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, region);
final Set<PlotArea> set = new HashSet<>();
Collections.addAll(set, areas);
return set;
return Collections.unmodifiableSet(set);
}
public enum SortType {

View File

@ -18,7 +18,7 @@ public class Updater {
public String getChanges() {
if (changes == null) {
try (Scanner scanner = new Scanner(new URL(
"http://empcraft.com/plots/cl?" + Integer.toHexString(PS.get().getVersion().hash))
"http://empcraft.com/plots/cl?" + Integer.toHexString(PlotSquared.get().getVersion().hash))
.openStream(), "UTF-8")) {
changes = scanner.useDelimiter("\\A").next();
} catch (IOException e) {
@ -50,7 +50,7 @@ public class Updater {
URL download = new URL(downloadUrl.replaceAll("%platform%", platform)
.replaceAll("%version%", versionString));
try (ReadableByteChannel rbc = Channels.newChannel(download.openStream())) {
File jarFile = PS.get().getJarFile();
File jarFile = PlotSquared.get().getJarFile();
File finalFile = new File(jarFile.getParent(),
"update" + File.separator + jarFile.getName());
@ -69,7 +69,7 @@ public class Updater {
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
}
outFile.renameTo(finalFile);
PS.debug("Updated PlotSquared to " + versionString);
PlotSquared.debug("Updated PlotSquared to " + versionString);
MainUtil.sendAdmin(
"&7Restart to update PlotSquared with these changes: &c/plot changelog &7or&c "
+ "http://empcraft.com/plots/cl?" + Integer

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -88,13 +88,13 @@ public class Alias extends SubCommand {
C.NOT_VALID_VALUE.send(player);
return false;
}
for (Plot p : PS.get().getPlots(plot.getArea())) {
for (Plot p : PlotSquared.get().getPlots(plot.getArea())) {
if (p.getAlias().equalsIgnoreCase(alias)) {
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
return false;
}
}
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PS.get().hasPlotArea(alias)) {
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get().hasPlotArea(alias)) {
MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN);
return false;
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
@ -81,7 +81,8 @@ public class Area extends SubCommand {
final int offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower);
final int offsetZ = bz - (area.ROAD_WIDTH == 0 ? 0 : lower);
final RegionWrapper region = new RegionWrapper(bx, tx, bz, tz);
Set<PlotArea> areas = PS.get().getPlotAreas(area.worldname, region);
Set<PlotArea> areas = PlotSquared
.get().getPlotAreas(area.worldname, region);
if (!areas.isEmpty()) {
C.CLUSTER_INTERSECTION
.send(player, areas.iterator().next().toString());
@ -94,8 +95,8 @@ public class Area extends SubCommand {
object.type = area.TYPE;
object.min = new PlotId(1, 1);
object.max = new PlotId(numX, numZ);
object.plotManager = PS.imp().getPluginName();
object.setupGenerator = PS.imp().getPluginName();
object.plotManager = PlotSquared.imp().getPluginName();
object.setupGenerator = PlotSquared.imp().getPluginName();
object.step = area.getSettingNodes();
final String path =
"worlds." + area.worldname + ".areas." + area.id + '-'
@ -103,14 +104,14 @@ public class Area extends SubCommand {
Runnable run = new Runnable() {
@Override public void run() {
if (offsetX != 0) {
PS.get().worlds.set(path + ".road.offset.x", offsetX);
PlotSquared.get().worlds.set(path + ".road.offset.x", offsetX);
}
if (offsetZ != 0) {
PS.get().worlds.set(path + ".road.offset.z", offsetZ);
PlotSquared.get().worlds.set(path + ".road.offset.z", offsetZ);
}
final String world = SetupUtils.manager.setupWorld(object);
if (WorldUtil.IMP.isWorld(world)) {
PS.get().loadWorld(world, null);
PlotSquared.get().loadWorld(world, null);
C.SETUP_FINISHED.send(player);
player.teleport(WorldUtil.IMP.getSpawn(world));
if (area.TERRAIN != 3) {
@ -149,13 +150,13 @@ public class Area extends SubCommand {
}
object.world = split[0];
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id,
PS.get().IMP.getDefaultGenerator(), null, null);
PlotArea other = PS.get().getPlotArea(pa.worldname, id);
PlotSquared.get().IMP.getDefaultGenerator(), null, null);
PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id);
if (other != null && Objects.equals(pa.id, other.id)) {
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
return false;
}
Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname);
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(pa.worldname);
if (!areas.isEmpty()) {
PlotArea area = areas.iterator().next();
pa.TYPE = area.TYPE;
@ -224,15 +225,15 @@ public class Area extends SubCommand {
Runnable run = new Runnable() {
@Override public void run() {
String path = "worlds." + pa.worldname;
if (!PS.get().worlds.contains(path)) {
PS.get().worlds.createSection(path);
if (!PlotSquared.get().worlds.contains(path)) {
PlotSquared.get().worlds.createSection(path);
}
ConfigurationSection section =
PS.get().worlds.getConfigurationSection(path);
PlotSquared.get().worlds.getConfigurationSection(path);
pa.saveConfiguration(section);
pa.loadConfiguration(section);
object.plotManager = PS.imp().getPluginName();
object.setupGenerator = PS.imp().getPluginName();
object.plotManager = PlotSquared.imp().getPluginName();
object.setupGenerator = PlotSquared.imp().getPluginName();
String world = SetupUtils.manager.setupWorld(object);
if (WorldUtil.IMP.isWorld(world)) {
C.SETUP_FINISHED.send(player);
@ -243,7 +244,7 @@ public class Area extends SubCommand {
+ pa.worldname);
}
try {
PS.get().worlds.save(PS.get().worldsFile);
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
} catch (IOException e) {
e.printStackTrace();
}
@ -291,7 +292,7 @@ public class Area extends SubCommand {
area = player.getApplicablePlotArea();
break;
case 2:
area = PS.get().getPlotAreaByString(args[1]);
area = PlotSquared.get().getPlotAreaByString(args[1]);
break;
default:
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
@ -351,7 +352,7 @@ public class Area extends SubCommand {
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
return false;
}
ArrayList<PlotArea> areas = new ArrayList<>(PS.get().getPlotAreas());
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
paginate(player, areas, 8, page,
new RunnableVal3<Integer, PlotArea, PlotMessage>() {
@Override public void run(Integer i, PlotArea area, PlotMessage message) {
@ -435,7 +436,7 @@ public class Area extends SubCommand {
C.COMMAND_SYNTAX.send(player, "/plot visit [area]");
return false;
}
PlotArea area = PS.get().getPlotAreaByString(args[1]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
return false;
@ -457,7 +458,7 @@ public class Area extends SubCommand {
case "remove":
MainUtil.sendMessage(player,
"$1World creation settings may be stored in multiple locations:"
+ "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PS.imp().getPluginName()
+ "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PlotSquared.imp().getPluginName()
+ " settings.yml"
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
+ "\n$1Stop the server and delete it from these locations.");

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -138,7 +138,7 @@ public class Auto extends SubCommand {
PlotArea plotarea = player.getApplicablePlotArea();
if (plotarea == null) {
if (EconHandler.manager != null) {
for (PlotArea area : PS.get().getPlotAreaManager().getAllPlotAreas()) {
for (PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
if (EconHandler.manager
.hasPermission(area.worldname, player.getName(), "plots.auto")) {
if (plotarea != null) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.Updater;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -15,11 +15,11 @@ import java.util.Scanner;
@Override public boolean onCommand(PlotPlayer player, String[] args) {
try {
Updater updater = PS.get().getUpdater();
Updater updater = PlotSquared.get().getUpdater();
String changes = updater != null ? updater.getChanges() : null;
if (changes == null) {
try (Scanner scanner = new Scanner(new URL("http://empcraft.com/plots/cl?" + Integer
.toHexString(PS.get().getVersion().hash)).openStream(), "UTF-8")) {
.toHexString(PlotSquared.get().getVersion().hash)).openStream(), "UTF-8")) {
changes = scanner.useDelimiter("\\A").next();
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -379,7 +379,7 @@ public class Cluster extends SubCommand {
MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName());
}
for (Plot plot : new ArrayList<>(
PS.get().getPlots(player2.getLocation().getWorld(), uuid))) {
PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) {
PlotCluster current = plot.getCluster();
if (current != null && current.equals(cluster)) {
plot.unclaim();
@ -433,7 +433,7 @@ public class Cluster extends SubCommand {
DBFunc.removeInvited(cluster, uuid);
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
for (Plot plot : new ArrayList<>(
PS.get().getPlots(player.getLocation().getWorld(), uuid))) {
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
PlotCluster current = plot.getCluster();
if (current != null && current.equals(cluster)) {
player.getLocation().getWorld();

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
@ -25,7 +25,7 @@ public class Condense extends SubCommand {
MainUtil.sendMessage(player, "/plot condense <area> <start|stop|info> [radius]");
return false;
}
PlotArea area = PS.get().getPlotAreaByString(args[0]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
MainUtil.sendMessage(player, "INVALID AREA");
return false;
@ -46,7 +46,7 @@ public class Condense extends SubCommand {
return false;
}
int radius = Integer.parseInt(args[2]);
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots(area));
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots(area));
// remove non base plots
Iterator<Plot> iterator = plots.iterator();
int maxSize = 0;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.database.MySQL;
import com.github.intellectualsites.plotsquared.plot.database.SQLManager;
@ -57,12 +57,12 @@ public class Database extends SubCommand {
return false;
}
List<Plot> plots;
PlotArea area = PS.get().getPlotAreaByString(args[0]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area != null) {
plots = PS.get().sortPlotsByTemp(area.getPlots());
plots = PlotSquared.get().sortPlotsByTemp(area.getPlots());
args = Arrays.copyOfRange(args, 1, args.length);
} else {
plots = PS.get().sortPlotsByTemp(PS.get().getPlots());
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots());
}
if (args.length < 1) {
MainUtil.sendMessage(player, "/plot database [world] <sqlite|mysql|import>");
@ -79,7 +79,7 @@ public class Database extends SubCommand {
.sendMessage(player, "/plot database import <sqlite file> [prefix]");
return false;
}
File file = MainUtil.getFile(PS.get().IMP.getDirectory(),
File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
args[1].endsWith(".db") ? args[1] : args[1] + ".db");
if (!file.exists()) {
MainUtil.sendMessage(player, "&6Database does not exist: " + file);
@ -93,7 +93,7 @@ public class Database extends SubCommand {
plots = new ArrayList<>();
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
String areaname = entry.getKey();
PlotArea pa = PS.get().getPlotAreaByString(areaname);
PlotArea pa = PlotSquared.get().getPlotAreaByString(areaname);
if (pa != null) {
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
Plot plot = entry2.getValue();
@ -103,11 +103,11 @@ public class Database extends SubCommand {
if (newPlot != null) {
PlotId newId = newPlot.getId();
PlotId id = plot.getId();
File worldFile = new File(PS.imp().getWorldContainer(),
File worldFile = new File(PlotSquared.imp().getWorldContainer(),
id.toCommaSeparatedString());
if (worldFile.exists()) {
File newFile =
new File(PS.imp().getWorldContainer(),
new File(PlotSquared.imp().getWorldContainer(),
newId.toCommaSeparatedString());
worldFile.renameTo(newFile);
}
@ -127,10 +127,10 @@ public class Database extends SubCommand {
plots.add(plot);
}
} else {
HashMap<PlotId, Plot> plotmap = PS.get().plots_tmp.get(areaname);
HashMap<PlotId, Plot> plotmap = PlotSquared.get().plots_tmp.get(areaname);
if (plotmap == null) {
plotmap = new HashMap<>();
PS.get().plots_tmp.put(areaname, plotmap);
PlotSquared.get().plots_tmp.put(areaname, plotmap);
}
plotmap.putAll(entry.getValue());
}
@ -161,7 +161,7 @@ public class Database extends SubCommand {
return MainUtil.sendMessage(player, "/plot database sqlite [file]");
}
File sqliteFile =
MainUtil.getFile(PS.get().IMP.getDirectory(), args[1] + ".db");
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1] + ".db");
implementation = new SQLite(sqliteFile);
break;
default:

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -26,8 +26,8 @@ public class Debug extends SubCommand {
information.append(header);
information.append(getSection(section, "PlotArea"));
information
.append(getLine(line, "Plot Worlds", StringMan.join(PS.get().getPlotAreas(), ", ")));
information.append(getLine(line, "Owned Plots", PS.get().getPlots().size()));
.append(getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
information.append(getSection(section, "Messages"));
information.append(getLine(line, "Total Messages", C.values().length));
information.append(getLine(line, "View all captions", "/plot debug msg"));

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -26,7 +26,7 @@ public class DebugClaimTest extends SubCommand {
"If you accidentally delete your database, this command will attempt to restore all plots based on the data from the "
+ "plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
}
PlotArea area = PS.get().getPlotAreaByString(args[0]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
return false;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -31,13 +31,13 @@ import java.util.*;
public DebugExec() {
try {
if (PS.get() != null) {
File file = new File(PS.get().IMP.getDirectory(),
if (PlotSquared.get() != null) {
File file = new File(PlotSquared.get().IMP.getDirectory(),
Settings.Paths.SCRIPTS + File.separator + "start.js");
if (file.exists()) {
init();
String script = StringMan.join(Files.readLines(new File(new File(
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
"start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator"));
this.scope.put("THIS", this);
this.scope.put("PlotPlayer", ConsolePlayer.getConsole());
@ -87,10 +87,10 @@ import java.util.*;
this.scope.put("RunnableVal", RunnableVal.class);
// Instances
this.scope.put("PS", PS.get());
this.scope.put("PS", PlotSquared.get());
this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP);
this.scope.put("ExpireManager", ExpireManager.IMP);
if (PS.get().worldedit != null) {
if (PlotSquared.get().worldedit != null) {
this.scope.put("WEManager", new WEManager());
}
this.scope.put("TaskManager", TaskManager.IMP);
@ -105,7 +105,7 @@ import java.util.*;
this.scope.put("UUIDHandler", UUIDHandler.implementation);
this.scope.put("DBFunc", DBFunc.dbManager);
this.scope.put("HybridUtils", HybridUtils.manager);
this.scope.put("IMP", PS.get().IMP);
this.scope.put("IMP", PlotSquared.get().IMP);
this.scope.put("MainCommand", MainCommand.getInstance());
// enums
@ -180,7 +180,7 @@ import java.util.*;
return false;
}
String flag = args[1];
for (Plot plot : PS.get().getBasePlots()) {
for (Plot plot : PlotSquared.get().getBasePlots()) {
Flag<?> flag1 = FlagManager.getFlag(flag);
if (plot.getFlag(flag1).isPresent()) {
plot.removeFlag(flag1);
@ -193,7 +193,7 @@ import java.util.*;
"&cInvalid syntax: /plot debugexec start-rgar <world>");
return false;
}
PlotArea area = PS.get().getPlotAreaByString(args[1]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
if (area == null) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]);
return false;
@ -261,7 +261,7 @@ import java.util.*;
case "addcmd":
try {
final String cmd = StringMan.join(Files.readLines(MainUtil.getFile(new File(
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
args[1]), StandardCharsets.UTF_8),
System.getProperty("line.separator"));
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
@ -291,7 +291,7 @@ import java.util.*;
case "run":
try {
script = StringMan.join(Files.readLines(MainUtil.getFile(new File(
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
args[1]), StandardCharsets.UTF_8),
System.getProperty("line.separator"));
if (args.length > 2) {
@ -308,7 +308,7 @@ import java.util.*;
break;
case "list-scripts":
String path =
PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS;
PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS;
File folder = new File(path);
File[] filesArray = folder.listFiles();
@ -350,7 +350,7 @@ import java.util.*;
if ("true".equals(args[1])) {
Location loc = player.getMeta("location");
Plot plot = player.getMeta("lastplot");
for (Plot current : PS.get().getBasePlots()) {
for (Plot current : PlotSquared.get().getBasePlots()) {
player.setMeta("location", current.getBottomAbs());
player.setMeta("lastplot", current);
cmd.execute(player, params, null, null);
@ -398,7 +398,7 @@ import java.util.*;
}
init();
this.scope.put("PlotPlayer", player);
PS.debug("> " + script);
PlotSquared.debug("> " + script);
try {
if (async) {
final String toExec = script;
@ -411,13 +411,13 @@ import java.util.*;
} catch (ScriptException e) {
e.printStackTrace();
}
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
}
});
} else {
long start = System.currentTimeMillis();
Object result = this.engine.eval(script, this.scope);
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
}
return true;
} catch (ScriptException e) {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
@ -24,7 +24,7 @@ public class DebugFixFlags extends SubCommand {
}
@Override public boolean onCommand(PlotPlayer player, String[] args) {
PlotArea area = PS.get().getPlotAreaByString(args[0]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]);
return false;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
@ -27,14 +27,14 @@ public class DebugImportWorlds extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
PlotAreaManager pam = PS.get().getPlotAreaManager();
PlotAreaManager pam = PlotSquared.get().getPlotAreaManager();
if (!(pam instanceof SinglePlotAreaManager)) {
player.sendMessage("Must be a single plot area!");
return;
}
SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea();
PlotId id = new PlotId(0, 0);
File container = PS.imp().getWorldContainer();
File container = PlotSquared.imp().getWorldContainer();
for (File folder : container.listFiles()) {
String name = folder.getName();
if (!WorldUtil.IMP.isWorld(name) && PlotId.fromString(name) == null) {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
public class DebugLoadTest extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
PS.get().plots_tmp = DBFunc.getPlots();
PlotSquared.get().plots_tmp = DBFunc.getPlots();
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -20,13 +20,13 @@ public class DebugPaste extends SubCommand {
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
try {
String settingsYML = HastebinUtility.upload(PS.get().configFile);
String worldsYML = HastebinUtility.upload(PS.get().worldsFile);
String commandsYML = HastebinUtility.upload(PS.get().commandsFile);
String settingsYML = HastebinUtility.upload(PlotSquared.get().configFile);
String worldsYML = HastebinUtility.upload(PlotSquared.get().worldsFile);
String commandsYML = HastebinUtility.upload(PlotSquared.get().commandsFile);
String latestLOG;
try {
latestLOG = HastebinUtility
.upload(new File(PS.get().IMP.getDirectory(), "../../logs/latest.log"));
.upload(new File(PlotSquared.get().IMP.getDirectory(), "../../logs/latest.log"));
} catch (IOException ignored) {
MainUtil.sendMessage(player,
"&clatest.log is too big to be pasted, will ignore");
@ -41,13 +41,13 @@ public class DebugPaste extends SubCommand {
b.append("links.commands_yml: ").append(commandsYML).append('\n');
b.append("links.latest_log: ").append(latestLOG).append('\n');
b.append("\n# Server Information\n");
int[] sVersion = PS.get().IMP.getServerVersion();
int[] sVersion = PlotSquared.get().IMP.getServerVersion();
b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1])
.append('.').append(sVersion[2]).append('\n');
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
.append(!Settings.UUID.OFFLINE).append('\n');
b.append("plugins:");
for (String id : PS.get().IMP.getPluginIds()) {
for (String id : PlotSquared.get().IMP.getPluginIds()) {
String[] split = id.split(":");
String[] split2 = split[0].split(";");
String enabled = split.length == 2 ? split[1] : "unknown";

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -14,7 +14,7 @@ public class DebugSaveTest extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
ArrayList<Plot> plots = new ArrayList<Plot>();
plots.addAll(PS.get().getPlots());
plots.addAll(PlotSquared.get().getPlots());
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
DBFunc.createPlotsAndData(plots, new Runnable() {
@Override public void run() {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -99,7 +99,7 @@ public class Deny extends SubCommand {
MainUtil.sendMessage(player, C.YOU_GOT_DENIED);
if (plot.equals(spawn.getPlot())) {
Location newSpawn =
WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]);
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) {
// Kick from server if you can't be teleported to spawn
player.kick(C.YOU_GOT_DENIED.s());

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -19,7 +19,7 @@ public class Download extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld();
if (!PS.get().hasPlotArea(world)) {
if (!PlotSquared.get().hasPlotArea(world)) {
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
final Plot plot = player.getCurrentPlot();

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -27,7 +27,7 @@ public class FlagCmd extends SubCommand {
int numeric = Integer.parseInt(value);
perm = perm.substring(0, perm.length() - value.length() - 1);
if (numeric > 0) {
int checkRange = PS.get().getPlatform().equalsIgnoreCase("bukkit") ?
int checkRange = PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ?
numeric :
Settings.Limit.MAX_PLOTS;
return player.hasPermissionRange(perm, checkRange) >= numeric;

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -76,7 +76,7 @@ public class Kick extends SubCommand {
C.YOU_GOT_KICKED.send(player2);
if (plot.equals(spawn.getPlot())) {
Location newSpawn =
WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]);
WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) {
// Kick from server if you can't be teleported to spawn
player2.kick(C.YOU_GOT_KICKED.s());

View File

@ -1,8 +1,8 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PS.SortType;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -98,7 +98,7 @@ public class ListCmd extends SubCommand {
return false;
}
sort = false;
plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player));
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player));
break;
case "shared":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
@ -106,7 +106,7 @@ public class ListCmd extends SubCommand {
return false;
}
plots = new ArrayList<>();
for (Plot plot : PS.get().getPlots()) {
for (Plot plot : PlotSquared.get().getPlots()) {
if (plot.getTrusted().contains(player.getUUID()) || plot.getMembers()
.contains(player.getUUID())) {
plots.add(plot);
@ -123,7 +123,7 @@ public class ListCmd extends SubCommand {
C.PERMISSION_LIST_WORLD_NAME.f(world));
return false;
}
plots = new ArrayList<>(PS.get().getPlots(world));
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
break;
case "expired":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
@ -151,7 +151,7 @@ public class ListCmd extends SubCommand {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL);
return false;
}
plots = new ArrayList<>(PS.get().getPlots());
plots = new ArrayList<>(PlotSquared.get().getPlots());
break;
case "done":
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
@ -159,7 +159,7 @@ public class ListCmd extends SubCommand {
return false;
}
plots = new ArrayList<>();
for (Plot plot : PS.get().getPlots()) {
for (Plot plot : PlotSquared.get().getPlots()) {
Optional<String> flag = plot.getFlag(Flags.DONE);
if (!flag.isPresent()) {
continue;
@ -186,7 +186,7 @@ public class ListCmd extends SubCommand {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
return false;
}
plots = new ArrayList<>(PS.get().getPlots());
plots = new ArrayList<>(PlotSquared.get().getPlots());
Collections.sort(plots, new Comparator<Plot>() {
@Override public int compare(Plot p1, Plot p2) {
double v1 = 0;
@ -226,7 +226,7 @@ public class ListCmd extends SubCommand {
break;
}
plots = new ArrayList<>();
for (Plot plot : PS.get().getPlots()) {
for (Plot plot : PlotSquared.get().getPlots()) {
Optional<Double> price = plot.getFlag(Flags.PRICE);
if (price.isPresent()) {
plots.add(plot);
@ -239,7 +239,7 @@ public class ListCmd extends SubCommand {
return false;
}
plots = new ArrayList<>();
for (Plot plot : PS.get().getPlots()) {
for (Plot plot : PlotSquared.get().getPlots()) {
if (plot.owner == null) {
plots.add(plot);
}
@ -251,7 +251,7 @@ public class ListCmd extends SubCommand {
return false;
}
plots = new ArrayList<>();
for (Plot plot : PS.get().getPlots()) {
for (Plot plot : PlotSquared.get().getPlots()) {
if (plot.owner == null) {
continue;
}
@ -279,7 +279,7 @@ public class ListCmd extends SubCommand {
sort = false;
break;
default:
if (PS.get().hasPlotArea(args[0])) {
if (PlotSquared.get().hasPlotArea(args[0])) {
if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
return false;
@ -290,7 +290,7 @@ public class ListCmd extends SubCommand {
C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
return false;
}
plots = new ArrayList<>(PS.get().getPlots(args[0]));
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
break;
}
UUID uuid = UUIDHandler.getUUID(args[0], null);
@ -306,7 +306,7 @@ public class ListCmd extends SubCommand {
return false;
}
sort = false;
plots = PS.get().sortPlotsByTemp(PS.get().getPlots(uuid));
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots(uuid));
break;
}
}
@ -336,7 +336,7 @@ public class ListCmd extends SubCommand {
}
}
if (sort) {
plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, area);
plots = PlotSquared.get().sortPlots(plots, SortType.CREATION_DATE, area);
}
this.paginate(player, plots, pageSize, page,
new RunnableVal3<Integer, Plot, PlotMessage>() {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -20,7 +20,7 @@ public class Load extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld();
if (!PS.get().hasPlotArea(world)) {
if (!PlotSquared.get().hasPlotArea(world)) {
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
final Plot plot = player.getCurrentPlot();

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
@ -185,7 +185,7 @@ import java.util.Arrays;
/**
* @Deprecated legacy
*/ public void addCommand(SubCommand command) {
PS.debug("Command registration is now done during instantiation");
PlotSquared.debug("Command registration is now done during instantiation");
}
@Override public void execute(final PlotPlayer player, String[] args,

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -34,7 +34,7 @@ public class Move extends SubCommand {
C.COMMAND_SYNTAX.send(player, getUsage());
return false;
}
PlotArea area = PS.get().getPlotAreaByString(args[0]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
Plot plot2;
if (area == null) {
plot2 = MainUtil.getPlotFromString(player, args[0], true);

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.json.JSONObject;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.HttpUtil;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -15,8 +15,8 @@ public class PluginCmd extends SubCommand {
TaskManager.IMP.taskAsync(new Runnable() {
@Override public void run() {
MainUtil.sendMessage(player, String
.format("$2>> $1&l" + PS.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
PS.get().getVersion()));
.format("$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
PlotSquared.get().getVersion()));
MainUtil.sendMessage(player,
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev");
MainUtil.sendMessage(player,

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
@ -45,7 +45,7 @@ public class Purge extends SubCommand {
break;
case "area":
case "a":
area = PS.get().getPlotAreaByString(split[1]);
area = PlotSquared.get().getPlotAreaByString(split[1]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, split[1]);
return false;
@ -86,7 +86,7 @@ public class Purge extends SubCommand {
}
}
final HashSet<Plot> toDelete = new HashSet<>();
for (Plot plot : PS.get().getBasePlots()) {
for (Plot plot : PlotSquared.get().getBasePlots()) {
if (world != null && !plot.getWorldName().equalsIgnoreCase(world)) {
continue;
}
@ -109,8 +109,8 @@ public class Purge extends SubCommand {
toDelete.add(current);
}
}
if (PS.get().plots_tmp != null) {
for (Entry<String, HashMap<PlotId, Plot>> entry : PS.get().plots_tmp.entrySet()) {
if (PlotSquared.get().plots_tmp != null) {
for (Entry<String, HashMap<PlotId, Plot>> entry : PlotSquared.get().plots_tmp.entrySet()) {
String worldName = entry.getKey();
if (world != null && !world.equalsIgnoreCase(worldName)) {
continue;
@ -141,7 +141,7 @@ public class Purge extends SubCommand {
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
Runnable run = new Runnable() {
@Override public void run() {
PS.debug("Calculating plots to purge, please wait...");
PlotSquared.debug("Calculating plots to purge, please wait...");
HashSet<Integer> ids = new HashSet<>();
for (Plot plot : toDelete) {
if (plot.temp != Integer.MAX_VALUE) {

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -20,7 +20,7 @@ public class Rate extends SubCommand {
if (args.length == 1) {
switch (args[0].toLowerCase()) {
case "next": {
ArrayList<Plot> plots = new ArrayList<>(PS.get().getBasePlots());
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getBasePlots());
Collections.sort(plots, new Comparator<Plot>() {
@Override public int compare(Plot p1, Plot p2) {
double v1 = 0;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
@ -33,7 +33,7 @@ public class RegenAllRoads extends SubCommand {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
return false;
}
PlotArea area = PS.get().getPlotAreaByString(args[0]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, args[0]);
return false;

View File

@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -21,12 +21,12 @@ public class Reload extends SubCommand {
try {
// The following won't affect world generation, as that has to be
// loaded during startup unfortunately.
PS.get().setupConfigs();
C.load(PS.get().translationFile);
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
PlotSquared.get().setupConfigs();
C.load(PlotSquared.get().translationFile);
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea area) {
ConfigurationSection worldSection =
PS.get().worlds.getConfigurationSection("worlds." + area.worldname);
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname);
if (worldSection == null) {
return;
}
@ -72,7 +72,7 @@ public class Reload extends SubCommand {
}
}
});
PS.get().worlds.save(PS.get().worldsFile);
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
MainUtil.sendMessage(player, C.RELOADED_CONFIGS);
} catch (IOException e) {
e.printStackTrace();

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -20,7 +20,7 @@ public class Save extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld();
if (!PS.get().hasPlotArea(world)) {
if (!PlotSquared.get().hasPlotArea(world)) {
return !sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
final Plot plot = player.getCurrentPlot();

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -141,7 +141,7 @@ public class SchematicCmd extends SubCommand {
"&cNeed world argument. Use &7/plot sch exportall <area>");
return false;
}
PlotArea area = PS.get().getPlotAreaByString(args[1]);
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
if (area == null) {
C.NOT_VALID_PLOT_WORLD.send(player, args[1]);
return false;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
@ -26,7 +26,7 @@ import java.util.Map.Entry;
StringBuilder message = new StringBuilder();
message.append("&6What generator do you want?");
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
if (entry.getKey().equals(PS.imp().getPluginName())) {
if (entry.getKey().equals(PlotSquared.imp().getPluginName())) {
message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
} else if (entry.getValue().isFull()) {
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
@ -74,7 +74,7 @@ import java.util.Map.Entry;
MainUtil.sendMessage(player,
"&cYou must choose a generator!" + prefix + StringMan
.join(SetupUtils.generators.keySet(), prefix)
.replaceAll(PS.imp().getPluginName(), "&2" + PS.imp().getPluginName()));
.replaceAll(PlotSquared.imp().getPluginName(), "&2" + PlotSquared.imp().getPluginName()));
sendMessage(player, C.SETUP_INIT);
return false;
}
@ -142,7 +142,7 @@ import java.util.Map.Entry;
SetupUtils.generators.get(object.plotManager).getPlotGenerator()
.processSetup(object);
} else {
object.plotManager = PS.imp().getPluginName();
object.plotManager = PlotSquared.imp().getPluginName();
MainUtil.sendMessage(player,
"&c[WARNING] The specified generator does not identify as BukkitPlotGenerator");
MainUtil.sendMessage(player,
@ -170,7 +170,7 @@ import java.util.Map.Entry;
MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!");
return false;
}
for (PlotArea area : PS.get().getPlotAreas()) {
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
if (area.id != null && area.id.equalsIgnoreCase(args[0])) {
MainUtil.sendMessage(player,
"&cYou must choose an area id that is not in use!");
@ -270,13 +270,13 @@ import java.util.Map.Entry;
return false;
}
if (WorldUtil.IMP.isWorld(args[0])) {
if (PS.get().hasPlotArea(args[0])) {
if (PlotSquared.get().hasPlotArea(args[0])) {
MainUtil.sendMessage(player, "&cThat world name is already taken!");
return false;
}
MainUtil.sendMessage(player,
"&cThe world you specified already exists. After restarting, new terrain will use "
+ PS.imp().getPluginName() + ", however you may need to "
+ PlotSquared.imp().getPluginName() + ", however you may need to "
+ "reset the world for it to generate correctly!");
}
object.world = args[0];

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -26,7 +26,7 @@ public class Target extends SubCommand {
Plot target = null;
if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) {
int distance = Integer.MAX_VALUE;
for (Plot plot : PS.get().getPlots(location.getWorld())) {
for (Plot plot : PlotSquared.get().getPlots(location.getWorld())) {
double current = plot.getCenter().getEuclideanDistanceSquared(location);
if (current < distance) {
distance = (int) current;

View File

@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
@ -26,12 +26,12 @@ public class Template extends SubCommand {
public static boolean extractAllFiles(String world, String template) {
try {
File folder = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
File folder = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
if (!folder.exists()) {
return false;
}
File input = new File(folder + File.separator + template + ".template");
File output = PS.get().IMP.getDirectory();
File output = PlotSquared.get().IMP.getDirectory();
if (!output.exists()) {
output.mkdirs();
}
@ -71,7 +71,7 @@ public class Template extends SubCommand {
public static byte[] getBytes(PlotArea plotArea) {
ConfigurationSection section =
PS.get().worlds.getConfigurationSection("worlds." + plotArea.worldname);
PlotSquared.get().worlds.getConfigurationSection("worlds." + plotArea.worldname);
YamlConfiguration config = new YamlConfiguration();
String generator = SetupUtils.manager.getGenerator(plotArea);
if (generator != null) {
@ -84,7 +84,7 @@ public class Template extends SubCommand {
}
public static void zipAll(String world, Set<FileBytes> files) throws IOException {
File output = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
File output = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
output.mkdirs();
try (FileOutputStream fos = new FileOutputStream(
output + File.separator + world + ".template");
@ -123,7 +123,7 @@ public class Template extends SubCommand {
"/plot template import <world> <template>");
return false;
}
if (PS.get().hasPlotArea(world)) {
if (PlotSquared.get().hasPlotArea(world)) {
MainUtil.sendMessage(player, C.SETUP_WORLD_TAKEN, world);
return false;
}
@ -133,18 +133,18 @@ public class Template extends SubCommand {
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
return false;
}
File worldFile = MainUtil.getFile(PS.get().IMP.getDirectory(),
File worldFile = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml");
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
PS.get().worlds.set("worlds." + world, worldConfig.get(""));
PlotSquared.get().worlds.set("worlds." + world, worldConfig.get(""));
try {
PS.get().worlds.save(PS.get().worldsFile);
PS.get().worlds.load(PS.get().worldsFile);
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
PlotSquared.get().worlds.load(PlotSquared.get().worldsFile);
} catch (InvalidConfigurationException | IOException e) {
e.printStackTrace();
}
String manager =
worldConfig.getString("generator.plugin", PS.imp().getPluginName());
worldConfig.getString("generator.plugin", PlotSquared.imp().getPluginName());
String generator = worldConfig.getString("generator.init", manager);
int type = worldConfig.getInt("generator.type");
int terrain = worldConfig.getInt("generator.terrain");
@ -170,7 +170,7 @@ public class Template extends SubCommand {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export <world>");
return false;
}
final PlotArea area = PS.get().getPlotAreaByString(world);
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
if (area == null) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
return false;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
@ -37,7 +37,7 @@ public class Trim extends SubCommand {
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
String directory = world + File.separator + "region";
File folder = new File(PS.get().IMP.getWorldContainer(), directory);
File folder = new File(PlotSquared.get().IMP.getWorldContainer(), directory);
File[] regionFiles = folder.listFiles();
for (File file : regionFiles) {
String name = file.getName();
@ -72,7 +72,7 @@ public class Trim extends SubCommand {
ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (NumberFormatException ignored) {
PS.debug("INVALID MCA: " + name);
PlotSquared.debug("INVALID MCA: " + name);
}
}
});
@ -94,7 +94,7 @@ public class Trim extends SubCommand {
}
MainUtil.sendMessage(null, "Collecting region data...");
ArrayList<Plot> plots = new ArrayList<>();
plots.addAll(PS.get().getPlots(world));
plots.addAll(PlotSquared.get().getPlots(world));
if (ExpireManager.IMP != null) {
plots.removeAll(ExpireManager.IMP.getPendingExpired());
}
@ -130,7 +130,7 @@ public class Trim extends SubCommand {
return false;
}
final String world = args[0];
if (!WorldUtil.IMP.isWorld(world) || !PS.get().hasPlotArea(world)) {
if (!WorldUtil.IMP.isWorld(world) || !PlotSquared.get().hasPlotArea(world)) {
MainUtil.sendMessage(player, C.NOT_VALID_WORLD);
return false;
}
@ -144,9 +144,9 @@ public class Trim extends SubCommand {
@Override public void run(Set<ChunkLoc> viable, final Set<ChunkLoc> nonViable) {
Runnable regenTask;
if (regen) {
PS.log("Starting regen task:");
PS.log(" - This is a VERY slow command");
PS.log(" - It will say `Trim done!` when complete");
PlotSquared.log("Starting regen task:");
PlotSquared.log(" - This is a VERY slow command");
PlotSquared.log(" - It will say `Trim done!` when complete");
regenTask = new Runnable() {
@Override public void run() {
if (nonViable.isEmpty()) {
@ -170,7 +170,7 @@ public class Trim extends SubCommand {
int bx = cbx << 4;
int bz = cbz << 4;
RegionWrapper region = new RegionWrapper(bx, bx + 511, bz, bz + 511);
for (Plot plot : PS.get().getPlots(world)) {
for (Plot plot : PlotSquared.get().getPlots(world)) {
Location bot = plot.getBottomAbs();
Location top = plot.getExtendedTopAbs();
RegionWrapper plotReg =

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -46,7 +46,7 @@ import java.util.*;
page = Integer.parseInt(args[2]);
case 2:
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
sortByArea = PS.get().getPlotAreaByString(args[1]);
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
if (sortByArea == null) {
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
C.COMMAND_SYNTAX.send(player, getUsage());
@ -57,22 +57,22 @@ import java.util.*;
C.COMMAND_SYNTAX.send(player, getUsage());
return;
}
unsorted = PS.get().getBasePlots(user);
unsorted = PlotSquared.get().getBasePlots(user);
shouldSortByArea = true;
break;
}
page = Integer.parseInt(args[1]);
case 1:
UUID user = args[0].length() >= 2 ? UUIDHandler.getUUIDFromString(args[0]) : null;
if (user != null && !PS.get().hasPlot(user))
if (user != null && !PlotSquared.get().hasPlot(user))
user = null;
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
page = Integer.parseInt(args[0]);
unsorted = PS.get().getBasePlots(player);
unsorted = PlotSquared.get().getBasePlots(player);
break;
}
if (user != null) {
unsorted = PS.get().getBasePlots(user);
unsorted = PlotSquared.get().getBasePlots(user);
} else {
Plot plot = MainUtil.getPlotFromString(player, args[0], true);
if (plot != null) {
@ -82,7 +82,7 @@ import java.util.*;
break;
case 0:
page = 1;
unsorted = PS.get().getPlots(player);
unsorted = PlotSquared.get().getPlots(player);
break;
default:
@ -106,9 +106,10 @@ import java.util.*;
}
List<Plot> plots;
if (shouldSortByArea) {
plots = PS.get().sortPlots(unsorted, PS.SortType.CREATION_DATE, sortByArea);
plots = PlotSquared
.get().sortPlots(unsorted, PlotSquared.SortType.CREATION_DATE, sortByArea);
} else {
plots = PS.get().sortPlotsByTemp(unsorted);
plots = PlotSquared.get().sortPlotsByTemp(unsorted);
}
final Plot plot = plots.get(page - 1);
if (!plot.hasOwner()) {

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.config;
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.io.File;
@ -757,7 +757,7 @@ public enum C {
changed = true;
yml.set(remove, null);
}
ConfigurationSection config = PS.get().style.getConfigurationSection("color");
ConfigurationSection config = PlotSquared.get().style.getConfigurationSection("color");
Set<String> styles = config.getKeys(false);
// HashMap<String, String> replacements = new HashMap<>();
replacements.clear();
@ -819,7 +819,7 @@ public enum C {
public void send(CommandCaller caller, Object... args) {
String msg = format(this, args);
if (caller == null) {
PS.log(msg);
PlotSquared.log(msg);
} else {
caller.sendMessage(msg);
}

View File

@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.config;
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.io.File;
@ -40,7 +40,7 @@ public class Config {
}
}
}
PS.debug("Failed to get config option: " + key);
PlotSquared.debug("Failed to get config option: " + key);
return null;
}
@ -68,13 +68,14 @@ public class Config {
field.set(instance, value);
return;
} catch (Throwable e) {
PS.debug("Invalid configuration value: " + key + ": " + value + " in " + root
PlotSquared
.debug("Invalid configuration value: " + key + ": " + value + " in " + root
.getSimpleName());
e.printStackTrace();
}
}
}
PS.debug("Failed to set config option: " + key + ": " + value + " | " + instance);
PlotSquared.debug("Failed to set config option: " + key + ": " + value + " | " + instance);
}
public static boolean load(File file, Class root) {
@ -261,7 +262,7 @@ public class Config {
setAccessible(field);
return field;
} catch (Throwable e) {
PS.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(
PlotSquared.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(
instance.getClass().getSimpleName()));
return null;
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.database;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.config.Storage;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
@ -304,12 +304,12 @@ import java.util.concurrent.atomic.AtomicInteger;
try {
task.run();
} catch (Throwable e) {
PS.debug("============ DATABASE ERROR ============");
PS.debug("There was an error updating the database.");
PS.debug(" - It will be corrected on shutdown");
PS.debug("========================================");
PlotSquared.debug("============ DATABASE ERROR ============");
PlotSquared.debug("There was an error updating the database.");
PlotSquared.debug(" - It will be corrected on shutdown");
PlotSquared.debug("========================================");
e.printStackTrace();
PS.debug("========================================");
PlotSquared.debug("========================================");
}
}
commit();
@ -359,12 +359,12 @@ import java.util.concurrent.atomic.AtomicInteger;
}
lastTask = task;
} catch (Throwable e) {
PS.debug("============ DATABASE ERROR ============");
PS.debug("There was an error updating the database.");
PS.debug(" - It will be corrected on shutdown");
PS.debug("========================================");
PlotSquared.debug("============ DATABASE ERROR ============");
PlotSquared.debug("There was an error updating the database.");
PlotSquared.debug(" - It will be corrected on shutdown");
PlotSquared.debug("========================================");
e.printStackTrace();
PS.debug("========================================");
PlotSquared.debug("========================================");
}
}
if (statement != null && task != null) {
@ -404,12 +404,12 @@ import java.util.concurrent.atomic.AtomicInteger;
}
lastTask = task;
} catch (Throwable e) {
PS.debug("============ DATABASE ERROR ============");
PS.debug("There was an error updating the database.");
PS.debug(" - It will be corrected on shutdown");
PS.debug("========================================");
PlotSquared.debug("============ DATABASE ERROR ============");
PlotSquared.debug("There was an error updating the database.");
PlotSquared.debug(" - It will be corrected on shutdown");
PlotSquared.debug("========================================");
e.printStackTrace();
PS.debug("========================================");
PlotSquared.debug("========================================");
}
}
if (statement != null && task != null) {
@ -450,12 +450,12 @@ import java.util.concurrent.atomic.AtomicInteger;
}
lastTask = task;
} catch (Throwable e) {
PS.debug("============ DATABASE ERROR ============");
PS.debug("There was an error updating the database.");
PS.debug(" - It will be corrected on shutdown");
PS.debug("========================================");
PlotSquared.debug("============ DATABASE ERROR ============");
PlotSquared.debug("There was an error updating the database.");
PlotSquared.debug(" - It will be corrected on shutdown");
PlotSquared.debug("========================================");
e.printStackTrace();
PS.debug("========================================");
PlotSquared.debug("========================================");
}
}
if (statement != null && task != null) {
@ -479,12 +479,12 @@ import java.util.concurrent.atomic.AtomicInteger;
this.plotTasks.clear();
}
} catch (Throwable e) {
PS.debug("============ DATABASE ERROR ============");
PS.debug("There was an error updating the database.");
PS.debug(" - It will be corrected on shutdown");
PS.debug("========================================");
PlotSquared.debug("============ DATABASE ERROR ============");
PlotSquared.debug("There was an error updating the database.");
PlotSquared.debug(" - It will be corrected on shutdown");
PlotSquared.debug("========================================");
e.printStackTrace();
PS.debug("========================================");
PlotSquared.debug("========================================");
}
return false;
}
@ -584,7 +584,7 @@ import java.util.concurrent.atomic.AtomicInteger;
});
} catch (SQLException e) {
e.printStackTrace();
PS.debug("&7[WARN] Failed to set all helpers for plots");
PlotSquared.debug("&7[WARN] Failed to set all helpers for plots");
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -595,7 +595,7 @@ import java.util.concurrent.atomic.AtomicInteger;
});
} catch (Exception e) {
e.printStackTrace();
PS.debug("&7[WARN] Failed to set all helpers for plots");
PlotSquared.debug("&7[WARN] Failed to set all helpers for plots");
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -754,7 +754,7 @@ import java.util.concurrent.atomic.AtomicInteger;
last = subList.size();
preparedStmt.addBatch();
}
PS.debug("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
PlotSquared.debug("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
@ -765,7 +765,7 @@ import java.util.concurrent.atomic.AtomicInteger;
} catch (SQLException e) {
if (this.mySQL) {
e.printStackTrace();
PS.debug("&cERROR 1: | " + objList.get(0).getClass().getCanonicalName());
PlotSquared.debug("&cERROR 1: | " + objList.get(0).getClass().getCanonicalName());
}
}
try {
@ -797,25 +797,25 @@ import java.util.concurrent.atomic.AtomicInteger;
last = subList.size();
preparedStmt.addBatch();
}
PS.debug("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
PlotSquared.debug("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
} catch (SQLException e) {
e.printStackTrace();
PS.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
PS.debug("&6[WARN] Could not bulk save!");
PlotSquared.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
PlotSquared.debug("&6[WARN] Could not bulk save!");
try (PreparedStatement preparedStmt = this.connection
.prepareStatement(mod.getCreateSQL())) {
for (T obj : objList) {
mod.setSQL(preparedStmt, obj);
preparedStmt.addBatch();
}
PS.debug("&aBatch 3");
PlotSquared.debug("&aBatch 3");
preparedStmt.executeBatch();
} catch (SQLException e3) {
e3.printStackTrace();
PS.debug("&c[ERROR] Failed to save all!");
PlotSquared.debug("&c[ERROR] Failed to save all!");
}
}
if (whenDone != null) {
@ -1114,7 +1114,7 @@ import java.util.concurrent.atomic.AtomicInteger;
return;
}
boolean addConstraint = create == tables.length;
PS.debug("Creating tables");
PlotSquared.debug("Creating tables");
try (Statement stmt = this.connection.createStatement()) {
if (this.mySQL) {
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` ("
@ -1347,7 +1347,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* @param plot
*/
@Override public void delete(final Plot plot) {
PS.debug(
PlotSquared.debug(
"Deleting plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
+ plot.owner + " Index: " + plot.temp);
deleteSettings(plot);
@ -1375,7 +1375,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* @param plot
*/
@Override public void createPlotSettings(final int id, Plot plot) {
PS.debug(
PlotSquared.debug(
"Creating plot... Id: " + plot.getId() + " World: " + plot.getWorldName() + " Owner: "
+ plot.owner + " Index: " + id);
addPlotTask(plot, new UniqueStatement("createPlotSettings") {
@ -1469,7 +1469,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@Override public void updateTables(int[] oldVersion) {
try {
if (this.mySQL && !PS.get().checkVersion(oldVersion, 3, 3, 2)) {
if (this.mySQL && !PlotSquared.get().checkVersion(oldVersion, 3, 3, 2)) {
try (Statement stmt = this.connection.createStatement()) {
stmt.executeUpdate(
"ALTER TABLE `" + this.prefix + "plots` DROP INDEX `unique_alias`");
@ -1535,7 +1535,7 @@ import java.util.concurrent.atomic.AtomicInteger;
"SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table
+ " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
if (result.next()) {
PS.debug("BACKING UP: " + this.prefix + table);
PlotSquared.debug("BACKING UP: " + this.prefix + table);
result.close();
statement.executeUpdate(
"CREATE TABLE " + this.prefix + table + "_tmp AS SELECT * FROM "
@ -1545,7 +1545,7 @@ import java.util.concurrent.atomic.AtomicInteger;
"CREATE TABLE " + this.prefix + table + " AS SELECT * FROM "
+ this.prefix + table + "_tmp");
statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
PS.debug("RESTORING: " + this.prefix + table);
PlotSquared.debug("RESTORING: " + this.prefix + table);
}
}
} catch (SQLException e2) {
@ -1599,9 +1599,9 @@ import java.util.concurrent.atomic.AtomicInteger;
HashMap<Integer, Plot> plots = new HashMap<>();
try {
HashSet<String> areas = new HashSet<>();
if (PS.get().worlds.contains("worlds")) {
if (PlotSquared.get().worlds.contains("worlds")) {
ConfigurationSection worldSection =
PS.get().worlds.getConfigurationSection("worlds");
PlotSquared.get().worlds.getConfigurationSection("worlds");
if (worldSection != null) {
for (String worldKey : worldSection.getKeys(false)) {
areas.add(worldKey);
@ -1677,7 +1677,7 @@ import java.util.concurrent.atomic.AtomicInteger;
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
.getTime();
} catch (ParseException e) {
PS.debug(
PlotSquared.debug(
"Could not parse date for plot: #" + id + "(" + areaid + ";"
+ plot_id + ") (" + parsable + ")");
time = System.currentTimeMillis() + id;
@ -1693,7 +1693,7 @@ import java.util.concurrent.atomic.AtomicInteger;
if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(last.temp);
} else {
PS.debug("&cPLOT #" + id + "(" + last + ") in `" + this.prefix
PlotSquared.debug("&cPLOT #" + id + "(" + last + ") in `" + this.prefix
+ "plot` is a duplicate. Delete this plot or set `database-purger: true` in the settings.yml.");
}
}
@ -1725,7 +1725,7 @@ import java.util.concurrent.atomic.AtomicInteger;
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY #" + id + "(" + plot
PlotSquared.debug("&cENTRY #" + id + "(" + plot
+ ") in `plot_rating` does not exist. Create this plot or set `database-purger: true` in the "
+ "settings.yml.");
}
@ -1754,7 +1754,7 @@ import java.util.concurrent.atomic.AtomicInteger;
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY #" + id + "(" + plot
PlotSquared.debug("&cENTRY #" + id + "(" + plot
+ ") in `plot_helpers` does not exist. Create this plot or set `database-purger: true` in the settings"
+ ".yml.");
}
@ -1782,7 +1782,7 @@ import java.util.concurrent.atomic.AtomicInteger;
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY #" + id + "(" + plot
PlotSquared.debug("&cENTRY #" + id + "(" + plot
+ ") in `plot_trusted` does not exist. Create this plot or set `database-purger: true` in the settings"
+ ".yml.");
}
@ -1810,7 +1810,7 @@ import java.util.concurrent.atomic.AtomicInteger;
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY " + id
PlotSquared.debug("&cENTRY " + id
+ " in `plot_denied` does not exist. Create this plot or set `database-purger: true` in the settings.yml.");
}
}
@ -1884,21 +1884,21 @@ import java.util.concurrent.atomic.AtomicInteger;
}
flags.put(flag, flag.parseValue(""));
} else {
PS.debug("INVALID FLAG: " + element);
PlotSquared.debug("INVALID FLAG: " + element);
}
}
}
if (exception) {
PS.debug("&cPlot #" + id + "(" + plot + ") | " + plot
PlotSquared.debug("&cPlot #" + id + "(" + plot + ") | " + plot
+ " had an invalid flag. A fix has been attempted.");
PS.debug("&c" + myflags);
PlotSquared.debug("&c" + myflags);
this.setFlags(plot, flags);
}
plot.getSettings().flags = flags;
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY #" + id + "(" + plot
PlotSquared.debug("&cENTRY #" + id + "(" + plot
+ ") in `plot_settings` does not exist. Create this plot or set `database-purger: true` in the settings"
+ ".yml.");
}
@ -1916,15 +1916,15 @@ import java.util.concurrent.atomic.AtomicInteger;
for (Entry<String, AtomicInteger> entry : noExist.entrySet()) {
String worldName = entry.getKey();
invalidPlot = true;
PS.debug("&c[WARNING] Found " + entry.getValue().intValue()
PlotSquared.debug("&c[WARNING] Found " + entry.getValue().intValue()
+ " plots in DB for non existent world; '" + worldName + "'.");
}
if (invalidPlot) {
PS.debug(
PlotSquared.debug(
"&c[WARNING] - Please create the world/s or remove the plots using the purge command");
}
} catch (SQLException e) {
PS.debug("&7[WARN] Failed to load plots.");
PlotSquared.debug("&7[WARN] Failed to load plots.");
e.printStackTrace();
}
return newPlots;
@ -2045,7 +2045,7 @@ import java.util.concurrent.atomic.AtomicInteger;
int count = 0;
int last = -1;
for (int j = 0; j <= amount; j++) {
PS.debug("Purging " + (j * packet) + " / " + size);
PlotSquared.debug("Purging " + (j * packet) + " / " + size);
List<Integer> subList =
uniqueIdsList.subList(j * packet, Math.min(size, (j + 1) * packet));
if (subList.isEmpty()) {
@ -2092,11 +2092,11 @@ import java.util.concurrent.atomic.AtomicInteger;
}
} catch (SQLException e) {
e.printStackTrace();
PS.debug("&c[ERROR] FAILED TO PURGE PLOTS!");
PlotSquared.debug("&c[ERROR] FAILED TO PURGE PLOTS!");
return;
}
}
PS.debug("&6[INFO] SUCCESSFULLY PURGED " + uniqueIds.size() + " PLOTS!");
PlotSquared.debug("&6[INFO] SUCCESSFULLY PURGED " + uniqueIds.size() + " PLOTS!");
}
});
}
@ -2122,7 +2122,7 @@ import java.util.concurrent.atomic.AtomicInteger;
purgeIds(ids);
} catch (SQLException e) {
e.printStackTrace();
PS.debug("&c[ERROR] FAILED TO PURGE AREA '" + area + "'!");
PlotSquared.debug("&c[ERROR] FAILED TO PURGE AREA '" + area + "'!");
}
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
PlotId plotId = iterator.next();
@ -2378,7 +2378,7 @@ import java.util.concurrent.atomic.AtomicInteger;
}
}
} catch (SQLException e) {
PS.debug("&7[WARN] Failed to fetch rating for plot " + plot.getId().toString());
PlotSquared.debug("&7[WARN] Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace();
}
return map;
@ -2534,9 +2534,9 @@ import java.util.concurrent.atomic.AtomicInteger;
HashMap<Integer, PlotCluster> clusters = new HashMap<>();
try {
HashSet<String> areas = new HashSet<>();
if (PS.get().worlds.contains("worlds")) {
if (PlotSquared.get().worlds.contains("worlds")) {
ConfigurationSection worldSection =
PS.get().worlds.getConfigurationSection("worlds");
PlotSquared.get().worlds.getConfigurationSection("worlds");
if (worldSection != null) {
for (String worldKey : worldSection.getKeys(false)) {
areas.add(worldKey);
@ -2609,7 +2609,7 @@ import java.util.concurrent.atomic.AtomicInteger;
if (cluster != null) {
cluster.helpers.add(user);
} else {
PS.debug("&cCluster #" + id + "(" + cluster
PlotSquared.debug("&cCluster #" + id + "(" + cluster
+ ") in cluster_helpers does not exist. Please create the cluster or remove this entry.");
}
}
@ -2628,7 +2628,7 @@ import java.util.concurrent.atomic.AtomicInteger;
if (cluster != null) {
cluster.invited.add(user);
} else {
PS.debug("&cCluster #" + id + "(" + cluster
PlotSquared.debug("&cCluster #" + id + "(" + cluster
+ ") in cluster_invited does not exist. Please create the cluster or remove this entry.");
}
}
@ -2698,7 +2698,7 @@ import java.util.concurrent.atomic.AtomicInteger;
}
cluster.settings.flags = flags;
} else {
PS.debug("&cCluster #" + id + "(" + cluster
PlotSquared.debug("&cCluster #" + id + "(" + cluster
+ ") in cluster_settings does not exist. Please create the cluster or remove this entry.");
}
}
@ -2708,15 +2708,15 @@ import java.util.concurrent.atomic.AtomicInteger;
for (Entry<String, Integer> entry : noExist.entrySet()) {
String a = entry.getKey();
invalidPlot = true;
PS.debug("&c[WARNING] Found " + noExist.get(a)
PlotSquared.debug("&c[WARNING] Found " + noExist.get(a)
+ " clusters in DB for non existent area; '" + a + "'.");
}
if (invalidPlot) {
PS.debug(
PlotSquared.debug(
"&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
}
} catch (SQLException e) {
PS.debug("&7[WARN] Failed to load clusters.");
PlotSquared.debug("&7[WARN] Failed to load clusters.");
e.printStackTrace();
}
return newClusters;
@ -2935,7 +2935,7 @@ import java.util.concurrent.atomic.AtomicInteger;
if (!isValid()) {
reconnect();
}
PS.debug(
PlotSquared.debug(
"$1All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
commit();
while (true) {
@ -2958,19 +2958,19 @@ import java.util.concurrent.atomic.AtomicInteger;
}
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
if (worldPlots == null) {
PS.debug("&8 - &7Creating plot (1): " + plot);
PlotSquared.debug("&8 - &7Creating plot (1): " + plot);
toCreate.add(plot);
continue;
}
Plot dataPlot = worldPlots.remove(plot.getId());
if (dataPlot == null) {
PS.debug("&8 - &7Creating plot (2): " + plot);
PlotSquared.debug("&8 - &7Creating plot (2): " + plot);
toCreate.add(plot);
continue;
}
// owner
if (!plot.owner.equals(dataPlot.owner)) {
PS.debug("&8 - &7Setting owner: " + plot + " -> " + MainUtil.getName(plot.owner));
PlotSquared.debug("&8 - &7Setting owner: " + plot + " -> " + MainUtil.getName(plot.owner));
setOwner(plot, plot.owner);
}
// trusted
@ -2979,7 +2979,7 @@ import java.util.concurrent.atomic.AtomicInteger;
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getTrusted().clone();
toRemove.removeAll(plot.getTrusted());
toAdd.removeAll(dataPlot.getTrusted());
PS.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " trusted for: "
PlotSquared.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " trusted for: "
+ plot);
if (!toRemove.isEmpty()) {
for (UUID uuid : toRemove) {
@ -2997,7 +2997,7 @@ import java.util.concurrent.atomic.AtomicInteger;
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getMembers().clone();
toRemove.removeAll(plot.getMembers());
toAdd.removeAll(dataPlot.getMembers());
PS.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " members for: "
PlotSquared.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " members for: "
+ plot);
if (!toRemove.isEmpty()) {
for (UUID uuid : toRemove) {
@ -3015,7 +3015,7 @@ import java.util.concurrent.atomic.AtomicInteger;
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getDenied().clone();
toRemove.removeAll(plot.getDenied());
toAdd.removeAll(dataPlot.getDenied());
PS.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " denied for: "
PlotSquared.debug("&8 - &7Correcting " + (toAdd.size() + toRemove.size()) + " denied for: "
+ plot);
if (!toRemove.isEmpty()) {
for (UUID uuid : toRemove) {
@ -3031,7 +3031,7 @@ import java.util.concurrent.atomic.AtomicInteger;
boolean[] pm = plot.getMerged();
boolean[] dm = dataPlot.getMerged();
if (pm[0] != dm[0] || pm[1] != dm[1]) {
PS.debug("&8 - &7Correcting merge for: " + plot);
PlotSquared.debug("&8 - &7Correcting merge for: " + plot);
setMerged(dataPlot, plot.getMerged());
}
HashMap<Flag<?>, Object> pf = plot.getFlags();
@ -3040,7 +3040,7 @@ import java.util.concurrent.atomic.AtomicInteger;
if (pf.size() != df.size() || !StringMan
.isEqual(StringMan.joinOrdered(pf.values(), ","),
StringMan.joinOrdered(df.values(), ","))) {
PS.debug("&8 - &7Correcting flags for: " + plot);
PlotSquared.debug("&8 - &7Correcting flags for: " + plot);
setFlags(plot, pf);
}
}
@ -3050,7 +3050,7 @@ import java.util.concurrent.atomic.AtomicInteger;
HashMap<PlotId, Plot> map = entry.getValue();
if (!map.isEmpty()) {
for (Entry<PlotId, Plot> entry2 : map.entrySet()) {
PS.debug("$1Plot was deleted: " + entry2.getValue().toString()
PlotSquared.debug("$1Plot was deleted: " + entry2.getValue().toString()
+ "// TODO implement this when sure safe");
}
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.database;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import java.io.File;
import java.io.IOException;
@ -27,15 +27,15 @@ public class SQLite extends Database {
if (checkConnection()) {
return this.connection;
}
if (!PS.get().IMP.getDirectory().exists()) {
PS.get().IMP.getDirectory().mkdirs();
if (!PlotSquared.get().IMP.getDirectory().exists()) {
PlotSquared.get().IMP.getDirectory().mkdirs();
}
File file = new File(this.dbLocation);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException ignored) {
PS.debug("&cUnable to create database!");
PlotSquared.debug("&cUnable to create database!");
}
}
Class.forName("org.sqlite.JDBC");

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.flag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
@ -37,7 +37,7 @@ public class FlagManager {
public static <V> Optional<V> getPlotFlag(Plot plot, Flag<V> key) {
V value = FlagManager.getPlotFlagRaw(plot, key);
if (value != null) {
if (PS.get().isMainThread(Thread.currentThread())) {
if (PlotSquared.get().isMainThread(Thread.currentThread())) {
try {
MUTABLE_OPTIONAL_FIELD.set(MUTABLE_OPTIONAL, value);
return MUTABLE_OPTIONAL;
@ -117,7 +117,7 @@ public class FlagManager {
.replaceAll(",", "´"));
i++;
} catch (Exception e) {
PS.debug("Failed to parse flag: " + entry.getKey() + "->" + entry.getValue());
PlotSquared.debug("Failed to parse flag: " + entry.getKey() + "->" + entry.getValue());
e.printStackTrace();
}
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.flag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
@ -136,7 +136,7 @@ public final class Flags {
}
Flag flag = (Flag) fieldValue;
if (!flag.getName().equals(fieldName)) {
PS.debug(Flags.class + "Field doesn't match: " + fieldName + " != " + flag
PlotSquared.debug(Flags.class + "Field doesn't match: " + fieldName + " != " + flag
.getName());
}
flags.put(flag.getName(), flag);
@ -162,7 +162,7 @@ public final class Flags {
public static void registerFlag(final Flag<?> flag) {
final Flag<?> duplicate = flags.put(flag.getName(), flag);
if (duplicate != null) {
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea value) {
Object remove;
if (value.DEFAULT_FLAGS.containsKey(duplicate)) {
@ -182,7 +182,7 @@ public final class Flags {
}
}
});
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
PlotSquared.get().foreachPlotRaw(new RunnableVal<Plot>() {
@Override public void run(Plot value) {
if (value.getFlags().containsKey(duplicate)) {
Object remove = value.getFlags().remove(duplicate);

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
@ -28,7 +28,7 @@ public class AugmentedUtils {
final int bx = cx << 4;
final int bz = cz << 4;
RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(world, region);
if (areas.isEmpty()) {
return false;
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
@ -15,7 +15,7 @@ import java.util.Map.Entry;
public class HybridGen extends IndependentPlotGenerator {
@Override public String getName() {
return PS.imp().getPluginName();
return PlotSquared.imp().getPluginName();
}
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX,

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.Template;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -31,18 +31,18 @@ public class HybridPlotManager extends ClassicPlotManager {
+ File.separator;
try {
File sideroad =
MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "sideroad.schematic");
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schematic");
if (sideroad.exists()) {
files.add(new FileBytes(newDir + "sideroad.schematic",
Files.readAllBytes(sideroad.toPath())));
}
File intersection =
MainUtil.getFile(PS.get().IMP.getDirectory(), "intersection.schematic");
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schematic");
if (intersection.exists()) {
files.add(new FileBytes(newDir + "intersection.schematic",
Files.readAllBytes(intersection.toPath())));
}
File plot = MainUtil.getFile(PS.get().IMP.getDirectory(), dir + "plot.schematic");
File plot = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schematic");
if (plot.exists()) {
files.add(
new FileBytes(newDir + "plot.schematic", Files.readAllBytes(plot.toPath())));

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
import com.github.intellectualsites.plotsquared.jnbt.Tag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -173,7 +173,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
try {
setupSchematics();
} catch (Exception ignored) {
PS.debug("&c - road schematics are disabled for this world.");
PlotSquared.debug("&c - road schematics are disabled for this world.");
}
}
@ -186,11 +186,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
public void setupSchematics() {
this.G_SCH = new HashMap<>();
File schematic1File = MainUtil.getFile(PS.get().IMP.getDirectory(),
File schematic1File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/sideroad.schematic");
File schematic2File = MainUtil.getFile(PS.get().IMP.getDirectory(),
File schematic2File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/intersection.schematic");
File schem3File = MainUtil.getFile(PS.get().IMP.getDirectory(),
File schem3File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/plot.schematic");
SchematicHandler.Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
SchematicHandler.Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
@ -270,7 +270,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
PS.debug(C.PREFIX + "&3 - schematic: &7false");
PlotSquared.debug(C.PREFIX + "&3 - schematic: &7false");
return;
}
this.ROAD_SCHEMATIC_ENABLED = true;

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
@ -207,16 +207,16 @@ public abstract class HybridUtils {
regenerateRoad(area, chunk, extend);
ChunkManager.manager.unloadChunk(area.worldname, chunk, true, true);
}
PS.debug("&cCancelled road task");
PlotSquared.debug("&cCancelled road task");
return;
}
count.incrementAndGet();
if (count.intValue() % 20 == 0) {
PS.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%");
PlotSquared.debug("PROGRESS: " + 100 * (2048 - chunks.size()) / 2048 + "%");
}
if (regions.isEmpty() && chunks.isEmpty()) {
HybridUtils.UPDATE = false;
PS.debug(C.PREFIX.s() + "Finished road conversion");
PlotSquared.debug(C.PREFIX.s() + "Finished road conversion");
// CANCEL TASK
} else {
final Runnable task = this;
@ -230,9 +230,9 @@ public abstract class HybridUtils {
Iterator<ChunkLoc> iterator = regions.iterator();
ChunkLoc loc = iterator.next();
iterator.remove();
PS.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
+ " (aprrox 1024 chunks)");
PS.debug(" - Remaining: " + regions.size());
PlotSquared.debug(" - Remaining: " + regions.size());
chunks.addAll(getChunks(loc));
System.gc();
}
@ -256,7 +256,7 @@ public abstract class HybridUtils {
Iterator<ChunkLoc> iterator = regions.iterator();
ChunkLoc loc = iterator.next();
iterator.remove();
PS.debug(
PlotSquared.debug(
"&c[ERROR]&7 Could not update '" + area.worldname + "/region/r."
+ loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
int sx = loc.x << 5;
@ -268,8 +268,8 @@ public abstract class HybridUtils {
true);
}
}
PS.debug("&d - Potentially skipping 1024 chunks");
PS.debug("&d - TODO: recommend chunkster if corrupt");
PlotSquared.debug("&d - Potentially skipping 1024 chunks");
PlotSquared.debug("&d - TODO: recommend chunkster if corrupt");
}
GlobalBlockQueue.IMP.addTask(new Runnable() {
@Override public void run() {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
@ -76,7 +76,7 @@ public abstract class IndependentPlotGenerator {
* @return
*/
public <T> GeneratorWrapper<T> specify(String world) {
return (GeneratorWrapper<T>) PS.get().IMP.wrapPlotGenerator(world, this);
return (GeneratorWrapper<T>) PlotSquared.get().IMP.wrapPlotGenerator(world, this);
}
@Override public String toString() {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -196,9 +196,9 @@ public abstract class SquarePlotManager extends GridPlotManager {
// northwest
return plot.getMerged(7) ? id : null;
}
PS.debug("invalid location: " + Arrays.toString(merged));
PlotSquared.debug("invalid location: " + Arrays.toString(merged));
} catch (Exception ignored) {
PS.debug("Invalid plot / road width in settings.yml for world: " + plotArea.worldname);
PlotSquared.debug("Invalid plot / road width in settings.yml for world: " + plotArea.worldname);
}
return null;
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
public abstract class SquarePlotWorld extends GridPlotWorld {
@ -18,7 +18,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override public void loadConfiguration(ConfigurationSection config) {
if (!config.contains("plot.height")) {
PS.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ')');
PlotSquared.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ')');
}
this.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width");

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.listener;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
@ -96,7 +96,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
this.BScount++;
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true;
PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
PlotSquared
.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + ","
+ location.getBlockZ());
}
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
@ -243,7 +244,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
this.Ecount++;
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
this.Eblocked = true;
PS.debug(
PlotSquared.debug(
C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location
.getBlockZ());
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.listener;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
@ -36,7 +36,7 @@ public class WEManager {
UUID uuid = player.getUUID();
Location location = player.getLocation();
String world = location.getWorld();
if (!PS.get().hasPlotArea(world)) {
if (!PlotSquared.get().hasPlotArea(world)) {
regions.add(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE,
Integer.MAX_VALUE));
return regions;

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.listener;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -23,7 +23,7 @@ import java.util.HashSet;
public class WESubscriber {
@Subscribe(priority = Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) {
WorldEdit worldedit = PS.get().worldedit;
WorldEdit worldedit = PlotSquared.get().worldedit;
if (worldedit == null) {
WorldEdit.getInstance().getEventBus().unregister(this);
return;
@ -55,19 +55,19 @@ public class WESubscriber {
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
}
if (PS.get().hasPlotArea(world)) {
if (PlotSquared.get().hasPlotArea(world)) {
event.setExtent(new NullExtent());
}
return;
}
}
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
if (PS.get().hasPlotArea(world)) {
if (PlotSquared.get().hasPlotArea(world)) {
event.setExtent(
new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(),
event.getExtent()));
}
} else if (PS.get().hasPlotArea(world)) {
} else if (PlotSquared.get().hasPlotArea(world)) {
event.setExtent(new WEExtent(mask, event.getExtent()));
}
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@ -61,7 +61,7 @@ public class BO3 {
}
public File getFile() {
return MainUtil.getFile(PS.get().IMP.getDirectory(),
return MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
Settings.Paths.BO3 + File.separator + getWorld() + File.separator + getFilename());
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
@ -13,7 +13,7 @@ public class ConsolePlayer extends PlotPlayer {
private static ConsolePlayer instance;
private ConsolePlayer() {
PlotArea area = PS.get().getFirstPlotArea();
PlotArea area = PlotSquared.get().getFirstPlotArea();
Location loc;
if (area != null) {
RegionWrapper region = area.getRegion();
@ -62,7 +62,7 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override public void sendMessage(String message) {
PS.log(message);
PlotSquared.log(message);
}
@Override public void teleport(Location location) {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.DebugExec;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
@ -41,7 +41,7 @@ public abstract class Expression<T> {
try {
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
} catch (ScriptException e) {
PS.debug("Invalid Expression: " + expression);
PlotSquared.debug("Invalid Expression: " + expression);
e.printStackTrace();
}
return 0d;

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
public class Location implements Cloneable, Comparable<Location> {
@ -66,11 +66,11 @@ public class Location implements Cloneable, Comparable<Location> {
}
public PlotArea getPlotArea() {
return PS.get().getPlotAreaAbs(this);
return PlotSquared.get().getPlotAreaAbs(this);
}
public Plot getOwnedPlot() {
PlotArea area = PS.get().getPlotAreaAbs(this);
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
if (area != null) {
return area.getOwnedPlot(this);
} else {
@ -79,7 +79,7 @@ public class Location implements Cloneable, Comparable<Location> {
}
public Plot getOwnedPlotAbs() {
PlotArea area = PS.get().getPlotAreaAbs(this);
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
if (area != null) {
return area.getOwnedPlotAbs(this);
} else {
@ -88,16 +88,16 @@ public class Location implements Cloneable, Comparable<Location> {
}
public boolean isPlotArea() {
return PS.get().getPlotAreaAbs(this) != null;
return PlotSquared.get().getPlotAreaAbs(this) != null;
}
public boolean isPlotRoad() {
PlotArea area = PS.get().getPlotAreaAbs(this);
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
return area != null && area.getPlotAbs(this) == null;
}
public boolean isUnownedPlotArea() {
PlotArea area = PS.get().getPlotAreaAbs(this);
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
return area != null && area.getOwnedPlotAbs(this) == null;
}
@ -111,7 +111,7 @@ public class Location implements Cloneable, Comparable<Location> {
}
public Plot getPlotAbs() {
PlotArea area = PS.get().getPlotAreaAbs(this);
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
if (area != null) {
return area.getPlotAbs(this);
} else {
@ -120,7 +120,7 @@ public class Location implements Cloneable, Comparable<Location> {
}
public Plot getPlot() {
PlotArea area = PS.get().getPlotAreaAbs(this);
PlotArea area = PlotSquared.get().getPlotAreaAbs(this);
if (area != null) {
return area.getPlot(this);
} else {

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.jnbt.CompoundTag;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
@ -201,13 +201,13 @@ public class Plot {
return id != null ? defaultArea.getPlotAbs(id) : null;
}
} else if (split.length == 3) {
PlotArea pa = PS.get().getPlotArea(split[0], null);
PlotArea pa = PlotSquared.get().getPlotArea(split[0], null);
if (pa != null) {
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
return pa.getPlotAbs(id);
}
} else if (split.length == 4) {
PlotArea pa = PS.get().getPlotArea(split[0], split[1]);
PlotArea pa = PlotSquared.get().getPlotArea(split[0], split[1]);
if (pa != null) {
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
return pa.getPlotAbs(id);
@ -224,7 +224,7 @@ public class Plot {
* @see PlotPlayer#getCurrentPlot() if a player is expected here.
*/
public static Plot getPlot(Location location) {
PlotArea pa = PS.get().getPlotAreaAbs(location);
PlotArea pa = PlotSquared.get().getPlotAreaAbs(location);
if (pa != null) {
return pa.getPlot(location);
}
@ -915,7 +915,7 @@ public class Plot {
public void setSign(final String name) {
if (!isLoaded())
return;
if (!PS.get().isMainThread(Thread.currentThread())) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(new Runnable() {
@Override public void run() {
Plot.this.setSign(name);
@ -1002,7 +1002,7 @@ public class Plot {
/**
* Delete a plot (use null for the runnable if you don't need to be notified on completion)
*
* @see PS#removePlot(Plot, boolean)
* @see PlotSquared#removePlot(Plot, boolean)
* @see #clear(Runnable) to simply clear a plot
*/
public boolean deletePlot(final Runnable whenDone) {
@ -1544,12 +1544,12 @@ public class Plot {
*/
public boolean moveData(Plot plot, Runnable whenDone) {
if (this.owner == null) {
PS.debug(plot + " is unowned (single)");
PlotSquared.debug(plot + " is unowned (single)");
TaskManager.runTask(whenDone);
return false;
}
if (plot.hasOwner()) {
PS.debug(plot + " is unowned (multi)");
PlotSquared.debug(plot + " is unowned (multi)");
TaskManager.runTask(whenDone);
return false;
}
@ -2352,7 +2352,7 @@ public class Plot {
tmp = this.area.getPlotAbs(this.id.getRelative(0));
if (!tmp.getMerged(2)) {
// invalid merge
PS.debug("Fixing invalid merge: " + this);
PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(2, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@ -2368,7 +2368,7 @@ public class Plot {
tmp = this.area.getPlotAbs(this.id.getRelative(1));
if (!tmp.getMerged(3)) {
// invalid merge
PS.debug("Fixing invalid merge: " + this);
PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(3, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@ -2384,7 +2384,7 @@ public class Plot {
tmp = this.area.getPlotAbs(this.id.getRelative(2));
if (!tmp.getMerged(0)) {
// invalid merge
PS.debug("Fixing invalid merge: " + this);
PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(0, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@ -2400,7 +2400,7 @@ public class Plot {
tmp = this.area.getPlotAbs(this.id.getRelative(3));
if (!tmp.getMerged(1)) {
// invalid merge
PS.debug("Fixing invalid merge: " + this);
PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(1, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@ -2417,7 +2417,7 @@ public class Plot {
if (current.owner == null || current.settings == null) {
// Invalid plot
// merged onto unclaimed plot
PS.debug("Ignoring invalid merged plot: " + current + " | " + current.owner);
PlotSquared.debug("Ignoring invalid merged plot: " + current + " | " + current.owner);
continue;
}
tmpSet.add(current);

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
@ -189,7 +189,7 @@ public abstract class PlotArea {
* @return true if both areas are compatible
*/
public boolean isCompatible(PlotArea plotArea) {
ConfigurationSection section = PS.get().worlds.getConfigurationSection("worlds");
ConfigurationSection section = PlotSquared.get().worlds.getConfigurationSection("worlds");
for (ConfigurationNode setting : plotArea.getSettingNodes()) {
Object constant = section.get(plotArea.worldname + '.' + setting.getConstant());
if (constant == null || !constant
@ -305,7 +305,7 @@ public abstract class PlotArea {
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
} catch (Exception e) {
e.printStackTrace();
PS.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan
PlotSquared.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan
.join(flags, ","));
this.DEFAULT_FLAGS = new HashMap<>();
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
@ -13,7 +13,9 @@ public class PlotMessage {
try {
reset(ChatManager.manager);
} catch (Throwable e) {
PS.debug(PS.imp().getPluginName() + " doesn't support fancy chat for " + PS.get().IMP
PlotSquared.debug(
PlotSquared.imp().getPluginName() + " doesn't support fancy chat for " + PlotSquared
.get().IMP
.getServerVersion());
ChatManager.manager = new PlainChatManager();
reset(ChatManager.manager);

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.commands.CommandCaller;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
@ -40,7 +40,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* @return
*/
public static PlotPlayer wrap(Object player) {
return PS.get().IMP.wrapPlayer(player);
return PlotSquared.get().IMP.wrapPlayer(player);
}
/**
@ -183,7 +183,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
final AtomicInteger count = new AtomicInteger(0);
final UUID uuid = getUUID();
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea value) {
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
for (Plot plot : value.getPlotsAbs(uuid)) {
@ -205,7 +205,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
final AtomicInteger count = new AtomicInteger(0);
final UUID uuid = getUUID();
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea value) {
for (PlotCluster cluster : value.getClusters()) {
if (cluster.isOwner(getUUID())) {
@ -226,7 +226,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public int getPlotCount(String world) {
UUID uuid = getUUID();
int count = 0;
for (PlotArea area : PS.get().getPlotAreas(world)) {
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
for (Plot plot : area.getPlotsAbs(uuid)) {
if (!plot.getFlag(Flags.DONE).isPresent()) {
@ -243,7 +243,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public int getClusterCount(String world) {
UUID uuid = getUUID();
int count = 0;
for (PlotArea area : PS.get().getPlotAreas(world)) {
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
for (PlotCluster cluster : area.getClusters()) {
if (cluster.isOwner(getUUID())) {
count++;
@ -257,11 +257,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* Get a {@code Set} of plots owned by this player.
*
* @return a {@code Set} of plots owned by the player
* @see PS for more searching functions
* @see PlotSquared for more searching functions
* @see #getPlotCount() for the number of plots
*/
public Set<Plot> getPlots() {
return PS.get().getPlots(this);
return PlotSquared.get().getPlots(this);
}
/**
@ -270,11 +270,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* @return
*/
public PlotArea getPlotAreaAbs() {
return PS.get().getPlotAreaAbs(getLocation());
return PlotSquared.get().getPlotAreaAbs(getLocation());
}
public PlotArea getApplicablePlotArea() {
return PS.get().getApplicablePlotArea(getLocation());
return PlotSquared.get().getApplicablePlotArea(getLocation());
}
@Override public RequiredType getSuperCaller() {
@ -462,7 +462,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
for (Plot owned : getPlots()) {
owned.deletePlot(null);
PS.debug(String
PlotSquared.debug(String
.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned",
plot.getId(), getName()));
}
@ -472,7 +472,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis());
}
UUIDHandler.getPlayers().remove(name);
PS.get().IMP.unregister(this);
PlotSquared.get().IMP.unregister(this);
}
/**
@ -484,7 +484,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public int getPlayerClusterCount(String world) {
UUID uuid = getUUID();
int count = 0;
for (PlotCluster cluster : PS.get().getClusters(world)) {
for (PlotCluster cluster : PlotSquared.get().getClusters(world)) {
if (uuid.equals(cluster.owner)) {
count += cluster.getArea();
}
@ -499,7 +499,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
*/
public int getPlayerClusterCount() {
final AtomicInteger count = new AtomicInteger();
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea value) {
count.addAndGet(value.getClusters().size());
}
@ -516,7 +516,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public Set<Plot> getPlots(String world) {
UUID uuid = getUUID();
HashSet<Plot> plots = new HashSet<>();
for (Plot plot : PS.get().getPlots(world)) {
for (Plot plot : PlotSquared.get().getPlots(world)) {
if (plot.isOwner(uuid)) {
plots.add(plot);
}
@ -532,7 +532,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
PlotPlayer.this.metaMap = value;
if (!value.isEmpty()) {
if (Settings.Enabled_Components.PERSISTENT_META) {
PlotAreaManager manager = PS.get().getPlotAreaManager();
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
PlotArea area = ((SinglePlotAreaManager) manager).getArea();
byte[] arr = PlotPlayer.this.getPersistentMeta("quitLoc");
@ -562,7 +562,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
}
});
} else if (!PS.get()
} else if (!PlotSquared.get()
.isMainThread(Thread.currentThread())) {
if (getMeta("teleportOnLogin", true)) {
if (plot.teleportPlayer(PlotPlayer.this)) {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object.worlds;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
@ -28,7 +28,7 @@ public class SinglePlotManager extends PlotManager {
@Override public boolean clearPlot(PlotArea plotArea, Plot plot, final Runnable whenDone) {
SetupUtils.manager.unload(plot.getWorldName(), false);
final File worldFolder = new File(PS.get().IMP.getWorldContainer(), plot.getWorldName());
final File worldFolder = new File(PlotSquared.get().IMP.getWorldContainer(), plot.getWorldName());
TaskManager.IMP.taskAsync(new Runnable() {
@Override public void run() {
MainUtil.deleteDirectory(worldFolder);

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.object.worlds;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
@ -34,7 +34,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
}
@Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
return ((SinglePlotAreaManager) PS.get().getPlotAreaManager()).getArea();
return ((SinglePlotAreaManager) PlotSquared.get().getPlotAreaManager()).getArea();
}
@Override public PlotManager getNewPlotManager() {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
@ -287,10 +287,10 @@ public class BO3Handler {
}
public static File getBaseFile(String category) {
File base = MainUtil.getFile(PS.get().IMP.getDirectory(),
File base = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
Settings.Paths.BO3 + File.separator + category + File.separator + "base.yml");
if (!base.exists()) {
PS.get().copyFile("base.yml", Settings.Paths.BO3 + File.separator + category);
PlotSquared.get().copyFile("base.yml", Settings.Paths.BO3 + File.separator + category);
}
return base;
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
@ -27,7 +27,7 @@ public abstract class ChunkManager {
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
RunnableVal<ScopedLocalBlockQueue> add, String world, ChunkLoc loc) {
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
if (PS.get().isAugmented(world)) {
if (PlotSquared.get().isAugmented(world)) {
int bx = loc.x << 4;
int bz = loc.z << 4;
ScopedLocalBlockQueue scoped =
@ -209,7 +209,7 @@ public abstract class ChunkManager {
public abstract void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe);
public Set<ChunkLoc> getChunkChunks(String world) {
File folder = new File(PS.get().IMP.getWorldContainer(), world + File.separator + "region");
File folder = new File(PlotSquared.get().IMP.getWorldContainer(), world + File.separator + "region");
File[] regionFiles = folder.listFiles();
HashSet<ChunkLoc> chunks = new HashSet<>();
if (regionFiles == null) {
@ -244,8 +244,8 @@ public abstract class ChunkManager {
String directory =
world + File.separator + "region" + File.separator + "r." + loc.x + "."
+ loc.z + ".mca";
File file = new File(PS.get().IMP.getWorldContainer(), directory);
PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory);
PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
if (file.exists()) {
file.delete();
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -15,7 +15,7 @@ public abstract class EconHandler {
return manager;
}
initialized = true;
return manager = PS.get().IMP.getEconomyHandler();
return manager = PlotSquared.get().IMP.getEconomyHandler();
}
public double getMoney(PlotPlayer player) {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
@ -57,7 +57,7 @@ public abstract class EventUtil {
if (ExpireManager.IMP != null) {
ExpireManager.IMP.handleJoin(player);
}
if (PS.get().worldedit != null) {
if (PlotSquared.get().worldedit != null) {
if (player.getAttribute("worldedit")) {
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
}
@ -89,7 +89,7 @@ public abstract class EventUtil {
public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type,
Location location, LazyBlock block, boolean notifyPerms) {
PlotArea area = PS.get().getPlotAreaAbs(location);
PlotArea area = PlotSquared.get().getPlotAreaAbs(location);
Plot plot;
if (area != null) {
plot = area.getPlot(location);

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -86,13 +86,13 @@ public class MainUtil {
player.sendMessage(C.color(s));
}
}
PS.debug(s);
PlotSquared.debug(s);
}
public static void upload(UUID uuid, String file, String extension,
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
if (writeTask == null) {
PS.debug("&cWrite task cannot be null");
PlotSquared.debug("&cWrite task cannot be null");
TaskManager.runTask(whenDone);
return;
}
@ -403,7 +403,7 @@ public class MainUtil {
if (id != null) {
continue;
}
area = PS.get().getPlotAreaByString(term);
area = PlotSquared.get().getPlotAreaByString(term);
if (area == null) {
alias = term;
}
@ -415,7 +415,7 @@ public class MainUtil {
plotList.add(new ArrayList<Plot>());
}
for (Plot plot : PS.get().getPlots()) {
for (Plot plot : PlotSquared.get().getPlots()) {
int count = 0;
if (!uuids.isEmpty()) {
for (UUID uuid : uuids) {
@ -463,7 +463,7 @@ public class MainUtil {
if (arg == null) {
if (player == null) {
if (message) {
PS.log(C.NOT_VALID_PLOT_WORLD);
PlotSquared.log(C.NOT_VALID_PLOT_WORLD);
}
return null;
}
@ -471,7 +471,7 @@ public class MainUtil {
}
PlotArea area;
if (player != null) {
area = PS.get().getPlotAreaByString(arg);
area = PlotSquared.get().getPlotAreaByString(arg);
if (area == null) {
area = player.getApplicablePlotArea();
}
@ -481,17 +481,17 @@ public class MainUtil {
String[] split = arg.split(";|,");
PlotId id;
if (split.length == 4) {
area = PS.get().getPlotAreaByString(split[0] + ';' + split[1]);
area = PlotSquared.get().getPlotAreaByString(split[0] + ';' + split[1]);
id = PlotId.fromString(split[2] + ';' + split[3]);
} else if (split.length == 3) {
area = PS.get().getPlotAreaByString(split[0]);
area = PlotSquared.get().getPlotAreaByString(split[0]);
id = PlotId.fromString(split[1] + ';' + split[2]);
} else if (split.length == 2) {
id = PlotId.fromString(arg);
} else {
Collection<Plot> plots;
if (area == null) {
plots = PS.get().getPlots();
plots = PlotSquared.get().getPlots();
} else {
plots = area.getPlots();
}
@ -592,7 +592,7 @@ public class MainUtil {
if (!msg.isEmpty()) {
if (player == null) {
String message = (prefix ? C.PREFIX.s() : "") + msg;
PS.log(message);
PlotSquared.log(message);
} else {
player.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
}
@ -627,7 +627,7 @@ public class MainUtil {
@Override public void run() {
String m = C.format(caption, args);
if (player == null) {
PS.log(m);
PlotSquared.log(m);
} else {
player.sendMessage(m);
}
@ -816,7 +816,7 @@ public class MainUtil {
if (file.isDirectory()) {
deleteDirectory(files[i]);
} else {
PS.debug("Deleting file: " + file + " | " + file.delete());
PlotSquared.debug("Deleting file: " + file + " | " + file.delete());
}
}
}

View File

@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.jnbt.*;
import com.github.intellectualsites.plotsquared.json.JSONArray;
import com.github.intellectualsites.plotsquared.json.JSONException;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
@ -115,7 +115,7 @@ public abstract class SchematicHandler {
whenDone.value = false;
}
if (schematic == null) {
PS.debug("Schematic == null :|");
PlotSquared.debug("Schematic == null :|");
TaskManager.runTask(whenDone);
return;
}
@ -139,8 +139,8 @@ public abstract class SchematicHandler {
RegionWrapper region = plot.getLargestRegion();
if (((region.maxX - region.minX + xOffset + 1) < WIDTH) || (
(region.maxZ - region.minZ + zOffset + 1) < LENGTH) || (HEIGHT > 256)) {
PS.debug("Schematic is too large");
PS.debug(
PlotSquared.debug("Schematic is too large");
PlotSquared.debug(
"(" + WIDTH + ',' + LENGTH + ',' + HEIGHT + ") is bigger than (" + (
region.maxX - region.minX) + ',' + (region.maxZ - region.minZ)
+ ",256)");
@ -427,13 +427,13 @@ public abstract class SchematicHandler {
* @return schematic if found, else null
*/
public Schematic getSchematic(String name) {
File parent = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
File parent = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
if (!parent.exists()) {
if (!parent.mkdir()) {
throw new RuntimeException("Could not create schematic parent directory");
}
}
File file = MainUtil.getFile(PS.get().IMP.getDirectory(),
File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
Settings.Paths.SCHEMATICS + File.separator + name + (name.endsWith(".schematic") ?
"" :
".schematic"));
@ -481,7 +481,7 @@ public abstract class SchematicHandler {
return getSchematic(tag);
} catch (IOException e) {
e.printStackTrace();
PS.debug(is.toString() + " | " + is.getClass().getCanonicalName()
PlotSquared.debug(is.toString() + " | " + is.getClass().getCanonicalName()
+ " is not in GZIP format : " + e.getMessage());
}
return null;
@ -510,14 +510,14 @@ public abstract class SchematicHandler {
return schematics;
} catch (JSONException | IOException e) {
e.printStackTrace();
PS.debug("ERROR PARSING: " + rawJSON);
PlotSquared.debug("ERROR PARSING: " + rawJSON);
}
return null;
}
public void upload(final CompoundTag tag, UUID uuid, String file, RunnableVal<URL> whenDone) {
if (tag == null) {
PS.debug("&cCannot save empty tag");
PlotSquared.debug("&cCannot save empty tag");
TaskManager.runTask(whenDone);
return;
}
@ -545,11 +545,11 @@ public abstract class SchematicHandler {
*/
public boolean save(CompoundTag tag, String path) {
if (tag == null) {
PS.debug("&cCannot save empty tag");
PlotSquared.debug("&cCannot save empty tag");
return false;
}
try {
File tmp = MainUtil.getFile(PS.get().IMP.getDirectory(), path);
File tmp = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), path);
tmp.getParentFile().mkdirs();
try (OutputStream stream = new FileOutputStream(tmp);
NBTOutputStream output = new NBTOutputStream(new GZIPOutputStream(stream))) {

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import java.util.Collection;
@ -115,7 +115,7 @@ public abstract class TaskManager {
}
public <T> T sync(final RunnableVal<T> function, int timeout) {
if (PS.get().isMainThread(Thread.currentThread())) {
if (PlotSquared.get().isMainThread(Thread.currentThread())) {
function.run();
return function.value;
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import com.google.common.collect.BiMap;
@ -52,7 +52,7 @@ public class UUIDHandler {
public static HashSet<UUID> getAllUUIDS() {
final HashSet<UUID> uuids = new HashSet<>();
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
PlotSquared.get().foreachPlotRaw(new RunnableVal<Plot>() {
@Override public void run(Plot plot) {
if (plot.hasOwner()) {
uuids.add(plot.owner);
@ -119,7 +119,7 @@ public class UUIDHandler {
private static PlotPlayer check(PlotPlayer plr) {
if (plr != null && !plr.isOnline()) {
UUIDHandler.getPlayers().remove(plr.getName());
PS.get().IMP.unregister(plr);
PlotSquared.get().IMP.unregister(plr);
plr = null;
}
return plr;

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -82,19 +82,19 @@ public abstract class UUIDHandlerImplementation {
}
this.uuidMap.put(name, uuid);
}
PS.debug(C.PREFIX + "&6Cached a total of: " + this.uuidMap.size() + " UUIDs");
PlotSquared.debug(C.PREFIX + "&6Cached a total of: " + this.uuidMap.size() + " UUIDs");
}
public boolean add(final StringWrapper name, final UUID uuid) {
if (uuid == null) {
PS.debug("UUID cannot be null!");
PlotSquared.debug("UUID cannot be null!");
return false;
}
if (name == null) {
try {
this.unknown.add(uuid);
} catch (Exception e) {
PS.log("&c(minor) Invalid UUID mapping: " + uuid);
PlotSquared.log("&c(minor) Invalid UUID mapping: " + uuid);
e.printStackTrace();
}
return false;
@ -120,16 +120,16 @@ public abstract class UUIDHandlerImplementation {
}
if (offline != null && !offline.equals(uuid)) {
UUIDHandlerImplementation.this.unknown.remove(offline);
Set<Plot> plots = PS.get().getPlotsAbs(offline);
Set<Plot> plots = PlotSquared.get().getPlotsAbs(offline);
if (!plots.isEmpty()) {
for (Plot plot : plots) {
plot.owner = uuid;
}
DBFunc.replaceUUID(offline, uuid);
PS.debug("&cDetected invalid UUID stored for: " + name.value);
PS.debug(
PlotSquared.debug("&cDetected invalid UUID stored for: " + name.value);
PlotSquared.debug(
"&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6" + PS.imp().getPluginName()
PlotSquared.debug("&6" + PlotSquared.imp().getPluginName()
+ " will update incorrect entries when the user logs in, or you can reconstruct your database.");
}
}
@ -144,7 +144,7 @@ public abstract class UUIDHandlerImplementation {
if (UUIDHandlerImplementation.this.unknown.contains(offlineUpper)
&& offlineUpper != null && !offlineUpper.equals(uuid)) {
UUIDHandlerImplementation.this.unknown.remove(offlineUpper);
Set<Plot> plots = PS.get().getPlotsAbs(offlineUpper);
Set<Plot> plots = PlotSquared.get().getPlotsAbs(offlineUpper);
if (!plots.isEmpty()) {
for (Plot plot : plots) {
plot.owner = uuid;
@ -159,7 +159,7 @@ public abstract class UUIDHandlerImplementation {
UUID offline = this.uuidMap.put(name, uuid);
if (offline != null) {
if (!offline.equals(uuid)) {
Set<Plot> plots = PS.get().getPlots(offline);
Set<Plot> plots = PlotSquared.get().getPlots(offline);
if (!plots.isEmpty()) {
for (Plot plot : plots) {
plot.owner = uuid;
@ -196,10 +196,10 @@ public abstract class UUIDHandlerImplementation {
private void replace(UUID from, UUID to, String name) {
DBFunc.replaceUUID(from, to);
PS.debug("&cDetected invalid UUID stored for: " + name);
PS.debug(
PlotSquared.debug("&cDetected invalid UUID stored for: " + name);
PlotSquared.debug(
"&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6" + PS.imp().getPluginName()
PlotSquared.debug("&6" + PlotSquared.imp().getPluginName()
+ " will update incorrect entries when the user logs in, or you can reconstruct your database.");
}

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.jnbt.*;
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.schematic.PlotItem;
@ -126,7 +126,7 @@ public abstract class WorldUtil {
public File getDat(String world) {
File file = new File(
PS.get().IMP.getWorldContainer() + File.separator + world + File.separator
PlotSquared.get().IMP.getWorldContainer() + File.separator + world + File.separator
+ "level.dat");
if (file.exists()) {
return file;
@ -135,7 +135,7 @@ public abstract class WorldUtil {
}
public File getMcr(String world, int x, int z) {
File file = new File(PS.get().IMP.getWorldContainer(),
File file = new File(PlotSquared.get().IMP.getWorldContainer(),
world + File.separator + "region" + File.separator + "r." + x + '.' + z + ".mca");
if (file.exists()) {
return file;

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util.block;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
@ -96,7 +96,7 @@ public class GlobalBlockQueue {
if (SET_TASK.value2 == null) {
return;
}
if (!PS.get().isMainThread(Thread.currentThread())) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
throw new IllegalStateException(
"This shouldn't be possible for placement to occur off the main thread");
}
@ -188,7 +188,7 @@ public class GlobalBlockQueue {
if (SET_TASK.value2 == null) {
return;
}
if (PS.get().isMainThread(Thread.currentThread())) {
if (PlotSquared.get().isMainThread(Thread.currentThread())) {
throw new IllegalStateException("Must be flushed on the main thread!");
}
// Disable the async catcher as it can't discern async vs parallel

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util.block;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue {
@ -68,7 +68,7 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue {
public void mapByType2D(RunnableVal3<Plot, Integer, Integer> task) {
int bx = minX;
int bz = minZ;
PlotArea area = PS.get().getPlotArea(getWorld(), null);
PlotArea area = PlotSquared.get().getPlotArea(getWorld(), null);
Location loc = new Location(getWorld(), bx, 0, bz);
if (area != null) {
PlotManager manager = area.getPlotManager();

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util.expiry;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
@ -37,7 +37,7 @@ public class ExpireManager {
}
public void addTask(ExpiryTask task) {
PS.debug("Adding new expiry task!");
PlotSquared.debug("Adding new expiry task!");
this.tasks.add(task);
}
@ -255,7 +255,7 @@ public class ExpireManager {
}
this.running = 2;
final ConcurrentLinkedDeque<Plot> plots =
new ConcurrentLinkedDeque<Plot>(PS.get().getPlots());
new ConcurrentLinkedDeque<Plot>(PlotSquared.get().getPlots());
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
final Runnable task = this;
@ -388,13 +388,13 @@ public class ExpireManager {
PlotAnalysis changed = plot.getComplexity(null);
int changes = changed == null ? 0 : changed.changes_sd;
int modified = changed == null ? 0 : changed.changes;
PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.owner
PlotSquared.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.owner
+ " Delta:" + changes + "/" + modified + " Connected: " + StringMan.getString(plots));
PS.debug("$4 - Area: " + plot.getArea());
PlotSquared.debug("$4 - Area: " + plot.getArea());
if (plot.hasOwner()) {
PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
PlotSquared.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
} else {
PS.debug("$4 - Owner: Unowned");
PlotSquared.debug("$4 - Owner: Unowned");
}
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util.expiry;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
@ -94,7 +94,7 @@ public class ExpiryTask {
}
public Set<Plot> getPlotsToCheck() {
return PS.get().getPlots(new PlotFilter() {
return PlotSquared.get().getPlots(new PlotFilter() {
@Override public boolean allowsArea(PlotArea area) {
return ExpiryTask.this.allowsArea(area);
}

View File

@ -1,6 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.util.expiry;
import com.github.intellectualsites.plotsquared.plot.PS;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
@ -64,21 +64,21 @@ public class PlotAnalysis {
*/
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
if (running) {
PS.debug("Calibration task already in progress!");
PlotSquared.debug("Calibration task already in progress!");
return;
}
if (threshold <= 0 || threshold >= 1) {
PS.debug(
PlotSquared.debug(
"Invalid threshold provided! (Cannot be 0 or 100 as then there's no point calibrating)");
return;
}
running = true;
PS.debug(" - Fetching all plots");
final ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
PlotSquared.debug(" - Fetching all plots");
final ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
Iterator<Plot> iterator = plots.iterator();
PS.debug(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
PlotSquared.debug(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
while (iterator.hasNext()) {
Plot plot = iterator.next();
if (plot.getSettings().ratings == null || plot.getSettings().getRatings()
@ -88,10 +88,10 @@ public class PlotAnalysis {
plot.addRunning();
}
}
PS.debug(" - | Reduced to " + plots.size() + " plots");
PlotSquared.debug(" - | Reduced to " + plots.size() + " plots");
if (plots.size() < 3) {
PS.debug(
PlotSquared.debug(
"Calibration cancelled due to insufficient comparison data, please try again later");
running = false;
for (Plot plot : plots) {
@ -100,7 +100,7 @@ public class PlotAnalysis {
return;
}
PS.debug(" - $1Analyzing plot contents (this may take a while)");
PlotSquared.debug(" - $1Analyzing plot contents (this may take a while)");
int[] changes = new int[plots.size()];
int[] faces = new int[plots.size()];
@ -126,7 +126,7 @@ public class PlotAnalysis {
ratings[i] = (int) (
(plot.getAverageRating() + plot.getSettings().getRatings().size())
* 100);
PS.debug(" | " + plot + " (rating) " + ratings[i]);
PlotSquared.debug(" | " + plot + " (rating) " + ratings[i]);
}
}
});
@ -138,7 +138,7 @@ public class PlotAnalysis {
if (queuePlot == null) {
break;
}
PS.debug(" | " + queuePlot);
PlotSquared.debug(" | " + queuePlot);
final Object lock = new Object();
TaskManager.runTask(new Runnable() {
@Override public void run() {
@ -168,7 +168,7 @@ public class PlotAnalysis {
}
}
PS.debug(" - $1Waiting on plot rating thread: " + mi.intValue() * 100 / plots.size()
PlotSquared.debug(" - $1Waiting on plot rating thread: " + mi.intValue() * 100 / plots.size()
+ "%");
try {
ratingAnalysis.join();
@ -176,10 +176,10 @@ public class PlotAnalysis {
e.printStackTrace();
}
PS.debug(" - $1Processing and grouping single plot analysis for bulk processing");
PlotSquared.debug(" - $1Processing and grouping single plot analysis for bulk processing");
for (int i = 0; i < plots.size(); i++) {
Plot plot = plots.get(i);
PS.debug(" | " + plot);
PlotSquared.debug(" | " + plot);
PlotAnalysis analysis = plot.getComplexity(null);
changes[i] = analysis.changes;
@ -195,17 +195,17 @@ public class PlotAnalysis {
variety_sd[i] = analysis.variety_sd;
}
PS.debug(" - $1Calculating rankings");
PlotSquared.debug(" - $1Calculating rankings");
int[] rankRatings = rank(ratings);
int n = rankRatings.length;
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
PS.debug(" - $1Calculating rank correlation: ");
PS.debug(
PlotSquared.debug(" - $1Calculating rank correlation: ");
PlotSquared.debug(
" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
PS.debug(
PlotSquared.debug(
" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
Settings.Auto_Clear settings = new Settings.Auto_Clear();
@ -218,7 +218,7 @@ public class PlotAnalysis {
settings.CALIBRATION.CHANGES = factorChanges == 1 ?
0 :
(int) (factorChanges * 1000 / MathMan.getMean(changes));
PS.debug(" - | changes " + factorChanges);
PlotSquared.debug(" - | changes " + factorChanges);
int[] rankFaces = rank(faces);
int[] sdFaces = getSD(rankFaces, rankRatings);
@ -227,7 +227,7 @@ public class PlotAnalysis {
double factorFaces = getCC(n, sumFaces);
settings.CALIBRATION.FACES =
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
PS.debug(" - | faces " + factorFaces);
PlotSquared.debug(" - | faces " + factorFaces);
int[] rankData = rank(data);
int[] sdData = getSD(rankData, rankRatings);
@ -236,7 +236,7 @@ public class PlotAnalysis {
double factor_data = getCC(n, sum_data);
settings.CALIBRATION.DATA =
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
PS.debug(" - | data " + factor_data);
PlotSquared.debug(" - | data " + factor_data);
int[] rank_air = rank(air);
int[] sd_air = getSD(rank_air, rankRatings);
@ -245,7 +245,7 @@ public class PlotAnalysis {
double factor_air = getCC(n, sum_air);
settings.CALIBRATION.AIR =
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
PS.debug(" - | air " + factor_air);
PlotSquared.debug(" - | air " + factor_air);
int[] rank_variety = rank(variety);
int[] sd_variety = getSD(rank_variety, rankRatings);
@ -255,7 +255,7 @@ public class PlotAnalysis {
settings.CALIBRATION.VARIETY = factor_variety == 1 ?
0 :
(int) (factor_variety * 1000 / MathMan.getMean(variety));
PS.debug(" - | variety " + factor_variety);
PlotSquared.debug(" - | variety " + factor_variety);
int[] rank_changes_sd = rank(changes_sd);
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
@ -265,7 +265,7 @@ public class PlotAnalysis {
settings.CALIBRATION.CHANGES_SD = factor_changes_sd == 1 ?
0 :
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
PS.debug(" - | changes_sd " + factor_changes_sd);
PlotSquared.debug(" - | changes_sd " + factor_changes_sd);
int[] rank_faces_sd = rank(faces_sd);
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
@ -275,7 +275,7 @@ public class PlotAnalysis {
settings.CALIBRATION.FACES_SD = factor_faces_sd == 1 ?
0 :
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
PS.debug(" - | faces_sd " + factor_faces_sd);
PlotSquared.debug(" - | faces_sd " + factor_faces_sd);
int[] rank_data_sd = rank(data_sd);
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
@ -285,7 +285,7 @@ public class PlotAnalysis {
settings.CALIBRATION.DATA_SD = factor_data_sd == 1 ?
0 :
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
PS.debug(" - | data_sd " + factor_data_sd);
PlotSquared.debug(" - | data_sd " + factor_data_sd);
int[] rank_air_sd = rank(air_sd);
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
@ -294,7 +294,7 @@ public class PlotAnalysis {
double factor_air_sd = getCC(n, sum_air_sd);
settings.CALIBRATION.AIR_SD =
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
PS.debug(" - | air_sd " + factor_air_sd);
PlotSquared.debug(" - | air_sd " + factor_air_sd);
int[] rank_variety_sd = rank(variety_sd);
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
@ -304,11 +304,11 @@ public class PlotAnalysis {
settings.CALIBRATION.VARIETY_SD = factor_variety_sd == 1 ?
0 :
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
PS.debug(" - | variety_sd " + factor_variety_sd);
PlotSquared.debug(" - | variety_sd " + factor_variety_sd);
int[] complexity = new int[n];
PS.debug(" $1Calculating threshold");
PlotSquared.debug(" $1Calculating threshold");
int max = 0;
int min = 0;
for (int i = 0; i < n; i++) {
@ -337,7 +337,7 @@ public class PlotAnalysis {
logln("Correlation: ");
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
if (optimalComplexity == Integer.MAX_VALUE) {
PS.debug(
PlotSquared.debug(
"Insufficient data to determine correlation! " + optimalIndex + " | "
+ n);
running = false;
@ -357,10 +357,10 @@ public class PlotAnalysis {
}
// Save calibration
PS.debug(" $1Saving calibration");
PlotSquared.debug(" $1Saving calibration");
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
Settings.save(PS.get().worldsFile);
PS.debug("$1Done!");
Settings.save(PlotSquared.get().worldsFile);
PlotSquared.debug("$1Done!");
running = false;
for (Plot plot : plots) {
plot.removeRunning();
@ -371,7 +371,7 @@ public class PlotAnalysis {
}
public static void logln(Object obj) {
PS.debug(log(obj));
PlotSquared.debug(log(obj));
}
public static String log(Object obj) {