Shorten class name (refactor if necessary)

This commit is contained in:
boy0001 2015-07-03 22:15:20 +10:00
parent 4926cae53e
commit 289527b8e5
98 changed files with 748 additions and 754 deletions

View File

@ -68,7 +68,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void onEnable() {
THIS = this;
PlotSquared.instance = new PlotSquared(this);
PS.instance = new PS(this);
if (Settings.METRICS) {
try {
final Metrics metrics = new Metrics(this);
@ -97,7 +97,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void onDisable() {
PlotSquared.getInstance().disable();
PS.get().disable();
THIS = null;
}
@ -235,7 +235,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
this.error = 0l;
}
World world;
for (final String w : PlotSquared.getInstance().getPlotWorlds()) {
for (final String w : PS.get().getPlotWorlds()) {
world = Bukkit.getWorld(w);
try {
if (world.getLoadedChunks().length < 1) {
@ -263,7 +263,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
WorldEvents.lastWorld = world;
if (!PlotSquared.getInstance().setupPlotWorld(world, id)) {
if (!PS.get().setupPlotWorld(world, id)) {
return null;
}
HybridGen result = new HybridGen(world);
@ -308,8 +308,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void registerWorldEditEvents() {
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
PlotSquared.getInstance().worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
final String version = PlotSquared.getInstance().worldEdit.getDescription().getVersion();
PS.get().worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
final String version = PS.get().worldEdit.getDescription().getVersion();
if ((version != null) && version.startsWith("5.")) {
log("&cThis version of WorldEdit does not support PlotSquared.");
log("&cPlease use WorldEdit 6+ for masking support");

View File

@ -37,13 +37,10 @@ import java.util.zip.ZipInputStream;
* @author Sauilitired | Citymonstret
* @author boy0001 | Empire92
*/
public class PlotSquared {
// public static final:
public static final String MAIN_PERMISSION = "plots.use";
public class PS {
// protected static:
protected static PlotSquared instance;
protected static PS instance;
// private final:
private final HashMap<String, PlotWorld> plotworlds = new HashMap<>();
@ -72,11 +69,11 @@ public class PlotSquared {
* Initialize PlotSquared with the desired Implementation class
* @param imp_class
*/
protected PlotSquared(final IPlotMain imp_class) {
protected PS(final IPlotMain imp_class) {
SetupUtils.generators = new HashMap<>();
IMP = imp_class;
try {
FILE = new File(PlotSquared.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
FILE = new File(PS.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
} catch (Exception e) {
log("Could not determine file path");
}
@ -173,7 +170,7 @@ public class PlotSquared {
*
* @return the instance created by IPlotMain
*/
public static PlotSquared getInstance() {
public static PS get() {
return instance;
}
@ -184,7 +181,7 @@ public class PlotSquared {
* @see IPlotMain#log(String)
*/
public static void log(final String message) {
getInstance().IMP.log(message);
get().IMP.log(message);
}
/**

View File

@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.api;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.SubCommand;
import com.intellectualcrafters.plot.config.C;
@ -68,7 +68,7 @@ import java.util.Set;
*
* @throws com.intellectualcrafters.plot.util.PlotSquaredException if the program fails to fetch the PlotSquared
* instance
* @see com.intellectualcrafters.plot.PlotSquared
* @see com.intellectualcrafters.plot.PS
*/
@Deprecated
public PlotAPI(final JavaPlugin plugin) {
@ -82,10 +82,10 @@ import java.util.Set;
*
* @return all plots
*
* @see com.intellectualcrafters.plot.PlotSquared#getPlots()
* @see com.intellectualcrafters.plot.PS#getPlots()
*/
public Set<Plot> getAllPlots() {
return PlotSquared.getInstance().getPlots();
return PS.get().getPlots();
}
/**
@ -96,7 +96,7 @@ import java.util.Set;
* @return all plots that a player owns
*/
public Set<Plot> getPlayerPlots(final Player player) {
return PlotSquared.getInstance().getPlots(BukkitUtil.getPlayer(player));
return PS.get().getPlots(BukkitUtil.getPlayer(player));
}
/**
@ -106,29 +106,29 @@ import java.util.Set;
* @param plotWorld Plot World Object
* @param manager World Manager
*
* @see com.intellectualcrafters.plot.PlotSquared#addPlotWorld(String, com.intellectualcrafters.plot.object.PlotWorld,
* @see com.intellectualcrafters.plot.PS#addPlotWorld(String, com.intellectualcrafters.plot.object.PlotWorld,
* com.intellectualcrafters.plot.object.PlotManager)
*/
public void addPlotWorld(final String world, final PlotWorld plotWorld, final PlotManager manager) {
PlotSquared.getInstance().addPlotWorld(world, plotWorld, manager);
PS.get().addPlotWorld(world, plotWorld, manager);
}
/**
* @return main configuration
*
* @see com.intellectualcrafters.plot.PlotSquared#config
* @see com.intellectualcrafters.plot.PS#config
*/
public YamlConfiguration getConfig() {
return PlotSquared.getInstance().config;
return PS.get().config;
}
/**
* @return storage configuration
*
* @see com.intellectualcrafters.plot.PlotSquared#storage
* @see com.intellectualcrafters.plot.PS#storage
*/
public YamlConfiguration getStorage() {
return PlotSquared.getInstance().storage;
return PS.get().storage;
}
/**
@ -137,10 +137,10 @@ import java.util.Set;
*
* @return PlotSquared PlotSquared Main Class
*
* @see com.intellectualcrafters.plot.PlotSquared
* @see com.intellectualcrafters.plot.PS
*/
public PlotSquared getMain() {
return PlotSquared.getInstance();
public PS getMain() {
return PS.get();
}
/**
@ -275,10 +275,10 @@ import java.util.Set;
* @return PlotManager
*
* @see com.intellectualcrafters.plot.object.PlotManager
* @see PlotSquared#getPlotManager(String)
* @see PS#getPlotManager(String)
*/
public PlotManager getPlotManager(final World world) {
return PlotSquared.getInstance().getPlotManager(world.getName());
return PS.get().getPlotManager(world.getName());
}
/**
@ -289,11 +289,11 @@ import java.util.Set;
*
* @return PlotManager
*
* @see PlotSquared#getPlotManager(String)
* @see PS#getPlotManager(String)
* @see com.intellectualcrafters.plot.object.PlotManager
*/
public PlotManager getPlotManager(final String world) {
return PlotSquared.getInstance().getPlotManager(world);
return PS.get().getPlotManager(world);
}
/**
@ -304,11 +304,11 @@ import java.util.Set;
*
* @return PlotWorld class for that world ! will return null if not a plot world world
*
* @see PlotSquared#getPlotWorld(String)
* @see PS#getPlotWorld(String)
* @see com.intellectualcrafters.plot.object.PlotWorld
*/
public PlotWorld getWorldSettings(final World world) {
return PlotSquared.getInstance().getPlotWorld(world.getName());
return PS.get().getPlotWorld(world.getName());
}
/**
@ -318,11 +318,11 @@ import java.util.Set;
*
* @return PlotWorld class for that world ! will return null if not a plot world world
*
* @see PlotSquared#getPlotWorld(String)
* @see PS#getPlotWorld(String)
* @see com.intellectualcrafters.plot.object.PlotWorld
*/
public PlotWorld getWorldSettings(final String world) {
return PlotSquared.getInstance().getPlotWorld(world);
return PS.get().getPlotWorld(world);
}
/**
@ -464,7 +464,7 @@ import java.util.Set;
*/
public Plot[] getPlots(final World world, final Player plr, final boolean just_owner) {
final ArrayList<Plot> pPlots = new ArrayList<>();
for (final Plot plot : PlotSquared.getInstance().getPlots(world.getName()).values()) {
for (final Plot plot : PS.get().getPlots(world.getName()).values()) {
if (just_owner) {
if ((plot.owner != null) && (plot.owner.equals(UUIDHandler.getUUID(BukkitUtil.getPlayer(plr))))) {
pPlots.add(plot);
@ -485,11 +485,11 @@ import java.util.Set;
*
* @return Plot[] - array of plot objects in world
*
* @see PlotSquared#getPlots(String)
* @see PS#getPlots(String)
* @see com.intellectualcrafters.plot.object.Plot
*/
public Plot[] getPlots(final World world) {
Collection<Plot> plots = PlotSquared.getInstance().getPlots(world.getName()).values();
Collection<Plot> plots = PS.get().getPlots(world.getName()).values();
return plots.toArray(new Plot[plots.size()]);
}
@ -498,10 +498,10 @@ import java.util.Set;
*
* @return World[] - array of plot worlds
*
* @see com.intellectualcrafters.plot.PlotSquared#getPlotWorlds()
* @see com.intellectualcrafters.plot.PS#getPlotWorlds()
*/
public String[] getPlotWorlds() {
Set<String> worlds = PlotSquared.getInstance().getPlotWorlds();
Set<String> worlds = PS.get().getPlotWorlds();
return worlds.toArray(new String[worlds.size()]);
}
@ -512,10 +512,10 @@ import java.util.Set;
*
* @return boolean (if plot world or not)
*
* @see com.intellectualcrafters.plot.PlotSquared#isPlotWorld(String)
* @see com.intellectualcrafters.plot.PS#isPlotWorld(String)
*/
public boolean isPlotWorld(final World world) {
return PlotSquared.getInstance().isPlotWorld(world.getName());
return PS.get().isPlotWorld(world.getName());
}
/**
@ -611,10 +611,10 @@ import java.util.Set;
*
* @return PlotSquared Class
*
* @see com.intellectualcrafters.plot.PlotSquared
* @see com.intellectualcrafters.plot.PS
*/
public PlotSquared getPlotSquared() {
return PlotSquared.getInstance();
public PS getPlotSquared() {
return PS.get();
}
/**
@ -639,12 +639,12 @@ import java.util.Set;
*
* @return a set containing the players plots
*
* @see com.intellectualcrafters.plot.PlotSquared#getPlots(String, PlotPlayer)
* @see com.intellectualcrafters.plot.PS#getPlots(String, PlotPlayer)
* org.bukkit.entity.Player)
* @see com.intellectualcrafters.plot.object.Plot
*/
public Set<Plot> getPlayerPlots(final World world, final Player player) {
return PlotSquared.getInstance().getPlots(world.getName(), BukkitUtil.getPlayer(player));
return PS.get().getPlots(world.getName(), BukkitUtil.getPlayer(player));
}
/**

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
@ -77,7 +77,7 @@ public class Add extends SubCommand {
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
}
if (plot.denied.contains(uuid)) {
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getInstance().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
if (plot.members.size() + plot.trusted.size() >= PS.get().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
return false;
}
@ -91,7 +91,7 @@ public class Add extends SubCommand {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getInstance().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
if (plot.members.size() + plot.trusted.size() >= PS.get().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
return false;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.*;
@ -70,11 +70,11 @@ public class Auto extends SubCommand {
int size_x = 1;
int size_z = 1;
String schematic = "";
if (PlotSquared.getInstance().getPlotWorlds().size() == 1) {
world = PlotSquared.getInstance().getPlotWorlds().iterator().next();
if (PS.get().getPlotWorlds().size() == 1) {
world = PS.get().getPlotWorlds().iterator().next();
} else {
world = plr.getLocation().getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}
@ -122,7 +122,7 @@ public class Auto extends SubCommand {
}
return false;
}
final PlotWorld pWorld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld pWorld = PS.get().getPlotWorld(world);
if ((EconHandler.manager != null) && pWorld.USE_ECONOMY) {
double cost = pWorld.PLOT_PRICE;
cost = (size_x * size_z) * cost;
@ -148,7 +148,7 @@ public class Auto extends SubCommand {
// }
}
final String worldname = world;
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(worldname);
final PlotWorld plotworld = PS.get().getPlotWorld(worldname);
if (plotworld.TYPE == 2) {
final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(new Location(worldname, loc.getX(), loc.getY(), loc.getZ()));
@ -199,7 +199,7 @@ public class Auto extends SubCommand {
MainUtil.lastPlot.put(worldname, start);
if (lastPlot) {
}
if ((PlotSquared.getInstance().getPlots(worldname).get(start) != null) && (PlotSquared.getInstance().getPlots(worldname).get(start).owner != null)) {
if ((PS.get().getPlots(worldname).get(start) != null) && (PS.get().getPlots(worldname).get(start).owner != null)) {
continue;
} else {
lastPlot = false;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -46,7 +46,7 @@ public class Buy extends SubCommand {
}
final Location loc = plr.getLocation();
final String world = loc.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return sendMessage(plr, C.NOT_IN_PLOT_WORLD);
}
Plot plot;
@ -83,7 +83,7 @@ public class Buy extends SubCommand {
final PlotId id = plot.id;
final PlotId id2 = MainUtil.getTopPlot(plot).id;
final int size = MainUtil.getPlotSelectionIds(id, id2).size();
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (plotworld.USE_ECONOMY) {
price += plotworld.PLOT_PRICE * size;
initPrice += plotworld.SELL_PRICE * size;

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
@ -13,7 +13,7 @@ public class Chat extends SubCommand {
@Override
public boolean execute(PlotPlayer plr, String... args) {
final String world = plr.getLocation().getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);
}
boolean enable = !(plr.getMeta("chat") != null && (Boolean) plr.getMeta("chat"));
@ -24,7 +24,7 @@ public class Chat extends SubCommand {
enable = false;
}
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (!enable && plotworld.PLOT_CHAT) {
return !sendMessage(plr, C.PLOT_CHAT_FORCED);
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
@ -56,8 +56,8 @@ public class Claim extends SubCommand {
MainUtil.teleportPlayer(player, loc, plot);
}
final String world = plot.world;
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final Plot plot2 = PlotSquared.getInstance().getPlots(world).get(plot.id);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final Plot plot2 = PS.get().getPlots(world).get(plot.id);
if (plotworld.SCHEMATIC_ON_CLAIM) {
Schematic sch;
if (schematic.equals("")) {
@ -70,7 +70,7 @@ public class Claim extends SubCommand {
}
SchematicHandler.manager.paste(sch, plot2, 0, 0);
}
PlotSquared.getInstance().getPlotManager(world).claimPlot(plotworld, plot);
PS.get().getPlotManager(world).claimPlot(plotworld, plot);
}
return result;
}
@ -93,7 +93,7 @@ public class Claim extends SubCommand {
if (!MainUtil.canClaim(plr, plot)) {
return sendMessage(plr, C.PLOT_IS_CLAIMED);
}
final PlotWorld world = PlotSquared.getInstance().getPlotWorld(plot.world);
final PlotWorld world = PS.get().getPlotWorld(plot.world);
if ((EconHandler.manager != null) && world.USE_ECONOMY) {
final double cost = world.PLOT_PRICE;
if (cost > 0d) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
@ -45,25 +45,25 @@ public class Clear extends SubCommand {
if (plr == null) {
// Is console
if (args.length < 2) {
PlotSquared.log("You need to specify two arguments: ID (0;0) & World (world)");
PS.log("You need to specify two arguments: ID (0;0) & World (world)");
} else {
final PlotId id = PlotId.fromString(args[0]);
final String world = args[1];
if (id == null) {
PlotSquared.log("Invalid Plot ID: " + args[0]);
PS.log("Invalid Plot ID: " + args[0]);
} else {
if (!PlotSquared.getInstance().isPlotWorld(world)) {
PlotSquared.log("Invalid plot world: " + world);
if (!PS.get().isPlotWorld(world)) {
PS.log("Invalid plot world: " + world);
} else {
final Plot plot = MainUtil.getPlot(world, id);
if (plot == null) {
PlotSquared.log("Could not find plot " + args[0] + " in world " + world);
PS.log("Could not find plot " + args[0] + " in world " + world);
} else {
Runnable runnable = new Runnable() {
@Override
public void run() {
MainUtil.clear(world, plot, plot.owner == null, null);
PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
PS.log("Plot " + plot.getId().toString() + " cleared.");
}
};
if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
@ -84,7 +84,7 @@ public class Clear extends SubCommand {
PlotId id = PlotId.fromString(args[0]);
if (id == null) {
if (args[1].equalsIgnoreCase("mine")) {
Set<Plot> plots = PlotSquared.getInstance().getPlots(plr);
Set<Plot> plots = PS.get().getPlots(plr);
if (plots.size() == 0) {
MainUtil.sendMessage(plr, C.NO_PLOTS);
return false;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
@ -121,25 +121,25 @@ public class Cluster extends SubCommand {
}
ClusterManager.clusters.get(world).add(cluster);
// Add any existing plots to the current cluster
for (final Plot plot : PlotSquared.getInstance().getPlots(plr.getLocation().getWorld()).values()) {
for (final Plot plot : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
final PlotCluster current = ClusterManager.getCluster(plot);
if (cluster.equals(current) && !cluster.isAdded(plot.owner)) {
cluster.invited.add(plot.owner);
DBFunc.setInvited(world, cluster, plot.owner);
}
}
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
PlotWorld plotworld = PS.get().getPlotWorld(world);
if (plotworld == null) {
PlotSquared.getInstance().config.createSection("worlds." + world);
PlotSquared.getInstance().loadWorld(world, null);
PS.get().config.createSection("worlds." + world);
PS.get().loadWorld(world, null);
}
else {
final String gen_string = PlotSquared.getInstance().config.getString("worlds." + world + "." + "generator.plugin");
final String gen_string = PS.get().config.getString("worlds." + world + "." + "generator.plugin");
PlotGenerator generator;
if (gen_string == null) {
generator = new HybridGen(world);
} else {
generator = (PlotGenerator) PlotSquared.getInstance().IMP.getGenerator(world, gen_string);
generator = (PlotGenerator) PS.get().IMP.getGenerator(world, gen_string);
}
new AugmentedPopulator(world, generator, cluster, plotworld.TERRAIN == 2, plotworld.TERRAIN != 2);
}
@ -177,10 +177,10 @@ public class Cluster extends SubCommand {
return false;
}
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(plr.getLocation().getWorld());
final PlotWorld plotworld = PS.get().getPlotWorld(plr.getLocation().getWorld());
if (plotworld.TYPE == 2) {
final ArrayList<Plot> toRemove = new ArrayList<>();
for (final Plot plot : PlotSquared.getInstance().getPlots(plr.getLocation().getWorld()).values()) {
for (final Plot plot : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
final PlotCluster other = ClusterManager.getCluster(plot);
if (cluster.equals(other)) {
toRemove.add(plot);
@ -361,7 +361,7 @@ public class Cluster extends SubCommand {
if (player != null) {
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
}
for (final Plot plot : PlotSquared.getInstance().getPlots(plr.getLocation().getWorld(), uuid)) {
for (final Plot plot : PS.get().getPlots(plr.getLocation().getWorld(), uuid)) {
final PlotCluster current = ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) {
final String world = plr.getLocation().getWorld();
@ -411,7 +411,7 @@ public class Cluster extends SubCommand {
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid);
MainUtil.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName());
for (final Plot plot : PlotSquared.getInstance().getPlots(plr.getLocation().getWorld(), uuid)) {
for (final Plot plot : PS.get().getPlots(plr.getLocation().getWorld(), uuid)) {
final PlotCluster current = ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) {
final String world = plr.getLocation().getWorld();

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
@ -40,7 +40,7 @@ public class Condense extends SubCommand {
}
public static void sendMessage(final String message) {
PlotSquared.log("&3PlotSquared -> Plot condense&8: &7" + message);
PS.log("&3PlotSquared -> Plot condense&8: &7" + message);
}
@Override
@ -54,7 +54,7 @@ public class Condense extends SubCommand {
return false;
}
final String worldname = args[0];
if (!BlockManager.manager.isWorld(worldname) || !PlotSquared.getInstance().isPlotWorld(worldname)) {
if (!BlockManager.manager.isWorld(worldname) || !PS.get().isPlotWorld(worldname)) {
MainUtil.sendMessage(plr, "INVALID WORLD");
return false;
}
@ -77,7 +77,7 @@ public class Condense extends SubCommand {
return false;
}
final int radius = Integer.parseInt(args[2]);
final Collection<Plot> plots = PlotSquared.getInstance().getPlots(worldname).values();
final Collection<Plot> plots = PS.get().getPlots(worldname).values();
final int size = plots.size();
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
if (radius < minimum_radius) {
@ -166,7 +166,7 @@ public class Condense extends SubCommand {
return false;
}
final int radius = Integer.parseInt(args[2]);
final Collection<Plot> plots = PlotSquared.getInstance().getPlots(worldname).values();
final Collection<Plot> plots = PS.get().getPlots(worldname).values();
final int size = plots.size();
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
if (radius < minimum_radius) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils;
@ -41,7 +41,7 @@ public class CreateRoadSchematic extends SubCommand {
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
}
if (!(PlotSquared.getInstance().getPlotWorld(loc.getWorld()) instanceof HybridPlotWorld)) {
if (!(PS.get().getPlotWorld(loc.getWorld()) instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
HybridUtils.manager.setupRoadSchematic(plot);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager;
@ -28,7 +28,7 @@ public class Database extends SubCommand {
private static boolean sendMessageU(final UUID uuid, final String msg) {
if (uuid == null) {
PlotSquared.log(msg);
PS.log(msg);
} else {
final PlotPlayer p = UUIDHandler.getPlayer(uuid);
if ((p != null) && p.isOnline()) {
@ -41,7 +41,7 @@ public class Database extends SubCommand {
}
public static void insertPlots(final SQLManager manager, final UUID requester, final Connection c) {
final java.util.Set<Plot> plots = PlotSquared.getInstance().getPlots();
final java.util.Set<Plot> plots = PS.get().getPlots();
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@ -92,7 +92,7 @@ public class Database extends SubCommand {
}
Connection n;
try {
n = new MySQL(PlotSquared.getInstance(), host, port, database, username, password).openConnection();
n = new MySQL(PS.get(), host, port, database, username, password).openConnection();
// Connection
if (n.isClosed()) {
return sendMessage(plr, "Failed to open connection");
@ -128,7 +128,7 @@ public class Database extends SubCommand {
private boolean sendMessage(final PlotPlayer player, final String msg) {
if (player == null) {
PlotSquared.log(msg);
PS.log(msg);
} else {
MainUtil.sendMessage(player, msg);
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.Lag;
@ -51,7 +51,7 @@ public class Debug extends SubCommand {
}
{
final StringBuilder worlds = new StringBuilder("");
for (final String world : PlotSquared.getInstance().getPlotWorlds()) {
for (final String world : PS.get().getPlotWorlds()) {
worlds.append(world).append(" ");
}
information.append(header);
@ -61,7 +61,7 @@ public class Debug extends SubCommand {
information.append(getLine(line, "TPS Percentage", (int) Lag.getFullPercentage() + "%"));
information.append(getSection(section, "PlotWorld"));
information.append(getLine(line, "Plot Worlds", worlds));
information.append(getLine(line, "Owned Plots", PlotSquared.getInstance().getPlots().size()));
information.append(getLine(line, "Owned Plots", PS.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

@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.commands;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*;
@ -66,7 +66,7 @@ public class DebugClaimTest extends SubCommand {
return !MainUtil.sendMessage(null, "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}");
}
final String world = args[0];
if (!BlockManager.manager.isWorld(world) || !PlotSquared.getInstance().isPlotWorld(world)) {
if (!BlockManager.manager.isWorld(world) || !PS.get().isPlotWorld(world)) {
return !MainUtil.sendMessage(null, "&cInvalid plot world!");
}
PlotId min, max;
@ -80,12 +80,12 @@ public class DebugClaimTest extends SubCommand {
}
MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while...");
MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final ArrayList<Plot> plots = new ArrayList<>();
for (final PlotId id : MainUtil.getPlotSelectionIds(min, max)) {
final Plot plot = MainUtil.getPlot(world, id);
final boolean contains = PlotSquared.getInstance().getPlots(world).containsKey(plot.id);
final boolean contains = PS.get().getPlots(world).containsKey(plot.id);
if (contains) {
MainUtil.sendMessage(null, " - &cDB Already contains: " + plot.id);
continue;
@ -134,7 +134,7 @@ public class DebugClaimTest extends SubCommand {
}
});
for (final Plot plot : plots) {
PlotSquared.getInstance().updatePlot(plot);
PS.get().updatePlot(plot);
}
MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
} else {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
import com.intellectualcrafters.plot.object.Location;
@ -42,19 +42,19 @@ public class DebugClear extends SubCommand {
if (plr == null) {
// Is console
if (args.length < 2) {
PlotSquared.log("You need to specify two arguments: ID (0;0) & World (world)");
PS.log("You need to specify two arguments: ID (0;0) & World (world)");
} else {
final PlotId id = PlotId.fromString(args[0]);
final String world = args[1];
if (id == null) {
PlotSquared.log("Invalid Plot ID: " + args[0]);
PS.log("Invalid Plot ID: " + args[0]);
} else {
if (!PlotSquared.getInstance().isPlotWorld(world) || !(PlotSquared.getInstance().getPlotWorld(world) instanceof SquarePlotWorld)) {
PlotSquared.log("Invalid plot world: " + world);
if (!PS.get().isPlotWorld(world) || !(PS.get().getPlotWorld(world) instanceof SquarePlotWorld)) {
PS.log("Invalid plot world: " + world);
} else {
final Plot plot = MainUtil.getPlot(world, id);
if (plot == null) {
PlotSquared.log("Could not find plot " + args[0] + " in world " + world);
PS.log("Could not find plot " + args[0] + " in world " + world);
} else {
final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
@ -67,8 +67,8 @@ public class DebugClear extends SubCommand {
@Override
public void run() {
MainUtil.runners.remove(plot);
PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
PlotSquared.log("&aDone!");
PS.log("Plot " + plot.getId().toString() + " cleared.");
PS.log("&aDone!");
}
});
}
@ -79,7 +79,7 @@ public class DebugClear extends SubCommand {
}
final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc);
if ((plot == null) || !(PlotSquared.getInstance().getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
if ((plot == null) || !(PS.get().getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
return sendMessage(plr, C.NOT_IN_PLOT);
}
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
@ -86,7 +86,7 @@ public class DebugExec extends SubCommand {
return false;
}
String flag = args[1];
for (Plot plot : PlotSquared.getInstance().getPlots()) {
for (Plot plot : PS.get().getPlots()) {
if (FlagManager.getPlotFlag(plot, flag) != null) {
FlagManager.removePlotFlag(plot, flag);
}
@ -95,11 +95,11 @@ public class DebugExec extends SubCommand {
}
case "start-rgar": {
if (args.length != 2) {
PlotSquared.log("&cInvalid syntax: /plot debugexec start-rgar <world>");
PS.log("&cInvalid syntax: /plot debugexec start-rgar <world>");
return false;
}
boolean result;
if (!PlotSquared.getInstance().isPlotWorld(args[1])) {
if (!PS.get().isPlotWorld(args[1])) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]);
return false;
}
@ -110,26 +110,26 @@ public class DebugExec extends SubCommand {
result = HybridUtils.manager.scheduleRoadUpdate(args[1], 0);
}
if (!result) {
PlotSquared.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
PS.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
return false;
}
return true;
}
case "stop-rgar": {
if (((BukkitHybridUtils)(HybridUtils.manager)).task == 0) {
PlotSquared.log("&cTASK NOT RUNNING!");
PS.log("&cTASK NOT RUNNING!");
return false;
}
((BukkitHybridUtils)(HybridUtils.manager)).task = 0;
Bukkit.getScheduler().cancelTask(((BukkitHybridUtils)(HybridUtils.manager)).task);
PlotSquared.log("&cCancelling task...");
PS.log("&cCancelling task...");
while (BukkitHybridUtils.chunks.size() > 0) {
ChunkLoc chunk = BukkitHybridUtils.chunks.get(0);
BukkitHybridUtils.chunks.remove(0);
HybridUtils.manager.regenerateRoad(BukkitHybridUtils.world, chunk, 0);
ChunkManager.manager.unloadChunk(BukkitHybridUtils.world, chunk);
}
PlotSquared.log("&cCancelled!");
PS.log("&cCancelled!");
return true;
}
case "start-expire": {
@ -197,7 +197,7 @@ public class DebugExec extends SubCommand {
return MainUtil.sendMessage(player, "&7 - Run after plot expiry has run");
}
final String world = args[1];
if (!BlockManager.manager.isWorld(world) || !PlotSquared.getInstance().isPlotWorld(args[1])) {
if (!BlockManager.manager.isWorld(world) || !PS.get().isPlotWorld(args[1])) {
return MainUtil.sendMessage(player, "Invalid world: " + args[1]);
}
final ArrayList<ChunkLoc> empty = new ArrayList<>();
@ -208,7 +208,7 @@ public class DebugExec extends SubCommand {
Trim.sendMessage(" - MCA #: " + empty.size());
Trim.sendMessage(" - CHUNKS: " + (empty.size() * 1024) + " (max)");
Trim.sendMessage("Exporting log for manual approval...");
final File file = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "trim.txt");
final File file = new File(PS.get().IMP.getDirectory() + File.separator + "trim.txt");
PrintWriter writer;
try {
writer = new PrintWriter(file);

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
@ -50,12 +50,12 @@ public class DebugFixFlags extends SubCommand {
return false;
}
final String world = args[0];
if (!BlockManager.manager.isWorld(world) || !PlotSquared.getInstance().isPlotWorld(world)) {
if (!BlockManager.manager.isWorld(world) || !PS.get().isPlotWorld(world)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
return false;
}
MainUtil.sendMessage(plr, "&8--- &6Starting task &8 ---");
for (final Plot plot : PlotSquared.getInstance().getPlots(world).values()) {
for (final Plot plot : PS.get().getPlots(world).values()) {
final HashMap<String, Flag> flags = plot.settings.flags;
Iterator<Entry<String, Flag>> i = flags.entrySet().iterator();
boolean changed = false;

View File

@ -22,7 +22,7 @@ package com.intellectualcrafters.plot.commands;
import java.lang.reflect.Field;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
@ -39,13 +39,13 @@ public class DebugLoadTest extends SubCommand {
public boolean execute(final PlotPlayer plr, final String... args) {
if (plr == null) {
try {
final Field fPlots = PlotSquared.class.getDeclaredField("plots");
final Field fPlots = PS.class.getDeclaredField("plots");
fPlots.setAccessible(true);
fPlots.set(null, DBFunc.getPlots());
} catch (final Exception e) {
PlotSquared.log("&3===FAILED&3===");
PS.log("&3===FAILED&3===");
e.printStackTrace();
PlotSquared.log("&3===END OF STACKTRACE===");
PS.log("&3===END OF STACKTRACE===");
}
} else {
MainUtil.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused..");

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils;
@ -38,7 +38,7 @@ public class DebugRoadRegen extends SubCommand {
public boolean execute(final PlotPlayer player, final String... args) {
final Location loc = player.getLocation();
final String world = loc.getWorld();
if (!(PlotSquared.getInstance().getPlotWorld(world) instanceof HybridPlotWorld)) {
if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -40,7 +40,7 @@ public class DebugSaveTest extends SubCommand {
public boolean execute(final PlotPlayer plr, final String... args) {
if (plr == null) {
final ArrayList<Plot> plots = new ArrayList<Plot>();
plots.addAll(PlotSquared.getInstance().getPlots());
plots.addAll(PS.get().getPlots());
MainUtil.sendMessage(null, "&6Starting `DEBUGSAVETEST`");
DBFunc.createPlotsAndData(plots, new Runnable() {
@Override

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.AbstractDB;
@ -139,7 +139,7 @@ public class DebugUUID extends SubCommand {
final UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (final Exception e) {
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
PS.log(C.PREFIX.s() + "Invalid playerdata: " + current);
}
}
}
@ -170,7 +170,7 @@ public class DebugUUID extends SubCommand {
uCReverse.put(uuid2, uuid);
}
} catch (final Throwable e) {
PlotSquared.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
PS.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
}
}
for (final String name : names) {
@ -215,7 +215,7 @@ public class DebugUUID extends SubCommand {
MainUtil.sendConsoleMessage("&7 - Updating plot objects");
for (Plot plot : PlotSquared.getInstance().getPlotsRaw()) {
for (Plot plot : PS.get().getPlotsRaw()) {
UUID value = uCMap.get(plot.owner);
if (value != null) {
plot.owner = value;
@ -235,13 +235,13 @@ public class DebugUUID extends SubCommand {
database.createTables(Settings.DB.USE_MYSQL ? "mysql" : "sqlite");
if (!result) {
MainUtil.sendConsoleMessage("&cConversion failed! Attempting recovery");
for (Plot plot : PlotSquared.getInstance().getPlots()) {
for (Plot plot : PS.get().getPlots()) {
UUID value = uCReverse.get(plot.owner);
if (value != null) {
plot.owner = value;
}
}
database.createPlotsAndData(new ArrayList<>(PlotSquared.getInstance().getPlots()), new Runnable() {
database.createPlotsAndData(new ArrayList<>(PS.get().getPlots()), new Runnable() {
@Override
public void run() {
MainUtil.sendMessage(null, "&6Recovery was successful!");
@ -256,19 +256,19 @@ public class DebugUUID extends SubCommand {
}
if (newWrapper instanceof OfflineUUIDWrapper) {
PlotSquared.getInstance().config.set("UUID.force-lowercase", false);
PlotSquared.getInstance().config.set("UUID.offline", true);
PS.get().config.set("UUID.force-lowercase", false);
PS.get().config.set("UUID.offline", true);
}
else if (newWrapper instanceof LowerOfflineUUIDWrapper) {
PlotSquared.getInstance().config.set("UUID.force-lowercase", true);
PlotSquared.getInstance().config.set("UUID.offline", true);
PS.get().config.set("UUID.force-lowercase", true);
PS.get().config.set("UUID.offline", true);
}
else if (newWrapper instanceof DefaultUUIDWrapper) {
PlotSquared.getInstance().config.set("UUID.force-lowercase", false);
PlotSquared.getInstance().config.set("UUID.offline", false);
PS.get().config.set("UUID.force-lowercase", false);
PS.get().config.set("UUID.offline", false);
}
try {
PlotSquared.getInstance().config.save(PlotSquared.getInstance().configFile);
PS.get().config.save(PS.get().configFile);
}
catch (Exception e) {
MainUtil.sendConsoleMessage("Could not save configuration. It will need to be manuall set!");
@ -279,7 +279,7 @@ public class DebugUUID extends SubCommand {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.getInstance().getPlots());
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
database.createPlotsAndData(plots, new Runnable() {
@Override
public void run() {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -50,7 +50,7 @@ public class Delete extends SubCommand {
return !sendMessage(plr, C.NO_PLOT_PERMS);
}
assert plot != null;
final PlotWorld pWorld = PlotSquared.getInstance().getPlotWorld(plot.world);
final PlotWorld pWorld = PS.get().getPlotWorld(plot.world);
if (MainUtil.runners.containsKey(plot)) {
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
return false;
@ -65,7 +65,7 @@ public class Delete extends SubCommand {
sendMessage(plr, C.ADDED_BALANCE, c + "");
}
}
PlotSquared.getInstance().removePlot(loc.getWorld(), plot.id, true);
PS.get().removePlot(loc.getWorld(), plot.id, true);
final long start = System.currentTimeMillis();
final boolean result = MainUtil.clearAsPlayer(plot, true, new Runnable() {
@Override

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
@ -89,7 +89,7 @@ public class Deny extends SubCommand {
}
MainUtil.sendMessage(plr, C.DENIED_ADDED);
if (!uuid.equals(DBFunc.everyone)) {
PlotSquared.getInstance().IMP.handleKick(uuid, C.YOU_GOT_DENIED);
PS.get().IMP.handleKick(uuid, C.YOU_GOT_DENIED);
}
return true;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -37,7 +37,7 @@ public class Home extends SubCommand {
}
private Plot isAlias(final String a) {
for (final Plot p : PlotSquared.getInstance().getPlots()) {
for (final Plot p : PS.get().getPlots()) {
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
return p;
}
@ -47,7 +47,7 @@ public class Home extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, String... args) {
final ArrayList<Plot> plots = PlotSquared.getInstance().sortPlotsByWorld(PlotSquared.getInstance().getPlots(plr));
final ArrayList<Plot> plots = PS.get().sortPlotsByWorld(PS.get().getPlots(plr));
if (plots.size() == 1) {
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
return true;

View File

@ -28,7 +28,7 @@ import java.util.regex.Matcher;
import org.apache.commons.lang.StringUtils;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;

View File

@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
@ -111,9 +111,6 @@ public class MainCommand {
}
public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
if (!Permissions.hasPermission(player, PlotSquared.MAIN_PERMISSION)) {
return no_permission(player, PlotSquared.MAIN_PERMISSION);
}
if ((args.length < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {
if (args.length < 2) {
final StringBuilder builder = new StringBuilder();

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.*;
@ -131,7 +131,7 @@ public class Merge extends SubCommand {
HashSet<PlotId> multiPlots = new HashSet<>();
final UUID u1 = plot.owner;
for (final PlotId myid : plots) {
final Plot myplot = PlotSquared.getInstance().getPlots(world).get(myid);
final Plot myplot = PS.get().getPlots(world).get(myid);
if (myplot == null || myplot.owner == null) {
MainUtil.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
return false;
@ -163,7 +163,7 @@ public class Merge extends SubCommand {
sendMessage(accepter, C.MERGE_NOT_VALID);
return;
}
final PlotWorld plotWorld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotWorld = PS.get().getPlotWorld(world);
if ((EconHandler.manager != null) && plotWorld.USE_ECONOMY) {
double cost = plotWorld.MERGE_PRICE;
cost = plots.size() * cost;
@ -192,7 +192,7 @@ public class Merge extends SubCommand {
MainUtil.sendMessage(plr, C.MERGE_REQUESTED);
return true;
}
final PlotWorld plotWorld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotWorld = PS.get().getPlotWorld(world);
if ((EconHandler.manager != null) && plotWorld.USE_ECONOMY) {
double cost = plotWorld.MERGE_PRICE;
cost = plots.size() * cost;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.MainUtil;
@ -61,8 +61,8 @@ public class Move extends SubCommand {
}
String world2;
if (args.length == 2) {
PlotWorld other = PlotSquared.getInstance().getPlotWorld(args[1]);
PlotWorld current = PlotSquared.getInstance().getPlotWorld(loc.getWorld());
PlotWorld other = PS.get().getPlotWorld(args[1]);
PlotWorld current = PS.get().getPlotWorld(loc.getWorld());
if (other == null || current == null || !other.equals(current)) {
MainUtil.sendMessage(plr, C.PLOTWORLD_INCOMPATIBLE);
return false;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot;
@ -91,7 +91,7 @@ public class Purge extends SubCommand {
return false;
}
final String worldname = args[1];
if (!PlotSquared.getInstance().getAllPlotsRaw().containsKey(worldname)) {
if (!PS.get().getAllPlotsRaw().containsKey(worldname)) {
MainUtil.sendMessage(plr, "INVALID WORLD");
return false;
}
@ -107,7 +107,7 @@ public class Purge extends SubCommand {
return finishPurge(DBid == Integer.MAX_VALUE ? 1 : 0);
}
if (arg.equals("all")) {
final Set<PlotId> ids = PlotSquared.getInstance().getPlots(worldname).keySet();
final Set<PlotId> ids = PS.get().getPlots(worldname).keySet();
int length = ids.size();
if (length == 0) {
return MainUtil.sendMessage(null, "&cNo plots found");
@ -116,7 +116,7 @@ public class Purge extends SubCommand {
return finishPurge(length);
}
if (arg.equals("unknown")) {
final Collection<Plot> plots = PlotSquared.getInstance().getPlots(worldname).values();
final Collection<Plot> plots = PS.get().getPlots(worldname).values();
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
if (plot.owner != null) {
@ -134,7 +134,7 @@ public class Purge extends SubCommand {
return finishPurge(length);
}
if (arg.equals("unowned")) {
final Collection<Plot> plots = PlotSquared.getInstance().getPlots(worldname).values();
final Collection<Plot> plots = PS.get().getPlots(worldname).values();
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
if (plot.owner == null) {
@ -150,7 +150,7 @@ public class Purge extends SubCommand {
}
final UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) {
final Set<Plot> plots = PlotSquared.getInstance().getPlots(worldname, uuid);
final Set<Plot> plots = PS.get().getPlots(worldname, uuid);
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
ids.add(plot.id);

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -49,7 +49,7 @@ public class Rate extends SubCommand {
public boolean execute(final PlotPlayer player, final String... args) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("next")) {
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.getInstance().getPlots());
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
Collections.sort(plots, new Comparator<Plot>() {
@Override
public int compare(Plot p1, Plot p2) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager;
import com.intellectualcrafters.plot.generator.HybridUtils;
@ -58,19 +58,19 @@ public class RegenAllRoads extends SubCommand {
}
}
final String name = args[0];
final PlotManager manager = PlotSquared.getInstance().getPlotManager(name);
final PlotManager manager = PS.get().getPlotManager(name);
if ((manager == null) || !(manager instanceof HybridPlotManager)) {
sendMessage(player, C.NOT_VALID_PLOT_WORLD);
return false;
}
final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
PlotSquared.log("&cIf no schematic is set, the following will not do anything");
PlotSquared.log("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
PlotSquared.log("&6Potential chunks to update: &7" + (chunks.size() * 1024));
PlotSquared.log("&6Estimated time: &7" + (chunks.size()) + " seconds");
PS.log("&cIf no schematic is set, the following will not do anything");
PS.log("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
PS.log("&6Potential chunks to update: &7" + (chunks.size() * 1024));
PS.log("&6Estimated time: &7" + (chunks.size()) + " seconds");
final boolean result = HybridUtils.manager.scheduleRoadUpdate(name, height);
if (!result) {
PlotSquared.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
PS.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
return false;
}
return true;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
@ -36,12 +36,12 @@ public class Reload extends SubCommand {
try {
// The following won't affect world generation, as that has to be
// loaded during startup unfortunately.
PlotSquared.getInstance().config.load(PlotSquared.getInstance().configFile);
PlotSquared.getInstance().setupConfig();
PS.get().config.load(PS.get().configFile);
PS.get().setupConfig();
C.setupTranslations();
for (final String pw : PlotSquared.getInstance().getPlotWorlds()) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(pw);
plotworld.loadDefaultConfiguration(PlotSquared.getInstance().config.getConfigurationSection("worlds." + pw));
for (final String pw : PS.get().getPlotWorlds()) {
final PlotWorld plotworld = PS.get().getPlotWorld(pw);
plotworld.loadDefaultConfiguration(PS.get().config.getConfigurationSection("worlds." + pw));
}
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
} catch (final Exception e) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -58,7 +58,7 @@ public class SchematicCmd extends SubCommand {
switch (arg) {
case "paste": {
if (plr == null) {
PlotSquared.log(C.IS_CONSOLE.s());
PS.log(C.IS_CONSOLE.s());
return false;
}
if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
@ -134,7 +134,7 @@ public class SchematicCmd extends SubCommand {
SchematicHandler.manager.pasteStates(schematic, plot, 0, 0);
sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS);
SchematicCmd.this.running = false;
PlotSquared.getInstance().TASK.cancelTask(SchematicCmd.this.task);
PS.get().TASK.cancelTask(SchematicCmd.this.task);
return;
}
final int end = Math.min(start + 5000, blen);
@ -155,7 +155,7 @@ public class SchematicCmd extends SubCommand {
}
case "test": {
if (plr == null) {
PlotSquared.log(C.IS_CONSOLE.s());
PS.log(C.IS_CONSOLE.s());
return false;
}
if (!Permissions.hasPermission(plr, "plots.schematic.test")) {
@ -198,7 +198,7 @@ public class SchematicCmd extends SubCommand {
MainUtil.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>");
return false;
}
final HashMap<PlotId, Plot> plotmap = PlotSquared.getInstance().getPlots(args[1]);
final HashMap<PlotId, Plot> plotmap = PS.get().getPlots(args[1]);
if ((plotmap == null) || (plotmap.size() == 0)) {
MainUtil.sendMessage(plr, "&cInvalid world. Use &7/plots sch exportall <world>");
return false;
@ -215,8 +215,8 @@ public class SchematicCmd extends SubCommand {
return false;
}
else {
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots...");
PS.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
PS.log("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots...");
}
break;
}
@ -250,11 +250,11 @@ public class SchematicCmd extends SubCommand {
world = args[1];
final String[] split = args[2].split(";");
final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
if ((PlotSquared.getInstance().getPlots(world) == null) || (PlotSquared.getInstance().getPlots(world).get(i) == null)) {
if ((PS.get().getPlots(world) == null) || (PS.get().getPlots(world).get(i) == null)) {
MainUtil.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false;
}
p2 = PlotSquared.getInstance().getPlots(world).get(i);
p2 = PS.get().getPlots(world).get(i);
} catch (final Exception e) {
MainUtil.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.database.DBFunc;
@ -66,10 +66,10 @@ public class Set extends SubCommand {
}
}
if (args.length < 1) {
PlotManager manager = PlotSquared.getInstance().getPlotManager(loc.getWorld());
PlotManager manager = PS.get().getPlotManager(loc.getWorld());
ArrayList<String> newValues = new ArrayList<String>();
newValues.addAll(Arrays.asList(values));
newValues.addAll(Arrays.asList(manager.getPlotComponents(PlotSquared.getInstance().getPlotWorld(loc.getWorld()), plot.id)));
newValues.addAll(Arrays.asList(manager.getPlotComponents(PS.get().getPlotWorld(loc.getWorld()), plot.id)));
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
return false;
}
@ -171,7 +171,7 @@ public class Set extends SubCommand {
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
return false;
}
for (final Plot p : PlotSquared.getInstance().getPlots(plr.getLocation().getWorld()).values()) {
for (final Plot p : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false;
@ -217,8 +217,8 @@ public class Set extends SubCommand {
}
// Get components
final String world = plr.getLocation().getWorld();
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final String[] components = manager.getPlotComponents(plotworld, plot.id);
for (final String component : components) {
if (component.equalsIgnoreCase(args[0])) {
@ -308,7 +308,7 @@ public class Set extends SubCommand {
}
ArrayList<String> newValues = new ArrayList<String>();
newValues.addAll(Arrays.asList(values));
newValues.addAll(Arrays.asList(manager.getPlotComponents(PlotSquared.getInstance().getPlotWorld(loc.getWorld()), plot.id)));
newValues.addAll(Arrays.asList(manager.getPlotComponents(PS.get().getPlotWorld(loc.getWorld()), plot.id)));
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
return false;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -93,14 +93,14 @@ public class SetOwner extends SubCommand {
final String world = loc.getWorld();
for (final PlotId id : plots) {
final Plot current = PlotSquared.getInstance().getPlots(world).get(id);
final Plot current = PS.get().getPlots(world).get(id);
final UUID uuid = getUUID(args[0]);
if (uuid == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false;
}
current.owner = uuid;
PlotSquared.getInstance().updatePlot(current);
PS.get().updatePlot(current);
DBFunc.setOwner(current, current.owner);
}
MainUtil.setSign(args[0], plot);

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -55,7 +55,7 @@ public class TP extends SubCommand {
world = args[1];
}
}
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}
@ -85,14 +85,14 @@ public class TP extends SubCommand {
}
final PlotPlayer player = UUIDHandler.getPlayer(a);
if (player != null) {
final java.util.Set<Plot> plotMainPlots = PlotSquared.getInstance().getPlots(world, player);
final java.util.Set<Plot> plotMainPlots = PS.get().getPlots(world, player);
final Plot[] plots = plotMainPlots.toArray(new Plot[plotMainPlots.size()]);
if (plots.length > index) {
return plots[index];
}
return null;
}
for (final Plot p : PlotSquared.getInstance().getPlots(world).values()) {
for (final Plot p : PS.get().getPlots(world).values()) {
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
return p;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotId;
@ -35,7 +35,7 @@ public class Target extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
final Location ploc = plr.getLocation();
if (!PlotSquared.getInstance().isPlotWorld(ploc.getWorld())) {
if (!PS.get().isPlotWorld(ploc.getWorld())) {
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.object.*;
@ -48,12 +48,12 @@ public class Template extends SubCommand {
public static boolean extractAllFiles(String world, String template) {
byte[] buffer = new byte[2048];
try {
File folder = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "templates");
File folder = new File(PS.get().IMP.getDirectory() + File.separator + "templates");
if (!folder.exists()) {
return false;
}
File input = new File(folder + File.separator + template + ".template");
File output = PlotSquared.getInstance().IMP.getDirectory();
File output = PS.get().IMP.getDirectory();
if (!output.exists()) {
output.mkdirs();
}
@ -81,7 +81,7 @@ public class Template extends SubCommand {
}
public static byte[] getBytes(PlotWorld plotworld) {
ConfigurationSection section = PlotSquared.getInstance().config.getConfigurationSection("worlds." + plotworld.worldname);
ConfigurationSection section = PS.get().config.getConfigurationSection("worlds." + plotworld.worldname);
YamlConfiguration config = new YamlConfiguration();
String generator = SetupUtils.manager.getGenerator(plotworld);
if (generator != null) {
@ -94,7 +94,7 @@ public class Template extends SubCommand {
}
public static void zipAll(final String world, Set<FileBytes> files) throws IOException {
File output = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "templates");
File output = new File(PS.get().IMP.getDirectory() + File.separator + "templates");
output.mkdirs();
FileOutputStream fos = new FileOutputStream(output + File.separator + world + ".template");
ZipOutputStream zos = new ZipOutputStream(fos);
@ -131,7 +131,7 @@ public class Template extends SubCommand {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template import <world> <template>");
return false;
}
if (PlotSquared.getInstance().isPlotWorld(world)) {
if (PS.get().isPlotWorld(world)) {
MainUtil.sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
return false;
}
@ -140,12 +140,12 @@ public class Template extends SubCommand {
MainUtil.sendMessage(plr, "&cInvalid template file: " + args[2] +".template");
return false;
}
File worldFile = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "templates" + File.separator + "tmp-data.yml");
File worldFile = new File(PS.get().IMP.getDirectory() + File.separator + "templates" + File.separator + "tmp-data.yml");
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
PlotSquared.getInstance().config.set("worlds." + world, worldConfig.get(""));
PS.get().config.set("worlds." + world, worldConfig.get(""));
try {
PlotSquared.getInstance().config.save(PlotSquared.getInstance().configFile);
PlotSquared.getInstance().config.load(PlotSquared.getInstance().configFile);
PS.get().config.save(PS.get().configFile);
PS.get().config.load(PS.get().configFile);
} catch (Exception e) {
e.printStackTrace();
}
@ -180,12 +180,12 @@ public class Template extends SubCommand {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template export <world>");
return false;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (!BlockManager.manager.isWorld(world) || (plotworld == null)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.BlockManager;
@ -66,7 +66,7 @@ public class Trim extends SubCommand {
final ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (final Exception e) {
PlotSquared.log("INVALID MCA: " + name);
PS.log("INVALID MCA: " + name);
}
} else {
final Path path = Paths.get(file.getPath());
@ -83,7 +83,7 @@ public class Trim extends SubCommand {
final ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (final Exception e) {
PlotSquared.log("INVALID MCA: " + name);
PS.log("INVALID MCA: " + name);
}
}
} catch (final Exception e) {
@ -106,7 +106,7 @@ public class Trim extends SubCommand {
System.currentTimeMillis();
sendMessage("Collecting region data...");
final ArrayList<Plot> plots = new ArrayList<>();
plots.addAll(PlotSquared.getInstance().getPlots(world).values());
plots.addAll(PS.get().getPlots(world).values());
final HashSet<ChunkLoc> chunks = new HashSet<>(ChunkManager.manager.getChunkChunks(world));
sendMessage(" - MCA #: " + chunks.size());
sendMessage(" - CHUNKS: " + (chunks.size() * 1024) + " (max)");
@ -120,7 +120,7 @@ public class Trim extends SubCommand {
empty.addAll(chunks);
Trim.TASK = false;
TaskManager.runTaskAsync(whenDone);
PlotSquared.getInstance().TASK.cancelTask(Trim.TASK_ID);
PS.get().TASK.cancelTask(Trim.TASK_ID);
return;
}
final Plot plot = plots.get(0);
@ -145,7 +145,7 @@ public class Trim extends SubCommand {
}
public static void sendMessage(final String message) {
PlotSquared.log("&3PlotSquared -> World trim&8: &7" + message);
PS.log("&3PlotSquared -> World trim&8: &7" + message);
}
public PlotId getId(final String id) {
@ -187,7 +187,7 @@ public class Trim extends SubCommand {
return false;
}
final String world = args[1];
if (!BlockManager.manager.isWorld(world) || (PlotSquared.getInstance().getPlotWorld(world) == null)) {
if (!BlockManager.manager.isWorld(world) || (PS.get().getPlotWorld(world) == null)) {
MainUtil.sendMessage(plr, C.NOT_VALID_WORLD);
return false;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
@ -77,7 +77,7 @@ public class Trust extends SubCommand {
DBFunc.removeMember(loc.getWorld(), plot, uuid);
}
if (plot.denied.contains(uuid)) {
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getInstance().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
if (plot.members.size() + plot.trusted.size() >= PS.get().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
return false;
}
@ -91,7 +91,7 @@ public class Trust extends SubCommand {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getInstance().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
if (plot.members.size() + plot.trusted.size() >= PS.get().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
return false;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
@ -50,7 +50,7 @@ public class Unclaim extends SubCommand {
return !sendMessage(plr, C.NO_PLOT_PERMS);
}
assert plot != null;
final PlotWorld pWorld = PlotSquared.getInstance().getPlotWorld(plot.world);
final PlotWorld pWorld = PS.get().getPlotWorld(plot.world);
if ((EconHandler.manager != null) && pWorld.USE_ECONOMY) {
final double c = pWorld.SELL_PRICE;
if (c > 0d) {
@ -58,10 +58,10 @@ public class Unclaim extends SubCommand {
sendMessage(plr, C.ADDED_BALANCE, c + "");
}
}
final boolean result = PlotSquared.getInstance().removePlot(loc.getWorld(), plot.id, true);
final boolean result = PS.get().removePlot(loc.getWorld(), plot.id, true);
if (result) {
final String worldname = plr.getLocation().getWorld();
PlotSquared.getInstance().getPlotManager(worldname).unclaimPlot(pWorld, plot);
PS.get().getPlotManager(worldname).unclaimPlot(pWorld, plot);
DBFunc.delete(worldname, plot);
// TODO set wall block
} else {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -39,7 +39,7 @@ public class Visit extends SubCommand {
public List<Plot> getPlots(final UUID uuid) {
final List<Plot> plots = new ArrayList<>();
for (final Plot p : PlotSquared.getInstance().getPlots()) {
for (final Plot p : PS.get().getPlots()) {
if (p.hasOwner() && p.isOwner(uuid)) {
plots.add(p);
}
@ -56,10 +56,10 @@ public class Visit extends SubCommand {
UUID user = UUIDHandler.getUUID(args[0]);
if (user != null ) {
// do plots by username
plots.addAll(PlotSquared.getInstance().getPlots(user));
} else if (PlotSquared.getInstance().isPlotWorld(args[0])) {
plots.addAll(PS.get().getPlots(user));
} else if (PS.get().isPlotWorld(args[0])) {
// do plots by world
plots.addAll(PlotSquared.getInstance().getPlots(args[0]).values());
plots.addAll(PS.get().getPlots(args[0]).values());
}
else {
Plot plot = MainUtil.getPlotFromString(plr, args[0], true);

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.listeners.worldedit.WEManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -34,7 +34,7 @@ public class WE_Anywhere extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (PlotSquared.getInstance().worldEdit == null) {
if (PS.get().worldEdit == null) {
MainUtil.sendMessage(plr, "&cWorldEdit is not enabled on this server");
return false;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
@ -102,7 +102,7 @@ public class list extends SubCommand {
world = plr.getLocation().getWorld();
}
else {
Set<String> worlds = PlotSquared.getInstance().getPlotWorlds();
Set<String> worlds = PS.get().getPlotWorlds();
if (worlds.size() == 0) {
world = "world";
}
@ -121,7 +121,7 @@ public class list extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.mine");
return false;
}
plots = new ArrayList<>(PlotSquared.getInstance().getPlots(plr));
plots = new ArrayList<>(PS.get().getPlots(plr));
break;
}
case "shared": {
@ -133,7 +133,7 @@ public class list extends SubCommand {
return false;
}
plots = new ArrayList<Plot>();
for (Plot plot : PlotSquared.getInstance().getPlots()) {
for (Plot plot : PS.get().getPlots()) {
if (plot.trusted.contains(plr.getUUID()) || plot.members.contains(plr.getUUID())) {
plots.add(plot);
}
@ -149,7 +149,7 @@ public class list extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + world);
return false;
}
plots = new ArrayList<>(PlotSquared.getInstance().getPlots(world).values());
plots = new ArrayList<>(PS.get().getPlots(world).values());
break;
}
case "all": {
@ -157,7 +157,7 @@ public class list extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.all");
return false;
}
plots = new ArrayList<>(PlotSquared.getInstance().getPlots());
plots = new ArrayList<>(PS.get().getPlots());
break;
}
case "top": {
@ -165,7 +165,7 @@ public class list extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.top");
return false;
}
plots = new ArrayList<>(PlotSquared.getInstance().getPlots());
plots = new ArrayList<>(PS.get().getPlots());
Collections.sort(plots, new Comparator<Plot>() {
@Override
public int compare(Plot p1, Plot p2) {
@ -203,7 +203,7 @@ public class list extends SubCommand {
break;
}
plots = new ArrayList<>();
for (Plot plot : PlotSquared.getInstance().getPlots()) {
for (Plot plot : PS.get().getPlots()) {
final Flag price = FlagManager.getPlotFlag(plot, "price");
if (price != null) {
plots.add(plot);
@ -217,7 +217,7 @@ public class list extends SubCommand {
return false;
}
plots = new ArrayList<>();
for (Plot plot : PlotSquared.getInstance().getPlots()) {
for (Plot plot : PS.get().getPlots()) {
if (plot.owner == null) {
plots.add(plot);
}
@ -230,7 +230,7 @@ public class list extends SubCommand {
return false;
}
plots = new ArrayList<>();
for (Plot plot : PlotSquared.getInstance().getPlots()) {
for (Plot plot : PS.get().getPlots()) {
if (plot.owner == null) {
continue;
}
@ -241,7 +241,7 @@ public class list extends SubCommand {
break;
}
default: {
if (PlotSquared.getInstance().isPlotWorld(args[0])) {
if (PS.get().isPlotWorld(args[0])) {
if (!Permissions.hasPermission(plr, "plots.list.world")) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world");
return false;
@ -250,7 +250,7 @@ public class list extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + args[0]);
return false;
}
plots = new ArrayList<>(PlotSquared.getInstance().getPlots(args[0]).values());
plots = new ArrayList<>(PS.get().getPlots(args[0]).values());
break;
}
UUID uuid = UUIDHandler.getUUID(args[0]);
@ -259,7 +259,7 @@ public class list extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.player");
return false;
}
plots = new ArrayList<>(PlotSquared.getInstance().getPlots(uuid));
plots = new ArrayList<>(PS.get().getPlots(uuid));
break;
}
}
@ -281,10 +281,10 @@ public class list extends SubCommand {
public void displayPlots(PlotPlayer player, List<Plot> plots, int pageSize, int page, String world, String[] args, boolean sort) {
if (sort) {
if (world != null) {
plots = PlotSquared.getInstance().sortPlots(plots, world);
plots = PS.get().sortPlots(plots, world);
}
else {
plots = PlotSquared.getInstance().sortPlots(plots);
plots = PS.get().sortPlots(plots);
}
}
if (page < 0) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
@ -93,7 +93,7 @@ public class plugin extends SubCommand {
public void run() {
final ArrayList<String> strings = new ArrayList<String>() {
{
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotSquared.getInstance().IMP.getVersion()));
add(String.format("&c>> &6PlotSquared (Version: %s)", PS.get().IMP.getVersion()));
add(String.format("&c>> &6Made by Citymonstret and Empire92"));
add(String.format("&c>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
add(String.format("&c>> &cNewest Version (Spigot): %s", version));

View File

@ -24,7 +24,7 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
/**
* Abstract Database class, serves as a base for any connection method (MySQL, SQLite, etc.)
@ -36,14 +36,14 @@ public abstract class Database {
/**
* Plugin instance, use for plugin.getDataFolder()
*/
protected final PlotSquared plotsquared;
protected final PS plotsquared;
/**
* Creates a new Database
*
* @param plotsquared Plugin instance
*/
protected Database(final PlotSquared plotsquared) {
protected Database(final PS plotsquared) {
this.plotsquared = plotsquared;
}

View File

@ -26,7 +26,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
/**
* Connects to and uses a MySQL database
@ -51,7 +51,7 @@ public class MySQL extends Database {
* @param username Username
* @param password Password
*/
public MySQL(final PlotSquared plotsquared, final String hostname, final String port, final String database, final String username, final String password) {
public MySQL(final PS plotsquared, final String hostname, final String port, final String database, final String username, final String password) {
super(plotsquared);
this.hostname = hostname;
this.port = port;

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
@ -76,7 +76,7 @@ public class SQLManager implements AbstractDB {
@Override
public void run() {
try {
SQLManager.this.connection = PlotSquared.getInstance().getDatabase().forceConnection();
SQLManager.this.connection = PS.get().getDatabase().forceConnection();
} catch (Exception e) {
e.printStackTrace();
}
@ -111,7 +111,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Could not set owner for plot " + plot.id);
PS.log("&c[ERROR] " + "Could not set owner for plot " + plot.id);
}
}
});
@ -171,7 +171,7 @@ public class SQLManager implements AbstractDB {
TaskManager.runTaskLater(whenDone, 60);
} catch (SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to set all helpers for plots");
PS.log("&7[WARN] " + "Failed to set all helpers for plots");
}
}
});
@ -322,7 +322,7 @@ public class SQLManager implements AbstractDB {
last = subList.size();
preparedStmt.addBatch();
}
PlotSquared.log("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
PS.log("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
@ -330,7 +330,7 @@ public class SQLManager implements AbstractDB {
} catch (Exception e) {
if (Settings.DB.USE_MYSQL) {
e.printStackTrace();
PlotSquared.log("&cERROR 1: " + " | " + objList.get(0).getClass().getCanonicalName());
PS.log("&cERROR 1: " + " | " + objList.get(0).getClass().getCanonicalName());
}
}
try {
@ -363,17 +363,17 @@ public class SQLManager implements AbstractDB {
last = subList.size();
preparedStmt.addBatch();
}
PlotSquared.log("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
PS.log("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
return;
} catch (Exception e) {
e.printStackTrace();
PlotSquared.log("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName());
PS.log("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName());
}
PlotSquared.log("&6[WARN] " + "Could not bulk save!");
PS.log("&6[WARN] " + "Could not bulk save!");
try {
PreparedStatement preparedStmt = null;
String nonBulk = mod.getCreateSQL();
@ -383,15 +383,15 @@ public class SQLManager implements AbstractDB {
mod.setSQL(preparedStmt, obj);
preparedStmt.addBatch();
} catch (final Exception e3) {
PlotSquared.log("&c[ERROR] " + "Failed to save " + obj + "!");
PS.log("&c[ERROR] " + "Failed to save " + obj + "!");
}
}
PlotSquared.log("&aBatch 3");
PS.log("&aBatch 3");
preparedStmt.executeBatch();
preparedStmt.close();
} catch (Exception e3) {
e3.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Failed to save all!");
PS.log("&c[ERROR] " + "Failed to save all!");
}
}
@ -581,7 +581,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final Exception e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Failed to save plot " + plot.id);
PS.log("&c[ERROR] " + "Failed to save plot " + plot.id);
}
}
});
@ -608,7 +608,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final Exception e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Failed to save plot " + plot.id);
PS.log("&c[ERROR] " + "Failed to save plot " + plot.id);
}
}
});
@ -641,7 +641,7 @@ public class SQLManager implements AbstractDB {
}
boolean add_constraint;
add_constraint = create == tables.length;
PlotSquared.log("Creating tables");
PS.log("Creating tables");
final boolean mysql = database.equals("mysql");
final Statement stmt = this.connection.createStatement();
if (mysql) {
@ -684,7 +684,7 @@ public class SQLManager implements AbstractDB {
*/
@Override
public void delete(final String world, final Plot plot) {
PlotSquared.getInstance().removePlot(world, plot.id, false);
PS.get().removePlot(world, plot.id, false);
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@ -717,7 +717,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Failed to delete plot " + plot.id);
PS.log("&c[ERROR] " + "Failed to delete plot " + plot.id);
}
}
});
@ -814,8 +814,8 @@ public class SQLManager implements AbstractDB {
Statement stmt = null;
try {
Set<String> worlds = new HashSet<>();
if (PlotSquared.getInstance().config.contains("worlds")) {
worlds = PlotSquared.getInstance().config.getConfigurationSection("worlds").getKeys(false);
if (PS.get().config.contains("worlds")) {
worlds = PS.get().config.getConfigurationSection("worlds").getKeys(false);
}
final HashMap<String, UUID> uuids = new HashMap<String, UUID>();
final HashMap<String, Integer> noExist = new HashMap<String, Integer>();
@ -867,7 +867,7 @@ public class SQLManager implements AbstractDB {
}
plot.settings.ratings.put(user, r.getInt("rating"));
} else {
PlotSquared.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
PS.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
}
}
}
@ -888,7 +888,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) {
plot.addTrusted(user);
} else {
PlotSquared.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
PS.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
}
}
/*
@ -907,7 +907,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) {
plot.addMember(user);
} else {
PlotSquared.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
PS.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
}
}
/*
@ -926,7 +926,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) {
plot.addDenied(user);
} else {
PlotSquared.log("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
PS.log("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
}
}
r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "plot_settings`");
@ -1004,18 +1004,18 @@ public class SQLManager implements AbstractDB {
Flag flag = new Flag(FlagManager.getFlag(element, true), "");
flags.put(flag.getKey(), flag);
} else {
PlotSquared.log("INVALID FLAG: " + element);
PS.log("INVALID FLAG: " + element);
}
}
}
if (exception) {
PlotSquared.log("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
PlotSquared.log("&c" + myflags);
PS.log("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
PS.log("&c" + myflags);
setFlags(id, flags.values());
}
plot.settings.flags = flags;
} else {
PlotSquared.log("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
PS.log("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
}
}
stmt.close();
@ -1026,13 +1026,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false;
for (final String worldname : noExist.keySet()) {
invalidPlot = true;
PlotSquared.log("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
PS.log("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
}
if (invalidPlot) {
PlotSquared.log("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
PS.log("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
}
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to load plots.");
PS.log("&7[WARN] " + "Failed to load plots.");
e.printStackTrace();
}
return newplots;
@ -1056,7 +1056,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Could not set merged for plot " + plot.id);
PS.log("&7[WARN] " + "Could not set merged for plot " + plot.id);
}
}
});
@ -1139,7 +1139,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Could not set flag for plot " + plot.id);
PS.log("&7[WARN] " + "Could not set flag for plot " + plot.id);
}
}
});
@ -1158,7 +1158,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Could not set flag for plot " + id);
PS.log("&7[WARN] " + "Could not set flag for plot " + id);
}
}
});
@ -1178,7 +1178,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set alias for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set alias for plot " + plot.id);
e.printStackTrace();
}
}
@ -1221,11 +1221,11 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
PS.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
return;
}
}
PlotSquared.log("&6[INFO] " + "SUCCESSFULLY PURGED WORLD '" + world + "'!");
PS.log("&6[INFO] " + "SUCCESSFULLY PURGED WORLD '" + world + "'!");
}
@Override
@ -1250,11 +1250,11 @@ public class SQLManager implements AbstractDB {
PlotId plotId = iter.next();
iter.remove();
PlotId id = new PlotId(plotId.x, plotId.y);
PlotSquared.getInstance().removePlot(world, new PlotId(id.x, id.y), true);
PS.get().removePlot(world, new PlotId(id.x, id.y), true);
}
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
PS.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
}
}
@ -1271,7 +1271,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set position for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set position for plot " + plot.id);
e.printStackTrace();
}
}
@ -1320,7 +1320,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
r.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to load settings for plot: " + id);
PS.log("&7[WARN] " + "Failed to load settings for plot: " + id);
e.printStackTrace();
}
return h;
@ -1350,7 +1350,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
}
}
});
@ -1376,7 +1376,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
}
}
});
@ -1421,7 +1421,7 @@ public class SQLManager implements AbstractDB {
statement.close();
set.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to fetch comment");
PS.log("&7[WARN] " + "Failed to fetch comment");
e.printStackTrace();
}
}
@ -1445,7 +1445,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to set comment for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set comment for plot " + plot.id);
}
}
});
@ -1464,7 +1464,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove helper for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to remove helper for plot " + plot.id);
}
}
});
@ -1483,7 +1483,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove trusted user for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to remove trusted user for plot " + plot.id);
}
}
});
@ -1501,7 +1501,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set helper for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set helper for plot " + plot.id);
e.printStackTrace();
}
}
@ -1519,7 +1519,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set helper for id " + id);
PS.log("&7[WARN] " + "Failed to set helper for id " + id);
e.printStackTrace();
}
}
@ -1538,7 +1538,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set plot trusted for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set plot trusted for plot " + plot.id);
e.printStackTrace();
}
}
@ -1558,7 +1558,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove denied for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to remove denied for plot " + plot.id);
}
}
});
@ -1576,7 +1576,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
e.printStackTrace();
}
}
@ -1598,7 +1598,7 @@ public class SQLManager implements AbstractDB {
statement.close();
set.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to fetch rating for plot " + plot.getId().toString());
PS.log("&7[WARN] " + "Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace();
}
return map;
@ -1617,7 +1617,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
PS.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
e.printStackTrace();
}
}
@ -1649,7 +1649,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2());
PS.log("&c[ERROR] " + "Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2());
}
}
});
@ -1686,8 +1686,8 @@ public class SQLManager implements AbstractDB {
Statement stmt = null;
try {
Set<String> worlds = new HashSet<>();
if (PlotSquared.getInstance().config.contains("worlds")) {
worlds = PlotSquared.getInstance().config.getConfigurationSection("worlds").getKeys(false);
if (PS.get().config.contains("worlds")) {
worlds = PS.get().config.getConfigurationSection("worlds").getKeys(false);
}
final HashMap<String, UUID> uuids = new HashMap<String, UUID>();
final HashMap<String, Integer> noExist = new HashMap<String, Integer>();
@ -1740,7 +1740,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.helpers.add(user);
} else {
PlotSquared.log("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry.");
PS.log("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry.");
}
}
/*
@ -1759,7 +1759,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.invited.add(user);
} else {
PlotSquared.log("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry.");
PS.log("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry.");
}
}
r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`");
@ -1834,12 +1834,12 @@ public class SQLManager implements AbstractDB {
}
}
if (exception) {
PlotSquared.log("&cCluster " + id + " had an invalid flag. A fix has been attempted.");
PlotSquared.log("&c" + myflags);
PS.log("&cCluster " + id + " had an invalid flag. A fix has been attempted.");
PS.log("&c" + myflags);
}
cluster.settings.flags = flags;
} else {
PlotSquared.log("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
PS.log("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
}
}
stmt.close();
@ -1854,13 +1854,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false;
for (final String w : noExist.keySet()) {
invalidPlot = true;
PlotSquared.log("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'.");
PS.log("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'.");
}
if (invalidPlot) {
PlotSquared.log("&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
PS.log("&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
}
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to load clusters.");
PS.log("&7[WARN] " + "Failed to load clusters.");
e.printStackTrace();
}
return newClusters;
@ -1888,7 +1888,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Could not set flag for plot " + cluster);
PS.log("&7[WARN] " + "Could not set flag for plot " + cluster);
}
}
});
@ -1908,7 +1908,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set alias for cluster " + cluster);
PS.log("&7[WARN] " + "Failed to set alias for cluster " + cluster);
e.printStackTrace();
}
}
@ -1928,7 +1928,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove helper for cluster " + cluster);
PS.log("&7[WARN] " + "Failed to remove helper for cluster " + cluster);
}
}
});
@ -1946,7 +1946,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set helper for cluster " + cluster);
PS.log("&7[WARN] " + "Failed to set helper for cluster " + cluster);
e.printStackTrace();
}
}
@ -1977,7 +1977,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final Exception e) {
e.printStackTrace();
PlotSquared.log("&c[ERROR] " + "Failed to save cluster " + cluster);
PS.log("&c[ERROR] " + "Failed to save cluster " + cluster);
}
}
});
@ -2003,7 +2003,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to rezize cluster " + current);
PS.log("&7[WARN] " + "Failed to rezize cluster " + current);
e.printStackTrace();
}
}
@ -2023,7 +2023,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set position for cluster " + cluster);
PS.log("&7[WARN] " + "Failed to set position for cluster " + cluster);
e.printStackTrace();
}
}
@ -2072,7 +2072,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
r.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to load settings for cluster: " + id);
PS.log("&7[WARN] " + "Failed to load settings for cluster: " + id);
e.printStackTrace();
}
return h;
@ -2091,7 +2091,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotSquared.log("&7[WARN] " + "Failed to remove invited for cluster " + cluster);
PS.log("&7[WARN] " + "Failed to remove invited for cluster " + cluster);
}
}
});
@ -2109,7 +2109,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set helper for cluster " + cluster);
PS.log("&7[WARN] " + "Failed to set helper for cluster " + cluster);
e.printStackTrace();
}
}
@ -2120,7 +2120,7 @@ public class SQLManager implements AbstractDB {
public boolean deleteTables() {
try {
SQLManager.this.connection.close();
SQLManager.this.connection = PlotSquared.getInstance().getDatabase().forceConnection();
SQLManager.this.connection = PS.get().getDatabase().forceConnection();
final Statement stmt = this.connection.createStatement();
stmt.addBatch("DROP TABLE `" + prefix + "cluster_invited`");
stmt.addBatch("DROP TABLE `" + prefix + "cluster_helpers`");

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import java.io.File;
import java.io.IOException;
@ -41,7 +41,7 @@ public class SQLite extends Database {
*
* @param dbLocation Location of the Database (Must end in .db)
*/
public SQLite(final PlotSquared plotsquared, final String dbLocation) {
public SQLite(final PS plotsquared, final String dbLocation) {
super(plotsquared);
this.dbLocation = dbLocation;
}
@ -51,15 +51,15 @@ public class SQLite extends Database {
if (checkConnection()) {
return this.connection;
}
if (!PlotSquared.getInstance().IMP.getDirectory().exists()) {
PlotSquared.getInstance().IMP.getDirectory().mkdirs();
if (!PS.get().IMP.getDirectory().exists()) {
PS.get().IMP.getDirectory().mkdirs();
}
final File file = new File(this.dbLocation);
if (!(file.exists())) {
try {
file.createNewFile();
} catch (final IOException e) {
PlotSquared.log("&cUnable to create database!");
PS.log("&cUnable to create database!");
}
}
Class.forName("org.sqlite.JDBC");

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.database.plotme;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.object.Location;
@ -44,7 +44,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
return DriverManager.getConnection(con, user, password);
// return new MySQL(plotsquared, hostname, port, database, username, password)
} else {
return new SQLite(PlotSquared.getInstance(), dataFolder + File.separator + "plots.db").openConnection();
return new SQLite(PS.get(), dataFolder + File.separator + "plots.db").openConnection();
}
}
catch (SQLException | ClassNotFoundException e) {}
@ -112,8 +112,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
final String name = r.getString("owner");
final String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) {
int plot = PlotSquared.getInstance().config.getInt("worlds." + world + ".plot.size");
int path = PlotSquared.getInstance().config.getInt("worlds." + world + ".road.width");
int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
int path = PS.get().config.getInt("worlds." + world + ".road.width");
if (plot == 0 && path == 0) {
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database.plotme;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.generator.HybridGen;
@ -75,7 +75,7 @@ public class LikePlotMeConverter {
}
private void sendMessage(final String message) {
PlotSquared.log("&3PlotMe&8->&3PlotSquared&8: &7" + message);
PS.log("&3PlotMe&8->&3PlotSquared&8: &7" + message);
}
public String getPlotMePath() {
@ -150,23 +150,23 @@ public class LikePlotMeConverter {
try {
String actualWorldName = getWorld(world);
final Integer pathwidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".road.width", pathwidth);
PS.get().config.set("worlds." + actualWorldName + ".road.width", pathwidth);
final Integer plotsize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".plot.size", plotsize);
PS.get().config.set("worlds." + actualWorldName + ".plot.size", plotsize);
final String wallblock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".wall.block", wallblock);
PS.get().config.set("worlds." + actualWorldName + ".wall.block", wallblock);
final String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
PS.get().config.set("worlds." + actualWorldName + ".plot.floor", Arrays.asList(floor));
final String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
PS.get().config.set("worlds." + actualWorldName + ".plot.filling", Arrays.asList(filling));
final String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".road.block", road);
PS.get().config.set("worlds." + actualWorldName + ".road.block", road);
Integer height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
if (height == null) {
height = 64;
}
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".road.height", height);
PlotSquared.getInstance().config.save(PlotSquared.getInstance().configFile);
PS.get().config.set("worlds." + actualWorldName + ".road.height", height);
PS.get().config.save(PS.get().configFile);
} catch (final Exception e) {
sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually");
}
@ -194,32 +194,32 @@ public class LikePlotMeConverter {
if (pathwidth == null) {
pathwidth = 7;
}
PlotSquared.getInstance().config.set("worlds." + world + ".road.width", pathwidth);
PS.get().config.set("worlds." + world + ".road.width", pathwidth);
Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
if (plotsize == null) {
plotsize = 32;
}
PlotSquared.getInstance().config.set("worlds." + world + ".plot.size", plotsize);
PS.get().config.set("worlds." + world + ".plot.size", plotsize);
String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); //
if (wallblock == null) {
wallblock = "44";
}
PlotSquared.getInstance().config.set("worlds." + world + ".wall.block", wallblock);
PS.get().config.set("worlds." + world + ".wall.block", wallblock);
String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); //
if (floor == null) {
floor = "2";
}
PlotSquared.getInstance().config.set("worlds." + world + ".plot.floor", Arrays.asList(floor));
PS.get().config.set("worlds." + world + ".plot.floor", Arrays.asList(floor));
String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); //
if (filling == null) {
filling = "3";
}
PlotSquared.getInstance().config.set("worlds." + world + ".plot.filling", Arrays.asList(filling));
PS.get().config.set("worlds." + world + ".plot.filling", Arrays.asList(filling));
String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock");
if (road == null) {
road = "5";
}
PlotSquared.getInstance().config.set("worlds." + world + ".road.block", road);
PS.get().config.set("worlds." + world + ".road.block", road);
Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if ((height == null) || (height == 0)) {
height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".GroundHeight"); //
@ -227,10 +227,10 @@ public class LikePlotMeConverter {
height = 64;
}
}
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".road.height", height);
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".plot.height", height);
PlotSquared.getInstance().config.set("worlds." + actualWorldName + ".wall.height", height);
PlotSquared.getInstance().config.save(PlotSquared.getInstance().configFile);
PS.get().config.set("worlds." + actualWorldName + ".road.height", height);
PS.get().config.set("worlds." + actualWorldName + ".plot.height", height);
PS.get().config.set("worlds." + actualWorldName + ".wall.height", height);
PS.get().config.save(PS.get().configFile);
}
} catch (final Exception e) {
}
@ -238,14 +238,14 @@ public class LikePlotMeConverter {
for (final String world : plots.keySet()) {
int duplicate = 0;
for (final Plot plot : plots.get(world).values()) {
if (!PlotSquared.getInstance().getPlots(world).containsKey(plot.id)) {
if (!PS.get().getPlots(world).containsKey(plot.id)) {
createdPlots.add(plot);
} else {
duplicate++;
}
}
if (duplicate > 0) {
PlotSquared.log("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?");
PS.log("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?");
}
}
sendMessage("Creating plot DB");
@ -254,16 +254,16 @@ public class LikePlotMeConverter {
@Override
public void run() {
sendMessage("&aDatabase conversion is now complete!");
PlotSquared.log("&c - Stop the server");
PlotSquared.log("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
PlotSquared.log("&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
PlotSquared.log("&c - Start the server");
PlotSquared.getInstance().setAllPlotsRaw(DBFunc.getPlots());
PS.log("&c - Stop the server");
PS.log("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
PS.log("&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
PS.log("&c - Start the server");
PS.get().setAllPlotsRaw(DBFunc.getPlots());
}
});
sendMessage("Saving configuration...");
try {
PlotSquared.getInstance().config.save(PlotSquared.getInstance().configFile);
PS.get().config.save(PS.get().configFile);
} catch (final IOException e) {
sendMessage(" - &cFailed to save configuration.");
}
@ -285,7 +285,7 @@ public class LikePlotMeConverter {
}
final String actualWorldName = world.getName();
sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
PlotSquared.getInstance().removePlotWorld(actualWorldName);
PS.get().removePlotWorld(actualWorldName);
if (MV) {
// unload world with MV
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName);
@ -321,7 +321,7 @@ public class LikePlotMeConverter {
}
});
} catch (final Exception e) {
PlotSquared.log("&/end/");
PS.log("&/end/");
}
return true;
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.flag;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*;
@ -90,15 +90,15 @@ public class FlagManager {
}
public static boolean addFlag(AbstractFlag af, boolean reserved) {
PlotSquared.log(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
for (PlotWorld plotworld : PlotSquared.getInstance().getPlotWorldObjects()) {
PS.log(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
for (PlotWorld plotworld : PS.get().getPlotWorldObjects()) {
Flag flag = ((HashMap<String, Flag>) plotworld.DEFAULT_FLAGS.clone()).get(af.getKey());
if (flag != null) {
flag.setKey(af);
}
}
if (PlotSquared.getInstance().getAllPlotsRaw() != null) {
for (final Plot plot : PlotSquared.getInstance().getPlotsRaw()) {
if (PS.get().getAllPlotsRaw() != null) {
for (final Plot plot : PS.get().getPlotsRaw()) {
Flag flag = plot.settings.flags.get(af.getKey());
if (flag != null) {
flag.setKey(af);
@ -115,7 +115,7 @@ public class FlagManager {
public static Flag getSettingFlag(final String world, final PlotSettings settings, final String id) {
Flag flag = settings.flags.get(id);
if (flag == null) {
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
PlotWorld plotworld = PS.get().getPlotWorld(world);
if (plotworld == null) {
return null;
}
@ -227,7 +227,7 @@ public class FlagManager {
}
public static Collection<Flag> getSettingFlags(final String world, final PlotSettings settings) {
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
PlotWorld plotworld = PS.get().getPlotWorld(world);
HashMap<String, Flag> map;
if (plotworld == null) {
map = new HashMap<>();

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.TaskManager;
@ -38,7 +38,7 @@ public class AugmentedPopulator extends BlockPopulator {
initCache();
this.cluster = cluster;
this.generator = generator;
this.plotworld = PlotSquared.getInstance().getPlotWorld(world);
this.plotworld = PS.get().getPlotWorld(world);
this.manager = generator.getPlotManager();
this.p = p;
this.b = b;

View File

@ -1,7 +1,7 @@
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.ChunkManager;
@ -233,7 +233,7 @@ public class BukkitHybridUtils extends HybridUtils {
public void run() {
int index = chunks.size() - 1;
if (index == -1) {
PlotSquared.getInstance().TASK.cancelTask(TaskManager.tasks.get(currentIndex));
PS.get().TASK.cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.runTaskAsync(run);
return;
}
@ -288,7 +288,7 @@ public class BukkitHybridUtils extends HybridUtils {
chunks.add(world.getChunkAt(X,Z));
}
}
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(plot.world);
PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
if (!(plotworld instanceof ClassicPlotWorld)) {
whenDone.value = -1;
TaskManager.runTaskLater(whenDone, 1);
@ -426,11 +426,11 @@ public class BukkitHybridUtils extends HybridUtils {
public void run() {
count.increment();
if (count.intValue() % 20 == 0) {
PlotSquared.log("PROGRESS: " + ((100 * (2048 - chunks.size())) / 2048) + "%");
PS.log("PROGRESS: " + ((100 * (2048 - chunks.size())) / 2048) + "%");
}
if (regions.size() == 0 && chunks.size() == 0) {
BukkitHybridUtils.UPDATE = false;
PlotSquared.log(C.PREFIX.s() + "Finished road conversion");
PS.log(C.PREFIX.s() + "Finished road conversion");
Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task);
return;
} else {
@ -438,8 +438,8 @@ public class BukkitHybridUtils extends HybridUtils {
if (chunks.size() < 1024) {
if (regions.size() > 0) {
final ChunkLoc loc = regions.get(0);
PlotSquared.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
PlotSquared.log(" - Remaining: " + regions.size());
PS.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
PS.log(" - Remaining: " + regions.size());
chunks.addAll(getChunks(loc));
regions.remove(0);
System.gc();
@ -449,7 +449,7 @@ public class BukkitHybridUtils extends HybridUtils {
long diff = System.currentTimeMillis() + 25;
if (System.currentTimeMillis() - last > 1200 && last != 0) {
last = 0;
PlotSquared.log(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
PS.log(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
while (chunks.size() > 0) {
ChunkLoc chunk = chunks.get(0);
chunks.remove(0);
@ -478,7 +478,7 @@ public class BukkitHybridUtils extends HybridUtils {
} catch (final Exception e) {
e.printStackTrace();
final ChunkLoc loc = regions.get(0);
PlotSquared.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
PS.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
final int sx = loc.x << 5;
final int sz = loc.z << 5;
for (int x = sx; x < (sx + 32); x++) {
@ -486,8 +486,8 @@ public class BukkitHybridUtils extends HybridUtils {
ChunkManager.manager.unloadChunk(world, new ChunkLoc(x, z));
}
}
PlotSquared.log("&d - Potentially skipping 1024 chunks");
PlotSquared.log("&d - TODO: recommend chunkster if corrupt");
PS.log("&d - Potentially skipping 1024 chunks");
PS.log("&d - TODO: recommend chunkster if corrupt");
}
}
}

View File

@ -3,7 +3,7 @@ package com.intellectualcrafters.plot.generator;
import org.apache.commons.lang.StringUtils;
import org.bukkit.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.object.PlotBlock;
@ -49,7 +49,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
@Override
public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) {
PlotSquared.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
PS.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
}
this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.Template;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.MainUtil;
@ -40,7 +40,7 @@ public class HybridPlotManager extends ClassicPlotManager {
@Override
public void exportTemplate(final PlotWorld plotworld) throws IOException {
final HashSet<FileBytes> files = new HashSet<>(Arrays.asList(new FileBytes("templates/" + "tmp-data.yml", Template.getBytes(plotworld))));
final String psRoot = PlotSquared.getInstance().IMP.getDirectory() + File.separator;
final String psRoot = PS.get().IMP.getDirectory() + File.separator;
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotworld.worldname + File.separator;
final String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
try {

View File

@ -27,7 +27,7 @@ import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import org.bukkit.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.object.PlotBlock;
@ -64,7 +64,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
@Override
public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) {
PlotSquared.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
PS.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
}
this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));
@ -88,7 +88,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
try {
setupSchematics();
} catch (final Exception e) {
PlotSquared.log("&c - road schematics are disabled for this world.");
PS.log("&c - road schematics are disabled for this world.");
}
}
@ -152,7 +152,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
}
if ((schem1 == null) || (schem2 == null) || (this.ROAD_WIDTH == 0)) {
PlotSquared.log(C.PREFIX.s() + "&3 - schematic: &7false");
PS.log(C.PREFIX.s() + "&3 - schematic: &7false");
return;
}
this.ROAD_SCHEMATIC_ENABLED = true;

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.intellectualcrafters.plot.util.BlockManager;
@ -106,7 +106,7 @@ public class HybridPop extends PlotPopulator {
@Override
public void populate(World world, RegionWrapper requiredRegion, PseudoRandom random, int cx, int cz) {
PlotSquared.getInstance().getPlotManager(world.getName());
PS.get().getPlotManager(world.getName());
int sx = (short) ((this.X) % this.size);
int sz = (short) ((this.Z) % this.size);

View File

@ -1,7 +1,7 @@
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ChunkManager;
@ -25,7 +25,7 @@ public abstract class HybridUtils {
final String world = plot.world;
final Location bot = MainUtil.getPlotBottomLoc(world, plot.id);
final Location top = MainUtil.getPlotTopLoc(world, plot.id);
final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getInstance().getPlotWorld(world);
final HybridPlotWorld plotworld = (HybridPlotWorld) PS.get().getPlotWorld(world);
final int sx = (bot.getX() - plotworld.ROAD_WIDTH) + 1;
final int sz = bot.getZ() + 1;
final int sy = plotworld.ROAD_HEIGHT;
@ -44,7 +44,7 @@ public abstract class HybridUtils {
final Location pos4 = new Location(world, tx, ty, tz);
final CompoundTag sideroad = SchematicHandler.manager.getCompoundTag(world, pos1, pos2);
final CompoundTag intersection = SchematicHandler.manager.getCompoundTag(world, pos3, pos4);
final String dir = PlotSquared.getInstance().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.world + File.separator;
final String dir = PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.world + File.separator;
SchematicHandler.manager.save(sideroad, dir + "sideroad.schematic");
SchematicHandler.manager.save(intersection, dir + "intersection.schematic");
plotworld.ROAD_SCHEMATIC_ENABLED = true;
@ -61,7 +61,7 @@ public abstract class HybridUtils {
final int z = chunk.z << 4;
final int ex = x + 15;
final int ez = z + 15;
final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getInstance().getPlotWorld(world);
final HybridPlotWorld plotworld = (HybridPlotWorld) PS.get().getPlotWorld(world);
extend = Math.min(extend, 255 - plotworld.ROAD_HEIGHT - plotworld.SCHEMATIC_HEIGHT);
if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
return false;
@ -77,7 +77,7 @@ public abstract class HybridUtils {
toCheck = c1 ^ c2;
}
}
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotId id1 = manager.getPlotId(plotworld, x, 0, z);
final PlotId id2 = manager.getPlotId(plotworld, ex, 0, ez);
if ((id1 == null) || (id2 == null) || (id1 != id2)) {

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
@ -122,7 +122,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
// This means you are in the intersection
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z + dpw.ROAD_WIDTH);
final PlotId id = MainUtil.getPlotAbs(loc);
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
final Plot plot = PS.get().getPlots(plotworld.worldname).get(id);
if (plot == null) {
return null;
}
@ -135,7 +135,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
// You are on a road running West to East (yeah, I named the var poorly)
final Location loc = new Location(plotworld.worldname, x, 0, z + dpw.ROAD_WIDTH);
final PlotId id = MainUtil.getPlotAbs(loc);
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
final Plot plot = PS.get().getPlots(plotworld.worldname).get(id);
if (plot == null) {
return null;
}
@ -148,7 +148,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
// This is the road separating an Eastern and Western plot
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z);
final PlotId id = MainUtil.getPlotAbs(loc);
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
final Plot plot = PS.get().getPlots(plotworld.worldname).get(id);
if (plot == null) {
return null;
}
@ -158,7 +158,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
return null;
}
final PlotId id = new PlotId(dx, dz);
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
final Plot plot = PS.get().getPlots(plotworld.worldname).get(id);
if (plot == null) {
return id;
}

View File

@ -2,7 +2,7 @@ package com.intellectualcrafters.plot.generator;
import org.bukkit.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
public abstract class SquarePlotWorld extends GridPlotWorld {
public static int PLOT_WIDTH_DEFAULT = 42;
@ -13,7 +13,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override
public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) {
PlotSquared.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
PS.log(" - &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.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.util.TaskManager;
import org.bukkit.Bukkit;
@ -47,7 +47,7 @@ public class ChunkListener implements Listener {
event.setCancelled(true);
return;
}
if (!PlotSquared.getInstance().isPlotWorld(chunk.getWorld().getName())) {
if (!PS.get().isPlotWorld(chunk.getWorld().getName())) {
return;
}
Entity[] entities = chunk.getEntities();
@ -85,7 +85,7 @@ public class ChunkListener implements Listener {
event.setCancelled(true);
return;
}
if (!PlotSquared.getInstance().isPlotWorld(chunk.getWorld().getName())) {
if (!PS.get().isPlotWorld(chunk.getWorld().getName())) {
return;
}
Entity[] entities = chunk.getEntities();
@ -108,7 +108,7 @@ public class ChunkListener implements Listener {
if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
PS.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@ -116,7 +116,7 @@ public class ChunkListener implements Listener {
if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
PS.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@ -126,7 +126,7 @@ public class ChunkListener implements Listener {
if (i >= tiles.length) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
PS.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@ -139,7 +139,7 @@ public class ChunkListener implements Listener {
}
public boolean processChunk(Chunk chunk, boolean unload) {
if (!PlotSquared.getInstance().isPlotWorld(chunk.getWorld().getName())) {
if (!PS.get().isPlotWorld(chunk.getWorld().getName())) {
return false;
}
Entity[] entities = chunk.getEntities();
@ -150,11 +150,11 @@ public class ChunkListener implements Listener {
ent.remove();
}
}
PlotSquared.log("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
PS.log("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
}
if (tiles.length > Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES) {
if (unload) {
PlotSquared.log("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
PS.log("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
cleanChunk(chunk);
return true;
}

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -81,7 +81,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onRedstoneEvent(BlockRedstoneEvent event) {
Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation());
if (!PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (!PS.get().isPlotWorld(loc.getWorld())) {
return;
}
Plot plot = MainUtil.getPlot(loc);
@ -144,7 +144,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onPhysicsEvent(BlockPhysicsEvent event) {
Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation());
if (!PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (!PS.get().isPlotWorld(loc.getWorld())) {
return;
}
switch (block.getType()) {
@ -180,7 +180,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onProjectileHit(ProjectileHitEvent event) {
Projectile entity = event.getEntity();
Location loc = BukkitUtil.getLocation(entity);
if (!PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (!PS.get().isPlotWorld(loc.getWorld())) {
return;
}
Plot plot = MainUtil.getPlot(loc);
@ -264,7 +264,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final UUID uuid = pp.getUUID();
UUIDHandler.add(name, uuid);
ExpireManager.dates.put(uuid, System.currentTimeMillis());
if (PlotSquared.getInstance().worldEdit != null) {
if (PS.get().worldEdit != null) {
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
WEManager.bypass.add(pp.getName());
}
@ -291,7 +291,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
TaskManager.TELEPORT_QUEUE.remove(player.getName());
}
final String worldname = t.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(worldname)) {
if (!PS.get().isPlotWorld(worldname)) {
return;
}
if (MainUtil.worldBorder.containsKey(worldname)) {
@ -348,10 +348,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onChat(final AsyncPlayerChatEvent event) {
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotPlayer plr = BukkitUtil.getPlayer(player);
if (!plotworld.PLOT_CHAT && (plr.getMeta("chat") == null || !(Boolean) plr.getMeta("chat"))) {
return;
@ -381,7 +381,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void BlockDestroy(final BlockBreakEvent event) {
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
@ -431,7 +431,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onBigBoom(final EntityExplodeEvent event) {
Location loc = BukkitUtil.getLocation(event.getLocation());
final String world = loc.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final Plot plot = MainUtil.getPlot(loc);
@ -463,7 +463,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onWorldChanged(final PlayerChangedWorldEvent event) {
final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer());
if (PlotSquared.getInstance().worldEdit != null) {
if (PS.get().worldEdit != null) {
if (!Permissions.hasPermission(player, "plots.worldedit.bypass")) {
WEManager.bypass.remove(player.getName());
}
@ -478,7 +478,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPeskyMobsChangeTheWorldLikeWTFEvent(final EntityChangeBlockEvent event) {
final String world = event.getBlock().getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final Entity e = event.getEntity();
@ -528,7 +528,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityBlockForm(final EntityBlockFormEvent e) {
final String world = e.getBlock().getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
if ((!(e.getEntity() instanceof Player))) {
@ -542,7 +542,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onBS(final BlockSpreadEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
@ -553,7 +553,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onBF(final BlockFormEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
@ -565,14 +565,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Player player = event.getPlayer();
if (player == null) {
final Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
event.setCancelled(true);
}
}
}
final String world = player.getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
@ -622,7 +622,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onFade(final BlockFadeEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
@ -633,7 +633,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onChange(final BlockFromToEvent e) {
final Block b = e.getToBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
@ -650,7 +650,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onGrow(final BlockGrowEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
@ -662,7 +662,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation());
String world = loc.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
Plot plot = MainUtil.getPlot(loc);
@ -704,7 +704,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation());
String world = loc.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
if (block.getType() != Material.PISTON_STICKY_BASE && block.getType() != Material.PISTON_BASE && block.getType() != Material.PISTON_MOVING_PIECE) {
@ -740,7 +740,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onStructureGrow(final StructureGrowEvent e) {
if (!PlotSquared.getInstance().isPlotWorld(e.getWorld().getName())) {
if (!PS.get().isPlotWorld(e.getWorld().getName())) {
return;
}
final List<BlockState> blocks = e.getBlocks();
@ -778,7 +778,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
}
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final Location loc = BukkitUtil.getLocation(event.getClickedBlock().getLocation());
@ -835,13 +835,13 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
}
final Location loc = BukkitUtil.getLocation(event.getLocation());
final String world = loc.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
if (!MainUtil.isPlotArea(loc)) {
return;
}
final PlotWorld pW = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld pW = PS.get().getPlotWorld(world);
final CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
if ((reason == CreatureSpawnEvent.SpawnReason.SPAWNER_EGG || reason == CreatureSpawnEvent.SpawnReason.DISPENSE_EGG) && !pW.SPAWN_EGGS) {
event.setCancelled(true);
@ -868,7 +868,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Block block = event.getBlock();
World world = block.getWorld();
String worldname = world.getName();
if (!PlotSquared.getInstance().isPlotWorld(worldname)) {
if (!PS.get().isPlotWorld(worldname)) {
return;
}
Location loc = BukkitUtil.getLocation(block.getLocation());
@ -966,7 +966,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else {
return;
}
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
if (e.getCause() == BlockIgniteEvent.IgniteCause.LIGHTNING) {
@ -1022,7 +1022,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location t = BukkitUtil.getLocation(event.getTo());
final Location q = new Location(t.getWorld(), t.getX(), 64, t.getZ());
final Player player = event.getPlayer();
if (PlotSquared.getInstance().isPlotWorld(q.getWorld())) {
if (PS.get().isPlotWorld(q.getWorld())) {
final Plot plot = MainUtil.getPlot(q);
if (plot != null) {
final PlotPlayer pp = BukkitUtil.getPlayer(player);
@ -1056,7 +1056,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final BlockFace bf = e.getBlockFace();
final Block b = e.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()).getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
final PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
@ -1126,17 +1126,17 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
ExpireManager.dates.put(pp.getUUID(), System.currentTimeMillis());
EventUtil.unregisterPlayer(pp);
if (PlotSquared.getInstance().worldEdit != null) {
if (PS.get().worldEdit != null) {
WEManager.bypass.remove(pp.getName());
}
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {
final Collection<Plot> plots = PlotSquared.getInstance().getPlots(pp.getName()).values();
final Collection<Plot> plots = PS.get().getPlots(pp.getName()).values();
for (final Plot plot : plots) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(plot.world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(plot.world);
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
final PlotManager manager = PS.get().getPlotManager(plot.world);
manager.clearPlot(plotworld, plot, true, null);
DBFunc.delete(plot.world, plot);
PlotSquared.log(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
PS.log(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
}
}
BukkitUtil.removePlayer(pp.getName());
@ -1146,7 +1146,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onBucketFill(final PlayerBucketFillEvent e) {
final Block b = e.getBlockClicked();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(loc);
@ -1190,7 +1190,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void onHangingPlace(final HangingPlaceEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.getInstance().isPlotWorld(loc.getWorld())) {
if (PS.get().isPlotWorld(loc.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(loc);
@ -1232,7 +1232,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Player p = (Player) r;
final Location l = BukkitUtil.getLocation(e.getEntity());
final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (PlotSquared.getInstance().isPlotWorld(l.getWorld())) {
if (PS.get().isPlotWorld(l.getWorld())) {
Plot plot = MainUtil.getPlot(l);
if (plot == null) {
if (MainUtil.isPlotAreaAbs(l)) {
@ -1269,7 +1269,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerInteractEntity(final PlayerInteractEntityEvent e) {
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
if (PlotSquared.getInstance().isPlotWorld(l.getWorld())) {
if (PS.get().isPlotWorld(l.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(l);
@ -1328,11 +1328,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onVehicleDestroy(final VehicleDestroyEvent e) {
final Location l = BukkitUtil.getLocation(e.getVehicle());
if (PlotSquared.getInstance().isPlotWorld(l.getWorld())) {
if (PS.get().isPlotWorld(l.getWorld())) {
final Entity d = e.getAttacker();
if (d instanceof Player) {
final Player p = (Player) d;
PlotSquared.getInstance().getPlotWorld(l.getWorld());
PS.get().getPlotWorld(l.getWorld());
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(l);
if (plot == null) {
@ -1382,7 +1382,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
TaskManager.TELEPORT_QUEUE.remove(name);
}
}
if (PlotSquared.getInstance().isPlotWorld(l.getWorld())) {
if (PS.get().isPlotWorld(l.getWorld())) {
Player p = null;
Projectile projectile = null;
if (damager instanceof Player) {
@ -1421,7 +1421,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
}
if (p != null) {
final boolean aPlr = victim instanceof Player;
final PlotWorld pW = PlotSquared.getInstance().getPlotWorld(l.getWorld());
final PlotWorld pW = PS.get().getPlotWorld(l.getWorld());
if (!aPlr && pW.PVE && (!(victim instanceof ItemFrame) && !(victim.getType().getTypeId() == 30))) {
return;
} else if (aPlr && pW.PVP) {
@ -1491,7 +1491,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerEggThrow(final PlayerEggThrowEvent e) {
final Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
if (PlotSquared.getInstance().isPlotWorld(l.getWorld())) {
if (PS.get().isPlotWorld(l.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(l);
@ -1528,7 +1528,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public void BlockCreate(final BlockPlaceEvent event) {
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final PlotPlayer pp = BukkitUtil.getPlayer(player);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -36,7 +36,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
return;
}
HumanEntity entity = event.getWhoClicked();
if (!(entity instanceof Player) || !PlotSquared.getInstance().isPlotWorld(entity.getWorld().getName())) {
if (!(entity instanceof Player) || !PS.get().isPlotWorld(entity.getWorld().getName())) {
return;
}
Player player = (Player) entity;
@ -123,7 +123,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
}
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
String world = l.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
Plot plot = MainUtil.getPlot(l);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -20,7 +20,7 @@ public class PlayerEvents_1_8_3 implements Listener {
Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation());
final String world = loc.getWorld();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
final Plot plot = MainUtil.getPlot(loc);

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
@ -48,7 +48,7 @@ import java.util.UUID;
*/
public class PlotListener extends APlotListener {
public void textures(final Player p) {
if ((Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1) && PlotSquared.getInstance().isPlotWorld(p.getWorld().getName())) {
if ((Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1) && PS.get().isPlotWorld(p.getWorld().getName())) {
p.setResourcePack(Settings.PLOT_SPECIFIC_RESOURCE_PACK);
}
}

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -33,7 +33,7 @@ public class TNTListener implements Listener {
}
World world = entity.getWorld();
String worldname = world.getName();
if (!PlotSquared.getInstance().isPlotWorld(worldname)) {
if (!PS.get().isPlotWorld(worldname)) {
return;
}
Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(entity));

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
import org.bukkit.World;
@ -31,10 +31,10 @@ public class WorldEvents implements Listener {
final ChunkGenerator gen = world.getGenerator();
if (gen instanceof PlotGenerator) {
//
PlotSquared.getInstance().loadWorld(name, (PlotGenerator) gen);
PS.get().loadWorld(name, (PlotGenerator) gen);
} else {
if (PlotSquared.getInstance().config.contains("worlds." + name)) {
PlotSquared.getInstance().loadWorld(name, null);
if (PS.get().config.contains("worlds." + name)) {
PS.get().loadWorld(name, null);
}
}
lastWorld = null;

View File

@ -2,7 +2,7 @@ package com.intellectualcrafters.plot.listeners.worldedit;
import java.util.HashSet;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.sk89q.worldedit.Vector;
@ -72,7 +72,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
BScount++;
if (BScount > Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES) {
BSblocked = true;
PlotSquared.log("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
PS.log("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
}
}
}
@ -90,7 +90,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
Ecount++;
if (Ecount > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
Eblocked = true;
PlotSquared.log("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
PS.log("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
}
if (WEManager.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
return super.createEntity(location, entity);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners.worldedit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot;
@ -93,7 +93,7 @@ public class WEListener implements Listener {
}
public boolean checkSelection(Player p, PlotPlayer pp, int modifier, long max, Cancellable e) {
final Selection selection = PlotSquared.getInstance().worldEdit.getSelection(p);
final Selection selection = PS.get().worldEdit.getSelection(p);
if (selection == null) {
return true;
}
@ -137,7 +137,7 @@ public class WEListener implements Listener {
public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!PlotSquared.getInstance().isPlotWorld(p.getWorld().getName())) {
if (!PS.get().isPlotWorld(p.getWorld().getName())) {
return true;
}
String cmd = e.getMessage().toLowerCase();

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners.worldedit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -26,7 +26,7 @@ public class WEManager {
public static HashSet<RegionWrapper> getMask(PlotPlayer player) {
HashSet<RegionWrapper> regions = new HashSet<>();
UUID uuid = player.getUUID();
for (Plot plot : PlotSquared.getInstance().getPlots(player.getLocation().getWorld()).values()) {
for (Plot plot : PS.get().getPlots(player.getLocation().getWorld()).values()) {
if (!plot.settings.getMerged(0) && !plot.settings.getMerged(3)) {
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.trusted.contains(uuid))) {
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.listeners.worldedit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -19,7 +19,7 @@ public class WESubscriber {
@Subscribe(priority=Priority.VERY_EARLY)
public void onEditSession(EditSessionEvent event) {
String world = event.getWorld().getName();
if (!PlotSquared.getInstance().isPlotWorld(world)) {
if (!PS.get().isPlotWorld(world)) {
return;
}
Actor actor = event.getActor();

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.listeners.WorldEvents;
import com.intellectualcrafters.plot.util.ChunkManager;
import org.bukkit.World;
@ -71,8 +71,8 @@ public abstract class PlotGenerator extends ChunkGenerator {
public List<BlockPopulator> getDefaultPopulators(World world) {
try {
if (!loaded) {
PlotSquared.getInstance().loadWorld(WorldEvents.getName(world), this);
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(WorldEvents.getName(world));
PS.get().loadWorld(WorldEvents.getName(world), this);
PlotWorld plotworld = PS.get().getPlotWorld(WorldEvents.getName(world));
if (!plotworld.MOB_SPAWNING) {
if (!plotworld.SPAWN_EGGS) {
world.setSpawnFlags(false, false);
@ -103,7 +103,7 @@ public abstract class PlotGenerator extends ChunkGenerator {
public short[][] generateExtBlockSections(World world, Random r, int cx, int cz, BiomeGrid biomes) {
try {
if (!loaded) {
PlotSquared.getInstance().loadWorld(WorldEvents.getName(world), this);
PS.get().loadWorld(WorldEvents.getName(world), this);
loaded = true;
}
final int prime = 13;
@ -115,7 +115,7 @@ public abstract class PlotGenerator extends ChunkGenerator {
this.X = cx << 4;
this.Z = cz << 4;
if (ChunkManager.FORCE_PASTE) {
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world.getName());
PlotWorld plotworld = PS.get().getPlotWorld(world.getName());
Biome biome = Biome.valueOf(plotworld.PLOT_BIOME);
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings;
@ -110,7 +110,7 @@ public abstract class PlotWorld {
return false;
}
PlotWorld plotworld = (PlotWorld) obj;
ConfigurationSection section = PlotSquared.getInstance().config.getConfigurationSection("worlds");
ConfigurationSection section = PS.get().config.getConfigurationSection("worlds");
for (ConfigurationNode setting : plotworld.getSettingNodes()) {
Object constant = section.get(plotworld.worldname + "." + setting.getConstant());
if (constant == null) {
@ -185,7 +185,7 @@ public abstract class PlotWorld {
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
} catch (final Exception e) {
e.printStackTrace();
PlotSquared.log("&cInvalid default flags for " + this.worldname + ": " + StringUtils.join(flags, ","));
PS.log("&cInvalid default flags for " + this.worldname + ": " + StringUtils.join(flags, ","));
this.DEFAULT_FLAGS = new HashMap<>();
}
this.PVP = config.getBoolean("event.pvp");

View File

@ -31,7 +31,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
public class EntityWrapper {
public short id;
@ -212,7 +212,7 @@ public class EntityWrapper {
return;
}
default: {
PlotSquared.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
PS.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return;
}
// MISC //
@ -469,7 +469,7 @@ public class EntityWrapper {
return entity;
}
default: {
PlotSquared.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
PS.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return entity;
}
// MISC //

View File

@ -2,7 +2,7 @@ package com.intellectualcrafters.plot.titles;
import org.bukkit.ChatColor;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.BukkitPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -16,7 +16,7 @@ public class HackTitle extends AbstractTitle {
title.setSubtitleColor(sub_color);
title.send(((BukkitPlayer) player).player);
} catch (final Throwable e) {
PlotSquared.log("&cYour server version does not support titles!");
PS.log("&cYour server version does not support titles!");
Settings.TITLES = false;
AbstractTitle.TITLE_CLASS = null;
}

View File

@ -38,7 +38,7 @@ import com.intellectualcrafters.jnbt.ListTag;
import com.intellectualcrafters.jnbt.ShortTag;
import com.intellectualcrafters.jnbt.StringTag;
import com.intellectualcrafters.jnbt.Tag;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.schematic.StateWrapper;
@ -61,13 +61,13 @@ public class BukkitSchematicHandler extends SchematicHandler {
for (j = (pos1.getZ() / 16) * 16; j < (16 + ((pos2.getZ() / 16) * 16)); j += 16) {
boolean result = ChunkManager.manager.loadChunk(world, new ChunkLoc(i, j));
if (!result) {
PlotSquared.log("&cIllegal selection. Cannot save non-existent chunk at " + (i / 16) + ", " + (j / 16));
PS.log("&cIllegal selection. Cannot save non-existent chunk at " + (i / 16) + ", " + (j / 16));
return null;
}
}
}
} catch (final Exception e) {
PlotSquared.log("&cIllegal selection. Cannot save corrupt chunk at " + (i / 16) + ", " + (j / 16));
PS.log("&cIllegal selection. Cannot save corrupt chunk at " + (i / 16) + ", " + (j / 16));
return null;
}
final int width = (pos2.getX() - pos1.getX()) + 1;

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.object.*;
@ -44,8 +44,8 @@ public class ClusterManager {
final PlotId center = getCenterPlot(cluster);
toReturn = MainUtil.getPlotHome(cluster.world, center);
if (toReturn.getY() == 0) {
final PlotManager manager = PlotSquared.getInstance().getPlotManager(cluster.world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(cluster.world);
final PlotManager manager = PS.get().getPlotManager(cluster.world);
final PlotWorld plotworld = PS.get().getPlotWorld(cluster.world);
final Location loc = manager.getSignLoc(plotworld, MainUtil.getPlot(cluster.world, center));
toReturn.setY(loc.getY());
}
@ -67,15 +67,15 @@ public class ClusterManager {
public static Location getClusterBottom(final PlotCluster cluster) {
final String world = cluster.world;
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
}
public static Location getClusterTop(final PlotCluster cluster) {
final String world = cluster.world;
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, cluster.getP2());
}
@ -93,8 +93,8 @@ public class ClusterManager {
public static boolean contains(final PlotCluster cluster, final Location loc) {
final String world = loc.getWorld();
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final Location bot = manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
final Location top = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1, 0, 1);
return (bot.getX() < loc.getX()) && (bot.getZ() < loc.getZ()) && (top.getX() > loc.getX()) && (top.getZ() > loc.getZ());
@ -148,8 +148,8 @@ public class ClusterManager {
public static PlotCluster getCluster(final Location loc) {
final String world = loc.getWorld();
PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
PlotId id = manager.getPlotIdAbs(PlotSquared.getInstance().getPlotWorld(world), loc.getX(), loc.getY(), loc.getZ());
PlotManager manager = PS.get().getPlotManager(world);
PlotId id = manager.getPlotIdAbs(PS.get().getPlotWorld(world), loc.getX(), loc.getY(), loc.getZ());
if (id != null) {
return getCluster(world, id);
}
@ -210,12 +210,12 @@ public class ClusterManager {
int xw;
int zw;
final String world = loc.getWorld();
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (plotworld == null) {
xw = 39;
zw = 39;
} else {
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
final Location al = manager.getPlotBottomLocAbs(plotworld, a);
final Location bl = manager.getPlotBottomLocAbs(plotworld, b);
xw = bl.getX() - al.getX();
@ -235,7 +235,7 @@ public class ClusterManager {
int i = 0;
final Random rand = new Random();
final World world = Bukkit.getWorld(cluster.world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(cluster.world);
final PlotWorld plotworld = PS.get().getPlotWorld(cluster.world);
final Location bot = getClusterBottom(cluster);
final Location top = getClusterTop(cluster);
final int minChunkX = bot.getX() >> 4;

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.object.*;
@ -17,7 +17,7 @@ public abstract class EventUtil {
SetupUtils.setupMap.remove(name);
}
CmdConfirm.removePending(name);
PlotSquared.getInstance().IMP.unregister(player);
PS.get().IMP.unregister(player);
}
public abstract boolean callClaim(final PlotPlayer player, final Plot plot, final boolean auto);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -43,7 +43,7 @@ public class ExpireManager {
public void run() {
try {
final List<Plot> plots = getOldPlots(world);
PlotSquared.log("&7[&5Expire&dManager&7] &3Found " + plots.size() + " expired plots for " + world + "!");
PS.log("&7[&5Expire&dManager&7] &3Found " + plots.size() + " expired plots for " + world + "!");
expiredPlots.put(world, plots);
updatingPlots.put(world, false);
}
@ -64,24 +64,24 @@ public class ExpireManager {
@Override
public void run() {
try {
for (final String world : PlotSquared.getInstance().getPlotWorldsString()) {
for (final String world : PS.get().getPlotWorldsString()) {
if (!ExpireManager.updatingPlots.containsKey(world)) {
ExpireManager.updatingPlots.put(world, false);
}
final Boolean updating = ExpireManager.updatingPlots.get(world);
if (updating) {
PlotSquared.log("&7[&5Expire&dManager&7] &3Waiting on fetch...");
PS.log("&7[&5Expire&dManager&7] &3Waiting on fetch...");
return;
}
if (!expiredPlots.containsKey(world)) {
PlotSquared.log("&7[&5Expire&dManager&7] &3Updating expired plots for: " + world);
PS.log("&7[&5Expire&dManager&7] &3Updating expired plots for: " + world);
updateExpired(world);
return;
}
final List<Plot> plots = expiredPlots.get(world);
if ((plots == null) || (plots.size() == 0)) {
if (updateExpired(world)) {
PlotSquared.log("&7[&5Expire&dManager&7] &3Re-evaluating expired plots for: " + world);
PS.log("&7[&5Expire&dManager&7] &3Re-evaluating expired plots for: " + world);
return;
}
continue;
@ -89,7 +89,7 @@ public class ExpireManager {
final Plot plot = plots.iterator().next();
if (!isExpired(plot)) {
expiredPlots.get(world).remove(plot);
PlotSquared.log("&7[&5Expire&dManager&7] &bSkipping no longer expired: " + plot);
PS.log("&7[&5Expire&dManager&7] &bSkipping no longer expired: " + plot);
return;
}
for (final UUID helper : plot.trusted) {
@ -104,26 +104,26 @@ public class ExpireManager {
MainUtil.sendMessage(player, C.PLOT_REMOVED_USER, plot.id.toString());
}
}
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
if (manager == null) {
PlotSquared.log("&7[&5Expire&dManager&7] &cThis is a friendly reminder to create or delete " + world +" as it is currently setup incorrectly");
PS.log("&7[&5Expire&dManager&7] &cThis is a friendly reminder to create or delete " + world +" as it is currently setup incorrectly");
expiredPlots.get(world).remove(plot);
return;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
RunnableVal run = new RunnableVal<Integer>() {
@Override
public void run() {
int changed = this.value;
if (Settings.MIN_BLOCKS_CHANGED_IGNORED > 0 || Settings.MIN_BLOCKS_CHANGED > 0 && manager instanceof ClassicPlotManager) {
if (changed >= Settings.MIN_BLOCKS_CHANGED && Settings.MIN_BLOCKS_CHANGED > 0) {
PlotSquared.log("&7[&5Expire&dManager&7] &bKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
PS.log("&7[&5Expire&dManager&7] &bKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("keep"), true));
expiredPlots.get(world).remove(plot);
return;
}
else if (changed >= Settings.MIN_BLOCKS_CHANGED_IGNORED && Settings.MIN_BLOCKS_CHANGED_IGNORED > 0) {
PlotSquared.log("&7[&5Expire&dManager&7] &bIgnoring modified plot: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
PS.log("&7[&5Expire&dManager&7] &bIgnoring modified plot: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("modified-blocks"), value));
expiredPlots.get(world).remove(plot);
return;
@ -135,14 +135,14 @@ public class ExpireManager {
manager.clearPlot(plotworld, plot, false, null);
MainUtil.removeSign(plot);
DBFunc.delete(world, plot);
PlotSquared.getInstance().removePlot(world, plot.id, false);
PS.get().removePlot(world, plot.id, false);
expiredPlots.get(world).remove(plot);
PlotSquared.log("&7[&5Expire&dManager&7] &cDeleted expired plot: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
PlotSquared.log("&3 - World: " + plot.world);
PS.log("&7[&5Expire&dManager&7] &cDeleted expired plot: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
PS.log("&3 - World: " + plot.world);
if (plot.hasOwner()) {
PlotSquared.log("&3 - Owner: " + UUIDHandler.getName(plot.owner));
PS.log("&3 - Owner: " + UUIDHandler.getName(plot.owner));
} else {
PlotSquared.log("&3 - Owner: Unowned");
PS.log("&3 - Owner: Unowned");
}
}
};
@ -150,7 +150,7 @@ public class ExpireManager {
Flag flag = FlagManager.getPlotFlagAbs(plot, "modified-blocks");
if (flag != null) {
if ((Integer) flag.getValue() > Settings.MIN_BLOCKS_CHANGED_IGNORED) {
PlotSquared.log("&7[&5Expire&dManager&7] &bSkipping modified: " + plot);
PS.log("&7[&5Expire&dManager&7] &bSkipping modified: " + plot);
expiredPlots.get(world).remove(plot);
this.run();
return;
@ -215,7 +215,7 @@ public class ExpireManager {
}
public static List<Plot> getOldPlots(final String world) {
final Collection<Plot> plots = PlotSquared.getInstance().getPlots(world).values();
final Collection<Plot> plots = PS.get().getPlots(world).values();
final List<Plot> toRemove = new ArrayList<>();
Iterator<Plot> iter = plots.iterator();
while (iter.hasNext()) {
@ -238,7 +238,7 @@ public class ExpireManager {
final String worldname = Bukkit.getWorlds().get(0).getName();
String foldername;
String filename = null;
if (PlotSquared.getInstance().IMP.checkVersion(1, 7, 5)) {
if (PS.get().IMP.checkVersion(1, 7, 5)) {
foldername = "playerdata";
try {
final OfflinePlotPlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
@ -256,7 +256,7 @@ public class ExpireManager {
if (filename != null) {
final File playerFile = new File(worldname + File.separator + foldername + File.separator + filename);
if (!playerFile.exists()) {
PlotSquared.log("Could not find file: " + filename);
PS.log("Could not find file: " + filename);
} else {
try {
long last = playerFile.lastModified();
@ -265,7 +265,7 @@ public class ExpireManager {
continue;
}
} catch (final Exception e) {
PlotSquared.log("Please disable disk checking in old plot auto clearing; Could not read file: " + filename);
PS.log("Please disable disk checking in old plot auto clearing; Could not read file: " + filename);
}
}
}

View File

@ -28,7 +28,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
/**
@ -51,7 +51,7 @@ public class Logger {
}
reader.close();
} catch (final IOException e) {
PlotSquared.log(C.PREFIX.s() + "File setup error Logger#setup");
PS.log(C.PREFIX.s() + "File setup error Logger#setup");
}
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -50,7 +50,7 @@ public class MainUtil {
static PseudoRandom random = new PseudoRandom();
public static boolean isPlotArea(final Location location) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(location.getWorld());
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
if (plotworld.TYPE == 2) {
return ClusterManager.getCluster(location) != null;
}
@ -90,21 +90,21 @@ public class MainUtil {
}
else {
if (worldname == null) {
if (PlotSquared.getInstance().getPlotWorlds().size() == 0) {
if (PS.get().getPlotWorlds().size() == 0) {
if (message) MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
return null;
}
worldname = PlotSquared.getInstance().getPlotWorlds().iterator().next();
worldname = PS.get().getPlotWorlds().iterator().next();
}
for (Plot p : PlotSquared.getInstance().getPlots(worldname).values()) {
for (Plot p : PS.get().getPlots(worldname).values()) {
String name = p.settings.getAlias();
if (name.length() != 0 && name.equalsIgnoreCase(arg)) {
return p;
}
}
for (String world : PlotSquared.getInstance().getPlotWorlds()) {
for (String world : PS.get().getPlotWorlds()) {
if (!world.endsWith(worldname)) {
for (Plot p : PlotSquared.getInstance().getPlots(world).values()) {
for (Plot p : PS.get().getPlots(world).values()) {
String name = p.settings.getAlias();
if (name.length() != 0 && name.equalsIgnoreCase(arg)) {
return p;
@ -113,7 +113,7 @@ public class MainUtil {
}
}
}
if (worldname == null || !PlotSquared.getInstance().isPlotWorld(worldname)) {
if (worldname == null || !PS.get().isPlotWorld(worldname)) {
if (message) MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
System.out.print("INVALID WORLD: ");
return null;
@ -137,7 +137,7 @@ public class MainUtil {
* @return boolean
*/
public static boolean mergePlots(final PlotPlayer player, final String world, final ArrayList<PlotId> plotIds) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY) {
final double cost = plotIds.size() * plotworld.MERGE_PRICE;
if (cost > 0d) {
@ -161,11 +161,11 @@ public class MainUtil {
if (!result) {
return false;
}
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
manager.startPlotUnlink(plotworld, ids);
for (final PlotId id : ids) {
final Plot myplot = PlotSquared.getInstance().getPlots(world).get(id);
final Plot myplot = PS.get().getPlots(world).get(id);
if (plot == null) {
continue;
}
@ -212,7 +212,7 @@ public class MainUtil {
}
public static boolean isPlotAreaAbs(final Location location) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(location.getWorld());
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
if (plotworld.TYPE == 2) {
return ClusterManager.getClusterAbs(location) != null;
}
@ -220,19 +220,19 @@ public class MainUtil {
}
public static boolean isPlotRoad(final Location location) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(location.getWorld());
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
if (plotworld.TYPE == 2) {
PlotCluster cluster = ClusterManager.getCluster(location);
if (cluster == null) {
return false;
}
}
PlotManager manager = PlotSquared.getInstance().getPlotManager(location.getWorld());
PlotManager manager = PS.get().getPlotManager(location.getWorld());
return manager.getPlotId(plotworld, location.getX(), location.getY(), location.getZ()) == null;
}
public static boolean isPlotArea(final Plot plot) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(plot.world);
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
if (plotworld.TYPE == 2) {
return ClusterManager.getCluster(plot) != null;
}
@ -253,8 +253,8 @@ public class MainUtil {
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
final Plot plot1 = PlotSquared.getInstance().getPlots(world).get(pos1);
final Plot plot2 = PlotSquared.getInstance().getPlots(world).get(pos2);
final Plot plot1 = PS.get().getPlots(world).get(pos1);
final Plot plot2 = PS.get().getPlots(world).get(pos2);
if (plot1 != null) {
pos1 = getBottomPlot(plot1).id;
@ -293,7 +293,7 @@ public class MainUtil {
public static int getPlayerPlotCount(final String world, final PlotPlayer plr) {
final UUID uuid = plr.getUUID();
int count = 0;
for (final Plot plot : PlotSquared.getInstance().getPlots(world).values()) {
for (final Plot plot : PS.get().getPlots(world).values()) {
if (plot.hasOwner() && plot.owner.equals(uuid) && plot.countsTowardsMax) {
count++;
}
@ -303,17 +303,17 @@ public class MainUtil {
public static int getPlayerPlotCount(final PlotPlayer plr) {
int count = 0;
for (final String world : PlotSquared.getInstance().getPlotWorldsString()) {
for (final String world : PS.get().getPlotWorldsString()) {
count += getPlayerPlotCount(world, plr);
}
return count;
}
public static Location getDefaultHome(Plot plot) {
PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(plot.world);
PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
if (plotworld.DEFAULT_HOME != null) {
final Location bot = getPlotBottomLoc(plot.world, plot.id);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(plot.world);
final PlotManager manager = PS.get().getPlotManager(plot.world);
final int x;
final int z;
if (plotworld.DEFAULT_HOME.x == Integer.MAX_VALUE && plotworld.DEFAULT_HOME.z == Integer.MAX_VALUE) {
@ -325,15 +325,15 @@ public class MainUtil {
x = bot.getX() + plotworld.DEFAULT_HOME.x;
z = bot.getZ() + plotworld.DEFAULT_HOME.z;
}
final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PlotSquared.getInstance().getPlotWorld(plot.world), plot).getY());
final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PS.get().getPlotWorld(plot.world), plot).getY());
return new Location(plot.world, x, y + 1, z);
}
final Location top = getPlotTopLoc(plot.world, plot.id);
final Location bot = getPlotBottomLoc(plot.world, plot.id);
final int x = ((top.getX() - bot.getX()) / 2) + bot.getX();
final int z = bot.getZ();
PlotManager manager = PlotSquared.getInstance().getPlotManager(plot.world);
final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PlotSquared.getInstance().getPlotWorld(plot.world), plot).getY());
PlotManager manager = PS.get().getPlotManager(plot.world);
final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PS.get().getPlotWorld(plot.world), plot).getY());
return new Location(plot.world, x, y + 1, z);
}
@ -344,7 +344,7 @@ public class MainUtil {
if (result) {
final Location location;
if (PlotSquared.getInstance().getPlotWorld(plot.world).HOME_ALLOW_NONMEMBER || plot.isAdded(player.getUUID())) {
if (PS.get().getPlotWorld(plot.world).HOME_ALLOW_NONMEMBER || plot.isAdded(player.getUUID())) {
location = MainUtil.getPlotHome(bot.world, bot);
}
else {
@ -380,21 +380,21 @@ public class MainUtil {
public static int getBorder(final String worldname) {
if (worldBorder.containsKey(worldname)) {
PlotSquared.getInstance().getPlotWorld(worldname);
PS.get().getPlotWorld(worldname);
return worldBorder.get(worldname) + 16;
}
return Integer.MAX_VALUE;
}
public static void setupBorder(final String world) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (!plotworld.WORLD_BORDER) {
return;
}
if (!worldBorder.containsKey(world)) {
worldBorder.put(world, 0);
}
for (final Plot plot : PlotSquared.getInstance().getPlots(world).values()) {
for (final Plot plot : PS.get().getPlots(world).values()) {
updateWorldBorder(plot);
}
}
@ -484,8 +484,8 @@ public class MainUtil {
}
final PlotId pos1 = plotIds.get(0);
final PlotId pos2 = plotIds.get(plotIds.size() - 1);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
boolean result = EventUtil.manager.callMerge(world, getPlot(world, pos1), plotIds);
if (!result) {
@ -498,7 +498,7 @@ public class MainUtil {
final boolean lx = x < pos2.x;
final boolean ly = y < pos2.y;
final PlotId id = new PlotId(x, y);
final Plot plot = PlotSquared.getInstance().getPlots(world).get(id);
final Plot plot = PS.get().getPlots(world).get(id);
Plot plot2 = null;
if (removeRoads) {
removeSign(plot);
@ -512,7 +512,7 @@ public class MainUtil {
}
}
if (!plot.settings.getMerged(1)) {
plot2 = PlotSquared.getInstance().getPlots(world).get(new PlotId(x + 1, y));
plot2 = PS.get().getPlots(world).get(new PlotId(x + 1, y));
mergePlot(world, plot, plot2, removeRoads);
plot.settings.setMerged(1, true);
plot2.settings.setMerged(3, true);
@ -520,7 +520,7 @@ public class MainUtil {
}
if (ly) {
if (!plot.settings.getMerged(2)) {
plot2 = PlotSquared.getInstance().getPlots(world).get(new PlotId(x, y + 1));
plot2 = PS.get().getPlots(world).get(new PlotId(x, y + 1));
mergePlot(world, plot, plot2, removeRoads);
plot.settings.setMerged(2, true);
plot2.settings.setMerged(0, true);
@ -531,7 +531,7 @@ public class MainUtil {
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y);
final Plot plot = PlotSquared.getInstance().getPlots(world).get(id);
final Plot plot = PS.get().getPlots(world).get(id);
DBFunc.setMerged(world, plot, plot.settings.getMerged());
}
}
@ -553,7 +553,7 @@ public class MainUtil {
ChunkManager.manager.regenerateRegion(pos1, pos2, null);
}
else {
PlotSquared.getInstance().getPlotManager(plot.world).removeRoadSouthEast(plotworld, plot);
PS.get().getPlotManager(plot.world).removeRoadSouthEast(plotworld, plot);
}
}
@ -571,7 +571,7 @@ public class MainUtil {
ChunkManager.manager.regenerateRegion(pos1, pos2, null);
}
else {
PlotSquared.getInstance().getPlotManager(plot.world).removeRoadEast(plotworld, plot);
PS.get().getPlotManager(plot.world).removeRoadEast(plotworld, plot);
}
}
@ -589,7 +589,7 @@ public class MainUtil {
ChunkManager.manager.regenerateRegion(pos1, pos2, null);
}
else {
PlotSquared.getInstance().getPlotManager(plot.world).removeRoadSouth(plotworld, plot);
PS.get().getPlotManager(plot.world).removeRoadSouth(plotworld, plot);
}
}
@ -603,7 +603,7 @@ public class MainUtil {
* @param greaterPlot
*/
public static void mergePlot(final String world, final Plot lesserPlot, final Plot greaterPlot, final boolean removeRoads) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (lesserPlot.id.x.equals(greaterPlot.id.x)) {
if (!lesserPlot.settings.getMerged(2)) {
lesserPlot.settings.setMerged(2, true);
@ -625,8 +625,8 @@ public class MainUtil {
public static void removeSign(final Plot p) {
final String world = p.world;
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
if (!plotworld.ALLOW_SIGNS) {
return;
}
@ -638,8 +638,8 @@ public class MainUtil {
if (name == null) {
name = "unknown";
}
final PlotManager manager = PlotSquared.getInstance().getPlotManager(p.world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(p.world);
final PlotManager manager = PS.get().getPlotManager(p.world);
final PlotWorld plotworld = PS.get().getPlotWorld(p.world);
if (plotworld.ALLOW_SIGNS) {
final Location loc = manager.getSignLoc(plotworld, p);
final String id = p.id.x + ";" + p.id.y;
@ -715,7 +715,7 @@ public class MainUtil {
final PlotId id_min = plots.get(0);
final PlotId id_max = plots.get(plots.size() - 1);
for (final PlotId myid : plots) {
final Plot myplot = PlotSquared.getInstance().getPlots(world).get(myid);
final Plot myplot = PS.get().getPlots(world).get(myid);
if ((myplot == null) || myplot.owner == null || !(myplot.owner.equals(uuid))) {
return false;
}
@ -736,8 +736,8 @@ public class MainUtil {
return;
}
final String world = plot.world;
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final Location bot = manager.getPlotBottomLocAbs(plotworld, plot.id);
final Location top = manager.getPlotTopLocAbs(plotworld, plot.id);
final int border = worldBorder.get(plot.world);
@ -757,7 +757,7 @@ public class MainUtil {
updateWorldBorder(plot);
}
final Plot p = createPlotAbs(uuid, plot);
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(plot.world);
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
if (plotworld.AUTO_MERGE) {
autoMerge(plot.world, p, uuid);
}
@ -770,7 +770,7 @@ public class MainUtil {
public static Plot createPlotAbs(final UUID uuid, final Plot plot) {
final String w = plot.world;
final Plot p = new Plot(plot.id, uuid, new ArrayList<UUID>(), new ArrayList<UUID>(), w);
PlotSquared.getInstance().updatePlot(p);
PS.get().updatePlot(p);
DBFunc.createPlotAndSettings(p);
return p;
}
@ -809,7 +809,7 @@ public class MainUtil {
}
public static void clear(final String world, final Plot plot, final boolean isDelete, final Runnable whenDone) {
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
final int prime = 31;
int h = 1;
@ -817,7 +817,7 @@ public class MainUtil {
h = (prime * h) + pos1.getZ();
state = h;
System.currentTimeMillis();
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
runners.put(plot, 1);
if (plotworld.TERRAIN != 0 || Settings.FAST_CLEAR) {
final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
@ -948,7 +948,7 @@ public class MainUtil {
final Plot plot = getPlot(w, plotid);
final BlockLoc home = plot.settings.getPosition();
final Location bot = getPlotBottomLoc(w, plotid);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(w);
final PlotManager manager = PS.get().getPlotManager(w);
if ((home == null) || ((home.x == 0) && (home.z == 0))) {
return getDefaultHome(plot);
} else {
@ -981,8 +981,8 @@ public class MainUtil {
* @return Location top
*/
public static Location getPlotTopLocAbs(final String world, final PlotId id) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id);
}
@ -996,8 +996,8 @@ public class MainUtil {
* @return Location bottom
*/
public static Location getPlotBottomLocAbs(final String world, final PlotId id) {
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id);
}
@ -1023,12 +1023,12 @@ public class MainUtil {
* @return Location top of mega plot
*/
public static Location getPlotTopLoc(final String world, PlotId id) {
final Plot plot = PlotSquared.getInstance().getPlots(world).get(id);
final Plot plot = PS.get().getPlots(world).get(id);
if (plot != null) {
id = getTopPlot(plot).id;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id);
}
@ -1042,12 +1042,12 @@ public class MainUtil {
* @return Location bottom of mega plot
*/
public static Location getPlotBottomLoc(final String world, PlotId id) {
final Plot plot = PlotSquared.getInstance().getPlots(world).get(id);
final Plot plot = PS.get().getPlots(world).get(id);
if (plot != null) {
id = getBottomPlot(plot).id;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id);
}
@ -1083,8 +1083,8 @@ public class MainUtil {
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y);
if (PlotSquared.getInstance().getPlots(world).get(id) != null) {
if (PlotSquared.getInstance().getPlots(world).get(id).owner != null) {
if (PS.get().getPlots(world).get(id) != null) {
if (PS.get().getPlots(world).get(id).owner != null) {
return false;
}
}
@ -1094,8 +1094,8 @@ public class MainUtil {
}
public static boolean swap(final String world, final PlotId current, final PlotId newPlot, final Runnable whenDone) {
Plot p1 = PlotSquared.getInstance().getPlots(world).get(current);
Plot p2 = PlotSquared.getInstance().getPlots(world).get(newPlot);
Plot p1 = PS.get().getPlots(world).get(current);
Plot p2 = PS.get().getPlots(world).get(newPlot);
if (p1==null || p2 == null || p1.owner == null || !p1.owner.equals(p2.owner)) {
return false;
}
@ -1107,20 +1107,20 @@ public class MainUtil {
p1.id.y = p2.id.y.intValue();
p2.id.x = temp.x;
p2.id.y = temp.y;
PlotSquared.getInstance().getPlots(world).remove(p1.id);
PlotSquared.getInstance().getPlots(world).remove(p2.id);
PS.get().getPlots(world).remove(p1.id);
PS.get().getPlots(world).remove(p2.id);
p1.id.recalculateHash();
p2.id.recalculateHash();
PlotSquared.getInstance().getPlots(world).put(p1.id, p1);
PlotSquared.getInstance().getPlots(world).put(p2.id, p2);
PS.get().getPlots(world).put(p1.id, p1);
PS.get().getPlots(world).put(p2.id, p2);
// Swap database
DBFunc.dbManager.swapPlots(p2, p1);
return true;
}
public static boolean swapData(final String world, final PlotId current, final PlotId newPlot, final Runnable whenDone) {
Plot p1 = PlotSquared.getInstance().getPlots(world).get(current);
Plot p2 = PlotSquared.getInstance().getPlots(world).get(newPlot);
Plot p1 = PS.get().getPlots(world).get(current);
Plot p2 = PS.get().getPlots(world).get(newPlot);
if (p1 == null || p1.owner == null) {
if (p2 != null && p2.owner != null) {
moveData(p2, p1, whenDone);
@ -1141,12 +1141,12 @@ public class MainUtil {
p1.id.y = p2.id.y.intValue();
p2.id.x = temp.x;
p2.id.y = temp.y;
PlotSquared.getInstance().getPlots(world).remove(p1.id);
PlotSquared.getInstance().getPlots(world).remove(p2.id);
PS.get().getPlots(world).remove(p1.id);
PS.get().getPlots(world).remove(p2.id);
p1.id.recalculateHash();
p2.id.recalculateHash();
PlotSquared.getInstance().getPlots(world).put(p1.id, p1);
PlotSquared.getInstance().getPlots(world).put(p2.id, p2);
PS.get().getPlots(world).put(p1.id, p1);
PS.get().getPlots(world).put(p2.id, p2);
// Swap database
DBFunc.dbManager.swapPlots(p2, p1);
TaskManager.runTask(whenDone);
@ -1170,12 +1170,12 @@ public class MainUtil {
final ArrayList<PlotId> selection = getPlotSelectionIds(pos1.id, pos2.id);
for (final PlotId id : selection) {
DBFunc.movePlot(getPlot(plot1.world, new PlotId(id.x, id.y)), getPlot(plot2.world, new PlotId(id.x + offset_x, id.y + offset_y)));
final Plot plot = PlotSquared.getInstance().getPlots(plot1.world).get(id);
PlotSquared.getInstance().getPlots(plot1.world).remove(id);
final Plot plot = PS.get().getPlots(plot1.world).get(id);
PS.get().getPlots(plot1.world).remove(id);
plot.id.x += offset_x;
plot.id.y += offset_y;
plot.id.recalculateHash();
PlotSquared.getInstance().getPlots(plot2.world).put(plot.id, plot);
PS.get().getPlots(plot2.world).put(plot.id, plot);
}
TaskManager.runTaskLater(whenDone, 1);
return true;
@ -1200,12 +1200,12 @@ public class MainUtil {
for (final PlotId id : selection) {
String worldOriginal = plot1.world;
PlotId idOriginal = new PlotId(id.x, id.y);
final Plot plot = PlotSquared.getInstance().getPlots(plot1.world).get(id);
PlotSquared.getInstance().getPlots(plot1.world).remove(id);
final Plot plot = PS.get().getPlots(plot1.world).get(id);
PS.get().getPlots(plot1.world).remove(id);
plot.id.x += offset_x;
plot.id.y += offset_y;
plot.id.recalculateHash();
PlotSquared.getInstance().getPlots(plot2.world).put(plot.id, plot);
PS.get().getPlots(plot2.world).put(plot.id, plot);
DBFunc.movePlot(getPlot(worldOriginal, idOriginal), getPlot(plot2.world, new PlotId(id.x + offset_x, id.y + offset_y)));
}
ChunkManager.manager.copyRegion(bot1, top, bot2, new Runnable() {
@ -1268,7 +1268,7 @@ public class MainUtil {
DBFunc.setDenied(world, plot, denied);
}
}
PlotSquared.getInstance().getPlots(world).put(plot.id, plot);
PS.get().getPlots(world).put(plot.id, plot);
}
ChunkManager.manager.copyRegion(bot1, top, bot2, whenDone);
return true;
@ -1310,7 +1310,7 @@ public class MainUtil {
final String prefixStr = colorise('&', C.PREFIX.s());
if ((msg.length() > 0) && !msg.equals("")) {
if (plr == null) {
PlotSquared.log(prefixStr + msg);
PS.log(prefixStr + msg);
} else {
sendMessageWrapped(plr, prefixStr + msg);
}
@ -1425,7 +1425,7 @@ public class MainUtil {
}
}
if (plr == null) {
PlotSquared.log(colorise('&', msg));
PS.log(colorise('&', msg));
} else {
sendMessage(plr, msg, c.usePrefix());
}
@ -1435,14 +1435,14 @@ public class MainUtil {
public static Plot getBottomPlot(final Plot plot) {
if (plot.settings.getMerged(0)) {
final Plot p = PlotSquared.getInstance().getPlots(plot.world).get(new PlotId(plot.id.x, plot.id.y - 1));
final Plot p = PS.get().getPlots(plot.world).get(new PlotId(plot.id.x, plot.id.y - 1));
if (p == null) {
return plot;
}
return getBottomPlot(p);
}
if (plot.settings.getMerged(3)) {
final Plot p = PlotSquared.getInstance().getPlots(plot.world).get(new PlotId(plot.id.x - 1, plot.id.y));
final Plot p = PS.get().getPlots(plot.world).get(new PlotId(plot.id.x - 1, plot.id.y));
if (p == null) {
return plot;
}
@ -1453,14 +1453,14 @@ public class MainUtil {
public static Plot getTopPlot(final Plot plot) {
if (plot.settings.getMerged(2)) {
final Plot p = PlotSquared.getInstance().getPlots(plot.world).get(new PlotId(plot.id.x, plot.id.y + 1));
final Plot p = PS.get().getPlots(plot.world).get(new PlotId(plot.id.x, plot.id.y + 1));
if (p == null) {
return plot;
}
return getTopPlot(p);
}
if (plot.settings.getMerged(1)) {
final Plot p = PlotSquared.getInstance().getPlots(plot.world).get(new PlotId(plot.id.x + 1, plot.id.y));
final Plot p = PS.get().getPlots(plot.world).get(new PlotId(plot.id.x + 1, plot.id.y));
if (p == null) {
return plot;
}
@ -1487,8 +1487,8 @@ public class MainUtil {
if (id == null) {
return null;
}
if (PlotSquared.getInstance().getPlots(world).containsKey(id)) {
return PlotSquared.getInstance().getPlots(world).get(id);
if (PS.get().getPlots(world).containsKey(id)) {
return PS.get().getPlots(world).get(id);
}
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world);
}
@ -1500,11 +1500,11 @@ public class MainUtil {
*/
public static PlotId getPlotAbs(final Location loc) {
final String world = loc.getWorld();
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
if (manager == null) {
return null;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
return manager.getPlotIdAbs(plotworld, loc.getX(), loc.getY(), loc.getZ());
}
@ -1515,11 +1515,11 @@ public class MainUtil {
*/
public static PlotId getPlotId(final Location loc) {
final String world = loc.getWorld();
final PlotManager manager = PlotSquared.getInstance().getPlotManager(world);
final PlotManager manager = PS.get().getPlotManager(world);
if (manager == null) {
return null;
}
final PlotWorld plotworld = PlotSquared.getInstance().getPlotWorld(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotId id = manager.getPlotId(plotworld, loc.getX(), loc.getY(), loc.getZ());
if ((id != null) && (plotworld.TYPE == 2)) {
if (ClusterManager.getCluster(world, id) == null) {

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
/**
* Created 2014-09-29 for PlotSquared
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.PlotSquared;
public class PlotSquaredException extends RuntimeException {
public PlotSquaredException(final PlotError error, final String details) {
super("PlotError >> " + error.getHeader() + ": " + details);
PlotSquared.log("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
PS.log("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
}
public static enum PlotError {

View File

@ -1,7 +1,7 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.jnbt.*;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -64,7 +64,7 @@ public abstract class SchematicHandler {
else {
directory = outputDir.getPath();
}
if (PlotSquared.getInstance().worldEdit != null) {
if (PS.get().worldEdit != null) {
new WorldEditSchematic().saveSchematic(directory + File.separator + name + ".schematic", plot.world, plot.id);
}
else {
@ -104,7 +104,7 @@ public abstract class SchematicHandler {
*/
public boolean paste(final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
if (schematic == null) {
PlotSquared.log("Schematic == null :|");
PS.log("Schematic == null :|");
return false;
}
try {
@ -152,7 +152,7 @@ public abstract class SchematicHandler {
public boolean pasteStates(final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
if (schematic == null) {
PlotSquared.log("Schematic == null :|");
PS.log("Schematic == null :|");
return false;
}
HashSet<PlotItem> items = schematic.getItems();
@ -236,14 +236,14 @@ public abstract class SchematicHandler {
*/
public Schematic getSchematic(final String name) {
{
final File parent = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "schematics");
final File parent = new File(PS.get().IMP.getDirectory() + File.separator + "schematics");
if (!parent.exists()) {
if (!parent.mkdir()) {
throw new RuntimeException("Could not create schematic parent directory");
}
}
}
final File file = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
final File file = new File(PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
return getSchematic(file);
}
@ -256,7 +256,7 @@ public abstract class SchematicHandler {
*/
public Schematic getSchematic(File file) {
if (!file.exists()) {
PlotSquared.log(file.toString() + " doesn't exist");
PS.log(file.toString() + " doesn't exist");
return null;
}
try {
@ -266,7 +266,7 @@ public abstract class SchematicHandler {
stream.close();
return getSchematic(tag, file);
} catch (final Exception e) {
PlotSquared.log(file.toString() + " is not in GZIP format");
PS.log(file.toString() + " is not in GZIP format");
return null;
}
}
@ -281,7 +281,7 @@ public abstract class SchematicHandler {
*/
public boolean save(final CompoundTag tag, final String path) {
if (tag == null) {
PlotSquared.log("&cCannot save empty tag");
PS.log("&cCannot save empty tag");
return false;
}
try {
@ -308,7 +308,7 @@ public abstract class SchematicHandler {
* @return tag
*/
public CompoundTag getCompoundTag(final String world, final PlotId id) {
if (!PlotSquared.getInstance().getPlots(world).containsKey(id)) {
if (!PS.get().getPlots(world).containsKey(id)) {
return null;
}
final Location pos1 = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock;
@ -62,7 +62,7 @@ public class SetBlockQueue {
return;
}
if (blocks.size() == 0) {
PlotSquared.getInstance().TASK.cancelTask(TaskManager.tasks.get(current));
PS.get().TASK.cancelTask(TaskManager.tasks.get(current));
for (Runnable runnable : runnables) {
TaskManager.runTask(runnable);
}

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import org.apache.commons.lang.mutable.MutableInt;
import java.util.HashMap;
@ -14,20 +14,20 @@ public abstract class TaskManager {
public static int runTaskRepeat(final Runnable r, final int interval) {
if (r != null) {
return PlotSquared.getInstance().TASK.taskRepeat(r, interval);
return PS.get().TASK.taskRepeat(r, interval);
}
return -1;
}
public static void runTaskAsync(final Runnable r) {
if (r != null) {
PlotSquared.getInstance().TASK.taskAsync(r);
PS.get().TASK.taskAsync(r);
}
}
public static void runTask(final Runnable r) {
if (r != null) {
PlotSquared.getInstance().TASK.task(r);
PS.get().TASK.task(r);
}
}
@ -38,13 +38,13 @@ public abstract class TaskManager {
*/
public static void runTaskLater(final Runnable r, final int delay) {
if (r != null) {
PlotSquared.getInstance().TASK.taskLater(r, delay);
PS.get().TASK.taskLater(r, delay);
}
}
public static void runTaskLaterAsync(final Runnable r, final int delay) {
if (r != null) {
PlotSquared.getInstance().TASK.taskLaterAsync(r, delay);
PS.get().TASK.taskLaterAsync(r, delay);
}
}

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotId;
import com.sk89q.worldedit.CuboidClipboard;
@ -20,7 +20,7 @@ public class WorldEditSchematic {
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
EditSession session = PlotSquared.getInstance().worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
EditSession session = PS.get().worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
clipboard.copy(session);
try {
clipboard.saveSchematic(new File(file));

View File

@ -45,7 +45,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.listeners.APlotListener;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.ChunkLoc;
@ -118,7 +118,7 @@ public class BukkitChunkManager extends ChunkManager {
public void run() {
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
final File file = new File(directory);
PlotSquared.log("&6 - Deleting region: " + file.getName() + " (approx 1024 chunks)");
PS.log("&6 - Deleting region: " + file.getName() + " (approx 1024 chunks)");
if (file.exists()) {
file.delete();
}
@ -137,7 +137,7 @@ public class BukkitChunkManager extends ChunkManager {
for (ChunkLoc loc : chunks) {
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
final File file = new File(directory);
PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
if (file.exists()) {
file.delete();
}
@ -469,7 +469,7 @@ public class BukkitChunkManager extends ChunkManager {
try {
entity.spawn(world, x_offset, z_offset);
} catch (final Exception e) {
PlotSquared.log("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
PS.log("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
e.printStackTrace();
}
}
@ -485,10 +485,10 @@ public class BukkitChunkManager extends ChunkManager {
chest.getInventory().setContents(chestContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : signContents.keySet()) {
@ -504,10 +504,10 @@ public class BukkitChunkManager extends ChunkManager {
}
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : dispenserContents.keySet()) {
@ -518,10 +518,10 @@ public class BukkitChunkManager extends ChunkManager {
((Dispenser) (state)).getInventory().setContents(dispenserContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : dropperContents.keySet()) {
@ -532,10 +532,10 @@ public class BukkitChunkManager extends ChunkManager {
((Dropper) (state)).getInventory().setContents(dropperContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : beaconContents.keySet()) {
@ -546,10 +546,10 @@ public class BukkitChunkManager extends ChunkManager {
((Beacon) (state)).getInventory().setContents(beaconContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : jukeDisc.keySet()) {
@ -560,10 +560,10 @@ public class BukkitChunkManager extends ChunkManager {
((Jukebox) (state)).setPlaying(Material.getMaterial(jukeDisc.get(loc)));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to restore jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : skullData.keySet()) {
@ -583,10 +583,10 @@ public class BukkitChunkManager extends ChunkManager {
}
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to restore skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : hopperContents.keySet()) {
@ -597,10 +597,10 @@ public class BukkitChunkManager extends ChunkManager {
((Hopper) (state)).getInventory().setContents(hopperContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : noteBlockContents.keySet()) {
@ -611,10 +611,10 @@ public class BukkitChunkManager extends ChunkManager {
((NoteBlock) (state)).setNote(noteBlockContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : brewTime.keySet()) {
@ -624,10 +624,10 @@ public class BukkitChunkManager extends ChunkManager {
if (state instanceof BrewingStand) {
((BrewingStand) (state)).setBrewingTime(brewTime.get(loc));
} else {
PlotSquared.log("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : spawnerData.keySet()) {
@ -638,10 +638,10 @@ public class BukkitChunkManager extends ChunkManager {
((CreatureSpawner) (state)).setCreatureTypeId(spawnerData.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : cmdData.keySet()) {
@ -652,10 +652,10 @@ public class BukkitChunkManager extends ChunkManager {
((CommandBlock) (state)).setCommand(cmdData.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : brewingStandContents.keySet()) {
@ -666,10 +666,10 @@ public class BukkitChunkManager extends ChunkManager {
((BrewingStand) (state)).getInventory().setContents(brewingStandContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : furnaceTime.keySet()) {
@ -681,10 +681,10 @@ public class BukkitChunkManager extends ChunkManager {
((Furnace) (state)).setBurnTime(time[0]);
((Furnace) (state)).setCookTime(time[1]);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : furnaceContents.keySet()) {
@ -695,10 +695,10 @@ public class BukkitChunkManager extends ChunkManager {
((Furnace) (state)).getInventory().setContents(furnaceContents.get(loc));
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : bannerBase.keySet()) {
@ -715,10 +715,10 @@ public class BukkitChunkManager extends ChunkManager {
}
state.update(true);
} else {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
PlotSquared.log("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
PS.log("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
}

View File

@ -20,7 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util.bukkit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
@ -85,8 +85,8 @@ public class BukkitPlayerFunctions {
}
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
final Plot plot1 = PlotSquared.getInstance().getPlots(world).get(pos1);
final Plot plot2 = PlotSquared.getInstance().getPlots(world).get(pos2);
final Plot plot1 = PS.get().getPlots(world).get(pos1);
final Plot plot2 = PS.get().getPlots(world).get(pos2);
if (plot1 != null) {
pos1 = MainUtil.getBottomPlot(plot1).id;
}
@ -110,7 +110,7 @@ public class BukkitPlayerFunctions {
* @return boolean
*/
public static Plot getCurrentPlot(final Player player) {
if (!PlotSquared.getInstance().isPlotWorld(player.getWorld().getName())) {
if (!PS.get().isPlotWorld(player.getWorld().getName())) {
return null;
}
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(player));
@ -118,8 +118,8 @@ public class BukkitPlayerFunctions {
if (id == null) {
return null;
}
if (PlotSquared.getInstance().getPlots(world).containsKey(id)) {
return PlotSquared.getInstance().getPlots(world).get(id);
if (PS.get().getPlots(world).containsKey(id)) {
return PS.get().getPlots(world).get(id);
}
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world);
}
@ -132,7 +132,7 @@ public class BukkitPlayerFunctions {
* @return boolean
*/
public static Set<Plot> getPlayerPlots(final String world, final Player plr) {
final Set<Plot> p = PlotSquared.getInstance().getPlots(world, plr.getName());
final Set<Plot> p = PS.get().getPlots(world, plr.getName());
if (p == null) {
return new HashSet<>();
}

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util.bukkit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotWorld;
@ -28,7 +28,7 @@ public class BukkitSetupUtils extends SetupUtils {
if (plugin.isEnabled()) {
final ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
if (generator != null) {
PlotSquared.getInstance().removePlotWorld(testWorld);
PS.get().removePlotWorld(testWorld);
final String name = plugin.getDescription().getName();
// final PlotGenerator pgen = (PlotGenerator) generator;
// if (pgen.getPlotManager() instanceof SquarePlotManager) {
@ -46,14 +46,14 @@ public class BukkitSetupUtils extends SetupUtils {
final ConfigurationNode[] steps = object.step;
final String world = object.world;
for (final ConfigurationNode step : steps) {
PlotSquared.getInstance().config.set("worlds." + world + "." + step.getConstant(), step.getValue());
PS.get().config.set("worlds." + world + "." + step.getConstant(), step.getValue());
}
if (object.type != 0) {
PlotSquared.getInstance().config.set("worlds." + world + "." + "generator.type", object.type);
PlotSquared.getInstance().config.set("worlds." + world + "." + "generator.terrain", object.terrain);
PlotSquared.getInstance().config.set("worlds." + world + "." + "generator.plugin", object.plotManager);
PS.get().config.set("worlds." + world + "." + "generator.type", object.type);
PS.get().config.set("worlds." + world + "." + "generator.terrain", object.terrain);
PS.get().config.set("worlds." + world + "." + "generator.plugin", object.plotManager);
if (object.setupGenerator != null && !object.setupGenerator.equals(object.plotManager)) {
PlotSquared.getInstance().config.set("worlds." + world + "." + "generator.init", object.setupGenerator);
PS.get().config.set("worlds." + world + "." + "generator.init", object.setupGenerator);
}
ChunkGenerator gen = generators.get(object.setupGenerator);
if (gen instanceof PlotGenerator) {
@ -61,7 +61,7 @@ public class BukkitSetupUtils extends SetupUtils {
}
}
try {
PlotSquared.getInstance().config.save(PlotSquared.getInstance().configFile);
PS.get().config.save(PS.get().configFile);
} catch (final IOException e) {
e.printStackTrace();
}

View File

@ -49,7 +49,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
public class Metrics {
/**
@ -525,7 +525,7 @@ public class Metrics {
connection.addRequestProperty("Connection", "close");
connection.setDoOutput(true);
if (this.debug) {
PlotSquared.log("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
PS.log("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
}
// Write the data
final OutputStream os = connection.getOutputStream();

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util.bukkit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
@ -29,7 +29,7 @@ public class SendChunk {
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
private static boolean v1_7_10 = PlotSquared.getInstance().IMP.checkVersion(1, 7, 10) && !PlotSquared.getInstance().IMP.checkVersion(1, 8, 0);
private static boolean v1_7_10 = PS.get().IMP.checkVersion(1, 7, 10) && !PS.get().IMP.checkVersion(1, 8, 0);
// Ref Method
private static RefMethod methodGetHandle;
// Ref Field

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util.bukkit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.util.SetupUtils;
import org.bukkit.World;
@ -15,7 +15,7 @@ import java.util.Iterator;
public class SetGenCB {
public static void setGenerator(World world) throws Exception {
SetupUtils.manager.updateGenerators();
PlotSquared.getInstance().removePlotWorldAbs(world.getName());
PS.get().removePlotWorldAbs(world.getName());
ChunkGenerator gen = world.getGenerator();
if (gen == null) {
return;
@ -49,6 +49,6 @@ public class SetGenCB {
}
}
}
PlotSquared.getInstance().loadWorld(world.getName(), null);
PS.get().loadWorld(world.getName(), null);
}
}

View File

@ -4,7 +4,7 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -90,7 +90,7 @@ public class UUIDHandler {
public static HashSet<UUID> getAllUUIDS() {
HashSet<UUID> uuids = new HashSet<UUID>();
for (Plot plot : PlotSquared.getInstance().getPlotsRaw()) {
for (Plot plot : PS.get().getPlotsRaw()) {
for (UUID uuid : plot.trusted) {
uuids.add(uuid);
}
@ -116,12 +116,12 @@ public class UUIDHandler {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching for: " + world);
PS.log(C.PREFIX.s() + "&6Starting player data caching for: " + world);
final HashMap<StringWrapper, UUID> toAdd = new HashMap<>();
toAdd.put(new StringWrapper("*"), DBFunc.everyone);
if (Settings.TWIN_MODE_UUID) {
HashSet<UUID> all = getAllUUIDS();
PlotSquared.log("&aFast mod UUID caching enabled!");
PS.log("&aFast mod UUID caching enabled!");
final File playerdataFolder = new File(container, world + File.separator + "playerdata");
String[] dat = playerdataFolder.list(new FilenameFilter() {
@Override
@ -147,7 +147,7 @@ public class UUIDHandler {
}
} catch (final Exception e) {
e.printStackTrace();
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
PS.log(C.PREFIX.s() + "Invalid playerdata: " + current);
}
}
}
@ -176,7 +176,7 @@ public class UUIDHandler {
final UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (final Exception e) {
PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: " + current);
PS.log(C.PREFIX.s() + "Invalid playerdata: " + current);
}
}
break;
@ -214,7 +214,7 @@ public class UUIDHandler {
ExpireManager.dates.put(uuid, last);
toAdd.put(new StringWrapper(name), uuid);
} catch (final Throwable e) {
PlotSquared.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
PS.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
}
}
for (final String name : names) {
@ -245,7 +245,7 @@ public class UUIDHandler {
for (Entry<StringWrapper, UUID> entry : toAdd.entrySet()) {
add(entry.getKey(), entry.getValue());
}
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
PS.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
}
});
}

View File

@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.BukkitOfflinePlayer;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -83,7 +83,7 @@ public class LowerOfflineUUIDWrapper extends UUIDWrapper {
return p.toArray(new Player[0]);
}
} catch (final Exception e) {
PlotSquared.log("Failed to resolve online players");
PS.log("Failed to resolve online players");
this.getOnline = null;
return Bukkit.getOnlinePlayers().toArray(new Player[0]);
}

View File

@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.BukkitOfflinePlayer;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -83,7 +83,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
return p.toArray(new Player[0]);
}
} catch (final Exception e) {
PlotSquared.log("Failed to resolve online players");
PS.log("Failed to resolve online players");
this.getOnline = null;
return Bukkit.getOnlinePlayers().toArray(new Player[0]);
}

View File

@ -1,6 +1,6 @@
package com.intellectualsites.translation.bukkit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PS;
import com.intellectualsites.translation.TranslationAsset;
import com.intellectualsites.translation.TranslationLanguage;
import com.intellectualsites.translation.TranslationManager;
@ -33,7 +33,7 @@ public class BukkitTranslation {
* @return parent folder
*/
public static File getParent() {
return new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "translations");
return new File(PS.get().IMP.getDirectory() + File.separator + "translations");
}
/**