This commit is contained in:
boy0001 2015-02-20 19:55:04 +11:00
parent 0dc0b29ea7
commit 439a1d440a
29 changed files with 60 additions and 61 deletions

View File

@ -92,7 +92,7 @@ public class PlotSquared {
plots.get(world).put(plot.id, plot); plots.get(world).put(plot.id, plot);
} }
public static PlotWorld getWorldSettings(final String world) { public static PlotWorld getPlotWorld(final String world) {
if (plotworlds.containsKey(world)) { if (plotworlds.containsKey(world)) {
return plotworlds.get(world); return plotworlds.get(world);
} }
@ -196,7 +196,7 @@ public class PlotSquared {
} }
public static void loadWorld(final String world, final PlotGenerator generator) { public static void loadWorld(final String world, final PlotGenerator generator) {
if (getWorldSettings(world) != null) { if (getPlotWorld(world) != null) {
return; return;
} }
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>()); final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());

View File

@ -133,7 +133,7 @@ public class Auto extends SubCommand {
} }
return false; return false;
} }
final PlotWorld pWorld = PlotSquared.getWorldSettings(world.getName()); final PlotWorld pWorld = PlotSquared.getPlotWorld(world.getName());
if ((PlotSquared.economy != null) && 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;
@ -160,7 +160,7 @@ public class Auto extends SubCommand {
// } // }
} }
final String worldname = world.getName(); final String worldname = world.getName();
final PlotWorld plotworld = PlotSquared.getWorldSettings(worldname); final PlotWorld plotworld = PlotSquared.getPlotWorld(worldname);
if (plotworld.TYPE == 2) { if (plotworld.TYPE == 2) {
final Location loc = BukkitUtil.getLocation(plr); final Location loc = BukkitUtil.getLocation(plr);
final Plot plot = PlotHelper.getCurrentPlot(new com.intellectualcrafters.plot.object.Location(worldname, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); final Plot plot = PlotHelper.getCurrentPlot(new com.intellectualcrafters.plot.object.Location(worldname, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));

View File

@ -87,7 +87,7 @@ public class Buy extends SubCommand {
final PlotId id = plot.id; final PlotId id = plot.id;
final PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id; final PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id;
final int size = PlayerFunctions.getPlotSelectionIds(id, id2).size(); final int size = PlayerFunctions.getPlotSelectionIds(id, id2).size();
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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;

View File

@ -62,7 +62,7 @@ public class Claim extends SubCommand {
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot); PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
} }
final World world = plot.world; final World world = plot.world;
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final Plot plot2 = PlotSquared.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;
@ -98,7 +98,7 @@ 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 = PlotSquared.getWorldSettings(plot.world); final PlotWorld world = PlotSquared.getPlotWorld(plot.world);
if (PlotSquared.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) {

View File

@ -176,7 +176,7 @@ public class Cluster extends SubCommand {
return false; return false;
} }
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(plr.getWorld()); final PlotWorld plotworld = PlotSquared.getPlotWorld(plr.getWorld());
if (plotworld.TYPE == 2) { if (plotworld.TYPE == 2) {
final ArrayList<Plot> toRemove = new ArrayList<>(); final ArrayList<Plot> toRemove = new ArrayList<>();
for (final Plot plot : PlotSquared.getPlots(plr.getWorld()).values()) { for (final Plot plot : PlotSquared.getPlots(plr.getWorld()).values()) {

View File

@ -41,7 +41,7 @@ public class CreateRoadSchematic extends SubCommand {
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
return false; return false;
} }
if (!(PlotSquared.getWorldSettings(player.getWorld()) instanceof HybridPlotWorld)) { if (!(PlotSquared.getPlotWorld(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);

View File

@ -94,7 +94,7 @@ 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 = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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);

View File

@ -53,7 +53,7 @@ public class DebugClear extends SubCommand {
if (id == null) { if (id == null) {
PlotSquared.log("Invalid Plot ID: " + args[0]); PlotSquared.log("Invalid Plot ID: " + args[0]);
} else { } else {
if (!PlotSquared.isPlotWorld(world) || !(PlotSquared.getWorldSettings(world) instanceof SquarePlotWorld)) { if (!PlotSquared.isPlotWorld(world) || !(PlotSquared.getPlotWorld(world) instanceof SquarePlotWorld)) {
PlotSquared.log("Invalid plot world: " + world); PlotSquared.log("Invalid plot world: " + world);
} else { } else {
final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id); final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id);
@ -82,7 +82,7 @@ public class DebugClear extends SubCommand {
} }
return true; return true;
} }
if (!PlayerFunctions.isInPlot(plr) || !(PlotSquared.getWorldSettings(plr.getWorld()) instanceof SquarePlotWorld)) { if (!PlayerFunctions.isInPlot(plr) || !(PlotSquared.getPlotWorld(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);

View File

@ -39,7 +39,7 @@ 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 (!(PlotSquared.getWorldSettings(player.getWorld()) instanceof HybridPlotWorld)) { if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD); return sendMessage(player, C.NOT_IN_PLOT_WORLD);
} }
final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld()); final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld());

View File

@ -51,7 +51,7 @@ public class Delete extends SubCommand {
return !sendMessage(plr, C.NO_PLOT_PERMS); return !sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
final PlotWorld pWorld = PlotSquared.getWorldSettings(plot.world); final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
if (PlotSquared.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) {

View File

@ -71,7 +71,7 @@ public class Info extends SubCommand {
PlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE); PlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
return false; return false;
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(args[0]); final PlotWorld plotworld = PlotSquared.getPlotWorld(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

@ -142,7 +142,7 @@ public class Merge extends SubCommand {
return false; return false;
} }
} }
final PlotWorld plotWorld = PlotSquared.getWorldSettings(world); final PlotWorld plotWorld = PlotSquared.getPlotWorld(world);
if (PlotSquared.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;

View File

@ -41,7 +41,7 @@ public class Reload extends SubCommand {
PlotSquared.setupConfig(); PlotSquared.setupConfig();
C.setupTranslations(); C.setupTranslations();
for (final String pw : PlotSquared.getPlotWorlds()) { for (final String pw : PlotSquared.getPlotWorlds()) {
final PlotWorld plotworld = PlotSquared.getWorldSettings(pw); final PlotWorld plotworld = PlotSquared.getPlotWorld(pw);
plotworld.loadDefaultConfiguration(PlotSquared.config.getConfigurationSection("worlds." + pw)); plotworld.loadDefaultConfiguration(PlotSquared.config.getConfigurationSection("worlds." + pw));
} }
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS); MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);

View File

@ -237,7 +237,7 @@ public class Set extends SubCommand {
} }
// Get components // Get components
final World world = plr.getWorld(); final World world = plr.getWorld();
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final String[] components = manager.getPlotComponents(world, plotworld, plot.id); final String[] components = manager.getPlotComponents(world, plotworld, plot.id);
for (final String component : components) { for (final String component : components) {

View File

@ -46,7 +46,7 @@ public class Template extends SubCommand {
return false; return false;
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
final PlotWorld plotworld = PlotSquared.getWorldSettings(args[1]); final PlotWorld plotworld = PlotSquared.getPlotWorld(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

@ -90,7 +90,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) || (PlotSquared.getWorldSettings(world) == null)) { if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD); PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD);
return false; return false;
} }
@ -209,7 +209,7 @@ public class Trim extends SubCommand {
// public static void updateUnmodifiedPlots(final World world) { // public static void updateUnmodifiedPlots(final World world) {
// final SquarePlotManager manager = (SquarePlotManager) PlotSquared.getPlotManager(world); // final SquarePlotManager manager = (SquarePlotManager) PlotSquared.getPlotManager(world);
// final SquarePlotWorld plotworld = (SquarePlotWorld) PlotSquared.getWorldSettings(world); // final SquarePlotWorld plotworld = (SquarePlotWorld) PlotSquared.getPlotWorld(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...");

View File

@ -52,7 +52,7 @@ public class Unclaim extends SubCommand {
return !sendMessage(plr, C.NO_PLOT_PERMS); return !sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
final PlotWorld pWorld = PlotSquared.getWorldSettings(plot.world); final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
if (PlotSquared.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) {

View File

@ -91,7 +91,7 @@ public class Unlink extends SubCommand {
return false; return false;
} }
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
manager.startPlotUnlink(world, plotworld, ids); manager.startPlotUnlink(world, plotworld, ids);
for (final PlotId id : ids) { for (final PlotId id : ids) {
final Plot myplot = PlotSquared.getPlots(world).get(id); final Plot myplot = PlotSquared.getPlots(world).get(id);

View File

@ -80,7 +80,7 @@ public class FlagManager {
if ((settings.flags != null) && (settings.flags.size() > 0)) { if ((settings.flags != null) && (settings.flags.size() > 0)) {
flags.addAll(settings.flags); flags.addAll(settings.flags);
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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));
} }
@ -177,7 +177,7 @@ public class FlagManager {
public static Set<Flag> getSettingFlags(final String world, final PlotSettings settings) { public static Set<Flag> getSettingFlags(final String world, final PlotSettings settings) {
final Set<Flag> plotflags = settings.flags; final Set<Flag> plotflags = settings.flags;
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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)) {
final HashSet<String> flagStrings = new HashSet<>(); final HashSet<String> flagStrings = new HashSet<>();
for (final Flag flag : plotflags) { for (final Flag flag : plotflags) {

View File

@ -52,7 +52,7 @@ public class AugmentedPopulator extends BlockPopulator {
public AugmentedPopulator(final String world, final PlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) { public AugmentedPopulator(final String world, final PlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) {
this.cluster = cluster; this.cluster = cluster;
this.generator = generator; this.generator = generator;
this.plotworld = PlotSquared.getWorldSettings(world); this.plotworld = PlotSquared.getPlotWorld(world);
this.manager = generator.getPlotManager(); this.manager = generator.getPlotManager();
this.p = p; this.p = p;
this.b = b; this.b = b;

View File

@ -90,7 +90,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) PlotSquared.getWorldSettings(world); this.plotworld = (HybridPlotWorld) PlotSquared.getPlotWorld(world);
} }
this.plotsize = this.plotworld.PLOT_WIDTH; this.plotsize = this.plotworld.PLOT_WIDTH;
this.pathsize = this.plotworld.ROAD_WIDTH; this.pathsize = this.plotworld.ROAD_WIDTH;

View File

@ -60,7 +60,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final int botz = bottom.getBlockZ(); final int botz = bottom.getBlockZ();
final int topx = top.getBlockX(); final int topx = top.getBlockX();
final int topz = top.getBlockZ(); final int topz = top.getBlockZ();
final HybridPlotWorld hpw = (HybridPlotWorld) PlotSquared.getWorldSettings(world); final HybridPlotWorld hpw = (HybridPlotWorld) PlotSquared.getPlotWorld(world);
final PlotBlock[] air = new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) }; final PlotBlock[] air = new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) };
int changes = checkModified(requiredChanges, world, botx, topx, hpw.PLOT_HEIGHT, hpw.PLOT_HEIGHT, botz, topz, hpw.TOP_BLOCK); int changes = checkModified(requiredChanges, world, botx, topx, hpw.PLOT_HEIGHT, hpw.PLOT_HEIGHT, botz, topz, hpw.TOP_BLOCK);
if (changes == -1) { if (changes == -1) {
@ -111,7 +111,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final World world = Bukkit.getWorld(plot.world); final World world = Bukkit.getWorld(plot.world);
final Location bot = PlotHelper.getPlotBottomLoc(world, plot.id); final Location bot = PlotHelper.getPlotBottomLoc(world, plot.id);
final Location top = PlotHelper.getPlotTopLoc(world, plot.id); final Location top = PlotHelper.getPlotTopLoc(world, plot.id);
final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getWorldSettings(world); final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getPlotWorld(world);
final int sx = (bot.getBlockX() - plotworld.ROAD_WIDTH) + 1; final int sx = (bot.getBlockX() - plotworld.ROAD_WIDTH) + 1;
final int sz = bot.getBlockZ() + 1; final int sz = bot.getBlockZ() + 1;
final int sy = plotworld.ROAD_HEIGHT; final int sy = plotworld.ROAD_HEIGHT;
@ -217,7 +217,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final int ez = z + 15; final int ez = z + 15;
final Location bot = new Location(world, x, 0, z); final Location bot = new Location(world, x, 0, z);
final Location top = new Location(world, ex, 0, ez); final Location top = new Location(world, ex, 0, ez);
final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getWorldSettings(world); final HybridPlotWorld plotworld = (HybridPlotWorld) PlotSquared.getPlotWorld(world);
if (!plotworld.ROAD_SCHEMATIC_ENABLED) { if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
return false; return false;
} }

View File

@ -520,8 +520,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
} }
final Player player = event.getPlayer(); final Location loc = BukkitUtil.getLocation(event.getClickedBlock().getLocation());
final Location loc = event.getClickedBlock().getLocation();
if (isInPlot(loc)) { if (isInPlot(loc)) {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
@ -559,18 +558,18 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void MobSpawn(final CreatureSpawnEvent event) { public static void MobSpawn(final CreatureSpawnEvent event) {
final World world = event.getLocation().getWorld();
if (event.getEntity() instanceof Player) { if (event.getEntity() instanceof Player) {
return; return;
} }
Location loc = BukkitUtil.getLocation(event.getLocation());
final String world = loc.getWorld();
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
} }
final Location loc = event.getLocation();
if (!isPlotArea(loc)) { if (!isPlotArea(loc)) {
return; return;
} }
final PlotWorld pW = getPlotWorld(world); final PlotWorld pW = PlotSquared.getPlotWorld(world);
final CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason(); final CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
if ((reason == CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) && pW.SPAWN_EGGS) { if ((reason == CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) && pW.SPAWN_EGGS) {
event.setCancelled(true); event.setCancelled(true);

View File

@ -78,7 +78,7 @@ public class PlotListener {
} }
public static boolean isPlotArea(final Location location) { public static boolean isPlotArea(final Location location) {
final PlotWorld plotworld = PlotSquared.getWorldSettings(location.getWorld()); final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
if (plotworld.TYPE == 2) { if (plotworld.TYPE == 2) {
return ClusterManager.getCluster(location) != null; return ClusterManager.getCluster(location) != null;
} }

View File

@ -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(PlotSquared.getPlotManager(world).getSignLoc(Bukkit.getWorld(world), PlotSquared.getWorldSettings(world), PlotHelper.getPlot(Bukkit.getWorld(world), id))); // this.hologram = createHologram(PlotSquared.getPlotManager(world).getSignLoc(Bukkit.getWorld(world), PlotSquared.getPlotWorld(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) {

View File

@ -60,7 +60,7 @@ public class ClusterManager {
toReturn = PlotHelper.getPlotHome(cluster.world, center); toReturn = PlotHelper.getPlotHome(cluster.world, center);
if (toReturn.getY() == 0) { if (toReturn.getY() == 0) {
final PlotManager manager = PlotSquared.getPlotManager(cluster.world); final PlotManager manager = PlotSquared.getPlotManager(cluster.world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(cluster.world); final PlotWorld plotworld = PlotSquared.getPlotWorld(cluster.world);
final Location loc = manager.getSignLoc(plotworld, PlotHelper.getPlot(cluster.world, center)); final Location loc = manager.getSignLoc(plotworld, PlotHelper.getPlot(cluster.world, center));
toReturn.setY(loc.getY()); toReturn.setY(loc.getY());
} }
@ -82,14 +82,14 @@ public class ClusterManager {
public static Location getClusterBottom(final PlotCluster cluster) { public static Location getClusterBottom(final PlotCluster cluster) {
final String world = cluster.world; final String world = cluster.world;
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, cluster.getP1()); return manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
} }
public static Location getClusterTop(final PlotCluster cluster) { public static Location getClusterTop(final PlotCluster cluster) {
final String world = cluster.world; final String world = cluster.world;
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, cluster.getP2()); return manager.getPlotTopLocAbs(plotworld, cluster.getP2());
} }
@ -109,7 +109,7 @@ public class ClusterManager {
public static boolean contains(final PlotCluster cluster, final Location loc) { public static boolean contains(final PlotCluster cluster, final Location loc) {
final String world = loc.getWorld(); final String world = loc.getWorld();
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final Location bot = manager.getPlotBottomLocAbs(plotworld, cluster.getP1()); final Location bot = manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
final Location top = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1, 0, 1); final Location top = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1, 0, 1);
if ((bot.getX() < loc.getX()) && (bot.getZ() < loc.getZ()) && (top.getX() > loc.getX()) && (top.getZ() > loc.getZ())) { if ((bot.getX() < loc.getX()) && (bot.getZ() < loc.getZ()) && (top.getX() > loc.getX()) && (top.getZ() > loc.getZ())) {
@ -221,7 +221,7 @@ public class ClusterManager {
int xw; int xw;
int zw; int zw;
final String world = loc.getWorld(); final String world = loc.getWorld();
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
if (plotworld == null) { if (plotworld == null) {
xw = 39; xw = 39;
zw = 39; zw = 39;
@ -246,7 +246,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 = PlotSquared.getWorldSettings(cluster.world); final PlotWorld plotworld = PlotSquared.getPlotWorld(cluster.world);
final Location bot = getClusterBottom(cluster); final Location bot = getClusterBottom(cluster);
final Location top = getClusterTop(cluster); final Location top = getClusterTop(cluster);
final int minChunkX = bot.getX() >> 4; final int minChunkX = bot.getX() >> 4;

View File

@ -111,7 +111,7 @@ public class ExpireManager {
if (plot.settings.isMerged()) { if (plot.settings.isMerged()) {
Unlink.unlinkPlot(Bukkit.getWorld(world), plot); Unlink.unlinkPlot(Bukkit.getWorld(world), plot);
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
manager.clearPlot(plotworld, plot, false, null); manager.clearPlot(plotworld, plot, false, null);
PlotHelper.removeSign(plot); PlotHelper.removeSign(plot);
DBFunc.delete(world, plot); DBFunc.delete(world, plot);

View File

@ -55,14 +55,14 @@ public class PlotHelper {
public static int getBorder(final String worldname) { public static int getBorder(final String worldname) {
if (worldBorder.containsKey(worldname)) { if (worldBorder.containsKey(worldname)) {
PlotSquared.getWorldSettings(worldname); PlotSquared.getPlotWorld(worldname);
return worldBorder.get(worldname) + 16; return worldBorder.get(worldname) + 16;
} }
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
public static void setupBorder(final String world) { public static void setupBorder(final String world) {
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
if (!plotworld.WORLD_BORDER) { if (!plotworld.WORLD_BORDER) {
return; return;
} }
@ -149,7 +149,7 @@ public class PlotHelper {
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 = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
manager.startPlotMerge(plotworld, plotIds); manager.startPlotMerge(plotworld, plotIds);
final boolean result = false; final boolean result = false;
for (int x = pos1.x; x <= pos2.x; x++) { for (int x = pos1.x; x <= pos2.x; x++) {
@ -208,7 +208,7 @@ public class PlotHelper {
*/ */
public static void mergePlot(final String world, final Plot lesserPlot, final Plot greaterPlot, final boolean removeRoads) { public static void mergePlot(final String world, final Plot lesserPlot, final Plot greaterPlot, final boolean removeRoads) {
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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)) {
lesserPlot.settings.setMerged(2, true); lesserPlot.settings.setMerged(2, true);
@ -231,7 +231,7 @@ public class PlotHelper {
public static void removeSign(final Plot p) { public static void removeSign(final Plot p) {
final String world = p.world; final String world = p.world;
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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 });
} }
@ -241,7 +241,7 @@ public class PlotHelper {
name = "unknown"; name = "unknown";
} }
final PlotManager manager = PlotSquared.getPlotManager(p.world); final PlotManager manager = PlotSquared.getPlotManager(p.world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(p.world); final PlotWorld plotworld = PlotSquared.getPlotWorld(p.world);
final Location loc = manager.getSignLoc(plotworld, p); final Location loc = manager.getSignLoc(plotworld, p);
final String id = p.id.x + ";" + p.id.y; final String id = p.id.x + ";" + p.id.y;
final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.translated().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", name) }; final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.translated().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", name) };
@ -338,7 +338,7 @@ public class PlotHelper {
} }
final String world = plot.world; final String world = plot.world;
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final Location bot = manager.getPlotBottomLocAbs(plotworld, plot.id); final Location bot = manager.getPlotBottomLocAbs(plotworld, plot.id);
final Location top = manager.getPlotTopLocAbs(plotworld, plot.id); final Location top = manager.getPlotTopLocAbs(plotworld, plot.id);
final int border = worldBorder.get(plot.world); final int border = worldBorder.get(plot.world);
@ -358,7 +358,7 @@ public class PlotHelper {
updateWorldBorder(plot); updateWorldBorder(plot);
} }
final Plot p = createPlotAbs(uuid, plot); final Plot p = createPlotAbs(uuid, plot);
final PlotWorld plotworld = PlotSquared.getWorldSettings(plot.world); final PlotWorld plotworld = PlotSquared.getPlotWorld(plot.world);
if (plotworld.AUTO_MERGE) { if (plotworld.AUTO_MERGE) {
autoMerge(plot.world, p, uuid); autoMerge(plot.world, p, uuid);
} }
@ -418,7 +418,7 @@ public class PlotHelper {
state = h; state = h;
System.currentTimeMillis(); System.currentTimeMillis();
final Location location = PlotHelper.getPlotHomeDefault(plot); final Location location = PlotHelper.getPlotHomeDefault(plot);
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(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);
@ -538,7 +538,7 @@ public class PlotHelper {
final Location top = getPlotTopLoc(w, plotid); final Location top = getPlotTopLoc(w, plotid);
final int x = ((top.getX() - bot.getX()) / 2) + bot.getX(); final int x = ((top.getX() - bot.getX()) / 2) + bot.getX();
final int z = ((top.getZ() - bot.getZ()) / 2) + bot.getZ(); final int z = ((top.getZ() - bot.getZ()) / 2) + bot.getZ();
final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(PlotSquared.getWorldSettings(w), plot).getY()); final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(PlotSquared.getPlotWorld(w), plot).getY());
return new Location(w, x, y, z); return new Location(w, x, y, z);
} else { } else {
final int y = Math.max(getHeighestBlock(w, home.x, home.z), home.y); final int y = Math.max(getHeighestBlock(w, home.x, home.z), home.y);
@ -621,7 +621,7 @@ public class PlotHelper {
* @return * @return
*/ */
public static Location getPlotTopLocAbs(final String world, final PlotId id) { public static Location getPlotTopLocAbs(final String world, final PlotId id) {
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id); return manager.getPlotTopLocAbs(plotworld, id);
} }
@ -636,7 +636,7 @@ public class PlotHelper {
* @return * @return
*/ */
public static Location getPlotBottomLocAbs(final String world, final PlotId id) { public static Location getPlotBottomLocAbs(final String world, final PlotId id) {
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id); return manager.getPlotBottomLocAbs(plotworld, id);
} }
@ -667,7 +667,7 @@ public class PlotHelper {
if (plot != null) { if (plot != null) {
id = getTopPlot(world, plot).id; id = getTopPlot(world, plot).id;
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id); return manager.getPlotTopLocAbs(plotworld, id);
} }
@ -686,7 +686,7 @@ public class PlotHelper {
if (plot != null) { if (plot != null) {
id = getBottomPlot(world, plot).id; id = getBottomPlot(world, plot).id;
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id); return manager.getPlotBottomLocAbs(plotworld, id);
} }
@ -804,7 +804,7 @@ public class PlotHelper {
if (manager == null) { if (manager == null) {
return null; return null;
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
return manager.getPlotIdAbs(plotworld, loc.getX(), loc.getY(), loc.getZ()); return manager.getPlotIdAbs(plotworld, loc.getX(), loc.getY(), loc.getZ());
} }
@ -819,7 +819,7 @@ public class PlotHelper {
if (manager == null) { if (manager == null) {
return null; return null;
} }
final PlotWorld plotworld = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final PlotId id = manager.getPlotId(plotworld, loc.getX(), loc.getY(), loc.getZ()); final PlotId id = manager.getPlotId(plotworld, loc.getX(), loc.getY(), loc.getZ());
if ((id != null) && (plotworld.TYPE == 2)) { if ((id != null) && (plotworld.TYPE == 2)) {
if (ClusterManager.getCluster(world, id) == null) { if (ClusterManager.getCluster(world, id) == null) {

View File

@ -77,7 +77,7 @@ public class PlayerFunctions {
* @return * @return
*/ */
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 = PlotSquared.getWorldSettings(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
if ((PlotSquared.economy != null) && plotworld.USE_ECONOMY) { if ((PlotSquared.economy != null) && 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) {