More changes

This commit is contained in:
boy0001 2015-02-19 19:51:10 +11:00
parent d227bcc739
commit fde378c965
96 changed files with 3323 additions and 1354 deletions

View File

@ -6,12 +6,19 @@ import java.util.Arrays;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -19,7 +26,12 @@ import com.intellectualcrafters.plot.commands.Buy;
import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.WE_Anywhere; import com.intellectualcrafters.plot.commands.WE_Anywhere;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.PlotMeConverter;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.listeners.ForceFieldListener; import com.intellectualcrafters.plot.listeners.ForceFieldListener;
import com.intellectualcrafters.plot.listeners.InventoryListener; import com.intellectualcrafters.plot.listeners.InventoryListener;
import com.intellectualcrafters.plot.listeners.PlayerEvents; import com.intellectualcrafters.plot.listeners.PlayerEvents;
@ -27,8 +39,19 @@ import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8;
import com.intellectualcrafters.plot.listeners.PlotListener; import com.intellectualcrafters.plot.listeners.PlotListener;
import com.intellectualcrafters.plot.listeners.PlotPlusListener; import com.intellectualcrafters.plot.listeners.PlotPlusListener;
import com.intellectualcrafters.plot.listeners.WorldEditListener; import com.intellectualcrafters.plot.listeners.WorldEditListener;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.ConsoleColors;
import com.intellectualcrafters.plot.util.Metrics; import com.intellectualcrafters.plot.util.Metrics;
import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.PlotHelper;
import com.intellectualcrafters.plot.util.SendChunk;
import com.intellectualcrafters.plot.util.SetBlockFast;
import com.intellectualcrafters.plot.util.SetBlockManager;
import com.intellectualcrafters.plot.util.SetBlockSlow;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager; import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -37,6 +60,46 @@ public class BukkitMain extends JavaPlugin implements Listener,IPlotMain {
public static BukkitMain THIS = null; public static BukkitMain THIS = null;
public static PlotSquared MAIN = null; public static PlotSquared MAIN = null;
public static boolean hasPermission(final Player player, final String perm) {
if ((player == null) || player.isOp() || player.hasPermission(PlotSquared.ADMIN_PERMISSION)) {
return true;
}
if (player.hasPermission(perm)) {
return true;
}
final String[] nodes = perm.split("\\.");
final StringBuilder n = new StringBuilder();
for (int i = 0; i < (nodes.length - 1); i++) {
n.append(nodes[i] + ("."));
if (player.hasPermission(n + "*")) {
return true;
}
}
return false;
}
@EventHandler
public static void worldLoad(WorldLoadEvent event) {
UUIDHandler.cacheAll();
}
@EventHandler
public void PlayerCommand(PlayerCommandPreprocessEvent event) {
String message = event.getMessage();
if (message.toLowerCase().startsWith("/plotme")) {
Plugin plotme = Bukkit.getPluginManager().getPlugin("PlotMe");
if (plotme == null) {
Player player = event.getPlayer();
if (Settings.USE_PLOTME_ALIAS) {
player.performCommand(message.replace("/plotme", "plots"));
} else {
PlayerFunctions.sendMessage(player, C.NOT_USING_PLOTME);
}
event.setCancelled(true);
}
}
}
@Override @Override
public void onEnable() { public void onEnable() {
MAIN = new PlotSquared(this); MAIN = new PlotSquared(this);
@ -54,7 +117,7 @@ public class BukkitMain extends JavaPlugin implements Listener,IPlotMain {
log("&dUsing metrics will allow us to improve the plugin, please consider it :)"); log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
} }
// TODO world load event getServer().getPluginManager().registerEvents(this, this);
} }
@Override @Override
@ -66,7 +129,15 @@ public class BukkitMain extends JavaPlugin implements Listener,IPlotMain {
@Override @Override
public void log(String message) { public void log(String message) {
// TODO Auto-generated method stub if (THIS == null || Bukkit.getServer().getConsoleSender() == null) {
System.out.println(ChatColor.stripColor(ConsoleColors.fromString(message)));
} else {
message = ChatColor.translateAlternateColorCodes('&', message);
if (!Settings.CONSOLE_COLOR) {
message = ChatColor.stripColor(message);
}
Bukkit.getServer().getConsoleSender().sendMessage(message);
}
} }
@Override @Override
@ -139,6 +210,14 @@ public class BukkitMain extends JavaPlugin implements Listener,IPlotMain {
}, 20); }, 20);
} }
@Override
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
if (!PlotSquared.setupPlotWorld(world, id)) {
return null;
}
return new HybridGen(world);
}
public static boolean checkVersion(int major, int minor, int minor2) { public static boolean checkVersion(int major, int minor, int minor2) {
try { try {
String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\."); String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
@ -209,4 +288,64 @@ public class BukkitMain extends JavaPlugin implements Listener,IPlotMain {
} }
return null; return null;
} }
@Override
public void initSetBlockManager() {
if (checkVersion(1, 8, 0)) {
try {
SetBlockManager.setBlockManager = new SetBlockSlow();
}
catch (Throwable e) {
e.printStackTrace();
SetBlockManager.setBlockManager = new SetBlockSlow();
}
}
else {
try {
SetBlockManager.setBlockManager = new SetBlockFast();
} catch (Throwable e) {
SetBlockManager.setBlockManager = new SetBlockSlow();
}
}
try {
new SendChunk();
PlotHelper.canSendChunk = true;
} catch (final Throwable e) {
PlotHelper.canSendChunk = false;
}
}
@Override
public boolean initPlotMeConverter() {
try {
new PlotMeConverter().runAsync();
} catch (final Exception e) {
e.printStackTrace();
}
if (Bukkit.getPluginManager().getPlugin("PlotMe") != null) {
return true;
}
return false;
}
@Override
public void getGenerator(String world, String name) {
Plugin gen_plugin = Bukkit.getPluginManager().getPlugin(name);
if (gen_plugin != null && gen_plugin.isEnabled()) {
gen_plugin.getDefaultWorldGenerator(world, "");
} else {
new HybridGen(world);
}
}
@Override
public boolean callRemovePlot(String world, PlotId id) {
final PlotDeleteEvent event = new PlotDeleteEvent(world, id);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
event.setCancelled(true);
return false;
}
return true;
}
} }

View File

@ -4,6 +4,7 @@ import java.io.File;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
public interface IPlotMain { public interface IPlotMain {
@ -32,4 +33,12 @@ public interface IPlotMain {
public void registerWorldEditEvents(); public void registerWorldEditEvents();
public Economy getEconomy(); public Economy getEconomy();
}
public void initSetBlockManager();
public boolean initPlotMeConverter();
public void getGenerator(String world, String name);
public boolean callRemovePlot(String world, PlotId id);
}

View File

@ -6,11 +6,15 @@ import java.sql.Connection;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
@ -22,6 +26,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.commands.Cluster; import com.intellectualcrafters.plot.commands.Cluster;
import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.MySQL; import com.intellectualcrafters.plot.database.MySQL;
@ -30,18 +35,30 @@ import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.AbstractFlag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.flag.FlagValue; import com.intellectualcrafters.plot.flag.FlagValue;
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.SquarePlotManager;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.ExpireManager; import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.Logger; import com.intellectualcrafters.plot.util.Logger;
import com.intellectualcrafters.plot.util.PlotHelper;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.Logger.LogLevel; import com.intellectualcrafters.plot.util.Logger.LogLevel;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
public class PlotSquared { public class PlotSquared {
public static final String MAIN_PERMISSION = "plots.use";
public static final String ADMIN_PERMISSION = "plots.admin";
public static File styleFile; public static File styleFile;
public static YamlConfiguration style; public static YamlConfiguration style;
@ -55,6 +72,7 @@ public class PlotSquared {
public static IPlotMain IMP = null; // Specific implementation of PlotSquared public static IPlotMain IMP = null; // Specific implementation of PlotSquared
public static String VERSION = null; public static String VERSION = null;
public static TaskManager TASK = null; public static TaskManager TASK = null;
private static boolean LOADING_WORLD = false;
public static Economy economy = null; public static Economy economy = null;
private final static HashMap<String, PlotWorld> plotworlds = new HashMap<>(); private final static HashMap<String, PlotWorld> plotworlds = new HashMap<>();
@ -68,6 +86,302 @@ public class PlotSquared {
return mySQL; return mySQL;
} }
public static void updatePlot(final Plot plot) {
final String world = plot.world;
if (!plots.containsKey(world)) {
plots.put(world, new HashMap<PlotId, Plot>());
}
plot.hasChanged = true;
plots.get(world).put(plot.id, plot);
}
public static PlotWorld getWorldSettings(final String world) {
if (plotworlds.containsKey(world)) {
return plotworlds.get(world);
}
return null;
}
public static void addPlotWorld(final String world, final PlotWorld plotworld, final PlotManager manager) {
plotworlds.put(world, plotworld);
plotmanagers.put(world, manager);
if (!plots.containsKey(world)) {
plots.put(world, new HashMap<PlotId, Plot>());
}
}
public static void removePlotWorld(final String world) {
plots.remove(world);
plotmanagers.remove(world);
plotworlds.remove(world);
}
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
PlotSquared.plots = plots;
}
public static Set<Plot> getPlots() {
final ArrayList<Plot> newplots = new ArrayList<>();
for (final HashMap<PlotId, Plot> world : plots.values()) {
newplots.addAll(world.values());
}
return new LinkedHashSet<>(newplots);
}
public static LinkedHashSet<Plot> getPlotsSorted() {
final ArrayList<Plot> newplots = new ArrayList<>();
for (final HashMap<PlotId, Plot> world : plots.values()) {
newplots.addAll(world.values());
}
return new LinkedHashSet<>(newplots);
}
public static Set<Plot> getPlots(final String world, final String player) {
final UUID uuid = UUIDHandler.getUUID(player);
return getPlots(world, uuid);
}
public static Set<Plot> getPlots(final String world, final UUID uuid) {
final ArrayList<Plot> myplots = new ArrayList<>();
for (final Plot plot : getPlots(world).values()) {
if (plot.hasOwner()) {
if (plot.getOwner().equals(uuid)) {
myplots.add(plot);
}
}
}
return new HashSet<>(myplots);
}
public static boolean isPlotWorld(final String world) {
return (plotworlds.containsKey(world));
}
public static PlotManager getPlotManager(final String world) {
if (plotmanagers.containsKey(world)) {
return plotmanagers.get(world);
}
return null;
}
public static String[] getPlotWorldsString() {
final Set<String> strings = plots.keySet();
return strings.toArray(new String[strings.size()]);
}
public static HashMap<PlotId, Plot> getPlots(final String world) {
if (plots.containsKey(world)) {
return plots.get(world);
}
return new HashMap<>();
}
public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) {
if (callEvent) {
if (!IMP.callRemovePlot(world, id)) {
return false;
}
}
plots.get(world).remove(id);
if (PlotHelper.lastPlot.containsKey(world)) {
PlotId last = PlotHelper.lastPlot.get(world);
int last_max = Math.max(last.x, last.y);
int this_max = Math.max(id.x, id.y);
if (this_max < last_max) {
PlotHelper.lastPlot.put(world, id);
}
}
return true;
}
public static void loadWorld(final String world, final PlotGenerator generator) {
if (getWorldSettings(world) != null) {
return;
}
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
final PlotWorld plotWorld;
final PlotGenerator plotGenerator;
final PlotManager plotManager;
final String path = "worlds." + world;
if (!LOADING_WORLD && (generator != null) && (generator instanceof PlotGenerator)) {
plotGenerator = (PlotGenerator) generator;
plotWorld = plotGenerator.getNewPlotWorld(world);
plotManager = plotGenerator.getPlotManager();
if (!world.equals("CheckingPlotSquaredGenerator")) {
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
log(C.PREFIX.s() + "&3 - generator: &7" + plotGenerator.getClass().getName());
log(C.PREFIX.s() + "&3 - plotworld: &7" + plotWorld.getClass().getName());
log(C.PREFIX.s() + "&3 - manager: &7" + plotManager.getClass().getName());
}
if (!config.contains(path)) {
config.createSection(path);
}
plotWorld.saveConfiguration(config.getConfigurationSection(path));
plotWorld.loadDefaultConfiguration(config.getConfigurationSection(path));
try {
config.save(configFile);
} catch (final IOException e) {
e.printStackTrace();
}
// Now add it
addPlotWorld(world, plotWorld, plotManager);
PlotHelper.setupBorder(world);
} else {
if (!worlds.contains(world)) {
return;
}
if (!LOADING_WORLD) {
LOADING_WORLD = true;
try {
String gen_string = config.getString("worlds." + world + "." + "generator.plugin");
if (gen_string == null) {
new HybridGen(world);
}
else {
IMP.getGenerator(world, gen_string);
}
} catch (Exception e) {
log("&d=== Oh no! Please set the generator for the " + world + " ===");
e.printStackTrace();
LOADING_WORLD = false;
removePlotWorld(world);
} finally {
LOADING_WORLD = false;
}
} else {
PlotGenerator gen_class = (PlotGenerator) generator;
plotWorld = gen_class.getNewPlotWorld(world);
plotManager = gen_class.getPlotManager();
if (!config.contains(path)) {
config.createSection(path);
}
plotWorld.TYPE = 2;
plotWorld.TERRAIN = 0;
plotWorld.saveConfiguration(config.getConfigurationSection(path));
plotWorld.loadDefaultConfiguration(config.getConfigurationSection(path));
try {
config.save(configFile);
} catch (final IOException e) {
e.printStackTrace();
}
if ((plotWorld.TYPE == 2 && !Settings.ENABLE_CLUSTERS) || !(plotManager instanceof SquarePlotManager)) {
log("&c[ERROR] World '" + world + "' in settings.yml is not using PlotSquared generator! Please set the generator correctly or delete the world from the 'settings.yml'!");
return;
}
addPlotWorld(world, plotWorld, plotManager);
if (plotWorld.TYPE == 2) {
if (ClusterManager.getClusters(world).size() > 0) {
for (PlotCluster cluster : ClusterManager.getClusters(world)) {
new AugmentedPopulator(world, gen_class, cluster, plotWorld.TERRAIN == 2, plotWorld.TERRAIN != 2);
}
}
} else if (plotWorld.TYPE == 1) {
new AugmentedPopulator(world, gen_class, null, plotWorld.TERRAIN == 2, plotWorld.TERRAIN != 2);
}
}
}
}
public static boolean setupPlotWorld(String world, String id) {
if (id != null && id.length() > 0) {
// save configuration
String[] split = id.split(",");
HybridPlotWorld plotworld = new HybridPlotWorld(world);
int width = HybridPlotWorld.PLOT_WIDTH_DEFAULT;
int gap = HybridPlotWorld.ROAD_WIDTH_DEFAULT;
int height = HybridPlotWorld.PLOT_HEIGHT_DEFAULT;
PlotBlock[] floor = HybridPlotWorld.TOP_BLOCK_DEFAULT;
PlotBlock[] main = HybridPlotWorld.MAIN_BLOCK_DEFAULT;
PlotBlock wall = HybridPlotWorld.WALL_FILLING_DEFAULT;
PlotBlock border = HybridPlotWorld.WALL_BLOCK_DEFAULT;
for (String element : split) {
String[] pair = element.split("=");
if (pair.length != 2) {
log("&cNo value provided for: &7" + element);
return false;
}
String key = pair[0].toLowerCase();
String value = pair[1];
try {
switch (key) {
case "s":
case "size": {
HybridPlotWorld.PLOT_WIDTH_DEFAULT = ((Integer) Configuration.INTEGER.parseString(value)).shortValue();
break;
}
case "g":
case "gap": {
HybridPlotWorld.ROAD_WIDTH_DEFAULT = ((Integer) Configuration.INTEGER.parseString(value)).shortValue();
break;
}
case "h":
case "height": {
HybridPlotWorld.PLOT_HEIGHT_DEFAULT = (Integer) Configuration.INTEGER.parseString(value);
HybridPlotWorld.ROAD_HEIGHT_DEFAULT = (Integer) Configuration.INTEGER.parseString(value);
HybridPlotWorld.WALL_HEIGHT_DEFAULT = (Integer) Configuration.INTEGER.parseString(value);
break;
}
case "f":
case "floor": {
HybridPlotWorld.TOP_BLOCK_DEFAULT = (PlotBlock[]) Configuration.BLOCKLIST.parseString(value);
break;
}
case "m":
case "main": {
HybridPlotWorld.MAIN_BLOCK_DEFAULT = (PlotBlock[]) Configuration.BLOCKLIST.parseString(value);
break;
}
case "w":
case "wall": {
HybridPlotWorld.WALL_FILLING_DEFAULT = (PlotBlock) Configuration.BLOCK.parseString(value);
break;
}
case "b":
case "border": {
HybridPlotWorld.WALL_BLOCK_DEFAULT = (PlotBlock) Configuration.BLOCK.parseString(value);
break;
}
default: {
log("&cKey not found: &7" + element);
return false;
}
}
}
catch (Exception e) {
e.printStackTrace();
log("&cInvalid value: &7" + value + " in arg " + element);
return false;
}
}
try {
String root = "worlds." + world;
if (!config.contains(root)) {
config.createSection(root);
}
plotworld.saveConfiguration(config.getConfigurationSection(root));
HybridPlotWorld.PLOT_HEIGHT_DEFAULT = height;
HybridPlotWorld.ROAD_HEIGHT_DEFAULT = height;
HybridPlotWorld.WALL_HEIGHT_DEFAULT = height;
HybridPlotWorld.TOP_BLOCK_DEFAULT = floor;
HybridPlotWorld.MAIN_BLOCK_DEFAULT = main;
HybridPlotWorld.WALL_BLOCK_DEFAULT = border;
HybridPlotWorld.WALL_FILLING_DEFAULT = wall;
HybridPlotWorld.PLOT_WIDTH_DEFAULT = width;
HybridPlotWorld.ROAD_WIDTH_DEFAULT = gap;
}
catch (Exception e) {
e.printStackTrace();
}
}
return true;
}
public static Connection getConnection() { public static Connection getConnection() {
return connection; return connection;
} }
@ -111,6 +425,23 @@ public class PlotSquared {
IMP.registerForceFieldEvents(); IMP.registerForceFieldEvents();
IMP.registerWorldEditEvents(); IMP.registerWorldEditEvents();
// Set block
IMP.initSetBlockManager();
// PlotMe
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
if (IMP.initPlotMeConverter()) {
log("&c=== IMPORTANT ===");
log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml@'");
}
}
}, 200);
if (Settings.AUTO_CLEAR) { if (Settings.AUTO_CLEAR) {
ExpireManager.runTask(); ExpireManager.runTask();
} }

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,8 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -80,10 +81,10 @@ public class Auto extends SubCommand {
int size_x = 1; int size_x = 1;
int size_z = 1; int size_z = 1;
String schematic = ""; String schematic = "";
if (PlotMain.getPlotWorlds().length == 1) { if (PlotSquared.getPlotWorlds().size() == 1) {
world = Bukkit.getWorld(PlotMain.getPlotWorlds()[0]); world = Bukkit.getWorld(PlotSquared.getPlotWorlds().iterator().next());
} else { } else {
if (PlotMain.isPlotWorld(plr.getWorld())) { if (PlotSquared.isPlotWorld(plr.getWorld().getName())) {
world = plr.getWorld(); world = plr.getWorld();
} else { } else {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
@ -91,7 +92,7 @@ public class Auto extends SubCommand {
} }
} }
if (args.length > 0) { if (args.length > 0) {
if (PlotMain.hasPermission(plr, "plots.auto.mega")) { if (BukkitMain.hasPermission(plr, "plots.auto.mega")) {
try { try {
final String[] split = args[0].split(","); final String[] split = args[0].split(",");
size_x = Integer.parseInt(split[0]); size_x = Integer.parseInt(split[0]);
@ -133,12 +134,12 @@ public class Auto extends SubCommand {
} }
return false; return false;
} }
final PlotWorld pWorld = PlotMain.getWorldSettings(world); final PlotWorld pWorld = PlotSquared.getWorldSettings(world.getName());
if (PlotMain.useEconomy && pWorld.USE_ECONOMY) { if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY) {
double cost = pWorld.PLOT_PRICE; double cost = pWorld.PLOT_PRICE;
cost = (size_x * size_z) * cost; cost = (size_x * size_z) * cost;
if (cost > 0d) { if (cost > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
if (economy.getBalance(plr) < cost) { if (economy.getBalance(plr) < cost) {
sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost); sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
return true; return true;
@ -153,14 +154,14 @@ public class Auto extends SubCommand {
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
return true; return true;
} }
if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { if (!PlotSquared.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
return true; return true;
} }
// } // }
} }
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (plotworld.TYPE == 2) { if (plotworld.TYPE == 2) {
Location loc = plr.getLocation(); Location loc = plr.getLocation();
Plot plot = PlotHelper.getCurrentPlot(loc); Plot plot = PlotHelper.getCurrentPlot(loc);
@ -214,7 +215,7 @@ public class Auto extends SubCommand {
PlotHelper.lastPlot.put(worldname, start); PlotHelper.lastPlot.put(worldname, start);
if (lastPlot) { if (lastPlot) {
} }
if ((PlotMain.getPlots(world).get(start) != null) && (PlotMain.getPlots(world).get(start).owner != null)) { if ((PlotSquared.getPlots(world).get(start) != null) && (PlotSquared.getPlots(world).get(start).owner != null)) {
continue; continue;
} else { } else {
lastPlot = false; lastPlot = false;

View File

@ -26,7 +26,7 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
@ -49,11 +49,11 @@ public class Buy extends SubCommand {
@Override @Override
public boolean execute(final Player plr, final String... args) { public boolean execute(final Player plr, final String... args) {
if (!PlotMain.useEconomy) { if (!PlotSquared.useEconomy) {
return sendMessage(plr, C.ECON_DISABLED); return sendMessage(plr, C.ECON_DISABLED);
} }
World world = plr.getWorld(); World world = plr.getWorld();
if (!PlotMain.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
return sendMessage(plr, C.NOT_IN_PLOT_WORLD); return sendMessage(plr, C.NOT_IN_PLOT_WORLD);
} }
Plot plot; Plot plot;
@ -91,13 +91,13 @@ public class Buy extends SubCommand {
PlotId id = plot.id; PlotId id = plot.id;
PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id; PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id;
int size = PlayerFunctions.getPlotSelectionIds(id, id2).size(); int size = PlayerFunctions.getPlotSelectionIds(id, id2).size();
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (plotworld.USE_ECONOMY) { if (plotworld.USE_ECONOMY) {
price += plotworld.PLOT_PRICE * size; price += plotworld.PLOT_PRICE * size;
initPrice += plotworld.SELL_PRICE * size; initPrice += plotworld.SELL_PRICE * size;
} }
if (price > 0d) { if (price > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
if (economy.getBalance(plr) < price) { if (economy.getBalance(plr) < price) {
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price); return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price);
} }

View File

@ -27,7 +27,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import com.intellectualcrafters.plot.generator.ClassicPlotWorld; import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
@ -62,12 +62,12 @@ public class Claim extends SubCommand {
PlotHelper.setSign(player, plot); PlotHelper.setSign(player, plot);
PlayerFunctions.sendMessage(player, C.CLAIMED); PlayerFunctions.sendMessage(player, C.CLAIMED);
if (teleport) { if (teleport) {
PlotMain.teleportPlayer(player, player.getLocation(), plot); PlotSquared.teleportPlayer(player, player.getLocation(), plot);
} }
World world = plot.getWorld(); World world = plot.getWorld();
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final Plot plot2 = PlotMain.getPlots(player.getWorld()).get(plot.id); final Plot plot2 = PlotSquared.getPlots(player.getWorld()).get(plot.id);
if (plotworld.SCHEMATIC_ON_CLAIM) { if (plotworld.SCHEMATIC_ON_CLAIM) {
SchematicHandler.Schematic sch; SchematicHandler.Schematic sch;
@ -81,7 +81,7 @@ public class Claim extends SubCommand {
} }
SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0); SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0);
} }
PlotMain.getPlotManager(plot.world).claimPlot(world, plotworld, plot); PlotSquared.getPlotManager(plot.world).claimPlot(world, plotworld, plot);
PlotHelper.update(player.getLocation()); PlotHelper.update(player.getLocation());
} }
return event.isCancelled(); return event.isCancelled();
@ -103,11 +103,11 @@ public class Claim extends SubCommand {
if (plot.hasOwner()) { if (plot.hasOwner()) {
return sendMessage(plr, C.PLOT_IS_CLAIMED); return sendMessage(plr, C.PLOT_IS_CLAIMED);
} }
final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld()); final PlotWorld world = PlotSquared.getWorldSettings(plot.getWorld());
if (PlotMain.useEconomy && world.USE_ECONOMY) { if (PlotSquared.useEconomy && world.USE_ECONOMY) {
final double cost = world.PLOT_PRICE; final double cost = world.PLOT_PRICE;
if (cost > 0d) { if (cost > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
if (economy.getBalance(plr) < cost) { if (economy.getBalance(plr) < cost) {
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost); return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
} }
@ -120,7 +120,7 @@ public class Claim extends SubCommand {
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) { if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
} }
if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { if (!PlotSquared.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
} }
} }

View File

@ -24,7 +24,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
@ -43,22 +43,22 @@ public class Clear extends SubCommand {
if (plr == null) { if (plr == null) {
// Is console // Is console
if (args.length < 2) { if (args.length < 2) {
PlotMain.sendConsoleSenderMessage("You need to specify two arguments: ID (0;0) & World (world)"); PlotSquared.sendConsoleSenderMessage("You need to specify two arguments: ID (0;0) & World (world)");
} else { } else {
final PlotId id = PlotId.fromString(args[0]); final PlotId id = PlotId.fromString(args[0]);
final String world = args[1]; final String world = args[1];
if (id == null) { if (id == null) {
PlotMain.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]); PlotSquared.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]);
} else { } else {
if (!PlotMain.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
PlotMain.sendConsoleSenderMessage("Invalid plot world: " + world); PlotSquared.sendConsoleSenderMessage("Invalid plot world: " + world);
} else { } else {
final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id); final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id);
if (plot == null) { if (plot == null) {
PlotMain.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world); PlotSquared.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world);
} else { } else {
plot.clear(null, false); plot.clear(null, false);
PlotMain.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared."); PlotSquared.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared.");
} }
} }
} }
@ -73,7 +73,7 @@ public class Clear extends SubCommand {
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return sendMessage(plr, C.UNLINK_REQUIRED); return sendMessage(plr, C.UNLINK_REQUIRED);
} }
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.clear")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.clear")) {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;

View File

@ -30,7 +30,7 @@ import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.generator.AugmentedPopulator; import com.intellectualcrafters.plot.generator.AugmentedPopulator;
@ -64,7 +64,7 @@ public class Cluster extends SubCommand {
switch (sub) { switch (sub) {
case "l": case "l":
case "list": { case "list": {
if (!PlotMain.hasPermission(plr, "plots.cluster.list")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.list")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list");
return false; return false;
} }
@ -94,7 +94,7 @@ public class Cluster extends SubCommand {
} }
case "c": case "c":
case "create": { case "create": {
if (!PlotMain.hasPermission(plr, "plots.cluster.create")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.create")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create");
return false; return false;
} }
@ -136,16 +136,16 @@ public class Cluster extends SubCommand {
} }
ClusterManager.clusters.get(world).add(cluster); ClusterManager.clusters.get(world).add(cluster);
// Add any existing plots to the current cluster // Add any existing plots to the current cluster
for (Plot plot : PlotMain.getPlots(plr.getWorld()).values()) { for (Plot plot : PlotSquared.getPlots(plr.getWorld()).values()) {
PlotCluster current = ClusterManager.getCluster(plot); PlotCluster current = ClusterManager.getCluster(plot);
if (cluster.equals(current) && !cluster.hasRights(plot.owner)) { if (cluster.equals(current) && !cluster.hasRights(plot.owner)) {
cluster.invited.add(plot.owner); cluster.invited.add(plot.owner);
DBFunc.setInvited(world, cluster, plot.owner); DBFunc.setInvited(world, cluster, plot.owner);
} }
} }
if (!PlotMain.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
PlotMain.config.createSection("worlds." + world); PlotSquared.config.createSection("worlds." + world);
PlotMain.loadWorld(plr.getWorld()); PlotSquared.loadWorld(plr.getWorld());
} }
PlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED); PlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED);
return true; return true;
@ -153,7 +153,7 @@ public class Cluster extends SubCommand {
case "disband": case "disband":
case "del": case "del":
case "delete": { case "delete": {
if (!PlotMain.hasPermission(plr, "plots.cluster.delete")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.delete")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete");
return false; return false;
} }
@ -177,15 +177,15 @@ public class Cluster extends SubCommand {
} }
} }
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) { if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
if (!PlotMain.hasPermission(plr, "plots.cluster.delete.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.delete.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other");
return false; return false;
} }
} }
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld()); PlotWorld plotworld = PlotSquared.getWorldSettings(plr.getWorld());
if (plotworld.TYPE == 2) { if (plotworld.TYPE == 2) {
ArrayList<Plot> toRemove = new ArrayList<>(); ArrayList<Plot> toRemove = new ArrayList<>();
for (Plot plot : PlotMain.getPlots(plr.getWorld()).values()) { for (Plot plot : PlotSquared.getPlots(plr.getWorld()).values()) {
PlotCluster other = ClusterManager.getCluster(plot); PlotCluster other = ClusterManager.getCluster(plot);
if (cluster.equals(other)) { if (cluster.equals(other)) {
toRemove.add(plot); toRemove.add(plot);
@ -216,7 +216,7 @@ public class Cluster extends SubCommand {
} }
case "res": case "res":
case "resize": { case "resize": {
if (!PlotMain.hasPermission(plr, "plots.cluster.resize")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.resize")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize");
return false; return false;
} }
@ -238,7 +238,7 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!PlotMain.hasPermission(plr, "plots.cluster.resize.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.resize.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other");
return false; return false;
} }
@ -258,7 +258,7 @@ public class Cluster extends SubCommand {
case "reg": case "reg":
case "regenerate": case "regenerate":
case "regen": { case "regen": {
if (!PlotMain.hasPermission(plr, "plots.cluster.delete")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.delete")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen");
return false; return false;
} }
@ -282,7 +282,7 @@ public class Cluster extends SubCommand {
} }
} }
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) { if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
if (!PlotMain.hasPermission(plr, "plots.cluster.regen.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.regen.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other");
return false; return false;
} }
@ -294,7 +294,7 @@ public class Cluster extends SubCommand {
case "add": case "add":
case "inv": case "inv":
case "invite": { case "invite": {
if (!PlotMain.hasPermission(plr, "plots.cluster.invite")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.invite")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite");
return false; return false;
} }
@ -309,7 +309,7 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!PlotMain.hasPermission(plr, "plots.cluster.invite.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.invite.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other");
return false; return false;
} }
@ -336,7 +336,7 @@ public class Cluster extends SubCommand {
case "k": case "k":
case "remove": case "remove":
case "kick": { case "kick": {
if (!PlotMain.hasPermission(plr, "plots.cluster.kick")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.kick")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick");
return false; return false;
} }
@ -350,7 +350,7 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!PlotMain.hasPermission(plr, "plots.cluster.kick.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.kick.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other");
return false; return false;
} }
@ -376,7 +376,7 @@ public class Cluster extends SubCommand {
if (player != null) { if (player != null) {
PlayerFunctions.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName()); PlayerFunctions.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
} }
for (Plot plot : PlotMain.getPlots(plr.getWorld(), uuid)) { for (Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
PlotCluster current = ClusterManager.getCluster(plot); PlotCluster current = ClusterManager.getCluster(plot);
if (current != null && current.equals(cluster)) { if (current != null && current.equals(cluster)) {
String world = plr.getWorld().getName(); String world = plr.getWorld().getName();
@ -388,7 +388,7 @@ public class Cluster extends SubCommand {
} }
case "quit": case "quit":
case "leave": { case "leave": {
if (!PlotMain.hasPermission(plr, "plots.cluster.leave")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.leave")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave");
return false; return false;
} }
@ -427,7 +427,7 @@ public class Cluster extends SubCommand {
cluster.invited.remove(uuid); cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid); DBFunc.removeInvited(cluster, uuid);
PlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName()); PlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName());
for (Plot plot : PlotMain.getPlots(plr.getWorld(), uuid)) { for (Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
PlotCluster current = ClusterManager.getCluster(plot); PlotCluster current = ClusterManager.getCluster(plot);
if (current != null && current.equals(cluster)) { if (current != null && current.equals(cluster)) {
String world = plr.getWorld().getName(); String world = plr.getWorld().getName();
@ -439,7 +439,7 @@ public class Cluster extends SubCommand {
case "admin": case "admin":
case "helper": case "helper":
case "helpers": { case "helpers": {
if (!PlotMain.hasPermission(plr, "plots.cluster.helpers")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.helpers")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers");
return false; return false;
} }
@ -471,7 +471,7 @@ public class Cluster extends SubCommand {
case "spawn": case "spawn":
case "home": case "home":
case "tp": { case "tp": {
if (!PlotMain.hasPermission(plr, "plots.cluster.tp")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.tp")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp");
return false; return false;
} }
@ -486,7 +486,7 @@ public class Cluster extends SubCommand {
} }
UUID uuid = UUIDHandler.getUUID(plr); UUID uuid = UUIDHandler.getUUID(plr);
if (!cluster.hasRights(uuid)) { if (!cluster.hasRights(uuid)) {
if (!PlotMain.hasPermission(plr, "plots.cluster.tp.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.tp.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other");
return false; return false;
} }
@ -498,7 +498,7 @@ public class Cluster extends SubCommand {
case "info": case "info":
case "show": case "show":
case "information": { case "information": {
if (!PlotMain.hasPermission(plr, "plots.cluster.info")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.info")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info");
return false; return false;
} }
@ -543,7 +543,7 @@ public class Cluster extends SubCommand {
case "sh": case "sh":
case "setspawn": case "setspawn":
case "sethome": { case "sethome": {
if (!PlotMain.hasPermission(plr, "plots.cluster.sethome")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.sethome")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome");
return false; return false;
} }
@ -557,7 +557,7 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!PlotMain.hasPermission(plr, "plots.cluster.sethome.other")) { if (!PlotSquared.hasPermission(plr, "plots.cluster.sethome.other")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other");
return false; return false;
} }

View File

@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
/** /**
* Created by Citymonstret on 2014-08-03. * Created by Citymonstret on 2014-08-03.
@ -50,6 +50,6 @@ public class CommandPermission {
* @return true of player has the required permission node * @return true of player has the required permission node
*/ */
public boolean hasPermission(final Player player) { public boolean hasPermission(final Player player) {
return PlotMain.hasPermission(player, this.permission); return PlotSquared.hasPermission(player, this.permission);
} }
} }

View File

@ -27,7 +27,7 @@ import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -54,7 +54,7 @@ public class Comment extends SubCommand {
if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) { if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) {
if (PlotMain.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) { if (PlotSquared.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) {
final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " "); final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase())); final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
plot.settings.addComment(comment); plot.settings.addComment(comment);

View File

@ -32,7 +32,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
@ -60,7 +60,7 @@ public class Condense extends SubCommand {
} }
String worldname = args[0]; String worldname = args[0];
final World world = Bukkit.getWorld(worldname); final World world = Bukkit.getWorld(worldname);
if (world == null || !PlotMain.isPlotWorld(worldname)) { if (world == null || !PlotSquared.isPlotWorld(worldname)) {
PlayerFunctions.sendMessage(plr, "INVALID WORLD"); PlayerFunctions.sendMessage(plr, "INVALID WORLD");
return false; return false;
} }
@ -83,7 +83,7 @@ public class Condense extends SubCommand {
return false; return false;
} }
int radius = Integer.parseInt(args[2]); int radius = Integer.parseInt(args[2]);
Collection<Plot> plots = PlotMain.getPlots(worldname).values(); Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
int size = plots.size(); int size = plots.size();
int minimum_radius = (int) Math.ceil((Math.sqrt(size)/2) + 1); int minimum_radius = (int) Math.ceil((Math.sqrt(size)/2) + 1);
if (radius < minimum_radius) { if (radius < minimum_radius) {
@ -168,7 +168,7 @@ public class Condense extends SubCommand {
return false; return false;
} }
int radius = Integer.parseInt(args[2]); int radius = Integer.parseInt(args[2]);
Collection<Plot> plots = PlotMain.getPlots(worldname).values(); Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
int size = plots.size(); int size = plots.size();
int minimum_radius = (int) Math.ceil((Math.sqrt(size)/2) + 1); int minimum_radius = (int) Math.ceil((Math.sqrt(size)/2) + 1);
if (radius < minimum_radius) { if (radius < minimum_radius) {
@ -203,7 +203,7 @@ public class Condense extends SubCommand {
} }
public static void sendMessage(final String message) { public static void sendMessage(final String message) {
PlotMain.sendConsoleSenderMessage("&3PlotSquared -> Plot condense&8: &7" + message); PlotSquared.sendConsoleSenderMessage("&3PlotSquared -> Plot condense&8: &7" + message);
} }
} }

View File

@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotSelection; import com.intellectualcrafters.plot.object.PlotSelection;
@ -44,7 +44,7 @@ public class Copy extends SubCommand {
return false; return false;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.copy")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.copy")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotManager;
import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridPlotWorld;
@ -45,13 +45,13 @@ public class CreateRoadSchematic extends SubCommand {
return false; return false;
} }
if (!(PlotMain.getWorldSettings(player.getWorld()) instanceof HybridPlotWorld)) { if (!(PlotSquared.getWorldSettings(player.getWorld()) instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD); return sendMessage(player, C.NOT_IN_PLOT_WORLD);
} }
final Plot plot = PlayerFunctions.getCurrentPlot(player); final Plot plot = PlayerFunctions.getCurrentPlot(player);
HybridPlotManager manager = (HybridPlotManager) PlotMain.getPlotManager(player.getWorld()); HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld());
manager.setupRoadSchematic(plot); manager.setupRoadSchematic(plot);
PlotHelper.update(player.getLocation()); PlotHelper.update(player.getLocation());

View File

@ -10,7 +10,7 @@ import java.util.UUID;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.database.MySQL; import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager; import com.intellectualcrafters.plot.database.SQLManager;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -33,7 +33,7 @@ public class Database extends SubCommand {
private static boolean sendMessageU(final UUID uuid, final String msg) { private static boolean sendMessageU(final UUID uuid, final String msg) {
if (uuid == null) { if (uuid == null) {
PlotMain.sendConsoleSenderMessage(msg); PlotSquared.sendConsoleSenderMessage(msg);
} else { } else {
final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid); final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid);
if ((p != null) && p.isOnline()) { if ((p != null) && p.isOnline()) {
@ -46,8 +46,8 @@ public class Database extends SubCommand {
} }
public static void insertPlots(final SQLManager manager, final UUID requester, final Connection c) { public static void insertPlots(final SQLManager manager, final UUID requester, final Connection c) {
final Plugin p = PlotMain.getMain(); final Plugin p = PlotSquared.getMain();
final java.util.Set<Plot> plots = PlotMain.getPlots(); final java.util.Set<Plot> plots = PlotSquared.getPlots();
p.getServer().getScheduler().runTaskAsynchronously(p, new Runnable() { p.getServer().getScheduler().runTaskAsynchronously(p, new Runnable() {
@Override @Override
public void run() { public void run() {
@ -94,7 +94,7 @@ public class Database extends SubCommand {
} }
Connection n; Connection n;
try { try {
n = new MySQL(PlotMain.getMain(), host, port, database, username, password).openConnection(); n = new MySQL(PlotSquared.getMain(), host, port, database, username, password).openConnection();
// Connection // Connection
if (n.isClosed()) { if (n.isClosed()) {
return sendMessage(plr, "Failed to open connection"); return sendMessage(plr, "Failed to open connection");
@ -141,7 +141,7 @@ public class Database extends SubCommand {
private boolean sendMessage(final Player player, final String msg) { private boolean sendMessage(final Player player, final String msg) {
if (player == null) { if (player == null) {
PlotMain.sendConsoleSenderMessage(msg); PlotSquared.sendConsoleSenderMessage(msg);
} else { } else {
PlayerFunctions.sendMessage(player, msg); PlayerFunctions.sendMessage(player, msg);
} }

View File

@ -25,7 +25,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.util.Lag; import com.intellectualcrafters.plot.util.Lag;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -58,7 +58,7 @@ public class Debug extends SubCommand {
} }
{ {
final StringBuilder worlds = new StringBuilder(""); final StringBuilder worlds = new StringBuilder("");
for (final String world : PlotMain.getPlotWorlds()) { for (final String world : PlotSquared.getPlotWorlds()) {
worlds.append(world).append(" "); worlds.append(world).append(" ");
} }
information.append(header); information.append(header);
@ -68,10 +68,10 @@ public class Debug extends SubCommand {
information.append(getLine(line, "TPS Percentage", (int) Lag.getFullPercentage() + "%")); information.append(getLine(line, "TPS Percentage", (int) Lag.getFullPercentage() + "%"));
information.append(getSection(section, "PlotWorld")); information.append(getSection(section, "PlotWorld"));
information.append(getLine(line, "Plot Worlds", worlds)); information.append(getLine(line, "Plot Worlds", worlds));
information.append(getLine(line, "Owned Plots", PlotMain.getPlots().size())); information.append(getLine(line, "Owned Plots", PlotSquared.getPlots().size()));
// information.append(getLine(line, "PlotWorld Size", // information.append(getLine(line, "PlotWorld Size",
// PlotHelper.getWorldFolderSize() + "MB")); // PlotHelper.getWorldFolderSize() + "MB"));
for (final String worldname : PlotMain.getPlotWorlds()) { for (final String worldname : PlotSquared.getPlotWorlds()) {
final World world = Bukkit.getWorld(worldname); final World world = Bukkit.getWorld(worldname);
information.append(getLine(line, "World: " + world.getName() + " size", PlotHelper.getWorldFolderSize(world))); information.append(getLine(line, "World: " + world.getName() + " size", PlotHelper.getWorldFolderSize(world)));
information.append(getLine(line, " - Entities", PlotHelper.getEntities(world))); information.append(getLine(line, " - Entities", PlotHelper.getEntities(world)));

View File

@ -33,7 +33,7 @@ import org.bukkit.block.Sign;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
@ -68,7 +68,7 @@ public class DebugClaimTest extends SubCommand {
PlotHelper.setSign(player, plot); PlotHelper.setSign(player, plot);
PlayerFunctions.sendMessage(player, C.CLAIMED); PlayerFunctions.sendMessage(player, C.CLAIMED);
if (teleport) { if (teleport) {
PlotMain.teleportPlayer(player, player.getLocation(), plot); PlotSquared.teleportPlayer(player, player.getLocation(), plot);
} }
} }
return event.isCancelled(); return event.isCancelled();
@ -81,7 +81,7 @@ public class DebugClaimTest extends SubCommand {
return !PlayerFunctions.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}"); return !PlayerFunctions.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 World world = Bukkit.getWorld(args[0]); final World world = Bukkit.getWorld(args[0]);
if ((world == null) || !PlotMain.isPlotWorld(world)) { if ((world == null) || !PlotSquared.isPlotWorld(world)) {
return !PlayerFunctions.sendMessage(null, "&cInvalid plot world!"); return !PlayerFunctions.sendMessage(null, "&cInvalid plot world!");
} }
@ -99,14 +99,14 @@ public class DebugClaimTest extends SubCommand {
PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while..."); PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while...");
PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final ArrayList<Plot> plots = new ArrayList<>(); final ArrayList<Plot> plots = new ArrayList<>();
for (final PlotId id : PlayerFunctions.getPlotSelectionIds(min, max)) { for (final PlotId id : PlayerFunctions.getPlotSelectionIds(min, max)) {
final Plot plot = PlotHelper.getPlot(world, id); final Plot plot = PlotHelper.getPlot(world, id);
final boolean contains = PlotMain.getPlots(world).containsKey(plot.id); final boolean contains = PlotSquared.getPlots(world).containsKey(plot.id);
if (contains) { if (contains) {
PlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id); PlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id);
continue; continue;
@ -165,7 +165,7 @@ public class DebugClaimTest extends SubCommand {
DBFunc.createAllSettingsAndHelpers(plots); DBFunc.createAllSettingsAndHelpers(plots);
for (final Plot plot : plots) { for (final Plot plot : plots) {
PlotMain.updatePlot(plot); PlotSquared.updatePlot(plot);
} }
PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");

View File

@ -26,7 +26,7 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.SquarePlotWorld; import com.intellectualcrafters.plot.generator.SquarePlotWorld;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -47,19 +47,19 @@ public class DebugClear extends SubCommand {
if (plr == null) { if (plr == null) {
// Is console // Is console
if (args.length < 2) { if (args.length < 2) {
PlotMain.sendConsoleSenderMessage("You need to specify two arguments: ID (0;0) & World (world)"); PlotSquared.sendConsoleSenderMessage("You need to specify two arguments: ID (0;0) & World (world)");
} else { } else {
final PlotId id = PlotId.fromString(args[0]); final PlotId id = PlotId.fromString(args[0]);
final String world = args[1]; final String world = args[1];
if (id == null) { if (id == null) {
PlotMain.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]); PlotSquared.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]);
} else { } else {
if (!PlotMain.isPlotWorld(world) || !(PlotMain.getWorldSettings(world) instanceof SquarePlotWorld)) { if (!PlotSquared.isPlotWorld(world) || !(PlotSquared.getWorldSettings(world) instanceof SquarePlotWorld)) {
PlotMain.sendConsoleSenderMessage("Invalid plot world: " + world); PlotSquared.sendConsoleSenderMessage("Invalid plot world: " + world);
} else { } else {
final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id); final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id);
if (plot == null) { if (plot == null) {
PlotMain.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world); PlotSquared.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world);
} else { } else {
World bukkitWorld = Bukkit.getWorld(world); World bukkitWorld = Bukkit.getWorld(world);
Location pos1 = PlotHelper.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); Location pos1 = PlotHelper.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
@ -73,8 +73,8 @@ public class DebugClear extends SubCommand {
@Override @Override
public void run() { public void run() {
PlotHelper.runners.remove(plot); PlotHelper.runners.remove(plot);
PlotMain.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared."); PlotSquared.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared.");
PlotMain.sendConsoleSenderMessage("&aDone!"); PlotSquared.sendConsoleSenderMessage("&aDone!");
} }
}); });
} }
@ -84,14 +84,14 @@ public class DebugClear extends SubCommand {
return true; return true;
} }
if (!PlayerFunctions.isInPlot(plr) || !(PlotMain.getWorldSettings(plr.getWorld()) instanceof SquarePlotWorld)) { if (!PlayerFunctions.isInPlot(plr) || !(PlotSquared.getWorldSettings(plr.getWorld()) instanceof SquarePlotWorld)) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return sendMessage(plr, C.UNLINK_REQUIRED); return sendMessage(plr, C.UNLINK_REQUIRED);
} }
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.debugclear")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.debugclear")) {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;

View File

@ -38,7 +38,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.ExpireManager; import com.intellectualcrafters.plot.util.ExpireManager;
@ -135,7 +135,7 @@ public class DebugExec extends SubCommand {
return PlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run"); return PlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run");
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if (world == null || !PlotMain.isPlotWorld(args[1])) { if (world == null || !PlotSquared.isPlotWorld(args[1])) {
return PlayerFunctions.sendMessage(null, "Invalid world: "+args[1]); return PlayerFunctions.sendMessage(null, "Invalid world: "+args[1]);
} }
final ArrayList<ChunkLoc> empty = new ArrayList<>(); final ArrayList<ChunkLoc> empty = new ArrayList<>();
@ -146,7 +146,7 @@ public class DebugExec extends SubCommand {
Trim.sendMessage(" - MCA #: " + empty.size()); Trim.sendMessage(" - MCA #: " + empty.size());
Trim.sendMessage(" - CHUNKS: " + (empty.size() * 1024) + " (max)"); Trim.sendMessage(" - CHUNKS: " + (empty.size() * 1024) + " (max)");
Trim.sendMessage("Exporting log for manual approval..."); Trim.sendMessage("Exporting log for manual approval...");
final File file = new File(PlotMain.getMain().getDirectory() + File.separator + "trim.txt"); final File file = new File(PlotSquared.getMain().getDirectory() + File.separator + "trim.txt");
PrintWriter writer; PrintWriter writer;
try { try {
writer = new PrintWriter(file); writer = new PrintWriter(file);

View File

@ -28,7 +28,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.AbstractFlag;
@ -54,12 +54,12 @@ public class DebugFixFlags extends SubCommand {
return false; return false;
} }
World world = Bukkit.getWorld(args[0]); World world = Bukkit.getWorld(args[0]);
if (world == null || !PlotMain.isPlotWorld(world)) { if (world == null || !PlotSquared.isPlotWorld(world)) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]); PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
return false; return false;
} }
PlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---"); PlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---");
for (Plot plot : PlotMain.getPlots(world).values()) { for (Plot plot : PlotSquared.getPlots(world).values()) {
Set<Flag> flags = plot.settings.flags; Set<Flag> flags = plot.settings.flags;
ArrayList<Flag> toRemove = new ArrayList<Flag>(); ArrayList<Flag> toRemove = new ArrayList<Flag>();
for (Flag flag : flags) { for (Flag flag : flags) {

View File

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

View File

@ -26,7 +26,7 @@ import java.util.Arrays;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotManager;
import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridPlotWorld;
@ -41,10 +41,10 @@ public class DebugRoadRegen extends SubCommand {
@Override @Override
public boolean execute(final Player player, final String... args) { public boolean execute(final Player player, final String... args) {
if (!(PlotMain.getWorldSettings(player.getWorld()) instanceof HybridPlotWorld)) { if (!(PlotSquared.getWorldSettings(player.getWorld()) instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD); return sendMessage(player, C.NOT_IN_PLOT_WORLD);
} }
HybridPlotManager manager = (HybridPlotManager) PlotMain.getPlotManager(player.getWorld()); HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld());
Chunk chunk = player.getLocation().getChunk(); Chunk chunk = player.getLocation().getChunk();
boolean result = manager.regenerateRoad(chunk); boolean result = manager.regenerateRoad(chunk);

View File

@ -25,7 +25,7 @@ import java.util.ArrayList;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -43,7 +43,7 @@ public class DebugSaveTest extends SubCommand {
public boolean execute(final Player plr, final String... args) { public boolean execute(final Player plr, final String... args) {
if (plr == null) { if (plr == null) {
final ArrayList<Plot> plots = new ArrayList<Plot>(); final ArrayList<Plot> plots = new ArrayList<Plot>();
plots.addAll(PlotMain.getPlots()); plots.addAll(PlotSquared.getPlots());
DBFunc.createPlots(plots); DBFunc.createPlots(plots);
DBFunc.createAllSettingsAndHelpers(plots); DBFunc.createAllSettingsAndHelpers(plots);
} else { } else {

View File

@ -25,7 +25,7 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -48,20 +48,20 @@ public class Delete extends SubCommand {
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return !sendMessage(plr, C.UNLINK_REQUIRED); return !sendMessage(plr, C.UNLINK_REQUIRED);
} }
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !PlotMain.hasPermission(plr, "plots.admin.command.delete")) { if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !PlotSquared.hasPermission(plr, "plots.admin.command.delete")) {
return !sendMessage(plr, C.NO_PLOT_PERMS); return !sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
final PlotWorld pWorld = PlotMain.getWorldSettings(plot.getWorld()); final PlotWorld pWorld = PlotSquared.getWorldSettings(plot.getWorld());
if (PlotMain.useEconomy && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) { if (PlotSquared.useEconomy && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
final double c = pWorld.SELL_PRICE; final double c = pWorld.SELL_PRICE;
if (c > 0d) { if (c > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
economy.depositPlayer(plr, c); economy.depositPlayer(plr, c);
sendMessage(plr, C.ADDED_BALANCE, c + ""); sendMessage(plr, C.ADDED_BALANCE, c + "");
} }
} }
final boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true); final boolean result = PlotSquared.removePlot(plr.getWorld().getName(), plot.id, true);
if (result) { if (result) {
plot.clear(plr, true); plot.clear(plr, true);
DBFunc.delete(plr.getWorld().getName(), plot); DBFunc.delete(plr.getWorld().getName(), plot);

View File

@ -26,7 +26,7 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent; import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
@ -55,7 +55,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin.command.denied")) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotSquared.hasPermission(plr, "plots.admin.command.denied")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }

View File

@ -28,7 +28,7 @@ import java.util.HashMap;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.AbstractFlag;
@ -67,13 +67,13 @@ public class FlagCmd extends SubCommand {
sendMessage(player, C.PLOT_NOT_CLAIMED); sendMessage(player, C.PLOT_NOT_CLAIMED);
return false; return false;
} }
if (!plot.hasRights(player) && !PlotMain.hasPermission(player, "plots.set.flag.other")) { if (!plot.hasRights(player) && !PlotSquared.hasPermission(player, "plots.set.flag.other")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other");
return false; return false;
} }
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "info": { case "info": {
if (!PlotMain.hasPermission(player, "plots.set.flag")) { if (!PlotSquared.hasPermission(player, "plots.set.flag")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.info"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
return false; return false;
} }
@ -96,7 +96,7 @@ public class FlagCmd extends SubCommand {
PlayerFunctions.sendMessage(player, "&cNot implemented."); PlayerFunctions.sendMessage(player, "&cNot implemented.");
} }
case "set": { case "set": {
if (!PlotMain.hasPermission(player, "plots.set.flag")) { if (!PlotSquared.hasPermission(player, "plots.set.flag")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag");
return false; return false;
} }
@ -109,7 +109,7 @@ public class FlagCmd extends SubCommand {
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
return false; return false;
} }
if (!PlotMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { if (!PlotSquared.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; return false;
} }
@ -130,7 +130,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "remove": { case "remove": {
if (!PlotMain.hasPermission(player, "plots.flag.remove")) { if (!PlotSquared.hasPermission(player, "plots.flag.remove")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove");
return false; return false;
} }
@ -143,7 +143,7 @@ public class FlagCmd extends SubCommand {
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
return false; return false;
} }
if (!PlotMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { if (!PlotSquared.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; return false;
} }
@ -169,7 +169,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "add": { case "add": {
if (!PlotMain.hasPermission(player, "plots.flag.add")) { if (!PlotSquared.hasPermission(player, "plots.flag.add")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.add"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.add");
return false; return false;
} }
@ -182,7 +182,7 @@ public class FlagCmd extends SubCommand {
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
return false; return false;
} }
if (!PlotMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { if (!PlotSquared.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; return false;
} }
@ -210,7 +210,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "list": { case "list": {
if (!PlotMain.hasPermission(player, "plots.flag.list")) { if (!PlotSquared.hasPermission(player, "plots.flag.list")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.list"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.list");
return false; return false;
} }

View File

@ -26,7 +26,7 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent; import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
@ -55,7 +55,7 @@ public class Helpers extends SubCommand {
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin.command.helpers")) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotSquared.hasPermission(plr, "plots.admin.command.helpers")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }

View File

@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -39,7 +39,7 @@ public class Home extends SubCommand {
} }
private Plot isAlias(final String a) { private Plot isAlias(final String a) {
for (final Plot p : PlotMain.getPlots()) { for (final Plot p : PlotSquared.getPlots()) {
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) { if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
return p; return p;
} }
@ -49,9 +49,9 @@ public class Home extends SubCommand {
@Override @Override
public boolean execute(final Player plr, String... args) { public boolean execute(final Player plr, String... args) {
final Plot[] plots = PlotMain.getPlots(plr).toArray(new Plot[0]); final Plot[] plots = PlotSquared.getPlots(plr).toArray(new Plot[0]);
if (plots.length == 1) { if (plots.length == 1) {
PlotMain.teleportPlayer(plr, plr.getLocation(), plots[0]); PlotSquared.teleportPlayer(plr, plr.getLocation(), plots[0]);
return true; return true;
} else if (plots.length > 1) { } else if (plots.length > 1) {
if (args.length < 1) { if (args.length < 1) {
@ -88,7 +88,7 @@ public class Home extends SubCommand {
} }
public void teleportPlayer(Player player, Plot plot) { public void teleportPlayer(Player player, Plot plot) {
PlotMain.teleportPlayer(player, player.getLocation(), plot); PlotSquared.teleportPlayer(player, player.getLocation(), plot);
} }
} }

View File

@ -29,7 +29,7 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -63,7 +63,7 @@ public class Inbox extends SubCommand {
Integer tier; Integer tier;
final UUID uuid = UUIDHandler.getUUID(plr); final UUID uuid = UUIDHandler.getUUID(plr);
if (PlotMain.hasPermission(plr, "plots.comment.admin")) { if (PlotSquared.hasPermission(plr, "plots.comment.admin")) {
tier = 0; tier = 0;
} else if (plot != null && plot.owner.equals(uuid)) { } else if (plot != null && plot.owner.equals(uuid)) {
tier = 1; tier = 1;
@ -138,7 +138,7 @@ public class Inbox extends SubCommand {
final String world = plr.getWorld().getName(); final String world = plr.getWorld().getName();
final int tier2 = tier; final int tier2 = tier;
Bukkit.getScheduler().runTaskAsynchronously(PlotMain.getMain(), new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(PlotSquared.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
ArrayList<PlotComment> comments = null; ArrayList<PlotComment> comments = null;

View File

@ -31,7 +31,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
@ -58,7 +58,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
Plot plot; Plot plot;
if (player != null) { if (player != null) {
world = player.getWorld(); world = player.getWorld();
if (!PlotMain.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD); PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD);
return false; return false;
} }
@ -72,7 +72,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
PlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE); PlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
return false; return false;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(args[0]); final PlotWorld plotworld = PlotSquared.getWorldSettings(args[0]);
if (plotworld == null) { if (plotworld == null) {
PlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD); PlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD);
return false; return false;

View File

@ -24,7 +24,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return false; return false;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.kick")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.kick")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -32,13 +32,14 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter; import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringComparison;
/** /**
* PlotMain command class * PlotSquared command class
* *
* @author Citymonstret * @author Citymonstret
*/ */
@ -47,8 +48,6 @@ public class MainCommand implements CommandExecutor, TabCompleter {
/** /**
* Main Permission Node * Main Permission Node
*/ */
public static final String MAIN_PERMISSION = "plots.use";
private final static SubCommand[] _subCommands = new SubCommand[]{new Setup(), new DebugSaveTest(), new DebugLoadTest(), new CreateRoadSchematic(), new RegenAllRoads(), new DebugClear(), new Ban(), new Unban(), new OP(), new DEOP(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Rate(), new DebugClaimTest(), new Inbox(), new Comment(), new Database(), new Unclaim(), new Swap(), new MusicSubcommand(), new DebugRoadRegen(), new Trim(), new DebugExec(), new FlagCmd(), new Target(), new DebugFixFlags(), new Move(), new Condense() }; private final static SubCommand[] _subCommands = new SubCommand[]{new Setup(), new DebugSaveTest(), new DebugLoadTest(), new CreateRoadSchematic(), new RegenAllRoads(), new DebugClear(), new Ban(), new Unban(), new OP(), new DEOP(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Rate(), new DebugClaimTest(), new Inbox(), new Comment(), new Database(), new Unclaim(), new Swap(), new MusicSubcommand(), new DebugRoadRegen(), new Trim(), new DebugExec(), new FlagCmd(), new Target(), new DebugFixFlags(), new Move(), new Condense() };
public final static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() { public final static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
@ -122,8 +121,8 @@ public class MainCommand implements CommandExecutor, TabCompleter {
public boolean onCommand(final CommandSender sender, final Command cmd, final String commandLabel, final String[] args) { public boolean onCommand(final CommandSender sender, final Command cmd, final String commandLabel, final String[] args) {
final Player player = (sender instanceof Player) ? (Player) sender : null; final Player player = (sender instanceof Player) ? (Player) sender : null;
if (!PlotMain.hasPermission(player, MAIN_PERMISSION)) { if (!BukkitMain.hasPermission(player, PlotSquared.MAIN_PERMISSION)) {
return no_permission(player, 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 < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {

View File

@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.events.PlotMergeEvent; import com.intellectualcrafters.plot.events.PlotMergeEvent;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -85,7 +85,7 @@ public class Merge extends SubCommand {
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
boolean admin = PlotMain.hasPermission(plr, "plots.admin.command.merge"); boolean admin = PlotSquared.hasPermission(plr, "plots.admin.command.merge");
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
@ -143,19 +143,19 @@ public class Merge extends SubCommand {
plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top); plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top);
for (final PlotId myid : plots) { for (final PlotId myid : plots) {
final Plot myplot = PlotMain.getPlots(world).get(myid); final Plot myplot = PlotSquared.getPlots(world).get(myid);
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) { if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString())); PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
return false; return false;
} }
} }
final PlotWorld plotWorld = PlotMain.getWorldSettings(world); final PlotWorld plotWorld = PlotSquared.getWorldSettings(world);
if (PlotMain.useEconomy && plotWorld.USE_ECONOMY) { if (PlotSquared.useEconomy && plotWorld.USE_ECONOMY) {
double cost = plotWorld.MERGE_PRICE; double cost = plotWorld.MERGE_PRICE;
cost = plots.size() * cost; cost = plots.size() * cost;
if (cost > 0d) { if (cost > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
if (economy.getBalance(plr) < cost) { if (economy.getBalance(plr) < cost) {
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + ""); sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
return false; return false;

View File

@ -28,7 +28,7 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;

View File

@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotSelection; import com.intellectualcrafters.plot.object.PlotSelection;
@ -44,7 +44,7 @@ public class Paste extends SubCommand {
return false; return false;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.paste")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.paste")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -96,7 +96,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return false; return false;
} }
World world = Bukkit.getWorld(args[1]); World world = Bukkit.getWorld(args[1]);
if (world == null || !PlotMain.isPlotWorld(world)) { if (world == null || !PlotSquared.isPlotWorld(world)) {
PlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD); PlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD);
return false; return false;
} }
@ -114,7 +114,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
} }
UUID uuid = UUIDHandler.getUUID(args[0]); UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) { if (uuid != null) {
Set<Plot> plots = PlotMain.getPlots(world,uuid); Set<Plot> plots = PlotSquared.getPlots(world,uuid);
Set<PlotId> ids = new HashSet<>(); Set<PlotId> ids = new HashSet<>();
for (Plot plot : plots) { for (Plot plot : plots) {
ids.add(plot.id); ids.add(plot.id);
@ -123,7 +123,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return finishPurge(ids.size()); return finishPurge(ids.size());
} }
if (arg.equals("all")) { if (arg.equals("all")) {
Set<PlotId> ids = PlotMain.getPlots(world).keySet(); Set<PlotId> ids = PlotSquared.getPlots(world).keySet();
if (ids.size() == 0) { if (ids.size() == 0) {
return PlayerFunctions.sendMessage(null, "&cNo plots found"); return PlayerFunctions.sendMessage(null, "&cNo plots found");
} }
@ -131,7 +131,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return finishPurge(ids.size()); return finishPurge(ids.size());
} }
if (arg.equals("unknown")) { if (arg.equals("unknown")) {
Collection<Plot> plots = PlotMain.getPlots(world).values(); Collection<Plot> plots = PlotSquared.getPlots(world).values();
Set<PlotId> ids = new HashSet<>(); Set<PlotId> ids = new HashSet<>();
for (Plot plot : plots) { for (Plot plot : plots) {
if (plot.owner != null) { if (plot.owner != null) {
@ -148,7 +148,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return finishPurge(ids.size()); return finishPurge(ids.size());
} }
if (arg.equals("unowned")) { if (arg.equals("unowned")) {
Collection<Plot> plots = PlotMain.getPlots(world).values(); Collection<Plot> plots = PlotSquared.getPlots(world).values();
Set<PlotId> ids = new HashSet<>(); Set<PlotId> ids = new HashSet<>();
for (Plot plot : plots) { for (Plot plot : plots) {
if (plot.owner == null) { if (plot.owner == null) {

View File

@ -27,7 +27,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotManager;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
@ -54,7 +54,7 @@ public class RegenAllRoads extends SubCommand {
} }
String name = args[0]; String name = args[0];
PlotManager manager = PlotMain.getPlotManager(name); PlotManager manager = PlotSquared.getPlotManager(name);
if (manager == null || !(manager instanceof HybridPlotManager)) { if (manager == null || !(manager instanceof HybridPlotManager)) {
sendMessage(player, C.NOT_VALID_PLOT_WORLD); sendMessage(player, C.NOT_VALID_PLOT_WORLD);
@ -66,15 +66,15 @@ public class RegenAllRoads extends SubCommand {
World world = Bukkit.getWorld(name); World world = Bukkit.getWorld(name);
ArrayList<ChunkLoc> chunks = ChunkManager.getChunkChunks(world); ArrayList<ChunkLoc> chunks = ChunkManager.getChunkChunks(world);
PlotMain.sendConsoleSenderMessage("&cIf no schematic is set, the following will not do anything"); PlotSquared.sendConsoleSenderMessage("&cIf no schematic is set, the following will not do anything");
PlotMain.sendConsoleSenderMessage("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic"); PlotSquared.sendConsoleSenderMessage("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
PlotMain.sendConsoleSenderMessage("&6Potential chunks to update: &7"+ (chunks.size() * 1024)); PlotSquared.sendConsoleSenderMessage("&6Potential chunks to update: &7"+ (chunks.size() * 1024));
PlotMain.sendConsoleSenderMessage("&6Estimated time: &7"+ (chunks.size()) + " seconds"); PlotSquared.sendConsoleSenderMessage("&6Estimated time: &7"+ (chunks.size()) + " seconds");
boolean result = hpm.scheduleRoadUpdate(world); boolean result = hpm.scheduleRoadUpdate(world);
if (!result) { if (!result) {
PlotMain.sendConsoleSenderMessage("&cCannot schedule mass schematic update! (Is one already in progress?)"); PlotSquared.sendConsoleSenderMessage("&cCannot schedule mass schematic update! (Is one already in progress?)");
return false; return false;
} }

View File

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

View File

@ -31,7 +31,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -67,10 +67,10 @@ public class Schematic extends SubCommand {
switch (arg) { switch (arg) {
case "paste": case "paste":
if (plr == null) { if (plr == null) {
PlotMain.sendConsoleSenderMessage(C.IS_CONSOLE); PlotSquared.sendConsoleSenderMessage(C.IS_CONSOLE);
return false; return false;
} }
if (!PlotMain.hasPermission(plr, "plots.schematic.paste")) { if (!PlotSquared.hasPermission(plr, "plots.schematic.paste")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
return false; return false;
} }
@ -131,7 +131,7 @@ public class Schematic extends SubCommand {
final int LENGTH = schematic.getSchematicDimension().getZ(); final int LENGTH = schematic.getSchematicDimension().getZ();
final int blen = b.length - 1; final int blen = b.length - 1;
Schematic.this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { Schematic.this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotSquared.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
boolean result = false; boolean result = false;
@ -155,10 +155,10 @@ public class Schematic extends SubCommand {
break; break;
case "test": case "test":
if (plr == null) { if (plr == null) {
PlotMain.sendConsoleSenderMessage(C.IS_CONSOLE); PlotSquared.sendConsoleSenderMessage(C.IS_CONSOLE);
return false; return false;
} }
if (!PlotMain.hasPermission(plr, "plots.schematic.test")) { if (!PlotSquared.hasPermission(plr, "plots.schematic.test")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
return false; return false;
} }
@ -195,7 +195,7 @@ public class Schematic extends SubCommand {
PlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>"); PlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>");
return false; return false;
} }
final HashMap<PlotId, Plot> plotmap = PlotMain.getPlots(args[1]); final HashMap<PlotId, Plot> plotmap = PlotSquared.getPlots(args[1]);
if ((plotmap == null) || (plotmap.size() == 0)) { if ((plotmap == null) || (plotmap.size() == 0)) {
PlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall <world>"); PlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall <world>");
return false; return false;
@ -205,8 +205,8 @@ public class Schematic extends SubCommand {
return false; return false;
} }
PlotMain.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while."); PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
PlotMain.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots..."); PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots...");
final World worldObj = Bukkit.getWorld(args[1]); final World worldObj = Bukkit.getWorld(args[1]);
final String worldname = Bukkit.getWorld(args[1]).getName(); final String worldname = Bukkit.getWorld(args[1]).getName();
@ -221,7 +221,7 @@ public class Schematic extends SubCommand {
@Override @Override
public void run() { public void run() {
if (Schematic.this.counter >= Schematic.this.plots.length) { if (Schematic.this.counter >= Schematic.this.plots.length) {
PlotMain.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &aFinished!"); PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
Schematic.this.running = false; Schematic.this.running = false;
Bukkit.getScheduler().cancelTask(Schematic.this.task); Bukkit.getScheduler().cancelTask(Schematic.this.task);
return; return;
@ -252,7 +252,7 @@ public class Schematic extends SubCommand {
break; break;
case "export": case "export":
case "save": case "save":
if (!PlotMain.hasPermission(plr, "plots.schematic.save")) { if (!PlotSquared.hasPermission(plr, "plots.schematic.save")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
return false; return false;
} }
@ -280,11 +280,11 @@ public class Schematic extends SubCommand {
world = args[0]; world = args[0];
final String[] split = args[2].split(";"); final String[] split = args[2].split(";");
final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1])); final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
if ((PlotMain.getPlots(world) == null) || (PlotMain.getPlots(world).get(i) == null)) { if ((PlotSquared.getPlots(world) == null) || (PlotSquared.getPlots(world).get(i) == null)) {
PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>"); PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false; return false;
} }
p2 = PlotMain.getPlots(world).get(i); p2 = PlotSquared.getPlots(world).get(i);
} catch (final Exception e) { } catch (final Exception e) {
PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>"); PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false; return false;
@ -305,7 +305,7 @@ public class Schematic extends SubCommand {
@Override @Override
public void run() { public void run() {
if (Schematic.this.counter >= Schematic.this.plots.length) { if (Schematic.this.counter >= Schematic.this.plots.length) {
PlotMain.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &aFinished!"); PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
Schematic.this.running = false; Schematic.this.running = false;
Bukkit.getScheduler().cancelTask(Schematic.this.task); Bukkit.getScheduler().cancelTask(Schematic.this.task);
return; return;

View File

@ -33,7 +33,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.Configuration.SettingValue; import com.intellectualcrafters.plot.config.Configuration.SettingValue;
@ -78,7 +78,7 @@ public class Set extends SubCommand {
sendMessage(plr, C.PLOT_NOT_CLAIMED); sendMessage(plr, C.PLOT_NOT_CLAIMED);
return false; return false;
} }
if (!plot.hasRights(plr) && !PlotMain.hasPermission(plr, "plots.admin.command.set")) { if (!plot.hasRights(plr) && !PlotSquared.hasPermission(plr, "plots.admin.command.set")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
@ -94,7 +94,7 @@ public class Set extends SubCommand {
} }
/* TODO: Implement option */ /* TODO: Implement option */
// final boolean advanced_permissions = true; // final boolean advanced_permissions = true;
if (!PlotMain.hasPermission(plr, "plots.set." + args[0].toLowerCase())) { if (!PlotSquared.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase()); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
return false; return false;
} }
@ -102,11 +102,11 @@ public class Set extends SubCommand {
if (args[0].equalsIgnoreCase("flag")) { if (args[0].equalsIgnoreCase("flag")) {
if (args.length < 2) { if (args.length < 2) {
String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6"); String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
if (PlotMain.worldGuardListener != null) { if (PlotSquared.worldGuardListener != null) {
if (message.equals("")) { if (message.equals("")) {
message = StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6"); message = StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
} else { } else {
message += "," + StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6"); message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
} }
} }
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message)); PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
@ -121,19 +121,19 @@ public class Set extends SubCommand {
af = new AbstractFlag(args[1].toLowerCase()); af = new AbstractFlag(args[1].toLowerCase());
} }
if (!FlagManager.getFlags().contains(af) && ((PlotMain.worldGuardListener == null) || !PlotMain.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) { if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG); PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
return false; return false;
} }
if (!PlotMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) { if (!PlotSquared.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
return false; return false;
} }
if (args.length == 2) { if (args.length == 2) {
if (FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase()) == null) { if (FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase()) == null) {
if (PlotMain.worldGuardListener != null) { if (PlotSquared.worldGuardListener != null) {
if (PlotMain.worldGuardListener.str_flags.contains(args[1].toLowerCase())) { if (PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
PlotMain.worldGuardListener.removeFlag(plr, plr.getWorld(), plot, args[1]); PlotSquared.worldGuardListener.removeFlag(plr, plr.getWorld(), plot, args[1]);
return false; return false;
} }
} }
@ -159,8 +159,8 @@ public class Set extends SubCommand {
return false; return false;
} }
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotMain.worldGuardListener != null)) { if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) {
PlotMain.worldGuardListener.addFlag(plr, plr.getWorld(), plot, args[1], af.toString(parsed_value)); PlotSquared.worldGuardListener.addFlag(plr, plr.getWorld(), plot, args[1], af.toString(parsed_value));
return false; return false;
} }
@ -209,7 +209,7 @@ public class Set extends SubCommand {
PlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG); PlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG);
return false; return false;
} }
for (final Plot p : PlotMain.getPlots(plr.getWorld()).values()) { for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
if (p.settings.getAlias().equalsIgnoreCase(alias)) { if (p.settings.getAlias().equalsIgnoreCase(alias)) {
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false; return false;
@ -254,8 +254,8 @@ public class Set extends SubCommand {
// Get components // Get components
World world = plr.getWorld(); World world = plr.getWorld();
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
PlotManager manager = PlotMain.getPlotManager(world); PlotManager manager = PlotSquared.getPlotManager(world);
String[] components = manager.getPlotComponents(world, plotworld, plot.id); String[] components = manager.getPlotComponents(world, plotworld, plot.id);
for (String component : components) { for (String component : components) {
if (component.equalsIgnoreCase(args[0])) { if (component.equalsIgnoreCase(args[0])) {

View File

@ -27,7 +27,7 @@ import java.util.UUID;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -64,7 +64,7 @@ public class SetOwner extends SubCommand {
return false; return false;
} }
if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin.command.setowner")) { if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !PlotSquared.hasPermission(plr, "plots.admin.command.setowner")) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner"); PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
return false; return false;
} }
@ -73,7 +73,7 @@ public class SetOwner extends SubCommand {
final PlotId top = PlayerFunctions.getTopPlot(world, plot).id; final PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
final ArrayList<PlotId> plots = PlayerFunctions.getPlotSelectionIds(bot, top); final ArrayList<PlotId> plots = PlayerFunctions.getPlotSelectionIds(bot, top);
for (final PlotId id : plots) { for (final PlotId id : plots) {
final Plot current = PlotMain.getPlots(world).get(id); final Plot current = PlotSquared.getPlots(world).get(id);
UUID uuid = getUUID(args[0]); UUID uuid = getUUID(args[0]);
@ -83,11 +83,11 @@ public class SetOwner extends SubCommand {
} }
current.owner = uuid; current.owner = uuid;
PlotMain.updatePlot(current); PlotSquared.updatePlot(current);
DBFunc.setOwner(current, current.owner); DBFunc.setOwner(current, current.owner);
if (PlotMain.worldGuardListener != null) { if (PlotSquared.worldGuardListener != null) {
PlotMain.worldGuardListener.changeOwner(plr, current.owner, plr.getWorld(), current); PlotSquared.worldGuardListener.changeOwner(plr, current.owner, plr.getWorld(), current);
} }
} }
PlotHelper.setSign(world, args[0], plot); PlotHelper.setSign(world, args[0], plot);

View File

@ -36,7 +36,7 @@ import org.bukkit.entity.Player;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
@ -72,7 +72,7 @@ public class Setup extends SubCommand {
if (plugin.isEnabled()) { if (plugin.isEnabled()) {
ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, ""); ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
if (generator != null) { if (generator != null) {
PlotMain.removePlotWorld(testWorld); PlotSquared.removePlotWorld(testWorld);
final String name = plugin.getDescription().getName(); final String name = plugin.getDescription().getName();
if (generator instanceof PlotGenerator) { if (generator instanceof PlotGenerator) {
PlotGenerator pgen = (PlotGenerator) generator; PlotGenerator pgen = (PlotGenerator) generator;
@ -299,15 +299,15 @@ public class Setup extends SubCommand {
final ConfigurationNode[] steps = object.step; final ConfigurationNode[] steps = object.step;
final String world = object.world; final String world = object.world;
for (final ConfigurationNode step : steps) { for (final ConfigurationNode step : steps) {
PlotMain.config.set("worlds." + world + "." + step.getConstant(), step.getValue()); PlotSquared.config.set("worlds." + world + "." + step.getConstant(), step.getValue());
} }
if (object.type != 0) { if (object.type != 0) {
PlotMain.config.set("worlds." + world + "." + "generator.type", object.type); PlotSquared.config.set("worlds." + world + "." + "generator.type", object.type);
PlotMain.config.set("worlds." + world + "." + "generator.terrain", object.terrain); PlotSquared.config.set("worlds." + world + "." + "generator.terrain", object.terrain);
PlotMain.config.set("worlds." + world + "." + "generator.plugin", object.generator); PlotSquared.config.set("worlds." + world + "." + "generator.plugin", object.generator);
} }
try { try {
PlotMain.config.save(PlotMain.configFile); PlotSquared.config.save(PlotSquared.configFile);
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -24,7 +24,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -57,7 +57,7 @@ public class Swap extends SubCommand {
return false; return false;
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.swap")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.swap")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
@ -70,8 +70,8 @@ public class Swap extends SubCommand {
final World world = plr.getWorld(); final World world = plr.getWorld();
try { try {
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1])); plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
final Plot plot2 = PlotMain.getPlots(world).get(plotid); final Plot plot2 = PlotSquared.getPlots(world).get(plotid);
if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.swap")) { if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.swap")) {
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString()); PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
return false; return false;
} }

View File

@ -26,7 +26,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
@ -56,19 +56,19 @@ public class TP extends SubCommand {
world = Bukkit.getWorld(args[1]); world = Bukkit.getWorld(args[1]);
} }
} }
if (!PlotMain.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false; return false;
} }
Plot temp; Plot temp;
if ((temp = isAlias(world, id)) != null) { if ((temp = isAlias(world, id)) != null) {
PlotMain.teleportPlayer(plr, plr.getLocation(), temp); PlotSquared.teleportPlayer(plr, plr.getLocation(), temp);
return true; return true;
} }
try { try {
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1])); plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
PlotMain.teleportPlayer(plr, plr.getLocation(), PlotHelper.getPlot(world, plotid)); PlotSquared.teleportPlayer(plr, plr.getLocation(), PlotHelper.getPlot(world, plotid));
return true; return true;
} catch (final Exception e) { } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
@ -87,14 +87,14 @@ public class TP extends SubCommand {
} }
@SuppressWarnings("deprecation") final Player player = Bukkit.getPlayer(a); @SuppressWarnings("deprecation") final Player player = Bukkit.getPlayer(a);
if (player != null) { if (player != null) {
final java.util.Set<Plot> plotMainPlots = PlotMain.getPlots(world, player); final java.util.Set<Plot> plotMainPlots = PlotSquared.getPlots(world, player);
final Plot[] plots = plotMainPlots.toArray(new Plot[plotMainPlots.size()]); final Plot[] plots = plotMainPlots.toArray(new Plot[plotMainPlots.size()]);
if (plots.length > index) { if (plots.length > index) {
return plots[index]; return plots[index];
} }
return null; return null;
} }
for (final Plot p : PlotMain.getPlots(world).values()) { for (final Plot p : PlotSquared.getPlots(world).values()) {
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) { if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
return p; return p;
} }

View File

@ -24,7 +24,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -38,7 +38,7 @@ public class Target extends SubCommand {
@Override @Override
public boolean execute(final Player plr, final String... args) { public boolean execute(final Player plr, final String... args) {
if (!PlotMain.isPlotWorld(plr.getWorld())) { if (!PlotSquared.isPlotWorld(plr.getWorld())) {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false; return false;
} }

View File

@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -48,7 +48,7 @@ public class Template extends SubCommand {
return false; return false;
} }
World world = Bukkit.getWorld(args[1]); World world = Bukkit.getWorld(args[1]);
PlotWorld plotworld = PlotMain.getWorldSettings(args[1]); PlotWorld plotworld = PlotSquared.getWorldSettings(args[1]);
if (world == null || plotworld == null) { if (world == null || plotworld == null) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD); PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false; return false;

View File

@ -35,7 +35,7 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.SquarePlotManager; import com.intellectualcrafters.plot.generator.SquarePlotManager;
import com.intellectualcrafters.plot.generator.SquarePlotWorld; import com.intellectualcrafters.plot.generator.SquarePlotWorld;
@ -97,7 +97,7 @@ public class Trim extends SubCommand {
return false; return false;
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if (world == null || PlotMain.getWorldSettings(world) == null) { if (world == null || PlotSquared.getWorldSettings(world) == null) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD); PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD);
return false; return false;
} }
@ -183,12 +183,12 @@ public class Trim extends SubCommand {
final long startOld = System.currentTimeMillis(); final long startOld = System.currentTimeMillis();
sendMessage("Collecting region data..."); sendMessage("Collecting region data...");
final ArrayList<Plot> plots = new ArrayList<>(); final ArrayList<Plot> plots = new ArrayList<>();
plots.addAll(PlotMain.getPlots(world).values()); plots.addAll(PlotSquared.getPlots(world).values());
final HashSet<ChunkLoc> chunks = new HashSet<>(ChunkManager.getChunkChunks(world)); final HashSet<ChunkLoc> chunks = new HashSet<>(ChunkManager.getChunkChunks(world));
sendMessage(" - MCA #: " + chunks.size()); sendMessage(" - MCA #: " + chunks.size());
sendMessage(" - CHUNKS: " + (chunks.size() * 1024) +" (max)"); sendMessage(" - CHUNKS: " + (chunks.size() * 1024) +" (max)");
sendMessage(" - TIME ESTIMATE: " + (chunks.size()/1200) +" minutes"); sendMessage(" - TIME ESTIMATE: " + (chunks.size()/1200) +" minutes");
Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotSquared.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
@ -223,12 +223,12 @@ public class Trim extends SubCommand {
public static ArrayList<Plot> expired = null; public static ArrayList<Plot> expired = null;
// public static void updateUnmodifiedPlots(final World world) { // public static void updateUnmodifiedPlots(final World world) {
// final SquarePlotManager manager = (SquarePlotManager) PlotMain.getPlotManager(world); // final SquarePlotManager manager = (SquarePlotManager) PlotSquared.getPlotManager(world);
// final SquarePlotWorld plotworld = (SquarePlotWorld) PlotMain.getWorldSettings(world); // final SquarePlotWorld plotworld = (SquarePlotWorld) PlotSquared.getWorldSettings(world);
// final ArrayList<Plot> expired = new ArrayList<>(); // final ArrayList<Plot> expired = new ArrayList<>();
// final Set<Plot> plots = ExpireManager.getOldPlots(world.getName()).keySet(); // final Set<Plot> plots = ExpireManager.getOldPlots(world.getName()).keySet();
// sendMessage("Checking " + plots.size() +" plots! This may take a long time..."); // sendMessage("Checking " + plots.size() +" plots! This may take a long time...");
// Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { // Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotSquared.getMain(), new Runnable() {
// @Override // @Override
// public void run() { // public void run() {
// if (manager != null && plots.size() > 0) { // if (manager != null && plots.size() > 0) {
@ -260,7 +260,7 @@ public class Trim extends SubCommand {
} }
public static void sendMessage(final String message) { public static void sendMessage(final String message) {
PlotMain.sendConsoleSenderMessage("&3PlotSquared -> World trim&8: &7" + message); PlotSquared.sendConsoleSenderMessage("&3PlotSquared -> World trim&8: &7" + message);
} }
} }

View File

@ -26,7 +26,7 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent; import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
@ -55,7 +55,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotMain.hasPermission(plr, "plots.admin.command.trusted")) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !PlotSquared.hasPermission(plr, "plots.admin.command.trusted")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }

View File

@ -26,7 +26,7 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -49,24 +49,24 @@ public class Unclaim extends SubCommand {
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return !sendMessage(plr, C.UNLINK_REQUIRED); return !sendMessage(plr, C.UNLINK_REQUIRED);
} }
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !PlotMain.hasPermission(plr, "plots.admin.command.unclaim")) { if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !PlotSquared.hasPermission(plr, "plots.admin.command.unclaim")) {
return !sendMessage(plr, C.NO_PLOT_PERMS); return !sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
final PlotWorld pWorld = PlotMain.getWorldSettings(plot.getWorld()); final PlotWorld pWorld = PlotSquared.getWorldSettings(plot.getWorld());
if (PlotMain.useEconomy && pWorld.USE_ECONOMY) { if (PlotSquared.useEconomy && pWorld.USE_ECONOMY) {
final double c = pWorld.SELL_PRICE; final double c = pWorld.SELL_PRICE;
if (c > 0d) { if (c > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
economy.depositPlayer(plr, c); economy.depositPlayer(plr, c);
sendMessage(plr, C.ADDED_BALANCE, c + ""); sendMessage(plr, C.ADDED_BALANCE, c + "");
} }
} }
final boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true); final boolean result = PlotSquared.removePlot(plr.getWorld().getName(), plot.id, true);
if (result) { if (result) {
World world = plr.getWorld(); World world = plr.getWorld();
String worldname = world.getName(); String worldname = world.getName();
PlotMain.getPlotManager(world).unclaimPlot(world, pWorld, plot); PlotSquared.getPlotManager(world).unclaimPlot(world, pWorld, plot);
DBFunc.delete(worldname, plot); DBFunc.delete(worldname, plot);
// TODO set wall block // TODO set wall block
} else { } else {

View File

@ -27,7 +27,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlotUnlinkEvent; import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
@ -56,7 +56,7 @@ public class Unlink extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final Plot plot = PlayerFunctions.getCurrentPlot(plr); final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotMain.hasPermission(plr, "plots.admin.command.unlink")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !PlotSquared.hasPermission(plr, "plots.admin.command.unlink")) {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
if (PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
@ -73,7 +73,7 @@ public class Unlink extends SubCommand {
} catch (final Exception e) { } catch (final Exception e) {
// execute(final Player plr, final String... args) { // execute(final Player plr, final String... args) {
try { try {
PlotMain.sendConsoleSenderMessage("Error on: " + getClass().getMethod("execute", Player.class, String[].class).toGenericString() + ":119, when trying to use \"SetBlockFast#update\""); PlotSquared.sendConsoleSenderMessage("Error on: " + getClass().getMethod("execute", Player.class, String[].class).toGenericString() + ":119, when trying to use \"SetBlockFast#update\"");
} catch (final Exception ex) { } catch (final Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
@ -95,13 +95,13 @@ public class Unlink extends SubCommand {
return false; return false;
} }
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
manager.startPlotUnlink(world, plotworld, ids); manager.startPlotUnlink(world, plotworld, ids);
for (final PlotId id : ids) { for (final PlotId id : ids) {
final Plot myplot = PlotMain.getPlots(world).get(id); final Plot myplot = PlotSquared.getPlots(world).get(id);
if (plot == null) { if (plot == null) {
continue; continue;

View File

@ -27,7 +27,7 @@ import java.util.UUID;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
@ -39,7 +39,7 @@ public class Visit extends SubCommand {
public List<Plot> getPlots(final UUID uuid) { public List<Plot> getPlots(final UUID uuid) {
final List<Plot> plots = new ArrayList<>(); final List<Plot> plots = new ArrayList<>();
for (final Plot p : PlotMain.getPlots()) { for (final Plot p : PlotSquared.getPlots()) {
if (p.hasOwner() && p.owner.equals(uuid)) { if (p.hasOwner() && p.owner.equals(uuid)) {
plots.add(p); plots.add(p);
} }
@ -62,7 +62,7 @@ public class Visit extends SubCommand {
return sendMessage(plr, C.FOUND_NO_PLOTS); return sendMessage(plr, C.FOUND_NO_PLOTS);
} }
if (args.length < 2) { if (args.length < 2) {
PlotMain.teleportPlayer(plr, plr.getLocation(), plots.get(0)); PlotSquared.teleportPlayer(plr, plr.getLocation(), plots.get(0));
return true; return true;
} }
int i; int i;
@ -74,7 +74,7 @@ public class Visit extends SubCommand {
if ((i < 0) || (i >= plots.size())) { if ((i < 0) || (i >= plots.size())) {
return sendMessage(plr, C.NOT_VALID_NUMBER); return sendMessage(plr, C.NOT_VALID_NUMBER);
} }
PlotMain.teleportPlayer(plr, plr.getLocation(), plots.get(i)); PlotSquared.teleportPlayer(plr, plr.getLocation(), plots.get(i));
return true; return true;
} }
} }

View File

@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.util.PWE; import com.intellectualcrafters.plot.util.PWE;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -35,12 +35,12 @@ public class WE_Anywhere extends SubCommand {
@Override @Override
public boolean execute(final Player plr, final String... args) { public boolean execute(final Player plr, final String... args) {
if (PlotMain.worldEdit == null) { if (PlotSquared.worldEdit == null) {
PlayerFunctions.sendMessage(plr, "&cWorldEdit is not enabled on this server"); PlayerFunctions.sendMessage(plr, "&cWorldEdit is not enabled on this server");
return false; return false;
} }
if (PlotMain.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) { if (PlotSquared.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) {
PWE.removeMask(plr); PWE.removeMask(plr);
PlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask"); PlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask");
} }

View File

@ -27,7 +27,7 @@ import java.util.UUID;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
@ -71,13 +71,13 @@ public class list extends SubCommand {
return true; return true;
} }
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) { if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
if (PlotMain.economy == null) { if (PlotSquared.economy == null) {
return sendMessage(plr, C.ECON_DISABLED); return sendMessage(plr, C.ECON_DISABLED);
} }
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "buyable")).append("\n"); string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "buyable")).append("\n");
int idx = 0; int idx = 0;
for (final Plot p : PlotMain.getPlots(plr.getWorld()).values()) { for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
Flag price = FlagManager.getPlotFlag(p, "price"); Flag price = FlagManager.getPlotFlag(p, "price");
if (price != null) { if (price != null) {
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", idx + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", price.getValueString()).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", idx + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", price.getValueString()).replaceAll("%owner", getName(p.owner))).append("\n");
@ -96,7 +96,7 @@ public class list extends SubCommand {
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your")).append("\n"); string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your")).append("\n");
int idx = 0; int idx = 0;
for (final Plot p : PlotMain.getPlots(plr)) { for (final Plot p : PlotSquared.getPlots(plr)) {
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", idx + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", idx + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
idx++; idx++;
} }
@ -110,12 +110,12 @@ public class list extends SubCommand {
} else if (args[0].equalsIgnoreCase("shared") && (plr != null)) { } else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all")).append("\n"); string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all")).append("\n");
for (final Plot p : PlotMain.getPlotsSorted()) { for (final Plot p : PlotSquared.getPlotsSorted()) {
if (p.helpers.contains(UUIDHandler.getUUID(plr))) { if (p.helpers.contains(UUIDHandler.getUUID(plr))) {
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
} }
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotMain.getPlotsSorted().size() + "").replaceAll("%plot%", PlotMain.getPlotsSorted().size() == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
PlayerFunctions.sendMessage(plr, string.toString()); PlayerFunctions.sendMessage(plr, string.toString());
return true; return true;
} else if (args[0].equalsIgnoreCase("all")) { } else if (args[0].equalsIgnoreCase("all")) {
@ -137,8 +137,8 @@ public class list extends SubCommand {
// Get the total pages // Get the total pages
// int totalPages = ((int) Math.ceil(12 * // int totalPages = ((int) Math.ceil(12 *
// (PlotMain.getPlotsSorted().size()) / 100)); // (PlotSquared.getPlotsSorted().size()) / 100));
final int totalPages = (int) Math.ceil(PlotMain.getPlotsSorted().size() / 12); final int totalPages = (int) Math.ceil(PlotSquared.getPlotsSorted().size() / 12);
if (page > totalPages) { if (page > totalPages) {
page = totalPages; page = totalPages;
@ -147,8 +147,8 @@ public class list extends SubCommand {
// Only display 12! // Only display 12!
int max = (page * 12) + 12; int max = (page * 12) + 12;
if (max > PlotMain.getPlotsSorted().size()) { if (max > PlotSquared.getPlotsSorted().size()) {
max = PlotMain.getPlotsSorted().size(); max = PlotSquared.getPlotsSorted().size();
} }
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
@ -158,17 +158,17 @@ public class list extends SubCommand {
// This might work xD // This might work xD
for (int x = (page * 12); x < max; x++) { for (int x = (page * 12); x < max; x++) {
p = (Plot) PlotMain.getPlotsSorted().toArray()[x]; p = (Plot) PlotSquared.getPlotsSorted().toArray()[x];
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotMain.getPlotsSorted().size() + "").replaceAll("%plot%", PlotMain.getPlotsSorted().size() == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
PlayerFunctions.sendMessage(plr, string.toString()); PlayerFunctions.sendMessage(plr, string.toString());
return true; return true;
} else if (args[0].equalsIgnoreCase("world") && (plr != null)) { } else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all")).append("\n"); string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all")).append("\n");
final HashMap<PlotId, Plot> plots = PlotMain.getPlots(plr.getWorld()); final HashMap<PlotId, Plot> plots = PlotSquared.getPlots(plr.getWorld());
for (final Plot p : plots.values()) { for (final Plot p : plots.values()) {
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
} }

View File

@ -31,7 +31,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
public class plugin extends SubCommand { public class plugin extends SubCommand {
@ -92,12 +92,12 @@ public class plugin extends SubCommand {
@Override @Override
public boolean execute(final Player plr, final String... args) { public boolean execute(final Player plr, final String... args) {
Bukkit.getScheduler().runTaskAsynchronously(PlotMain.getMain(), new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(PlotSquared.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
final ArrayList<String> strings = new ArrayList<String>() { final ArrayList<String> strings = new ArrayList<String>() {
{ {
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotMain.getMain().getDescription().getVersion())); add(String.format("&c>> &6PlotSquared (Version: %s)", PlotSquared.getMain().getDescription().getVersion()));
add(String.format("&c>> &6Made by Citymonstret and Empire92")); 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>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
add(String.format("&c>> &cNewest Version (Spigot): %s", version)); add(String.format("&c>> &cNewest Version (Spigot): %s", version));

View File

@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.config; package com.intellectualcrafters.plot.config;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualsites.translation.*; import com.intellectualsites.translation.*;
import com.intellectualsites.translation.bukkit.BukkitTranslation; import com.intellectualsites.translation.bukkit.BukkitTranslation;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -506,7 +506,7 @@ public enum C {
public static void setupTranslations() { public static void setupTranslations() {
manager = new TranslationManager(); manager = new TranslationManager();
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(PlotMain.getMain()), lang, "PlotSquared", manager).read(); defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(), lang, "PlotSquared", manager).read();
// register everything in this class // register everything in this class
for (final C c : values()) { for (final C c : values()) {
manager.addTranslationObject(new TranslationObject(c.toString(), c.d, "", "")); manager.addTranslationObject(new TranslationObject(c.toString(), c.d, "", ""));
@ -539,8 +539,8 @@ public enum C {
String s = manager.getTranslated(toString(), lang).getTranslated().replaceAll("&-", "\n").replaceAll("\\n", "\n"); String s = manager.getTranslated(toString(), lang).getTranslated().replaceAll("&-", "\n").replaceAll("\\n", "\n");
return s.replace("$1", COLOR_1.toString()).replace("$2", COLOR_2.toString()).replace("$3", COLOR_3.toString()).replace("$4", COLOR_4.toString()); return s.replace("$1", COLOR_1.toString()).replace("$2", COLOR_2.toString()).replace("$3", COLOR_3.toString()).replace("$4", COLOR_4.toString());
/* /*
* if (PlotMain.translations != null) { * if (PlotSquared.translations != null) {
* final String t = PlotMain.translations.getString(this.toString()); * final String t = PlotSquared.translations.getString(this.toString());
* if (t != null) { * if (t != null) {
* this.s = t; * this.s = t;
* } * }

View File

@ -40,10 +40,11 @@ import org.bukkit.WorldCreator;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.generator.HybridGen; import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
/** /**
@ -54,27 +55,18 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
*/ */
public class PlotMeConverter { public class PlotMeConverter {
/**
* PlotMain Object
*/
private final PlotMain plugin;
/** /**
* Constructor * Constructor
* *
* @param plugin Plugin Used to run the converter * @param plugin Plugin Used to run the converter
*/ */
public PlotMeConverter(final PlotMain plugin) {
this.plugin = plugin;
}
private void sendMessage(final String message) { private void sendMessage(final String message) {
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7" + message); PlotSquared.log("&3PlotMe&8->&3PlotSquared&8: &7" + message);
} }
public void runAsync() throws Exception { public void runAsync() throws Exception {
// We have to make it wait a couple of seconds // We have to make it wait a couple of seconds
Bukkit.getScheduler().runTaskLaterAsynchronously(this.plugin, new Runnable() { TaskManager.runTaskLaterAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@ -96,7 +88,7 @@ public class PlotMeConverter {
final String con = plotConfig.getString("mySQLconn"); final String con = plotConfig.getString("mySQLconn");
connection = DriverManager.getConnection(con, user, password); connection = DriverManager.getConnection(con, user, password);
} else { } else {
connection = new SQLite(PlotMain.getMain(), dataFolder + File.separator + "plots.db").openConnection(); connection = new SQLite(PlotSquared.THIS, dataFolder + File.separator + "plots.db").openConnection();
} }
sendMessage("Collecting plot data"); sendMessage("Collecting plot data");
sendMessage(" - plotmePlots"); sendMessage(" - plotmePlots");
@ -179,28 +171,28 @@ public class PlotMeConverter {
try { try {
String plotMeWorldName = world.toLowerCase(); String plotMeWorldName = world.toLowerCase();
final Integer pathwidth = plotConfig.getInt("worlds." + plotMeWorldName + ".PathWidth"); // final Integer pathwidth = plotConfig.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
PlotMain.config.set("worlds." + world + ".road.width", pathwidth); PlotSquared.config.set("worlds." + world + ".road.width", pathwidth);
final Integer plotsize = plotConfig.getInt("worlds." + plotMeWorldName + ".PlotSize"); // final Integer plotsize = plotConfig.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
PlotMain.config.set("worlds." + world + ".plot.size", plotsize); PlotSquared.config.set("worlds." + world + ".plot.size", plotsize);
final String wallblock = plotConfig.getString("worlds." + plotMeWorldName + ".WallBlockId"); // final String wallblock = plotConfig.getString("worlds." + plotMeWorldName + ".WallBlockId"); //
PlotMain.config.set("worlds." + world + ".wall.block", wallblock); PlotSquared.config.set("worlds." + world + ".wall.block", wallblock);
final String floor = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFloorBlockId"); // final String floor = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFloorBlockId"); //
PlotMain.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor)); PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor));
final String filling = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFillingBlockId"); // final String filling = plotConfig.getString("worlds." + plotMeWorldName + ".PlotFillingBlockId"); //
PlotMain.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling)); PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling));
final String road = plotConfig.getString("worlds." + plotMeWorldName + ".RoadMainBlockId"); final String road = plotConfig.getString("worlds." + plotMeWorldName + ".RoadMainBlockId");
PlotMain.config.set("worlds." + world + ".road.block", road); PlotSquared.config.set("worlds." + world + ".road.block", road);
Integer height = plotConfig.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // Integer height = plotConfig.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if (height == null) { if (height == null) {
height = 64; height = 64;
} }
PlotMain.config.set("worlds." + world + ".road.height", height); PlotSquared.config.set("worlds." + world + ".road.height", height);
} catch (final Exception e) { } 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"); sendMessage("&c-- &lFailed to save configuration for world '" + world + "'\nThis will need to be done using the setup command, or manually");
} }
@ -216,37 +208,37 @@ public class PlotMeConverter {
if (pathwidth == null) { if (pathwidth == null) {
pathwidth = 7; pathwidth = 7;
} }
PlotMain.config.set("worlds." + world + ".road.width", pathwidth); PlotSquared.config.set("worlds." + world + ".road.width", pathwidth);
Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); // Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
if (plotsize == null) { if (plotsize == null) {
plotsize = 32; plotsize = 32;
} }
PlotMain.config.set("worlds." + world + ".plot.size", plotsize); PlotSquared.config.set("worlds." + world + ".plot.size", plotsize);
String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); // String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); //
if (wallblock == null) { if (wallblock == null) {
wallblock = "44"; wallblock = "44";
} }
PlotMain.config.set("worlds." + world + ".wall.block", wallblock); PlotSquared.config.set("worlds." + world + ".wall.block", wallblock);
String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); // String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); //
if (floor == null) { if (floor == null) {
floor = "2"; floor = "2";
} }
PlotMain.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor)); PlotSquared.config.set("worlds." + world + ".plot.floor", Arrays.asList(floor));
String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); // String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); //
if (filling == null) { if (filling == null) {
filling = "3"; filling = "3";
} }
PlotMain.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling)); PlotSquared.config.set("worlds." + world + ".plot.filling", Arrays.asList(filling));
String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock"); String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock");
if (road == null) { if (road == null) {
road = "5"; road = "5";
} }
PlotMain.config.set("worlds." + world + ".road.block", road); PlotSquared.config.set("worlds." + world + ".road.block", road);
Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if (height == null || height == 0) { if (height == null || height == 0) {
@ -255,9 +247,9 @@ public class PlotMeConverter {
height = 64; height = 64;
} }
} }
PlotMain.config.set("worlds." + world + ".road.height", height); PlotSquared.config.set("worlds." + world + ".road.height", height);
PlotMain.config.set("worlds." + world + ".plot.height", height); PlotSquared.config.set("worlds." + world + ".plot.height", height);
PlotMain.config.set("worlds." + world + ".wall.height", height); PlotSquared.config.set("worlds." + world + ".wall.height", height);
} }
} catch (final Exception e) { } catch (final Exception e) {
@ -266,14 +258,14 @@ public class PlotMeConverter {
for (final String world : plots.keySet()) { for (final String world : plots.keySet()) {
int duplicate = 0; int duplicate = 0;
for (final Plot plot : plots.get(world).values()) { for (final Plot plot : plots.get(world).values()) {
if (!PlotMain.getPlots(world).containsKey(plot.id)) { if (!PlotSquared.getPlots(world).containsKey(plot.id)) {
createdPlots.add(plot); createdPlots.add(plot);
} else { } else {
duplicate++; duplicate++;
} }
} }
if (duplicate > 0) { if (duplicate > 0) {
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?"); PlotSquared.log("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?");
} }
} }
@ -284,12 +276,11 @@ public class PlotMeConverter {
DBFunc.createAllSettingsAndHelpers(createdPlots); DBFunc.createAllSettingsAndHelpers(createdPlots);
sendMessage("Saving configuration..."); sendMessage("Saving configuration...");
try { try {
PlotMain.config.save(PlotMain.configFile); PlotSquared.config.save(PlotSquared.configFile);
} catch (final IOException e) { } catch (final IOException e) {
sendMessage(" - &cFailed to save configuration."); sendMessage(" - &cFailed to save configuration.");
} }
TaskManager.runTask(new Runnable() {
Bukkit.getScheduler().scheduleSyncDelayedTask(PlotMain.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@ -307,7 +298,7 @@ public class PlotMeConverter {
final String actualWorldName = world.getName(); final String actualWorldName = world.getName();
sendMessage("Reloading generator for world: '" + actualWorldName + "'..."); sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
PlotMain.removePlotWorld(actualWorldName); PlotSquared.removePlotWorld(actualWorldName);
if (MV) { if (MV) {
// unload // unload
@ -336,9 +327,9 @@ public class PlotMeConverter {
} }
} }
PlotMain.setAllPlotsRaw(DBFunc.getPlots()); PlotSquared.setAllPlotsRaw(DBFunc.getPlots());
sendMessage("Conversion has finished"); sendMessage("Conversion has finished");
PlotMain.sendConsoleSenderMessage("&cPlease disable 'plotme-convert.enabled' in the settings.yml to indicate that you conversion is no longer required."); PlotSquared.log("&cPlease disable 'plotme-convert.enabled' in the settings.yml to indicate that you conversion is no longer required.");
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -39,7 +39,7 @@ import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.BlockLoc; import com.intellectualcrafters.plot.object.BlockLoc;
@ -91,12 +91,12 @@ public class SQLManager implements AbstractDB {
this.CREATE_CLUSTER = "INSERT INTO `" + this.prefix + "cluster`(`pos1_x`, `pos1_z`, `pos2_x`, `pos2_z`, `owner`, `world`) VALUES(?, ?, ?, ?, ?, ?)"; this.CREATE_CLUSTER = "INSERT INTO `" + this.prefix + "cluster`(`pos1_x`, `pos1_z`, `pos2_x`, `pos2_z`, `owner`, `world`) VALUES(?, ?, ?, ?, ?, ?)";
// schedule reconnect // schedule reconnect
if (PlotMain.getMySQL() != null) { if (PlotSquared.getMySQL() != null) {
Bukkit.getScheduler().runTaskTimer(PlotMain.getMain(), new Runnable() { Bukkit.getScheduler().runTaskTimer(PlotSquared.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
SQLManager.this.connection = PlotMain.getMySQL().forceConnection(); SQLManager.this.connection = PlotSquared.getMySQL().forceConnection();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -126,7 +126,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Could not set owner for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Could not set owner for plot " + plot.id);
} }
} }
}); });
@ -136,7 +136,7 @@ public class SQLManager implements AbstractDB {
public void createAllSettingsAndHelpers(final ArrayList<Plot> mylist) { public void createAllSettingsAndHelpers(final ArrayList<Plot> mylist) {
int size = mylist.size(); int size = mylist.size();
int packet; int packet;
if (PlotMain.getMySQL() != null) { if (PlotSquared.getMySQL() != null) {
packet = Math.min(size, 50000); packet = Math.min(size, 50000);
} }
else { else {
@ -232,7 +232,7 @@ public class SQLManager implements AbstractDB {
} }
} }
catch (Exception e2) {} catch (Exception e2) {}
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set all helpers for plots"); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set all helpers for plots");
} }
} }
} }
@ -246,7 +246,7 @@ public class SQLManager implements AbstractDB {
public void createPlots(final ArrayList<Plot> mylist) { public void createPlots(final ArrayList<Plot> mylist) {
int size = mylist.size(); int size = mylist.size();
int packet; int packet;
if (PlotMain.getMySQL() != null) { if (PlotSquared.getMySQL() != null) {
packet = Math.min(size, 50000); packet = Math.min(size, 50000);
} }
else { else {
@ -284,20 +284,20 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&6[WARN] "+"Could not bulk save. Conversion may be slower..."); PlotSquared.sendConsoleSenderMessage("&6[WARN] "+"Could not bulk save. Conversion may be slower...");
try { try {
for (Plot plot : plots) { for (Plot plot : plots) {
try { try {
createPlot(plot); createPlot(plot);
} }
catch (Exception e3) { catch (Exception e3) {
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot: "+plot.id); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot: "+plot.id);
} }
} }
} }
catch (Exception e2) { catch (Exception e2) {
e2.printStackTrace(); e2.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plots!"); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plots!");
} }
} }
} }
@ -324,7 +324,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id);
} }
} }
}); });
@ -352,7 +352,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id);
} }
} }
}); });
@ -411,7 +411,7 @@ public class SQLManager implements AbstractDB {
*/ */
@Override @Override
public void delete(final String world, final Plot plot) { public void delete(final String world, final Plot plot) {
PlotMain.removePlot(world, plot.id, false); PlotSquared.removePlot(world, plot.id, false);
BukkitTaskManager.runTaskAsync(new Runnable() { BukkitTaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -439,7 +439,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] " + "Failed to delete plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&c[ERROR] " + "Failed to delete plot " + plot.id);
} }
} }
}); });
@ -529,8 +529,8 @@ public class SQLManager implements AbstractDB {
try { try {
Set<String> worlds = new HashSet<>(); Set<String> worlds = new HashSet<>();
if (PlotMain.config.contains("worlds")) { if (PlotSquared.config.contains("worlds")) {
worlds = PlotMain.config.getConfigurationSection("worlds").getKeys(false); worlds = PlotSquared.config.getConfigurationSection("worlds").getKeys(false);
} }
final HashMap<String, UUID> uuids = new HashMap<String, UUID>(); final HashMap<String, UUID> uuids = new HashMap<String, UUID>();
final HashMap<String, Integer> noExist = new HashMap<String, Integer>(); final HashMap<String, Integer> noExist = new HashMap<String, Integer>();
@ -582,7 +582,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) { if (plot != null) {
plot.addHelper(user); plot.addHelper(user);
} else { } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry."); PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
} }
} }
/* /*
@ -601,7 +601,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) { if (plot != null) {
plot.addTrusted(user); plot.addTrusted(user);
} else { } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry."); PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
} }
} }
/* /*
@ -620,7 +620,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) { if (plot != null) {
plot.addDenied(user); plot.addDenied(user);
} else { } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry."); PlotSquared.sendConsoleSenderMessage("&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`"); r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "plot_settings`");
@ -700,12 +700,12 @@ public class SQLManager implements AbstractDB {
} }
} }
if (exception) { if (exception) {
PlotMain.sendConsoleSenderMessage("&cPlot " + id + " had an invalid flag. A fix has been attempted."); PlotSquared.sendConsoleSenderMessage("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
setFlags(id, flags.toArray(new Flag[0])); setFlags(id, flags.toArray(new Flag[0]));
} }
plot.settings.flags = flags; plot.settings.flags = flags;
} else { } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry."); PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
} }
} }
stmt.close(); stmt.close();
@ -720,13 +720,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false; boolean invalidPlot = false;
for (final String worldname : noExist.keySet()) { for (final String worldname : noExist.keySet()) {
invalidPlot = true; invalidPlot = true;
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'."); PlotSquared.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
} }
if (invalidPlot) { if (invalidPlot) {
PlotMain.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the plots using the purge command"); PlotSquared.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
} }
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load plots."); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load plots.");
e.printStackTrace(); e.printStackTrace();
} }
return newplots; return newplots;
@ -750,7 +750,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Could not set merged for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set merged for plot " + plot.id);
} }
} }
}); });
@ -837,7 +837,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + plot.id);
} }
} }
}); });
@ -862,7 +862,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + id);
} }
} }
}); });
@ -886,7 +886,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set alias for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set alias for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
@ -930,16 +930,16 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!"); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!");
return; return;
} }
} }
PlotMain.sendConsoleSenderMessage("&6[INFO] "+"SUCCESSFULLY PURGED WORLD '" + world + "'!"); PlotSquared.sendConsoleSenderMessage("&6[INFO] "+"SUCCESSFULLY PURGED WORLD '" + world + "'!");
} }
@Override @Override
public void purge(final String world, Set<PlotId> plots) { public void purge(final String world, Set<PlotId> plots) {
for (PlotId id : plots) { for (PlotId id : plots) {
PlotMain.removePlot(world, id, true); PlotSquared.removePlot(world, id, true);
} }
PreparedStatement stmt; PreparedStatement stmt;
try { try {
@ -959,7 +959,7 @@ public class SQLManager implements AbstractDB {
r.close(); r.close();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!"); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!");
} }
} }
@ -980,7 +980,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set position for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set position for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1034,7 +1034,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
r.close(); r.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for plot: " + id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for plot: " + id);
e.printStackTrace(); e.printStackTrace();
} }
return h; return h;
@ -1064,7 +1064,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id);
} }
} }
}); });
@ -1096,7 +1096,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
set.close(); set.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment"); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment");
e.printStackTrace(); e.printStackTrace();
} }
return comments; return comments;
@ -1117,7 +1117,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set comment for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set comment for plot " + plot.id);
} }
} }
}); });
@ -1141,7 +1141,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id);
} }
} }
}); });
@ -1164,7 +1164,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove trusted user for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove trusted user for plot " + plot.id);
} }
} }
}); });
@ -1186,7 +1186,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1204,7 +1204,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for id " + id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for id " + id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1227,7 +1227,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set plot trusted for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set plot trusted for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1251,7 +1251,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove denied for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove denied for plot " + plot.id);
} }
} }
}); });
@ -1273,7 +1273,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set denied for plot " + plot.id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set denied for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1294,7 +1294,7 @@ public class SQLManager implements AbstractDB {
set.close(); set.close();
return rating; return rating;
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString()); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace(); e.printStackTrace();
} }
return 0.0d; return 0.0d;
@ -1325,7 +1325,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2()); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2());
} }
} }
}); });
@ -1363,8 +1363,8 @@ public class SQLManager implements AbstractDB {
try { try {
Set<String> worlds = new HashSet<>(); Set<String> worlds = new HashSet<>();
if (PlotMain.config.contains("worlds")) { if (PlotSquared.config.contains("worlds")) {
worlds = PlotMain.config.getConfigurationSection("worlds").getKeys(false); worlds = PlotSquared.config.getConfigurationSection("worlds").getKeys(false);
} }
final HashMap<String, UUID> uuids = new HashMap<String, UUID>(); final HashMap<String, UUID> uuids = new HashMap<String, UUID>();
final HashMap<String, Integer> noExist = new HashMap<String, Integer>(); final HashMap<String, Integer> noExist = new HashMap<String, Integer>();
@ -1419,7 +1419,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) { if (cluster != null) {
cluster.helpers.add(user); cluster.helpers.add(user);
} else { } else {
PlotMain.sendConsoleSenderMessage("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry."); PlotSquared.sendConsoleSenderMessage("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry.");
} }
} }
/* /*
@ -1438,7 +1438,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) { if (cluster != null) {
cluster.invited.add(user); cluster.invited.add(user);
} else { } else {
PlotMain.sendConsoleSenderMessage("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry."); PlotSquared.sendConsoleSenderMessage("&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`"); r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`");
@ -1517,12 +1517,12 @@ public class SQLManager implements AbstractDB {
} }
} }
if (exception) { if (exception) {
PlotMain.sendConsoleSenderMessage("&cPlot " + id + " had an invalid flag. A fix has been attempted."); PlotSquared.sendConsoleSenderMessage("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
setFlags(id, flags.toArray(new Flag[0])); setFlags(id, flags.toArray(new Flag[0]));
} }
cluster.settings.flags = flags; cluster.settings.flags = flags;
} else { } else {
PlotMain.sendConsoleSenderMessage("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry."); PlotSquared.sendConsoleSenderMessage("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
} }
} }
stmt.close(); stmt.close();
@ -1537,13 +1537,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false; boolean invalidPlot = false;
for (final String w : noExist.keySet()) { for (final String w : noExist.keySet()) {
invalidPlot = true; invalidPlot = true;
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'."); PlotSquared.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'.");
} }
if (invalidPlot) { if (invalidPlot) {
PlotMain.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the clusters using the purge command"); PlotSquared.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
} }
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load clusters."); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load clusters.");
e.printStackTrace(); e.printStackTrace();
} }
return newClusters; return newClusters;
@ -1571,7 +1571,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + cluster);
} }
} }
}); });
@ -1592,7 +1592,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set alias for cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set alias for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
@ -1613,7 +1613,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for cluster " + cluster);
} }
} }
}); });
@ -1631,7 +1631,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1663,7 +1663,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save cluster " + cluster);
} }
} }
}); });
@ -1689,7 +1689,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to rezize cluster " + current); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to rezize cluster " + current);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1709,7 +1709,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set position for cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set position for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1758,7 +1758,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
r.close(); r.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for cluster: " + id); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for cluster: " + id);
e.printStackTrace(); e.printStackTrace();
} }
return h; return h;
@ -1777,7 +1777,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove invited for cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove invited for cluster " + cluster);
} }
} }
}); });
@ -1796,7 +1796,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for cluster " + cluster); PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -30,7 +30,7 @@ import java.util.Set;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlotFlagAddEvent; import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
@ -63,10 +63,10 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* @return success? * @return success?
*/ */
public static boolean addFlag(final AbstractFlag af) { public static boolean addFlag(final AbstractFlag af) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&8 - Adding flag: &7" + af); PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
String key = af.getKey(); String key = af.getKey();
if (PlotMain.getAllPlotsRaw() != null) { if (PlotSquared.getAllPlotsRaw() != null) {
for (Plot plot : PlotMain.getPlots()) { for (Plot plot : PlotSquared.getPlots()) {
for (Flag flag : plot.settings.flags) { for (Flag flag : plot.settings.flags) {
if (flag.getAbstractFlag().getKey().equals(af.getKey())) { if (flag.getAbstractFlag().getKey().equals(af.getKey())) {
flag.setKey(af); flag.setKey(af);
@ -82,7 +82,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
if (settings.flags != null && settings.flags.size() > 0) { if (settings.flags != null && settings.flags.size() > 0) {
flags.addAll(settings.flags); flags.addAll(settings.flags);
} }
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (plotworld != null && plotworld.DEFAULT_FLAGS != null && plotworld.DEFAULT_FLAGS.length > 0) { if (plotworld != null && plotworld.DEFAULT_FLAGS != null && plotworld.DEFAULT_FLAGS.length > 0) {
flags.addAll(Arrays.asList(plotworld.DEFAULT_FLAGS)); flags.addAll(Arrays.asList(plotworld.DEFAULT_FLAGS));
} }
@ -179,7 +179,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
public static Set<Flag> getSettingFlags(String world, PlotSettings settings) { public static Set<Flag> getSettingFlags(String world, PlotSettings settings) {
Set<Flag> plotflags = settings.flags; Set<Flag> plotflags = settings.flags;
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (plotworld != null && plotworld.DEFAULT_FLAGS != null && plotworld.DEFAULT_FLAGS.length > 0) { if (plotworld != null && plotworld.DEFAULT_FLAGS != null && plotworld.DEFAULT_FLAGS.length > 0) {
HashSet<String> flagStrings = new HashSet<>(); HashSet<String> flagStrings = new HashSet<>();
for (Flag flag : plotflags) { for (Flag flag : plotflags) {

View File

@ -8,7 +8,7 @@ import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.BlockWrapper; import com.intellectualcrafters.plot.object.BlockWrapper;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotCluster;
@ -54,7 +54,7 @@ public class AugmentedPopulator extends BlockPopulator {
public AugmentedPopulator(String world, PlotGenerator generator, PlotCluster cluster, boolean p, boolean b) { public AugmentedPopulator(String world, PlotGenerator generator, PlotCluster cluster, boolean p, boolean b) {
this.cluster = cluster; this.cluster = cluster;
this.generator = generator; this.generator = generator;
this.plotworld = PlotMain.getWorldSettings(world); this.plotworld = PlotSquared.getWorldSettings(world);
this.manager = generator.getPlotManager(); this.manager = generator.getPlotManager();
this.p = p; this.p = p;
this.b = b; this.b = b;

View File

@ -9,7 +9,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

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

View File

@ -32,7 +32,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotGenerator; import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotManager;
@ -92,7 +92,7 @@ public class HybridGen extends PlotGenerator {
public HybridGen(final String world) { public HybridGen(final String world) {
super(world); super(world);
if (this.plotworld == null) { if (this.plotworld == null) {
this.plotworld = (HybridPlotWorld) PlotMain.getWorldSettings(world); this.plotworld = (HybridPlotWorld) PlotSquared.getWorldSettings(world);
} }
this.plotsize = this.plotworld.PLOT_WIDTH; this.plotsize = this.plotworld.PLOT_WIDTH;

View File

@ -34,7 +34,7 @@ import org.bukkit.block.Block;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -65,7 +65,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
int topx = top.getBlockX(); int topx = top.getBlockX();
int topz = top.getBlockZ(); int topz = top.getBlockZ();
HybridPlotWorld hpw = (HybridPlotWorld) PlotMain.getWorldSettings(world); HybridPlotWorld hpw = (HybridPlotWorld) PlotSquared.getWorldSettings(world);
PlotBlock[] air = new PlotBlock[] {new PlotBlock((short) 0, (byte) 0)}; PlotBlock[] air = new PlotBlock[] {new PlotBlock((short) 0, (byte) 0)};
@ -120,7 +120,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
Location bot = PlotHelper.getPlotBottomLoc(world, plot.id); Location bot = PlotHelper.getPlotBottomLoc(world, plot.id);
Location top = PlotHelper.getPlotTopLoc(world, plot.id); Location top = PlotHelper.getPlotTopLoc(world, plot.id);
HybridPlotWorld plotworld = (HybridPlotWorld) PlotMain.getWorldSettings(world); HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getWorldSettings(world);
int sx = bot.getBlockX() - plotworld.ROAD_WIDTH + 1; int sx = bot.getBlockX() - plotworld.ROAD_WIDTH + 1;
int sz = bot.getBlockZ() + 1; int sz = bot.getBlockZ() + 1;
@ -147,7 +147,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
CompoundTag sideroad = SchematicHandler.getCompoundTag(world, pos1, pos2); CompoundTag sideroad = SchematicHandler.getCompoundTag(world, pos1, pos2);
CompoundTag intersection = SchematicHandler.getCompoundTag(world, pos3, pos4); CompoundTag intersection = SchematicHandler.getCompoundTag(world, pos3, pos4);
String dir = PlotMain.getMain().getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.world + File.separator; String dir = PlotSquared.getMain().getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.world + File.separator;
SchematicHandler.save(sideroad, dir + "sideroad.schematic"); SchematicHandler.save(sideroad, dir + "sideroad.schematic");
SchematicHandler.save(intersection, dir + "intersection.schematic"); SchematicHandler.save(intersection, dir + "intersection.schematic");
@ -205,29 +205,29 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
} }
final ArrayList<ChunkLoc> chunks = ChunkManager.getChunkChunks(world); final ArrayList<ChunkLoc> chunks = ChunkManager.getChunkChunks(world);
final Plugin plugin = (Plugin) PlotMain.getMain(); final Plugin plugin = (Plugin) PlotSquared.getMain();
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
if (chunks.size() == 0) { if (chunks.size() == 0) {
HybridPlotManager.UPDATE = false; HybridPlotManager.UPDATE = false;
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Finished road conversion"); PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "Finished road conversion");
Bukkit.getScheduler().cancelTask(task); Bukkit.getScheduler().cancelTask(task);
return; return;
} }
else { else {
try { try {
ChunkLoc loc = chunks.get(0); ChunkLoc loc = chunks.get(0);
PlotMain.sendConsoleSenderMessage("Updating .mcr: " + loc.x + ", "+loc.z + " (aprrox 256 chunks)"); PlotSquared.sendConsoleSenderMessage("Updating .mcr: " + loc.x + ", "+loc.z + " (aprrox 256 chunks)");
PlotMain.sendConsoleSenderMessage("Remaining regions: "+chunks.size()); PlotSquared.sendConsoleSenderMessage("Remaining regions: "+chunks.size());
regenerateChunkChunk(world, loc); regenerateChunkChunk(world, loc);
chunks.remove(0); chunks.remove(0);
} }
catch (Exception e) { catch (Exception e) {
ChunkLoc loc = chunks.get(0); ChunkLoc loc = chunks.get(0);
PlotMain.sendConsoleSenderMessage("&c[ERROR]&7 Could not update '"+world.getName() + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); PlotSquared.sendConsoleSenderMessage("&c[ERROR]&7 Could not update '"+world.getName() + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
PlotMain.sendConsoleSenderMessage("&d - Potentially skipping 256 chunks"); PlotSquared.sendConsoleSenderMessage("&d - Potentially skipping 256 chunks");
PlotMain.sendConsoleSenderMessage("&d - TODO: recommend chunkster if corrupt"); PlotSquared.sendConsoleSenderMessage("&d - TODO: recommend chunkster if corrupt");
} }
} }
} }
@ -246,7 +246,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
Location bot = new Location(world, x, 0, z); Location bot = new Location(world, x, 0, z);
Location top = new Location(world, ex, 0, ez); Location top = new Location(world, ex, 0, ez);
HybridPlotWorld plotworld = (HybridPlotWorld) PlotMain.getWorldSettings(world); HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getWorldSettings(world);
if (!plotworld.ROAD_SCHEMATIC_ENABLED) { if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
return false; return false;
} }
@ -392,7 +392,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
@Override @Override
public boolean clearPlot(final World world, final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) { public boolean clearPlot(final World world, final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) {
PlotHelper.runners.put(plot, 1); PlotHelper.runners.put(plot, 1);
final Plugin plugin = PlotMain.getMain(); final Plugin plugin = PlotSquared.getMain();
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -26,7 +26,7 @@ import java.util.HashMap;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
@ -62,7 +62,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
@Override @Override
public void loadConfiguration(final ConfigurationSection config) { public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) { if (!config.contains("plot.height")) {
PlotMain.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")"); PlotSquared.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
} }
this.PLOT_BEDROCK = config.getBoolean("plot.bedrock"); this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));
@ -89,7 +89,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
try { try {
setupSchematics(); setupSchematics();
} catch (Exception e) { } catch (Exception e) {
PlotMain.sendConsoleSenderMessage("&c - road schematics are disabled for this world."); PlotSquared.sendConsoleSenderMessage("&c - road schematics are disabled for this world.");
this.ROAD_SCHEMATIC_ENABLED = false; this.ROAD_SCHEMATIC_ENABLED = false;
} }
System.out.print("LOADED!"); System.out.print("LOADED!");
@ -144,7 +144,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} }
if (schem1 == null || schem2 == null || this.ROAD_WIDTH == 0) { if (schem1 == null || schem2 == null || this.ROAD_WIDTH == 0) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&3 - schematic: &7false"); PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&3 - schematic: &7false");
return; return;
} }
// Do not populate road if using schematic population // Do not populate road if using schematic population

View File

@ -8,7 +8,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RegionWrapper;
@ -132,7 +132,7 @@ public class HybridPop extends BlockPopulator {
this.X = cx << 4; this.X = cx << 4;
this.Z = cz << 4; this.Z = cz << 4;
HybridPlotManager manager = (HybridPlotManager) PlotMain.getPlotManager(w); HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(w);
RegionWrapper plot = ChunkManager.CURRENT_PLOT_CLEAR; RegionWrapper plot = ChunkManager.CURRENT_PLOT_CLEAR;
if (plot != null) { if (plot != null) {
short sx = (short) ((X) % this.size); short sx = (short) ((X) % this.size);

View File

@ -6,7 +6,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
@ -127,7 +127,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
if (northSouth && eastWest) { if (northSouth && eastWest) {
// This means you are in the intersection // This means you are in the intersection
final PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, dpw.ROAD_WIDTH)); final PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, dpw.ROAD_WIDTH));
final Plot plot = PlotMain.getPlots(loc.getWorld()).get(id); final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
if (plot == null) { if (plot == null) {
return null; return null;
} }
@ -140,7 +140,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
// You are on a road running West to East (yeah, I named the var // You are on a road running West to East (yeah, I named the var
// poorly) // poorly)
final PlotId id = PlayerFunctions.getPlotAbs(loc.add(0, 0, dpw.ROAD_WIDTH)); final PlotId id = PlayerFunctions.getPlotAbs(loc.add(0, 0, dpw.ROAD_WIDTH));
final Plot plot = PlotMain.getPlots(loc.getWorld()).get(id); final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
if (plot == null) { if (plot == null) {
return null; return null;
} }
@ -152,7 +152,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
if (eastWest) { if (eastWest) {
// This is the road separating an Eastern and Western plot // This is the road separating an Eastern and Western plot
final PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, 0)); final PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, 0));
final Plot plot = PlotMain.getPlots(loc.getWorld()).get(id); final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
if (plot == null) { if (plot == null) {
return null; return null;
} }
@ -162,7 +162,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
return null; return null;
} }
final PlotId id = new PlotId(dx + 1, dz + 1); final PlotId id = new PlotId(dx + 1, dz + 1);
final Plot plot = PlotMain.getPlots(loc.getWorld()).get(id); final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
if (plot == null) { if (plot == null) {
return id; return id;
} }

View File

@ -2,7 +2,7 @@ package com.intellectualcrafters.plot.generator;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
public abstract class SquarePlotWorld extends GridPlotWorld { public abstract class SquarePlotWorld extends GridPlotWorld {
@ -15,7 +15,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override @Override
public void loadConfiguration(final ConfigurationSection config) { public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) { if (!config.contains("plot.height")) {
PlotMain.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")"); PlotSquared.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
} }
this.PLOT_WIDTH = config.getInt("plot.size"); this.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width"); this.ROAD_WIDTH = config.getInt("road.width");

View File

@ -83,7 +83,7 @@ import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldInitEvent;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.commands.Setup; import com.intellectualcrafters.plot.commands.Setup;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
@ -112,7 +112,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void onWorldInit(final WorldInitEvent event) { public static void onWorldInit(final WorldInitEvent event) {
PlotMain.loadWorld(event.getWorld()); PlotSquared.loadWorld(event.getWorld());
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@ -200,7 +200,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Plot plot = getCurrentPlot(q); Plot plot = getCurrentPlot(q);
if (plot != null) { if (plot != null) {
if (plot.deny_entry(player)) { if (plot.deny_entry(player)) {
if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) { if (!PlotSquared.hasPermission(player, "plots.admin.entry.denied")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied");
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -225,7 +225,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (!plotworld.PLOT_CHAT) { if (!plotworld.PLOT_CHAT) {
return; return;
} }
@ -264,7 +264,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (PlotMain.hasPermission(player, "plots.admin.destroy.unowned")) { if (PlotSquared.hasPermission(player, "plots.admin.destroy.unowned")) {
return; return;
} }
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned");
@ -277,7 +277,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (destroy != null && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), (byte) block.getData()))) { if (destroy != null && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), (byte) block.getData()))) {
return; return;
} }
if (PlotMain.hasPermission(event.getPlayer(), "plots.admin.destroy.other")) { if (PlotSquared.hasPermission(event.getPlayer(), "plots.admin.destroy.other")) {
return; return;
} }
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other");
@ -286,7 +286,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
return; return;
} }
if (PlotMain.hasPermission(event.getPlayer(), "plots.admin.destroy.road")) { if (PlotSquared.hasPermission(event.getPlayer(), "plots.admin.destroy.road")) {
return; return;
} }
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
@ -345,7 +345,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Player p = (Player) e; final Player p = (Player) e;
Location loc = b.getLocation(); Location loc = b.getLocation();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -353,13 +353,13 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.build.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.other")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
event.setCancelled(true); event.setCancelled(true);
@ -504,7 +504,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isInPlot(loc)) { if (isInPlot(loc)) {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (PlotMain.hasPermission(player, "plots.admin.interact.unowned")) { if (PlotSquared.hasPermission(player, "plots.admin.interact.unowned")) {
return; return;
} }
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned");
@ -516,7 +516,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!plot.hasRights(player)) { if (!plot.hasRights(player)) {
if (PlotMain.hasPermission(player, "plots.admin.interact.other")) { if (PlotSquared.hasPermission(player, "plots.admin.interact.other")) {
return; return;
} }
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other");
@ -525,7 +525,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
return; return;
} }
if (PlotMain.hasPermission(player, "plots.admin.interact.road")) { if (PlotSquared.hasPermission(player, "plots.admin.interact.road")) {
return; return;
} }
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
@ -589,7 +589,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (e.getPlayer() != null) { if (e.getPlayer() != null) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -597,13 +597,13 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.build.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.other")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
@ -657,7 +657,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
Player p = e.getPlayer(); Player p = e.getPlayer();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (PlotMain.hasPermission(p, "plots.admin.build.road")) { if (PlotSquared.hasPermission(p, "plots.admin.build.road")) {
return; return;
} }
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
@ -666,7 +666,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (PlotMain.hasPermission(p, "plots.admin.build.unowned")) { if (PlotSquared.hasPermission(p, "plots.admin.build.unowned")) {
return; return;
} }
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
@ -677,7 +677,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (use != null && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) e.getBucket().getId(), (byte) 0))) { if (use != null && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) e.getBucket().getId(), (byte) 0))) {
return; return;
} }
if (PlotMain.hasPermission(p, "plots.admin.build.other")) { if (PlotSquared.hasPermission(p, "plots.admin.build.other")) {
return; return;
} }
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
@ -707,13 +707,13 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Setup.setupMap.remove(event.getPlayer().getName()); Setup.setupMap.remove(event.getPlayer().getName());
} }
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) { if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {
final Set<Plot> plots = PlotMain.getPlots(event.getPlayer()); final Set<Plot> plots = PlotSquared.getPlots(event.getPlayer());
for (final Plot plot : plots) { for (final Plot plot : plots) {
PlotWorld plotworld = PlotMain.getWorldSettings(plot.world); PlotWorld plotworld = PlotSquared.getWorldSettings(plot.world);
final PlotManager manager = PlotMain.getPlotManager(plot.getWorld()); final PlotManager manager = PlotSquared.getPlotManager(plot.getWorld());
manager.clearPlot(null, plotworld, plot, true, null); manager.clearPlot(null, plotworld, plot, true, null);
DBFunc.delete(plot.getWorld().getName(), plot); DBFunc.delete(plot.getWorld().getName(), plot);
PlotMain.sendConsoleSenderMessage(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName())); PlotSquared.sendConsoleSenderMessage(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
} }
} }
} }
@ -725,7 +725,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
Player p = e.getPlayer(); Player p = e.getPlayer();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (PlotMain.hasPermission(p, "plots.admin.build.road")) { if (PlotSquared.hasPermission(p, "plots.admin.build.road")) {
return; return;
} }
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
@ -734,7 +734,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (PlotMain.hasPermission(p, "plots.admin.build.unowned")) { if (PlotSquared.hasPermission(p, "plots.admin.build.unowned")) {
return; return;
} }
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
@ -746,7 +746,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (use != null && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) { if (use != null && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
return; return;
} }
if (PlotMain.hasPermission(p, "plots.admin.build.other")) { if (PlotSquared.hasPermission(p, "plots.admin.build.other")) {
return; return;
} }
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
@ -766,7 +766,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (!PlotMain.hasPermission(p, "plots.admin.build.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -774,7 +774,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.build.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -783,7 +783,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) { if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.build.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.build.other")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
@ -803,7 +803,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location l = e.getEntity().getLocation(); final Location l = e.getEntity().getLocation();
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!PlotMain.hasPermission(p, "plots.admin.destroy.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.destroy.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.road");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -811,7 +811,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(l); final Plot plot = getCurrentPlot(l);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.destroy.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.destroy.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -820,7 +820,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) { if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) {
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.destroy.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.destroy.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.other");
e.setCancelled(true); e.setCancelled(true);
@ -839,7 +839,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!PlotMain.hasPermission(p, "plots.admin.interact.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.interact.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -847,7 +847,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(l); final Plot plot = getCurrentPlot(l);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.interact.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.interact.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -866,7 +866,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (entity instanceof RideableMinecart && FlagManager.isPlotFlagTrue(plot, "vehicle-use")) { if (entity instanceof RideableMinecart && FlagManager.isPlotFlagTrue(plot, "vehicle-use")) {
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.interact.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.interact.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
e.setCancelled(true); e.setCancelled(true);
@ -887,7 +887,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Player p = (Player) d; final Player p = (Player) d;
final PlotWorld pW = getPlotWorld(l.getWorld()); final PlotWorld pW = getPlotWorld(l.getWorld());
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!PlotMain.hasPermission(p, "plots.admin.vehicle.break.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.vehicle.break.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.road");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -895,7 +895,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(l); final Plot plot = getCurrentPlot(l);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.vehicle.break.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.vehicle.break.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -906,7 +906,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) { if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) {
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.vehicle.break.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.vehicle.break.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.other");
e.setCancelled(true); e.setCancelled(true);
@ -944,7 +944,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!PlotMain.hasPermission(p, "plots.admin.pve.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.pve.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.road");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -952,7 +952,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(l); final Plot plot = getCurrentPlot(l);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.pve.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.pve.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -974,7 +974,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (a instanceof Tameable && ((Tameable) a).isTamed() && FlagManager.isPlotFlagTrue(plot, "tamed-attack")) { if (a instanceof Tameable && ((Tameable) a).isTamed() && FlagManager.isPlotFlagTrue(plot, "tamed-attack")) {
return; return;
} }
if (!PlotMain.hasPermission(p, "plots.admin.pve.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.pve.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.other");
e.setCancelled(true); e.setCancelled(true);
@ -996,7 +996,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!PlotMain.hasPermission(p, "plots.admin.projectile.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.projectile.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.road");
e.setHatching(false); e.setHatching(false);
return; return;
@ -1004,13 +1004,13 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Plot plot = getCurrentPlot(l); final Plot plot = getCurrentPlot(l);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.projectile.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.projectile.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.unowned");
e.setHatching(false); e.setHatching(false);
return; return;
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.projectile.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.projectile.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.other");
e.setHatching(false); e.setHatching(false);
@ -1028,7 +1028,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
} }
if (PlotMain.hasPermission(event.getPlayer(), "plots.admin")) { if (PlotSquared.hasPermission(event.getPlayer(), "plots.admin")) {
return; return;
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -1036,7 +1036,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isInPlot(loc)) { if (isInPlot(loc)) {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (PlotMain.hasPermission(player, "plots.admin.build.unowned")) { if (PlotSquared.hasPermission(player, "plots.admin.build.unowned")) {
return; return;
} }
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned");
@ -1049,7 +1049,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (place != null && ((HashSet<PlotBlock>) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), (byte) block.getData()))) { if (place != null && ((HashSet<PlotBlock>) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), (byte) block.getData()))) {
return; return;
} }
if (!PlotMain.hasPermission(player, "plots.admin.build.other")) { if (!PlotSquared.hasPermission(player, "plots.admin.build.other")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.other"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.other");
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -1057,7 +1057,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
return; return;
} }
if (!PlotMain.hasPermission(player, "plots.admin.build.road")) { if (!PlotSquared.hasPermission(player, "plots.admin.build.road")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road"); PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road");
event.setCancelled(true); event.setCancelled(true);

View File

@ -7,7 +7,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
@ -20,19 +20,19 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!PlotMain.hasPermission(p, "plots.admin.interact.road")) { if (!PlotSquared.hasPermission(p, "plots.admin.interact.road")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
e.setCancelled(true); e.setCancelled(true);
} }
} else { } else {
final Plot plot = getCurrentPlot(l); final Plot plot = getCurrentPlot(l);
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
if (!PlotMain.hasPermission(p, "plots.admin.interact.unowned")) { if (!PlotSquared.hasPermission(p, "plots.admin.interact.unowned")) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
e.setCancelled(true); e.setCancelled(true);
} }
} else if (!plot.hasRights(p)) { } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin.interact.other")) { if (!PlotSquared.hasPermission(p, "plots.admin.interact.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other"); PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
e.setCancelled(true); e.setCancelled(true);

View File

@ -34,7 +34,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent; import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
@ -82,11 +82,11 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
} }
public static boolean isPlotWorld(final World world) { public static boolean isPlotWorld(final World world) {
return PlotMain.isPlotWorld(world); return PlotSquared.isPlotWorld(world);
} }
public static boolean isPlotArea(Location location) { public static boolean isPlotArea(Location location) {
PlotWorld plotworld = PlotMain.getWorldSettings(location.getWorld()); PlotWorld plotworld = PlotSquared.getWorldSettings(location.getWorld());
if (plotworld.TYPE == 2) { if (plotworld.TYPE == 2) {
return ClusterManager.getCluster(location) != null; return ClusterManager.getCluster(location) != null;
} }
@ -94,7 +94,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
} }
public static PlotWorld getPlotWorld(final World world) { public static PlotWorld getPlotWorld(final World world) {
return PlotMain.getWorldSettings(world); return PlotSquared.getWorldSettings(world);
} }
private static String getName(final UUID id) { private static String getName(final UUID id) {
@ -126,7 +126,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
} }
public static boolean isPlotWorld(final Location l) { public static boolean isPlotWorld(final Location l) {
return PlotMain.isPlotWorld(l.getWorld()); return PlotSquared.isPlotWorld(l.getWorld());
} }
public static boolean isInPlot(final Location loc) { public static boolean isInPlot(final Location loc) {
@ -139,8 +139,8 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
return null; return null;
} }
final World world = loc.getWorld(); final World world = loc.getWorld();
if (PlotMain.getPlots(world).containsKey(id)) { if (PlotSquared.getPlots(world).containsKey(id)) {
return PlotMain.getPlots(world).get(id); return PlotSquared.getPlots(world).get(id);
} }
return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), loc.getWorld().getName()); return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), loc.getWorld().getName());
} }

View File

@ -46,7 +46,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent; import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent; import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
@ -195,7 +195,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(trespasser))) { if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(trespasser))) {
return; return;
} }
if (PlotMain.hasPermission(trespasser, "plots.flag.notify-enter.bypass")) { if (PlotSquared.hasPermission(trespasser, "plots.flag.notify-enter.bypass")) {
return; return;
} }
if (player.isOnline()) { if (player.isOnline()) {
@ -238,7 +238,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(trespasser))) { if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(trespasser))) {
return; return;
} }
if (PlotMain.hasPermission(trespasser, "plots.flag.notify-leave.bypass")) { if (PlotSquared.hasPermission(trespasser, "plots.flag.notify-leave.bypass")) {
return; return;
} }
if (player.isOnline()) { if (player.isOnline()) {

View File

@ -40,7 +40,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
@ -68,14 +68,14 @@ public class WorldEditListener implements Listener {
public final Set<String> restrictedcmds = new HashSet<>(Arrays.asList("/up", "//up", "/worldedit:up")); public final Set<String> restrictedcmds = new HashSet<>(Arrays.asList("/up", "//up", "/worldedit:up"));
private boolean isPlotWorld(final Location l) { private boolean isPlotWorld(final Location l) {
return (PlotMain.isPlotWorld(l.getWorld())); return (PlotSquared.isPlotWorld(l.getWorld()));
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onDelete(final PlotDeleteEvent e) { public void onDelete(final PlotDeleteEvent e) {
final String world = e.getWorld(); final String world = e.getWorld();
final PlotId id = e.getPlotId(); final PlotId id = e.getPlotId();
final Plot plot = PlotMain.getPlots(world).get(id); final Plot plot = PlotSquared.getPlots(world).get(id);
if ((plot == null) || (plot.owner == null)) { if ((plot == null) || (plot.owner == null)) {
return; return;
} }
@ -86,7 +86,7 @@ public class WorldEditListener implements Listener {
if (!world.equals(player.getWorld().getName())) { if (!world.equals(player.getWorld().getName())) {
return; return;
} }
if (PlotMain.hasPermission(player, "plots.worldedit.bypass")) { if (PlotSquared.hasPermission(player, "plots.worldedit.bypass")) {
return; return;
} }
PWE.setNoMask(player); PWE.setNoMask(player);
@ -118,7 +118,7 @@ public class WorldEditListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerCommand(final PlayerCommandPreprocessEvent e) { public void onPlayerCommand(final PlayerCommandPreprocessEvent e) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!PlotMain.isPlotWorld(p.getWorld()) || PlotMain.hasPermission(p, "plots.worldedit.bypass")) { if (!PlotSquared.isPlotWorld(p.getWorld()) || PlotSquared.hasPermission(p, "plots.worldedit.bypass")) {
return; return;
} }
String cmd = e.getMessage().toLowerCase(); String cmd = e.getMessage().toLowerCase();
@ -141,14 +141,14 @@ public class WorldEditListener implements Listener {
} }
for (final String c : this.monitored) { for (final String c : this.monitored) {
if (cmd.equals("//" + c) || cmd.equals("/" + c) || cmd.equals("/worldedit:/" + c)) { if (cmd.equals("//" + c) || cmd.equals("/" + c) || cmd.equals("/worldedit:/" + c)) {
final Selection selection = PlotMain.worldEdit.getSelection(p); final Selection selection = PlotSquared.worldEdit.getSelection(p);
if (selection == null) { if (selection == null) {
return; return;
} }
final BlockVector pos1 = selection.getNativeMinimumPoint().toBlockVector(); final BlockVector pos1 = selection.getNativeMinimumPoint().toBlockVector();
final BlockVector pos2 = selection.getNativeMaximumPoint().toBlockVector(); final BlockVector pos2 = selection.getNativeMaximumPoint().toBlockVector();
final LocalSession session = PlotMain.worldEdit.getSession(p); final LocalSession session = PlotSquared.worldEdit.getSession(p);
final Mask mask = session.getMask(); final Mask mask = session.getMask();
if (mask == null) { if (mask == null) {
PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points"); PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points");
@ -171,7 +171,7 @@ public class WorldEditListener implements Listener {
public void onPlayerJoin(final PlayerJoinEvent e) { public void onPlayerJoin(final PlayerJoinEvent e) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
final Location l = p.getLocation(); final Location l = p.getLocation();
if (PlotMain.hasPermission(p, "plots.worldedit.bypass")) { if (PlotSquared.hasPermission(p, "plots.worldedit.bypass")) {
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
PWE.removeMask(p); PWE.removeMask(p);
} }
@ -192,7 +192,7 @@ public class WorldEditListener implements Listener {
} }
final Location f = e.getFrom(); final Location f = e.getFrom();
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (PlotMain.hasPermission(p, "plots.worldedit.bypass")) { if (PlotSquared.hasPermission(p, "plots.worldedit.bypass")) {
if (!PWE.hasMask(p)) { if (!PWE.hasMask(p)) {
return; return;
} }
@ -208,7 +208,7 @@ public class WorldEditListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPortal(final PlayerPortalEvent e) { public void onPortal(final PlayerPortalEvent e) {
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) { if (PlotSquared.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
return; return;
} }
final Player p = e.getPlayer(); final Player p = e.getPlayer();
@ -230,7 +230,7 @@ public class WorldEditListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTeleport(final PlayerTeleportEvent e) { public void onTeleport(final PlayerTeleportEvent e) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) { if (PlotSquared.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
if (!PWE.hasMask(p)) { if (!PWE.hasMask(p)) {
return; return;
} }

View File

@ -33,7 +33,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent; import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent; import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
@ -62,7 +62,7 @@ public class WorldGuardListener implements Listener {
public final ArrayList<String> str_flags; public final ArrayList<String> str_flags;
public final ArrayList<Flag<?>> flags; public final ArrayList<Flag<?>> flags;
public WorldGuardListener(final PlotMain plugin) { public WorldGuardListener(final PlotSquared plugin) {
this.str_flags = new ArrayList<>(); this.str_flags = new ArrayList<>();
this.flags = new ArrayList<>(); this.flags = new ArrayList<>();
for (final Flag<?> flag : DefaultFlag.getFlags()) { for (final Flag<?> flag : DefaultFlag.getFlags()) {
@ -73,7 +73,7 @@ public class WorldGuardListener implements Listener {
public void changeOwner(final Player requester, final UUID owner, final World world, final Plot plot) { public void changeOwner(final Player requester, final UUID owner, final World world, final Plot plot) {
try { try {
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y); ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y);
DefaultDomain owners = new DefaultDomain(); DefaultDomain owners = new DefaultDomain();
owners.addPlayer(UUIDHandler.getName(owner)); owners.addPlayer(UUIDHandler.getName(owner));
@ -86,7 +86,7 @@ public class WorldGuardListener implements Listener {
final boolean op = requester.isOp(); final boolean op = requester.isOp();
requester.setOp(true); requester.setOp(true);
try { try {
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
manager.getRegion(plot.id.x + "-" + plot.id.y); manager.getRegion(plot.id.x + "-" + plot.id.y);
for (final Flag<?> flag : this.flags) { for (final Flag<?> flag : this.flags) {
if (flag.getName().equalsIgnoreCase(key)) { if (flag.getName().equalsIgnoreCase(key)) {
@ -104,7 +104,7 @@ public class WorldGuardListener implements Listener {
final boolean op = requester.isOp(); final boolean op = requester.isOp();
requester.setOp(true); requester.setOp(true);
try { try {
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
manager.getRegion(plot.id.x + "-" + plot.id.y); manager.getRegion(plot.id.x + "-" + plot.id.y);
for (final Flag<?> flag : this.flags) { for (final Flag<?> flag : this.flags) {
if (flag.getName().equalsIgnoreCase(key)) { if (flag.getName().equalsIgnoreCase(key)) {
@ -123,7 +123,7 @@ public class WorldGuardListener implements Listener {
final Plot main = event.getPlot(); final Plot main = event.getPlot();
final ArrayList<PlotId> plots = event.getPlots(); final ArrayList<PlotId> plots = event.getPlots();
final World world = event.getWorld(); final World world = event.getWorld();
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
for (final PlotId plot : plots) { for (final PlotId plot : plots) {
if (!plot.equals(main.getId())) { if (!plot.equals(main.getId())) {
manager.removeRegion(plot.x + "-" + plot.y); manager.removeRegion(plot.x + "-" + plot.y);
@ -156,9 +156,9 @@ public class WorldGuardListener implements Listener {
try { try {
final World w = event.getWorld(); final World w = event.getWorld();
final ArrayList<PlotId> plots = event.getPlots(); final ArrayList<PlotId> plots = event.getPlots();
final Plot main = PlotMain.getPlots(w).get(plots.get(0)); final Plot main = PlotSquared.getPlots(w).get(plots.get(0));
final RegionManager manager = PlotMain.worldGuard.getRegionManager(w); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(w);
final ProtectedRegion region = manager.getRegion(main.id.x + "-" + main.id.y); final ProtectedRegion region = manager.getRegion(main.id.x + "-" + main.id.y);
final DefaultDomain owner = region.getOwners(); final DefaultDomain owner = region.getOwners();
@ -192,7 +192,7 @@ public class WorldGuardListener implements Listener {
try { try {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final Plot plot = event.getPlot(); final Plot plot = event.getPlot();
final RegionManager manager = PlotMain.worldGuard.getRegionManager(plot.getWorld()); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(plot.getWorld());
final Location location1 = PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()); final Location location1 = PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId());
final Location location2 = PlotHelper.getPlotTopLoc(plot.getWorld(), plot.getId()); final Location location2 = PlotHelper.getPlotTopLoc(plot.getWorld(), plot.getId());
@ -203,7 +203,7 @@ public class WorldGuardListener implements Listener {
final ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + "-" + plot.getId().y, vector1, vector2); final ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + "-" + plot.getId().y, vector1, vector2);
final DefaultDomain owner = new DefaultDomain(); final DefaultDomain owner = new DefaultDomain();
owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player)); owner.addPlayer(PlotSquared.worldGuard.wrapPlayer(player));
region.setOwners(owner); region.setOwners(owner);
@ -218,14 +218,14 @@ public class WorldGuardListener implements Listener {
final PlotId plot = event.getPlotId(); final PlotId plot = event.getPlotId();
final World world = Bukkit.getWorld(event.getWorld()); final World world = Bukkit.getWorld(event.getWorld());
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
manager.removeRegion(plot.x + "-" + plot.y); manager.removeRegion(plot.x + "-" + plot.y);
} catch (final Exception e) { } catch (final Exception e) {
} }
} }
public void addUser(final Player requester, final UUID user, final World world, final Plot plot) { public void addUser(final Player requester, final UUID user, final World world, final Plot plot) {
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y); ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y);
DefaultDomain members = region.getMembers(); DefaultDomain members = region.getMembers();
members.addPlayer(UUIDHandler.getName(user)); members.addPlayer(UUIDHandler.getName(user));
@ -233,7 +233,7 @@ public class WorldGuardListener implements Listener {
} }
public void removeUser(final Player requester, final UUID user, final World world, final Plot plot) { public void removeUser(final Player requester, final UUID user, final World world, final Plot plot) {
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world); final RegionManager manager = PlotSquared.worldGuard.getRegionManager(world);
ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y); ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y);
DefaultDomain members = region.getMembers(); DefaultDomain members = region.getMembers();
members.removePlayer(UUIDHandler.getName(user)); members.removePlayer(UUIDHandler.getName(user));

View File

@ -31,7 +31,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.PlotHelper;
@ -216,7 +216,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
* @return true if the player is added as a helper or is the owner * @return true if the player is added as a helper or is the owner
*/ */
public boolean hasRights(final Player player) { public boolean hasRights(final Player player) {
return PlotMain.hasPermission(player, "plots.admin.build.other") || ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(UUIDHandler.getUUID(player))) || ((this.owner != null) && this.owner.equals(UUIDHandler.getUUID(player))) || ((this.owner != null) && (this.trusted != null) && (UUIDHandler.uuidWrapper.getPlayer(this.owner) != null) && (this.trusted.contains(UUIDHandler.getUUID(player)) || this.trusted.contains(DBFunc.everyone))); return PlotSquared.hasPermission(player, "plots.admin.build.other") || ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(UUIDHandler.getUUID(player))) || ((this.owner != null) && this.owner.equals(UUIDHandler.getUUID(player))) || ((this.owner != null) && (this.trusted != null) && (UUIDHandler.uuidWrapper.getPlayer(this.owner) != null) && (this.trusted.contains(UUIDHandler.getUUID(player)) || this.trusted.contains(DBFunc.everyone)));
} }
/** /**

View File

@ -23,12 +23,12 @@ package com.intellectualcrafters.plot.object;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
public abstract class PlotGenerator extends ChunkGenerator { public abstract class PlotGenerator extends ChunkGenerator {
public PlotGenerator(final String world) { public PlotGenerator(final String world) {
PlotMain.loadWorld(world, this); PlotSquared.loadWorld(world, this);
} }
public abstract PlotWorld getNewPlotWorld(final String world); public abstract PlotWorld getNewPlotWorld(final String world);

View File

@ -7,7 +7,7 @@
// //
//import com.gmail.filoghost.holographicdisplays.api.Hologram; //import com.gmail.filoghost.holographicdisplays.api.Hologram;
//import com.gmail.filoghost.holographicdisplays.api.HologramsAPI; //import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
//import com.intellectualcrafters.plot.PlotMain; //import com.intellectualcrafters.plot.PlotSquared;
//import com.intellectualcrafters.plot.util.PlotHelper; //import com.intellectualcrafters.plot.util.PlotHelper;
// //
///** ///**
@ -25,7 +25,7 @@
// public PlotHologram(final String world, final PlotId id) { // public PlotHologram(final String world, final PlotId id) {
// this.id = id; // this.id = id;
// this.world = world; // this.world = world;
// this.hologram = createHologram(PlotMain.getPlotManager(world).getSignLoc(Bukkit.getWorld(world), PlotMain.getWorldSettings(world), PlotHelper.getPlot(Bukkit.getWorld(world), id))); // this.hologram = createHologram(PlotSquared.getPlotManager(world).getSignLoc(Bukkit.getWorld(world), PlotSquared.getWorldSettings(world), PlotHelper.getPlot(Bukkit.getWorld(world), id)));
// } // }
// //
// public static Hologram createHologram(final org.bukkit.Location location) { // public static Hologram createHologram(final org.bukkit.Location location) {
@ -34,7 +34,7 @@
// //
// public static JavaPlugin getPlugin() { // public static JavaPlugin getPlugin() {
// if (plugin == null) { // if (plugin == null) {
// plugin = JavaPlugin.getPlugin(PlotMain.class); // plugin = JavaPlugin.getPlugin(PlotSquared.class);
// } // }
// return plugin; // return plugin;
// } // }

View File

@ -30,7 +30,7 @@ import org.bukkit.Material;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
@ -137,7 +137,7 @@ public abstract class PlotWorld {
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags); this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
} }
catch (Exception e) { catch (Exception e) {
PlotMain.sendConsoleSenderMessage("&cInvalid default flags for "+this.worldname+": "+StringUtils.join(flags,",")); PlotSquared.sendConsoleSenderMessage("&cInvalid default flags for "+this.worldname+": "+StringUtils.join(flags,","));
this.DEFAULT_FLAGS = new Flag[]{}; this.DEFAULT_FLAGS = new Flag[]{};
} }
} }

View File

@ -30,7 +30,7 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
public class EntityWrapper { public class EntityWrapper {
@ -227,7 +227,7 @@ public class EntityWrapper {
return; return;
} }
default: { default: {
PlotMain.sendConsoleSenderMessage("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); PlotSquared.sendConsoleSenderMessage("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return; return;
} }
@ -443,7 +443,7 @@ public class EntityWrapper {
return entity; return entity;
} }
default: { default: {
PlotMain.sendConsoleSenderMessage("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); PlotSquared.sendConsoleSenderMessage("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return entity; return entity;
} }

View File

@ -3,7 +3,7 @@ package com.intellectualcrafters.plot.titles;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
public class HackTitle extends AbstractTitle { public class HackTitle extends AbstractTitle {
@ -16,7 +16,7 @@ public class HackTitle extends AbstractTitle {
title.send(player); title.send(player);
} }
catch (Throwable e) { catch (Throwable e) {
PlotMain.sendConsoleSenderMessage("&cYour server version does not support titles!"); PlotSquared.sendConsoleSenderMessage("&cYour server version does not support titles!");
Settings.TITLES = false; Settings.TITLES = false;
AbstractTitle.TITLE_CLASS = null; AbstractTitle.TITLE_CLASS = null;
} }

View File

@ -1,65 +0,0 @@
package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import com.intellectualcrafters.plot.object.PlotBlock;
public class BukkitUtil extends BlockManager {
private static HashMap<String, World> worlds = new HashMap<>();
private static String lastString = null;
private static World lastWorld = null;
public static World getWorld(String string) {
if (lastString == string) {
return lastWorld;
}
World world = worlds.get(string);
if (world == null) {
world = Bukkit.getWorld(string);
worlds.put(string, world);
}
return world;
}
public static Chunk getChunkAt(String worldname, int x, int z) {
World world = getWorld(worldname);
return world.getChunkAt(x, z);
}
public static void update(String world, int x, int z) {
ArrayList<Chunk> chunks = new ArrayList<>();
final int distance = Bukkit.getViewDistance();
for (int cx = -distance; cx < distance; cx++) {
for (int cz = -distance; cz < distance; cz++) {
final Chunk chunk = getChunkAt(world, (x >> 4) + cx, (z >> 4) + cz);
chunks.add(chunk);
}
}
SetBlockManager.setBlockManager.update(chunks);
}
public static void setBlock(World world, int x, int y, int z, int id, byte data) {
try {
SetBlockManager.setBlockManager.set(world, x, y, z, id, data);
}
catch (Throwable e) {
SetBlockManager.setBlockManager = new SetBlockSlow();
SetBlockManager.setBlockManager.set(world, x, y, z, id, data);
}
}
@Override
public void functionSetBlock(String worldname, int[] x, int[] y, int[] z, int[] id, byte[] data) {
World world = getWorld(worldname);
for (int i = 0; i < x.length; i++) {
BukkitUtil.setBlock(world, x[i], y[i], z[i], id[i], data[i]);
}
}
}

View File

@ -40,7 +40,7 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.BlockLoc; import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -100,7 +100,7 @@ public class ChunkManager {
public void run() { public void run() {
String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca"; String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
File file = new File(directory); File file = new File(directory);
PlotMain.sendConsoleSenderMessage("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)"); PlotSquared.sendConsoleSenderMessage("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
if (file.exists()) { if (file.exists()) {
file.delete(); file.delete();
} }
@ -189,7 +189,7 @@ public class ChunkManager {
} }
} }
final Plugin plugin = (Plugin) PlotMain.getMain(); final Plugin plugin = (Plugin) PlotSquared.getMain();
final Integer currentIndex = index.toInteger(); final Integer currentIndex = index.toInteger();
final int loadTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { final int loadTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override @Override
@ -269,7 +269,7 @@ public class ChunkManager {
public static boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone) { public static boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone) {
index.increment(); index.increment();
final Plugin plugin = (Plugin) PlotMain.getMain(); final Plugin plugin = (Plugin) PlotSquared.getMain();
final World world = pos1.getWorld(); final World world = pos1.getWorld();
Chunk c1 = world.getChunkAt(pos1); Chunk c1 = world.getChunkAt(pos1);
@ -446,7 +446,7 @@ public class ChunkManager {
chest.getInventory().setContents(chestContents.get(loc)); chest.getInventory().setContents(chestContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate chest: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate chest: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: signContents.keySet()) { for (BlockLoc loc: signContents.keySet()) {
@ -461,7 +461,7 @@ public class ChunkManager {
} }
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate sign: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate sign: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: dispenserContents.keySet()) { for (BlockLoc loc: dispenserContents.keySet()) {
@ -471,7 +471,7 @@ public class ChunkManager {
((Dispenser) (state)).getInventory().setContents(dispenserContents.get(loc)); ((Dispenser) (state)).getInventory().setContents(dispenserContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: dropperContents.keySet()) { for (BlockLoc loc: dropperContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -480,7 +480,7 @@ public class ChunkManager {
((Dropper) (state)).getInventory().setContents(dropperContents.get(loc)); ((Dropper) (state)).getInventory().setContents(dropperContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: beaconContents.keySet()) { for (BlockLoc loc: beaconContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -489,7 +489,7 @@ public class ChunkManager {
((Beacon) (state)).getInventory().setContents(beaconContents.get(loc)); ((Beacon) (state)).getInventory().setContents(beaconContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate beacon: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate beacon: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: jukeDisc.keySet()) { for (BlockLoc loc: jukeDisc.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -498,7 +498,7 @@ public class ChunkManager {
((Jukebox) (state)).setPlaying(Material.getMaterial(jukeDisc.get(loc))); ((Jukebox) (state)).setPlaying(Material.getMaterial(jukeDisc.get(loc)));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: skullData.keySet()) { for (BlockLoc loc: skullData.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -516,7 +516,7 @@ public class ChunkManager {
} }
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: hopperContents.keySet()) { for (BlockLoc loc: hopperContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -525,7 +525,7 @@ public class ChunkManager {
((Hopper) (state)).getInventory().setContents(hopperContents.get(loc)); ((Hopper) (state)).getInventory().setContents(hopperContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate hopper: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate hopper: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: noteBlockContents.keySet()) { for (BlockLoc loc: noteBlockContents.keySet()) {
@ -535,7 +535,7 @@ public class ChunkManager {
((NoteBlock) (state)).setNote(noteBlockContents.get(loc)); ((NoteBlock) (state)).setNote(noteBlockContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate note block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate note block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: brewTime.keySet()) { for (BlockLoc loc: brewTime.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -543,7 +543,7 @@ public class ChunkManager {
if (state instanceof BrewingStand) { if (state instanceof BrewingStand) {
((BrewingStand) (state)).setBrewingTime(brewTime.get(loc)); ((BrewingStand) (state)).setBrewingTime(brewTime.get(loc));
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore brewing stand cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore brewing stand cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: spawnerData.keySet()) { for (BlockLoc loc: spawnerData.keySet()) {
@ -553,7 +553,7 @@ public class ChunkManager {
((CreatureSpawner) (state)).setCreatureTypeId(spawnerData.get(loc)); ((CreatureSpawner) (state)).setCreatureTypeId(spawnerData.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore spawner type: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore spawner type: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: cmdData.keySet()) { for (BlockLoc loc: cmdData.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -562,7 +562,7 @@ public class ChunkManager {
((CommandBlock) (state)).setCommand(cmdData.get(loc)); ((CommandBlock) (state)).setCommand(cmdData.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore command block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore command block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: brewingStandContents.keySet()) { for (BlockLoc loc: brewingStandContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -571,7 +571,7 @@ public class ChunkManager {
((BrewingStand) (state)).getInventory().setContents(brewingStandContents.get(loc)); ((BrewingStand) (state)).getInventory().setContents(brewingStandContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate brewing stand: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate brewing stand: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: furnaceTime.keySet()) { for (BlockLoc loc: furnaceTime.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -581,7 +581,7 @@ public class ChunkManager {
((Furnace) (state)).setBurnTime(time[0]); ((Furnace) (state)).setBurnTime(time[0]);
((Furnace) (state)).setCookTime(time[1]); ((Furnace) (state)).setCookTime(time[1]);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore furnace cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore furnace cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: furnaceContents.keySet()) { for (BlockLoc loc: furnaceContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -590,7 +590,7 @@ public class ChunkManager {
((Furnace) (state)).getInventory().setContents(furnaceContents.get(loc)); ((Furnace) (state)).getInventory().setContents(furnaceContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate furnace: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate furnace: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: bannerBase.keySet()) { for (BlockLoc loc: bannerBase.keySet()) {
@ -606,7 +606,7 @@ public class ChunkManager {
} }
state.update(true); state.update(true);
} }
else { PlotMain.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate banner: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate banner: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
} }

View File

@ -14,7 +14,7 @@ import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.AugmentedPopulator; import com.intellectualcrafters.plot.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.object.BlockLoc; import com.intellectualcrafters.plot.object.BlockLoc;
@ -58,8 +58,8 @@ public class ClusterManager {
PlotId center = getCenterPlot(cluster); PlotId center = getCenterPlot(cluster);
toReturn = PlotHelper.getPlotHome(world, center); toReturn = PlotHelper.getPlotHome(world, center);
if (toReturn.getBlockY() == 0) { if (toReturn.getBlockY() == 0) {
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final Location loc = manager.getSignLoc(world, plotworld, PlotHelper.getPlot(world, center)); final Location loc = manager.getSignLoc(world, plotworld, PlotHelper.getPlot(world, center));
toReturn.setY(loc.getY()); toReturn.setY(loc.getY());
} }
@ -82,15 +82,15 @@ public class ClusterManager {
public static Location getClusterBottom(PlotCluster cluster) { public static Location getClusterBottom(PlotCluster cluster) {
String world = cluster.world; String world = cluster.world;
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, cluster.getP1()); return manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
} }
public static Location getClusterTop(PlotCluster cluster) { public static Location getClusterTop(PlotCluster cluster) {
String world = cluster.world; String world = cluster.world;
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, cluster.getP2()); return manager.getPlotTopLocAbs(plotworld, cluster.getP2());
} }
@ -108,8 +108,8 @@ public class ClusterManager {
public static boolean contains(PlotCluster cluster, Location loc) { public static boolean contains(PlotCluster cluster, Location loc) {
String world = loc.getWorld().getName(); String world = loc.getWorld().getName();
PlotManager manager = PlotMain.getPlotManager(world); PlotManager manager = PlotSquared.getPlotManager(world);
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
Location bot = manager.getPlotBottomLocAbs(plotworld, cluster.getP1()); Location bot = manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
Location top = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1,0,1); Location top = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1,0,1);
if (bot.getBlockX() < loc.getBlockX() && bot.getBlockZ() < loc.getBlockZ() && top.getBlockX() > loc.getBlockX() && top.getBlockZ() > loc.getBlockZ()) { if (bot.getBlockX() < loc.getBlockX() && bot.getBlockZ() < loc.getBlockZ() && top.getBlockX() > loc.getBlockX() && top.getBlockZ() > loc.getBlockZ()) {
@ -223,13 +223,13 @@ public class ClusterManager {
int zw; int zw;
String world = loc.getWorld().getName(); String world = loc.getWorld().getName();
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (plotworld == null) { if (plotworld == null) {
xw = 39; xw = 39;
zw = 39; zw = 39;
} }
else { else {
PlotManager manager = PlotMain.getPlotManager(world); PlotManager manager = PlotSquared.getPlotManager(world);
Location al = manager.getPlotBottomLocAbs(plotworld, a); Location al = manager.getPlotBottomLocAbs(plotworld, a);
Location bl = manager.getPlotBottomLocAbs(plotworld, b); Location bl = manager.getPlotBottomLocAbs(plotworld, b);
@ -252,7 +252,7 @@ public class ClusterManager {
int i = 0; int i = 0;
final Random rand = new Random(); final Random rand = new Random();
final World world = Bukkit.getWorld(cluster.world); final World world = Bukkit.getWorld(cluster.world);
final PlotWorld plotworld = PlotMain.getWorldSettings(cluster.world); final PlotWorld plotworld = PlotSquared.getWorldSettings(cluster.world);
Location bot = getClusterBottom(cluster); Location bot = getClusterBottom(cluster);
Location top = getClusterTop(cluster); Location top = getClusterTop(cluster);

View File

@ -13,7 +13,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.commands.Unlink; import com.intellectualcrafters.plot.commands.Unlink;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
@ -50,7 +50,7 @@ public class ExpireManager {
@Override @Override
public void run() { public void run() {
HashMap<Plot, Long> plots = getOldPlots(world); HashMap<Plot, Long> plots = getOldPlots(world);
PlotMain.sendConsoleSenderMessage("&cFound " + plots.size() + " expired plots for " + world + "!"); PlotSquared.sendConsoleSenderMessage("&cFound " + plots.size() + " expired plots for " + world + "!");
expiredPlots.put(world, plots); expiredPlots.put(world, plots);
updatingPlots.put(world, false); updatingPlots.put(world, false);
} }
@ -64,10 +64,10 @@ public class ExpireManager {
} }
public static void runTask() { public static void runTask() {
ExpireManager.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { ExpireManager.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotSquared.getMain(), new Runnable() {
@Override @Override
public void run() { public void run() {
for (String world : PlotMain.getPlotWorldsString()) { for (String world : PlotSquared.getPlotWorldsString()) {
if (!ExpireManager.updatingPlots.containsKey(world)) { if (!ExpireManager.updatingPlots.containsKey(world)) {
ExpireManager.updatingPlots.put(world, false); ExpireManager.updatingPlots.put(world, false);
} }
@ -110,23 +110,23 @@ public class ExpireManager {
} }
} }
final World worldobj = Bukkit.getWorld(world); final World worldobj = Bukkit.getWorld(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
if (plot.settings.isMerged()) { if (plot.settings.isMerged()) {
Unlink.unlinkPlot(Bukkit.getWorld(world), plot); Unlink.unlinkPlot(Bukkit.getWorld(world), plot);
} }
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
manager.clearPlot(worldobj, plotworld, plot, false, null); manager.clearPlot(worldobj, plotworld, plot, false, null);
PlotHelper.removeSign(worldobj, plot); PlotHelper.removeSign(worldobj, plot);
DBFunc.delete(world, plot); DBFunc.delete(world, plot);
PlotMain.removePlot(world, plot.id, true); PlotSquared.removePlot(world, plot.id, true);
expiredPlots.get(world).remove(plot); expiredPlots.get(world).remove(plot);
PlotMain.sendConsoleSenderMessage("&cDeleted expired plot: " + plot.id); PlotSquared.sendConsoleSenderMessage("&cDeleted expired plot: " + plot.id);
PlotMain.sendConsoleSenderMessage("&3 - World: "+plot.world); PlotSquared.sendConsoleSenderMessage("&3 - World: "+plot.world);
if (plot.hasOwner()) { if (plot.hasOwner()) {
PlotMain.sendConsoleSenderMessage("&3 - Owner: "+UUIDHandler.getName(plot.owner)); PlotSquared.sendConsoleSenderMessage("&3 - Owner: "+UUIDHandler.getName(plot.owner));
} }
else { else {
PlotMain.sendConsoleSenderMessage("&3 - Owner: Unowned"); PlotSquared.sendConsoleSenderMessage("&3 - Owner: Unowned");
} }
return; return;
} }
@ -150,7 +150,7 @@ public class ExpireManager {
} }
public static HashMap<Plot, Long> getOldPlots(String world) { public static HashMap<Plot, Long> getOldPlots(String world) {
final Collection<Plot> plots = PlotMain.getPlots(world).values(); final Collection<Plot> plots = PlotSquared.getPlots(world).values();
final HashMap<Plot, Long> toRemove = new HashMap<>(); final HashMap<Plot, Long> toRemove = new HashMap<>();
HashMap<UUID, Long> remove = new HashMap<>(); HashMap<UUID, Long> remove = new HashMap<>();
Set<UUID> keep = new HashSet<>(); Set<UUID> keep = new HashSet<>();
@ -186,7 +186,7 @@ public class ExpireManager {
String worldname = Bukkit.getWorlds().get(0).getName(); String worldname = Bukkit.getWorlds().get(0).getName();
String foldername; String foldername;
String filename = null; String filename = null;
if (PlotMain.checkVersion(1, 7, 5)) { if (PlotSquared.checkVersion(1, 7, 5)) {
foldername = "playerdata"; foldername = "playerdata";
try { try {
filename = op.getUniqueId() +".dat"; filename = op.getUniqueId() +".dat";
@ -205,7 +205,7 @@ public class ExpireManager {
if (filename != null) { if (filename != null) {
File playerFile = new File(worldname + File.separator + foldername + File.separator + filename); File playerFile = new File(worldname + File.separator + foldername + File.separator + filename);
if (!playerFile.exists()) { if (!playerFile.exists()) {
PlotMain.sendConsoleSenderMessage("Could not find file: " + filename); PlotSquared.sendConsoleSenderMessage("Could not find file: " + filename);
} }
else { else {
try { try {
@ -217,7 +217,7 @@ public class ExpireManager {
} }
} }
catch (Exception e) { catch (Exception e) {
PlotMain.sendConsoleSenderMessage("Please disable disk checking in old plot auto clearing; Could not read file: " + filename); PlotSquared.sendConsoleSenderMessage("Please disable disk checking in old plot auto clearing; Could not read file: " + filename);
} }
} }
} }

View File

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

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
public class MainUtil { public class MainUtil {
@ -12,6 +12,6 @@ public class MainUtil {
* @param c message * @param c message
*/ */
public static void sendConsoleSenderMessage(final C c) { public static void sendConsoleSenderMessage(final C c) {
PlotMain.MAIN_IMP.sendConsoleSenderMessage(c.s()); PlotSquared.MAIN_IMP.sendConsoleSenderMessage(c.s());
} }
} }

View File

@ -25,7 +25,7 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -48,17 +48,17 @@ import com.sk89q.worldedit.regions.CuboidRegion;
public static void setMask(final Player p, final Location l, boolean force) { public static void setMask(final Player p, final Location l, boolean force) {
try { try {
LocalSession s; LocalSession s;
if (PlotMain.worldEdit == null) { if (PlotSquared.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName()); s = WorldEdit.getInstance().getSession(p.getName());
} else { } else {
s = PlotMain.worldEdit.getSession(p); s = PlotSquared.worldEdit.getSession(p);
} }
if (!PlotMain.isPlotWorld(p.getWorld())) { if (!PlotSquared.isPlotWorld(p.getWorld())) {
removeMask(p); removeMask(p);
} }
final PlotId id = PlayerFunctions.getPlot(l); final PlotId id = PlayerFunctions.getPlot(l);
if (id != null) { if (id != null) {
final Plot plot = PlotMain.getPlots(l.getWorld()).get(id); final Plot plot = PlotSquared.getPlots(l.getWorld()).get(id);
if (plot != null) { if (plot != null) {
if (FlagManager.isPlotFlagTrue(plot, "no-worldedit")) { if (FlagManager.isPlotFlagTrue(plot, "no-worldedit")) {
return; return;
@ -73,7 +73,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
final Vector bvec = new Vector(bloc.getBlockX() + 1, bloc.getBlockY(), bloc.getBlockZ() + 1); final Vector bvec = new Vector(bloc.getBlockX() + 1, bloc.getBlockY(), bloc.getBlockZ() + 1);
final Vector tvec = new Vector(tloc.getBlockX(), tloc.getBlockY(), tloc.getBlockZ()); final Vector tvec = new Vector(tloc.getBlockX(), tloc.getBlockY(), tloc.getBlockZ());
final LocalWorld lw = PlotMain.worldEdit.wrapPlayer(p).getWorld(); final LocalWorld lw = PlotSquared.worldEdit.wrapPlayer(p).getWorld();
final CuboidRegion region = new CuboidRegion(lw, bvec, tvec); final CuboidRegion region = new CuboidRegion(lw, bvec, tvec);
final RegionMask mask = new RegionMask(region); final RegionMask mask = new RegionMask(region);
@ -82,8 +82,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
} }
} }
} }
if (force ^ (noMask(s) && !PlotMain.hasPermission(p, "plots.worldedit.bypass"))) { if (force ^ (noMask(s) && !PlotSquared.hasPermission(p, "plots.worldedit.bypass"))) {
final BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p); final BukkitPlayer plr = PlotSquared.worldEdit.wrapPlayer(p);
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69); final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2))); s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
} }
@ -97,10 +97,10 @@ import com.sk89q.worldedit.regions.CuboidRegion;
public static boolean hasMask(final Player p) { public static boolean hasMask(final Player p) {
LocalSession s; LocalSession s;
if (PlotMain.worldEdit == null) { if (PlotSquared.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName()); s = WorldEdit.getInstance().getSession(p.getName());
} else { } else {
s = PlotMain.worldEdit.getSession(p); s = PlotSquared.worldEdit.getSession(p);
} }
return !noMask(s); return !noMask(s);
} }
@ -113,12 +113,12 @@ import com.sk89q.worldedit.regions.CuboidRegion;
public static void setNoMask(final Player p) { public static void setNoMask(final Player p) {
try { try {
LocalSession s; LocalSession s;
if (PlotMain.worldEdit == null) { if (PlotSquared.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName()); s = WorldEdit.getInstance().getSession(p.getName());
} else { } else {
s = PlotMain.worldEdit.getSession(p); s = PlotSquared.worldEdit.getSession(p);
} }
final BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p); final BukkitPlayer plr = PlotSquared.worldEdit.wrapPlayer(p);
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69); final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2))); s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
} catch (final Exception e) { } catch (final Exception e) {
@ -134,10 +134,10 @@ import com.sk89q.worldedit.regions.CuboidRegion;
public static void removeMask(final Player p) { public static void removeMask(final Player p) {
try { try {
LocalSession s; LocalSession s;
if (PlotMain.worldEdit == null) { if (PlotSquared.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName()); s = WorldEdit.getInstance().getSession(p.getName());
} else { } else {
s = PlotMain.worldEdit.getSession(p); s = PlotSquared.worldEdit.getSession(p);
} }
removeMask(p, s); removeMask(p, s);
} catch (final Exception e) { } catch (final Exception e) {

View File

@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -69,8 +69,8 @@ import java.util.UUID;
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) { public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
final Plot plot1 = PlotMain.getPlots(world).get(pos1); final Plot plot1 = PlotSquared.getPlots(world).get(pos1);
final Plot plot2 = PlotMain.getPlots(world).get(pos2); final Plot plot2 = PlotSquared.getPlots(world).get(pos2);
if (plot1 != null) { if (plot1 != null) {
pos1 = getBottomPlot(world, plot1).id; pos1 = getBottomPlot(world, plot1).id;
@ -92,14 +92,14 @@ import java.util.UUID;
public static Plot getBottomPlot(final String world, final Plot plot) { public static Plot getBottomPlot(final String world, final Plot plot) {
if (plot.settings.getMerged(0)) { if (plot.settings.getMerged(0)) {
final Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1)); final Plot p = PlotSquared.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1));
if (p == null) { if (p == null) {
return plot; return plot;
} }
return getBottomPlot(world, p); return getBottomPlot(world, p);
} }
if (plot.settings.getMerged(3)) { if (plot.settings.getMerged(3)) {
final Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x - 1, plot.id.y)); final Plot p = PlotSquared.getPlots(world).get(new PlotId(plot.id.x - 1, plot.id.y));
if (p == null) { if (p == null) {
return plot; return plot;
} }
@ -111,10 +111,10 @@ import java.util.UUID;
public static Plot getTopPlot(final String world, final Plot plot) { public static Plot getTopPlot(final String world, final Plot plot) {
if (plot.settings.getMerged(2)) { if (plot.settings.getMerged(2)) {
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1))); return getTopPlot(world, PlotSquared.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1)));
} }
if (plot.settings.getMerged(1)) { if (plot.settings.getMerged(1)) {
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x + 1, plot.id.y))); return getTopPlot(world, PlotSquared.getPlots(world).get(new PlotId(plot.id.x + 1, plot.id.y)));
} }
return plot; return plot;
} }
@ -128,11 +128,11 @@ import java.util.UUID;
*/ */
public static PlotId getPlotAbs(final Location loc) { public static PlotId getPlotAbs(final Location loc) {
final String world = loc.getWorld().getName(); final String world = loc.getWorld().getName();
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
if (manager == null) { if (manager == null) {
return null; return null;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
return manager.getPlotIdAbs(plotworld, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); return manager.getPlotIdAbs(plotworld, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
} }
@ -146,11 +146,11 @@ import java.util.UUID;
*/ */
public static PlotId getPlot(final Location loc) { public static PlotId getPlot(final Location loc) {
final String world = loc.getWorld().getName(); final String world = loc.getWorld().getName();
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
if (manager == null) { if (manager == null) {
return null; return null;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
PlotId id = manager.getPlotId(plotworld, loc.getBlockX(),loc.getBlockY(), loc.getBlockZ()); PlotId id = manager.getPlotId(plotworld, loc.getBlockX(),loc.getBlockY(), loc.getBlockZ());
if (id!=null && plotworld.TYPE == 2) { if (id!=null && plotworld.TYPE == 2) {
@ -169,7 +169,7 @@ import java.util.UUID;
* @return * @return
*/ */
public static Plot getCurrentPlot(final Player player) { public static Plot getCurrentPlot(final Player player) {
if (!PlotMain.isPlotWorld(player.getWorld())) { if (!PlotSquared.isPlotWorld(player.getWorld())) {
return null; return null;
} }
final PlotId id = getPlot(player.getLocation()); final PlotId id = getPlot(player.getLocation());
@ -177,8 +177,8 @@ import java.util.UUID;
if (id == null) { if (id == null) {
return null; return null;
} }
if (PlotMain.getPlots(world).containsKey(id)) { if (PlotSquared.getPlots(world).containsKey(id)) {
return PlotMain.getPlots(world).get(id); return PlotSquared.getPlots(world).get(id);
} }
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName()); return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName());
@ -193,7 +193,7 @@ import java.util.UUID;
*/ */
@Deprecated @Deprecated
public static void set(final Plot plot) { public static void set(final Plot plot) {
PlotMain.updatePlot(plot); PlotSquared.updatePlot(plot);
} }
/** /**
@ -204,7 +204,7 @@ import java.util.UUID;
* @return * @return
*/ */
public static Set<Plot> getPlayerPlots(final World world, final Player plr) { public static Set<Plot> getPlayerPlots(final World world, final Player plr) {
final Set<Plot> p = PlotMain.getPlots(world, plr); final Set<Plot> p = PlotSquared.getPlots(world, plr);
if (p == null) { if (p == null) {
return new HashSet<>(); return new HashSet<>();
} }
@ -221,7 +221,7 @@ import java.util.UUID;
public static int getPlayerPlotCount(final World world, final Player plr) { public static int getPlayerPlotCount(final World world, final Player plr) {
final UUID uuid = UUIDHandler.getUUID(plr); final UUID uuid = UUIDHandler.getUUID(plr);
int count = 0; int count = 0;
for (final Plot plot : PlotMain.getPlots(world).values()) { for (final Plot plot : PlotSquared.getPlots(world).values()) {
if (plot.hasOwner() && plot.owner.equals(uuid) && plot.countsTowardsMax) { if (plot.hasOwner() && plot.owner.equals(uuid) && plot.countsTowardsMax) {
count++; count++;
} }
@ -237,17 +237,17 @@ import java.util.UUID;
* @return * @return
*/ */
public static int getAllowedPlots(final Player p) { public static int getAllowedPlots(final Player p) {
return PlotMain.MAIN_IMP.(p, "plots.plot", Settings.MAX_PLOTS); return PlotSquared.MAIN_IMP.(p, "plots.plot", Settings.MAX_PLOTS);
} }
/** /**
* @return PlotMain.getPlots(); * @return PlotSquared.getPlots();
* *
* @deprecated * @deprecated
*/ */
@Deprecated @Deprecated
public static Set<Plot> getPlots() { public static Set<Plot> getPlots() {
return PlotMain.getPlots(); return PlotSquared.getPlots();
} }
/** /**
@ -286,7 +286,7 @@ import java.util.UUID;
public static boolean sendMessage(final Player plr, final String msg, final boolean prefix) { public static boolean sendMessage(final Player plr, final String msg, final boolean prefix) {
if ((msg.length() > 0) && !msg.equals("")) { if ((msg.length() > 0) && !msg.equals("")) {
if (plr == null) { if (plr == null) {
PlotMain.MAIN_IMP.sendConsoleSenderMessage(C.PREFIX.s() + msg); PlotSquared.MAIN_IMP.sendConsoleSenderMessage(C.PREFIX.s() + msg);
} else { } else {
sendMessageWrapped(plr, ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + msg)); sendMessageWrapped(plr, ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + msg));
} }
@ -313,7 +313,7 @@ import java.util.UUID;
} }
} }
if (plr == null) { if (plr == null) {
PlotMain.sendConsoleSenderMessage(msg); PlotSquared.sendConsoleSenderMessage(msg);
} }
else { else {
sendMessage(plr, msg, c.usePrefix()); sendMessage(plr, msg, c.usePrefix());

View File

@ -41,7 +41,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.listeners.PlotListener; import com.intellectualcrafters.plot.listeners.PlotListener;
@ -70,21 +70,21 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
public static int getBorder(String worldname) { public static int getBorder(String worldname) {
if (worldBorder.containsKey(worldname)) { if (worldBorder.containsKey(worldname)) {
PlotWorld plotworld = PlotMain.getWorldSettings(worldname); PlotWorld plotworld = PlotSquared.getWorldSettings(worldname);
return worldBorder.get(worldname) + 16; return worldBorder.get(worldname) + 16;
} }
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
public static void setupBorder(String world) { public static void setupBorder(String world) {
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (!plotworld.WORLD_BORDER) { if (!plotworld.WORLD_BORDER) {
return; return;
} }
if (!worldBorder.containsKey(world)) { if (!worldBorder.containsKey(world)) {
worldBorder.put(world,0); worldBorder.put(world,0);
} }
for (Plot plot : PlotMain.getPlots(world).values()) { for (Plot plot : PlotSquared.getPlots(world).values()) {
updateWorldBorder(plot); updateWorldBorder(plot);
} }
} }
@ -136,11 +136,11 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
*/ */
public static boolean mergePlots(final Player plr, final String world, final ArrayList<PlotId> plotIds) { public static boolean mergePlots(final Player plr, final String world, final ArrayList<PlotId> plotIds) {
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (PlotMain.useEconomy && plotworld.USE_ECONOMY) { if (PlotSquared.useEconomy && plotworld.USE_ECONOMY) {
final double cost = plotIds.size() * plotworld.MERGE_PRICE; final double cost = plotIds.size() * plotworld.MERGE_PRICE;
if (cost > 0d) { if (cost > 0d) {
final Economy economy = PlotMain.economy; final Economy economy = PlotSquared.economy;
if (economy.getBalance(plr) < cost) { if (economy.getBalance(plr) < cost) {
PlayerFunctions.sendMessage(plr, C.CANNOT_AFFORD_MERGE, "" + cost); PlayerFunctions.sendMessage(plr, C.CANNOT_AFFORD_MERGE, "" + cost);
return false; return false;
@ -171,8 +171,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
final PlotId pos1 = plotIds.get(0); final PlotId pos1 = plotIds.get(0);
final PlotId pos2 = plotIds.get(plotIds.size() - 1); final PlotId pos2 = plotIds.get(plotIds.size() - 1);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
manager.startPlotMerge(plotworld, plotIds); manager.startPlotMerge(plotworld, plotIds);
@ -189,7 +189,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
final PlotId id = new PlotId(x, y); final PlotId id = new PlotId(x, y);
final Plot plot = PlotMain.getPlots(world).get(id); final Plot plot = PlotSquared.getPlots(world).get(id);
Plot plot2 = null; Plot plot2 = null;
@ -208,7 +208,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
} }
if (!plot.settings.getMerged(1)) { if (!plot.settings.getMerged(1)) {
changed = true; changed = true;
plot2 = PlotMain.getPlots(world).get(new PlotId(x + 1, y)); plot2 = PlotSquared.getPlots(world).get(new PlotId(x + 1, y));
mergePlot(world, plot, plot2, removeRoads); mergePlot(world, plot, plot2, removeRoads);
plot.settings.setMerged(1, true); plot.settings.setMerged(1, true);
plot2.settings.setMerged(3, true); plot2.settings.setMerged(3, true);
@ -217,7 +217,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
if (ly) { if (ly) {
if (!plot.settings.getMerged(2)) { if (!plot.settings.getMerged(2)) {
changed = true; changed = true;
plot2 = PlotMain.getPlots(world).get(new PlotId(x, y + 1)); plot2 = PlotSquared.getPlots(world).get(new PlotId(x, y + 1));
mergePlot(world, plot, plot2, removeRoads); mergePlot(world, plot, plot2, removeRoads);
plot.settings.setMerged(2, true); plot.settings.setMerged(2, true);
plot2.settings.setMerged(0, true); plot2.settings.setMerged(0, true);
@ -229,7 +229,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
for (int x = pos1.x; x <= pos2.x; x++) { for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) { for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y); final PlotId id = new PlotId(x, y);
final Plot plot = PlotMain.getPlots(world).get(id); final Plot plot = PlotSquared.getPlots(world).get(id);
DBFunc.setMerged(world, plot, plot.settings.getMerged()); DBFunc.setMerged(world, plot, plot.settings.getMerged());
} }
@ -252,8 +252,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
*/ */
public static void mergePlot(final String world, final Plot lesserPlot, final Plot greaterPlot, boolean removeRoads) { public static void mergePlot(final String world, final Plot lesserPlot, final Plot greaterPlot, boolean removeRoads) {
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
if (lesserPlot.id.x.equals(greaterPlot.id.x)) { if (lesserPlot.id.x.equals(greaterPlot.id.x)) {
if (!lesserPlot.settings.getMerged(2)) { if (!lesserPlot.settings.getMerged(2)) {
@ -278,8 +278,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
public static void removeSign(final Plot p) { public static void removeSign(final Plot p) {
String world = p.world; String world = p.world;
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final Location loc = manager.getSignLoc(plotworld, p); final Location loc = manager.getSignLoc(plotworld, p);
BlockManager.setBlocks(world, new int[] { loc.getX()}, new int[] { loc.getY()}, new int[] { loc.getZ()}, new int[] { 0 }, new byte[] { 0 }); BlockManager.setBlocks(world, new int[] { loc.getX()}, new int[] { loc.getY()}, new int[] { loc.getZ()}, new int[] { 0 }, new byte[] { 0 });
} }
@ -289,8 +289,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
if (name == null) { if (name == null) {
name = "unknown"; name = "unknown";
} }
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final Location loc = manager.getSignLoc(plotworld, p); final Location loc = manager.getSignLoc(plotworld, p);
final Block bs = loc.getBlock(); final Block bs = loc.getBlock();
@ -387,7 +387,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
final PlotId id_min = plots.get(0); final PlotId id_min = plots.get(0);
final PlotId id_max = plots.get(plots.size() - 1); final PlotId id_max = plots.get(plots.size() - 1);
for (final PlotId myid : plots) { for (final PlotId myid : plots) {
final Plot myplot = PlotMain.getPlots(world).get(myid); final Plot myplot = PlotSquared.getPlots(world).get(myid);
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(player)))) { if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(player)))) {
return false; return false;
} }
@ -408,8 +408,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
return; return;
} }
String world = plot.world; String world = plot.world;
PlotManager manager = PlotMain.getPlotManager(world); PlotManager manager = PlotSquared.getPlotManager(world);
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
Location bot = manager.getPlotBottomLocAbs(plotworld, plot.id); Location bot = manager.getPlotBottomLocAbs(plotworld, plot.id);
Location top = manager.getPlotTopLocAbs(plotworld, plot.id); Location top = manager.getPlotTopLocAbs(plotworld, plot.id);
int border = worldBorder.get(plot.world); int border = worldBorder.get(plot.world);
@ -431,7 +431,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
World w = player.getWorld(); World w = player.getWorld();
UUID uuid = UUIDHandler.getUUID(player); UUID uuid = UUIDHandler.getUUID(player);
Plot p = createPlotAbs(uuid, plot); Plot p = createPlotAbs(uuid, plot);
final PlotWorld plotworld = PlotMain.getWorldSettings(w); final PlotWorld plotworld = PlotSquared.getWorldSettings(w);
if (plotworld.AUTO_MERGE) { if (plotworld.AUTO_MERGE) {
autoMerge(w, p, player); autoMerge(w, p, player);
} }
@ -444,7 +444,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
public static Plot createPlotAbs(final UUID uuid, final Plot plot) { public static Plot createPlotAbs(final UUID uuid, final Plot plot) {
final World w = plot.getWorld(); final World w = plot.getWorld();
final Plot p = new Plot(plot.id, uuid, plot.settings.getBiome(), new ArrayList<UUID>(), new ArrayList<UUID>(), w.getName()); final Plot p = new Plot(plot.id, uuid, plot.settings.getBiome(), new ArrayList<UUID>(), new ArrayList<UUID>(), w.getName());
PlotMain.updatePlot(p); PlotSquared.updatePlot(p);
DBFunc.createPlotAndSettings(p); DBFunc.createPlotAndSettings(p);
return p; return p;
} }
@ -461,7 +461,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
public static int getTileEntities(final String world) { public static int getTileEntities(final String world) {
PlotMain.getWorldSettings(world); PlotSquared.getWorldSettings(world);
int x = 0; int x = 0;
for (final Chunk chunk : world.getLoadedChunks()) { for (final Chunk chunk : world.getLoadedChunks()) {
x += chunk.getTileEntities().length; x += chunk.getTileEntities().length;
@ -502,7 +502,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
if (plot.id.equals(id)) { if (plot.id.equals(id)) {
if (entity instanceof Player) { if (entity instanceof Player) {
final Player player = (Player) entity; final Player player = (Player) entity;
PlotMain.teleportPlayer(player, entity.getLocation(), plot); PlotSquared.teleportPlayer(player, entity.getLocation(), plot);
PlotListener.plotExit(player, plot); PlotListener.plotExit(player, plot);
} else { } else {
entity.remove(); entity.remove();
@ -524,7 +524,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
return; return;
} }
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1); final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
@ -536,7 +536,7 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
final Location location = PlotHelper.getPlotHomeDefault(plot); final Location location = PlotHelper.getPlotHomeDefault(plot);
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotSquared.getWorldSettings(world);
runners.put(plot, 1); runners.put(plot, 1);
if (plotworld.TERRAIN != 0) { if (plotworld.TERRAIN != 0) {
final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id); final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
@ -693,12 +693,12 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
Plot plot = getPlot(w, plotid); Plot plot = getPlot(w, plotid);
BlockLoc home = plot.settings.getPosition(); BlockLoc home = plot.settings.getPosition();
final Location bot = getPlotBottomLoc(w, plotid); final Location bot = getPlotBottomLoc(w, plotid);
PlotManager manager = PlotMain.getPlotManager(w); PlotManager manager = PlotSquared.getPlotManager(w);
if (home == null || (home.x == 0 && home.z == 0)) { if (home == null || (home.x == 0 && home.z == 0)) {
final Location top = getPlotTopLoc(w, plotid); final Location top = getPlotTopLoc(w, plotid);
final int x = ((top.getBlockX() - bot.getBlockX())/2) + bot.getBlockX(); final int x = ((top.getBlockX() - bot.getBlockX())/2) + bot.getBlockX();
final int z = ((top.getBlockZ() - bot.getBlockZ())/2) + bot.getBlockZ(); final int z = ((top.getBlockZ() - bot.getBlockZ())/2) + bot.getBlockZ();
final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(w, PlotMain.getWorldSettings(w), plot).getBlockY()); final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(w, PlotSquared.getWorldSettings(w), plot).getBlockY());
return new Location(w, x, y, z); return new Location(w, x, y, z);
} }
else { else {
@ -787,8 +787,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
*/ */
public static Location getPlotTopLocAbs(final String world, final PlotId id) { public static Location getPlotTopLocAbs(final String world, final PlotId id) {
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id); return manager.getPlotTopLocAbs(plotworld, id);
} }
@ -803,8 +803,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
*/ */
public static Location getPlotBottomLocAbs(final String world, final PlotId id) { public static Location getPlotBottomLocAbs(final String world, final PlotId id) {
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id); return manager.getPlotBottomLocAbs(plotworld, id);
} }
@ -832,12 +832,12 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
*/ */
public static Location getPlotTopLoc(final String world, PlotId id) { public static Location getPlotTopLoc(final String world, PlotId id) {
final Plot plot = PlotMain.getPlots(world).get(id); final Plot plot = PlotSquared.getPlots(world).get(id);
if (plot != null) { if (plot != null) {
id = PlayerFunctions.getTopPlot(world, plot).id; id = PlayerFunctions.getTopPlot(world, plot).id;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id); return manager.getPlotTopLocAbs(plotworld, id);
} }
@ -852,12 +852,12 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
*/ */
public static Location getPlotBottomLoc(final String world, PlotId id) { public static Location getPlotBottomLoc(final String world, PlotId id) {
final Plot plot = PlotMain.getPlots(world).get(id); final Plot plot = PlotSquared.getPlots(world).get(id);
if (plot != null) { if (plot != null) {
id = PlayerFunctions.getBottomPlot(world, plot).id; id = PlayerFunctions.getBottomPlot(world, plot).id;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id); return manager.getPlotBottomLocAbs(plotworld, id);
} }
@ -866,8 +866,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
for (int x = pos1.x; x <= pos2.x; x++) { for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) { for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y); final PlotId id = new PlotId(x, y);
if (PlotMain.getPlots(world).get(id) != null) { if (PlotSquared.getPlots(world).get(id) != null) {
if (PlotMain.getPlots(world).get(id).owner != null) { if (PlotSquared.getPlots(world).get(id).owner != null) {
return false; return false;
} }
} }
@ -899,11 +899,11 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
String worldname = world.getName(); String worldname = world.getName();
for (PlotId id : selection) { for (PlotId id : selection) {
DBFunc.movePlot(world.getName(), new PlotId(id.x, id.y), new PlotId(id.x + offset_x, id.y + offset_y)); DBFunc.movePlot(world.getName(), new PlotId(id.x, id.y), new PlotId(id.x + offset_x, id.y + offset_y));
Plot plot = PlotMain.getPlots(worldname).get(id); Plot plot = PlotSquared.getPlots(worldname).get(id);
PlotMain.getPlots(worldname).remove(id); PlotSquared.getPlots(worldname).remove(id);
plot.id.x += offset_x; plot.id.x += offset_x;
plot.id.y += offset_y; plot.id.y += offset_y;
PlotMain.getPlots(worldname).put(plot.id, plot); PlotSquared.getPlots(worldname).put(plot.id, plot);
} }
ChunkManager.copyRegion(bot1, top, bot2, new Runnable() { ChunkManager.copyRegion(bot1, top, bot2, new Runnable() {
@Override @Override
@ -940,8 +940,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
if (id == null) { if (id == null) {
return null; return null;
} }
if (PlotMain.getPlots(world).containsKey(id)) { if (PlotSquared.getPlots(world).containsKey(id)) {
return PlotMain.getPlots(world).get(id); return PlotSquared.getPlots(world).get(id);
} }
return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName()); return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName());
} }
@ -958,8 +958,8 @@ import com.intellectualcrafters.plot.util.bukkit.TaskManager;
if (id == null) { if (id == null) {
return null; return null;
} }
if (PlotMain.getPlots(loc.getWorld()).containsKey(id)) { if (PlotSquared.getPlots(loc.getWorld()).containsKey(id)) {
return PlotMain.getPlots(loc.getWorld()).get(id); return PlotSquared.getPlots(loc.getWorld()).get(id);
} }
return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), loc.getWorld().getName()); return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), loc.getWorld().getName());
} }

View File

@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
/** /**
* Created 2014-09-29 for PlotSquared * Created 2014-09-29 for PlotSquared
@ -32,11 +32,11 @@ public class PlotSquaredException extends RuntimeException {
public PlotSquaredException(final PlotError error, final String details) { public PlotSquaredException(final PlotError error, final String details) {
super("PlotError >> " + error.getHeader() + ": " + details); super("PlotError >> " + error.getHeader() + ": " + details);
PlotMain.sendConsoleSenderMessage("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details); PlotSquared.sendConsoleSenderMessage("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
} }
public static enum PlotError { public static enum PlotError {
PLOTMAIN_NULL("The PlotMain instance was null"), PLOTMAIN_NULL("The PlotSquared instance was null"),
MISSING_DEPENDENCY("Missing Dependency"); MISSING_DEPENDENCY("Missing Dependency");
private final String errorHeader; private final String errorHeader;

View File

@ -47,7 +47,7 @@ import com.intellectualcrafters.jnbt.NBTOutputStream;
import com.intellectualcrafters.jnbt.ShortTag; import com.intellectualcrafters.jnbt.ShortTag;
import com.intellectualcrafters.jnbt.StringTag; import com.intellectualcrafters.jnbt.StringTag;
import com.intellectualcrafters.jnbt.Tag; import com.intellectualcrafters.jnbt.Tag;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
@ -69,7 +69,7 @@ public class SchematicHandler {
*/ */
public static boolean paste(final Location location, final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) { public static boolean paste(final Location location, final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
if (schematic == null) { if (schematic == null) {
PlotMain.sendConsoleSenderMessage("Schematic == null :|"); PlotSquared.sendConsoleSenderMessage("Schematic == null :|");
return false; return false;
} }
try { try {
@ -170,16 +170,16 @@ public class SchematicHandler {
*/ */
public static Schematic getSchematic(final String name) { public static Schematic getSchematic(final String name) {
{ {
final File parent = new File(PlotMain.getMain().getDirectory() + File.separator + "schematics"); final File parent = new File(PlotSquared.getMain().getDirectory() + File.separator + "schematics");
if (!parent.exists()) { if (!parent.exists()) {
if (!parent.mkdir()) { if (!parent.mkdir()) {
throw new RuntimeException("Could not create schematic parent directory"); throw new RuntimeException("Could not create schematic parent directory");
} }
} }
} }
final File file = new File(PlotMain.getMain().getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic"); final File file = new File(PlotSquared.getMain().getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
if (!file.exists()) { if (!file.exists()) {
PlotMain.sendConsoleSenderMessage(file.toString() + " doesn't exist"); PlotSquared.sendConsoleSenderMessage(file.toString() + " doesn't exist");
return null; return null;
} }
@ -191,7 +191,7 @@ public class SchematicHandler {
return getSchematic(tag, file); return getSchematic(tag, file);
} catch (final Exception e) { } catch (final Exception e) {
PlotMain.sendConsoleSenderMessage(file.toString() + " is not in GZIP format"); PlotSquared.sendConsoleSenderMessage(file.toString() + " is not in GZIP format");
return null; return null;
} }
} }
@ -206,7 +206,7 @@ public class SchematicHandler {
*/ */
public static boolean save(final CompoundTag tag, final String path) { public static boolean save(final CompoundTag tag, final String path) {
if (tag == null) { if (tag == null) {
PlotMain.sendConsoleSenderMessage("&cCannot save empty tag"); PlotSquared.sendConsoleSenderMessage("&cCannot save empty tag");
return false; return false;
} }
try { try {
@ -233,7 +233,7 @@ public class SchematicHandler {
* @return tag * @return tag
*/ */
public static CompoundTag getCompoundTag(final World world, PlotId id) { public static CompoundTag getCompoundTag(final World world, PlotId id) {
if (!PlotMain.getPlots(world).containsKey(id)) { if (!PlotSquared.getPlots(world).containsKey(id)) {
return null; return null;
} }
@ -265,7 +265,7 @@ public class SchematicHandler {
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
PlotMain.sendConsoleSenderMessage("&7 - Cannot save: corrupt chunk at " + (i / 16) + ", " + (j / 16)); PlotSquared.sendConsoleSenderMessage("&7 - Cannot save: corrupt chunk at " + (i / 16) + ", " + (j / 16));
return null; return null;
} }
final int width = (pos2.getBlockX() - pos1.getBlockX()) + 1; final int width = (pos2.getBlockX() - pos1.getBlockX()) + 1;

View File

@ -16,6 +16,8 @@ public abstract class TaskManager {
public abstract void taskLater(final Runnable r, int delay); public abstract void taskLater(final Runnable r, int delay);
public abstract void taskLaterAsync(final Runnable r, int delay);
public static void runTaskRepeat(final Runnable r, int interval) { public static void runTaskRepeat(final Runnable r, int interval) {
if (r != null) if (r != null)
PlotSquared.TASK.taskRepeat(r, interval); PlotSquared.TASK.taskRepeat(r, interval);
@ -35,4 +37,9 @@ public abstract class TaskManager {
if (r != null) if (r != null)
PlotSquared.TASK.taskLater(r, delay); PlotSquared.TASK.taskLater(r, delay);
} }
public static void runTaskLaterAsync(final Runnable r, int delay) {
if (r != null)
PlotSquared.TASK.taskLaterAsync(r, delay);
}
} }

View File

@ -12,7 +12,8 @@ import org.bukkit.entity.Player;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
@ -80,7 +81,10 @@ public class UUIDHandler {
} }
public static void cacheAll() { public static void cacheAll() {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&6Starting player data caching"); if (CACHED) {
return;
}
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching");
UUIDHandler.CACHED = true; UUIDHandler.CACHED = true;
HashSet<String> worlds = new HashSet<>(); HashSet<String> worlds = new HashSet<>();
worlds.add(Bukkit.getWorlds().get(0).getName()); worlds.add(Bukkit.getWorlds().get(0).getName());
@ -105,7 +109,7 @@ public class UUIDHandler {
uuids.add(uuid); uuids.add(uuid);
} }
catch (Exception e) { catch (Exception e) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current); PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current);
} }
} }
} }
@ -132,7 +136,7 @@ public class UUIDHandler {
add(name, uuid); add(name, uuid);
} }
catch (Throwable e) { catch (Throwable e) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&6Invalid playerdata: "+uuid.toString() + ".dat"); PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&6Invalid playerdata: "+uuid.toString() + ".dat");
} }
} }
for (String name : names) { for (String name : names) {
@ -145,7 +149,7 @@ public class UUIDHandler {
// add the Everyone '*' UUID // add the Everyone '*' UUID
add(new StringWrapper("*"), DBFunc.everyone); add(new StringWrapper("*"), DBFunc.everyone);
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs"); PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
} }
public static UUID getUUID(Player player) { public static UUID getUUID(Player player) {

View File

@ -3,7 +3,7 @@ package com.intellectualcrafters.plot.util.bukkit;
import java.util.HashSet; import java.util.HashSet;
import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
public class BukkitTaskManager extends TaskManager { public class BukkitTaskManager extends TaskManager {

View File

@ -3,8 +3,8 @@ package com.intellectualsites.translation.bukkit;
import java.io.File; import java.io.File;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualsites.translation.TranslationAsset; import com.intellectualsites.translation.TranslationAsset;
import com.intellectualsites.translation.TranslationLanguage; import com.intellectualsites.translation.TranslationLanguage;
import com.intellectualsites.translation.TranslationManager; import com.intellectualsites.translation.TranslationManager;
@ -36,8 +36,8 @@ public class BukkitTranslation {
* *
* @return parent folder * @return parent folder
*/ */
public static File getParent(final JavaPlugin plugin) { public static File getParent() {
return new File(plugin.getDataFolder() + File.separator + "translations"); return new File(PlotSquared.IMP.getDirectory() + File.separator + "translations");
} }
/** /**

View File

@ -1,5 +1,5 @@
name: ${project.name} name: ${project.name}
main: com.intellectualcrafters.plot.PlotMain main: com.intellectualcrafters.plot.PlotSquared
version: ${project.version} version: ${project.version}
load: STARTUP load: STARTUP
description: > description: >
@ -9,7 +9,7 @@ softdepend: [WorldEdit, BarAPI, CameraAPI, Vault]
database: false database: false
commands: commands:
plots: plots:
description: PlotMain PlotSquared command. description: PlotSquared PlotSquared command.
aliases: [p,plot,ps,plotsquared,p2] aliases: [p,plot,ps,plotsquared,p2]
permission: plots.use permission: plots.use
permission-message: "You are lacking the permission node 'plots.use'" permission-message: "You are lacking the permission node 'plots.use'"