This commit is contained in:
boy0001 2015-02-23 12:32:27 +11:00
parent 625d19b5d0
commit f2c9e4933a
210 changed files with 2119 additions and 2141 deletions

View File

@ -12,10 +12,7 @@ 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.WorldLoadEvent;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
@ -69,11 +66,6 @@ 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;
@EventHandler
public static void worldLoad(final WorldLoadEvent event) {
UUIDHandler.cacheAll(event.getWorld().getName());
}
public static boolean checkVersion(final int major, final int minor, final int minor2) { public static boolean checkVersion(final int major, final int minor, final int minor2) {
try { try {
final String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\."); final String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
@ -92,23 +84,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
} }
@EventHandler
public void PlayerCommand(final PlayerCommandPreprocessEvent event) {
final String message = event.getMessage();
if (message.toLowerCase().startsWith("/plotme")) {
final Plugin plotme = Bukkit.getPluginManager().getPlugin("PlotMe");
if (plotme == null) {
final Player player = event.getPlayer();
if (Settings.USE_PLOTME_ALIAS) {
player.performCommand(message.replace("/plotme", "plots"));
} else {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
}
event.setCancelled(true);
}
}
}
@Override @Override
public void onEnable() { public void onEnable() {
THIS = this; THIS = this;
@ -124,6 +99,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} else { } else {
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 :)");
} }
System.out.print("REGISTERING EVENTS");
getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(this, this);
} }
@ -160,7 +136,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override @Override
public void registerCommands() { public void registerCommands() {
final MainCommand command = new MainCommand(); new MainCommand();
final BukkitCommand bcmd = new BukkitCommand(); final BukkitCommand bcmd = new BukkitCommand();
final PluginCommand plotCommand = getCommand("plots"); final PluginCommand plotCommand = getCommand("plots");
plotCommand.setExecutor(bcmd); plotCommand.setExecutor(bcmd);
@ -184,6 +160,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
TaskManager.runTaskRepeat(new Runnable() { TaskManager.runTaskRepeat(new Runnable() {
long ticked = 0l; long ticked = 0l;
long error = 0l; long error = 0l;
@Override @Override
public void run() { public void run() {
if (this.ticked > 36_000L) { if (this.ticked > 36_000L) {
@ -351,32 +328,28 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override @Override
public UUIDWrapper initUUIDHandler() { public UUIDWrapper initUUIDHandler() {
boolean checkVersion = checkVersion(1, 7, 6); final boolean checkVersion = checkVersion(1, 7, 6);
if (!checkVersion) { if (!checkVersion) {
log(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); log(C.PREFIX.s() + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false; Settings.TITLES = false;
FlagManager.removeFlag(FlagManager.getFlag("titles")); FlagManager.removeFlag(FlagManager.getFlag("titles"));
} } else {
else {
AbstractTitle.TITLE_CLASS = new DefaultTitle(); AbstractTitle.TITLE_CLASS = new DefaultTitle();
} }
if (Settings.OFFLINE_MODE) { if (Settings.OFFLINE_MODE) {
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper(); UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
Settings.OFFLINE_MODE = true; Settings.OFFLINE_MODE = true;
} } else if (checkVersion) {
else if (checkVersion) {
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper(); UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
Settings.OFFLINE_MODE = false; Settings.OFFLINE_MODE = false;
} } else {
else {
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper(); UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
Settings.OFFLINE_MODE = true; Settings.OFFLINE_MODE = true;
} }
if (Settings.OFFLINE_MODE) { if (Settings.OFFLINE_MODE) {
log(C.PREFIX.s()+" &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit"); log(C.PREFIX.s() + " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit");
} } else {
else { log(C.PREFIX.s() + " &6PlotSquared is using online UUIDs");
log(C.PREFIX.s()+" &6PlotSquared is using online UUIDs");
} }
return UUIDHandler.uuidWrapper; return UUIDHandler.uuidWrapper;
} }

View File

@ -119,7 +119,7 @@ public class Auto extends SubCommand {
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + ""); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
return false; return false;
} }
int currentPlots = MainUtil.getPlayerPlotCount(world, plr); final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots); final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots);
if ((diff + (size_x * size_z)) > 0) { if ((diff + (size_x * size_z)) > 0) {
if (diff < 0) { if (diff < 0) {

View File

@ -21,7 +21,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
public class BukkitCommand implements CommandExecutor, TabCompleter { public class BukkitCommand implements CommandExecutor, TabCompleter {
@Override @Override
public boolean onCommand(CommandSender commandSender, Command command, String commandLabel, String[] args) { public boolean onCommand(final CommandSender commandSender, final Command command, final String commandLabel, final String[] args) {
if (commandSender instanceof Player) { if (commandSender instanceof Player) {
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), commandLabel, args); return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), commandLabel, args);
} }

View File

@ -47,7 +47,7 @@ public class Buy extends SubCommand {
if (PlotSquared.economy == null) { if (PlotSquared.economy == null) {
return sendMessage(plr, C.ECON_DISABLED); return sendMessage(plr, C.ECON_DISABLED);
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final String world = loc.getWorld(); final String world = loc.getWorld();
if (!PlotSquared.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
return sendMessage(plr, C.NOT_IN_PLOT_WORLD); return sendMessage(plr, C.NOT_IN_PLOT_WORLD);
@ -67,7 +67,7 @@ public class Buy extends SubCommand {
if (plot == null) { if (plot == null) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
int currentPlots = MainUtil.getPlayerPlotCount(world, plr); final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) { if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) {
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
} }
@ -91,14 +91,14 @@ public class Buy extends SubCommand {
price += plotworld.PLOT_PRICE * size; price += plotworld.PLOT_PRICE * size;
initPrice += plotworld.SELL_PRICE * size; initPrice += plotworld.SELL_PRICE * size;
} }
if (PlotSquared.economy != null && price > 0d) { if ((PlotSquared.economy != null) && (price > 0d)) {
if (EconHandler.getBalance(plr) < price) { if (EconHandler.getBalance(plr) < price) {
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price); return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price);
} }
EconHandler.withdrawPlayer(plr, price); EconHandler.withdrawPlayer(plr, price);
sendMessage(plr, C.REMOVED_BALANCE, price + ""); sendMessage(plr, C.REMOVED_BALANCE, price + "");
EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner), initPrice); EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner), initPrice);
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner); final PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
if (owner != null) { if (owner != null) {
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + ""); sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + "");
} }

View File

@ -20,8 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import net.milkbowl.vault.economy.Economy;
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.object.Location; import com.intellectualcrafters.plot.object.Location;
@ -50,16 +48,16 @@ public class Claim extends SubCommand {
return false; return false;
} }
// FIXME claim plot event // FIXME claim plot event
// final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto); // final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
// Bukkit.getPluginManager().callEvent(event); // Bukkit.getPluginManager().callEvent(event);
// boolean result = event.isCancelled(); // boolean result = event.isCancelled();
boolean result = false; final boolean result = false;
if (!result) { if (!result) {
MainUtil.createPlot(player.getUUID(), plot); MainUtil.createPlot(player.getUUID(), plot);
MainUtil.setSign(player.getName(), plot); MainUtil.setSign(player.getName(), plot);
MainUtil.sendMessage(player, C.CLAIMED); MainUtil.sendMessage(player, C.CLAIMED);
Location loc = player.getLocation(); final Location loc = player.getLocation();
if (teleport) { if (teleport) {
MainUtil.teleportPlayer(player, loc, plot); MainUtil.teleportPlayer(player, loc, plot);
} }
@ -90,12 +88,12 @@ public class Claim extends SubCommand {
if (args.length >= 1) { if (args.length >= 1) {
schematic = args[0]; schematic = args[0];
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr); final int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr);
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) { if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) {
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
} }
@ -103,7 +101,7 @@ public class Claim extends SubCommand {
return sendMessage(plr, C.PLOT_IS_CLAIMED); return sendMessage(plr, C.PLOT_IS_CLAIMED);
} }
final PlotWorld world = PlotSquared.getPlotWorld(plot.world); final PlotWorld world = PlotSquared.getPlotWorld(plot.world);
if (PlotSquared.economy != null && world.USE_ECONOMY) { if ((PlotSquared.economy != null) && world.USE_ECONOMY) {
final double cost = world.PLOT_PRICE; final double cost = world.PLOT_PRICE;
if (cost > 0d) { if (cost > 0d) {
if (EconHandler.getBalance(plr) < cost) { if (EconHandler.getBalance(plr) < cost) {

View File

@ -62,12 +62,12 @@ public class Clear extends SubCommand {
} }
return true; return true;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot( plot))) { if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
return sendMessage(plr, C.UNLINK_REQUIRED); return sendMessage(plr, C.UNLINK_REQUIRED);
} }
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
@ -75,7 +75,7 @@ public class Clear extends SubCommand {
} }
assert plot != null; assert plot != null;
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() { final boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() {
@Override @Override
public void run() { public void run() {
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start)); MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));

View File

@ -307,7 +307,7 @@ public class Cluster extends SubCommand {
cluster.invited.add(uuid); cluster.invited.add(uuid);
final String world = plr.getLocation().getWorld(); final String world = plr.getLocation().getWorld();
DBFunc.setInvited(world, cluster, uuid); DBFunc.setInvited(world, cluster, uuid);
PlotPlayer player = UUIDHandler.getPlayer(uuid); final PlotPlayer player = UUIDHandler.getPlayer(uuid);
if (player != null) { if (player != null) {
MainUtil.sendMessage(player, C.CLUSTER_INVITED, cluster.getName()); MainUtil.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
} }
@ -354,7 +354,7 @@ public class Cluster extends SubCommand {
} }
cluster.invited.remove(uuid); cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid); DBFunc.removeInvited(cluster, uuid);
PlotPlayer player = UUIDHandler.getPlayer(uuid); final PlotPlayer player = UUIDHandler.getPlayer(uuid);
if (player != null) { if (player != null) {
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName()); MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
} }

View File

@ -41,8 +41,8 @@ public class Comment extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }

View File

@ -36,8 +36,8 @@ public class CreateRoadSchematic extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer player, final String... args) { public boolean execute(final PlotPlayer player, final String... args) {
Location loc = player.getLocation(); final Location loc = player.getLocation();
Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT); return sendMessage(player, C.NOT_IN_PLOT);
} }

View File

@ -55,7 +55,7 @@ public class DebugClaimTest extends SubCommand {
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic) { public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic) {
// FIXME call claim event // FIXME call claim event
// boolean result = event result // boolean result = event result
boolean result = true; final boolean result = true;
if (!result) { if (!result) {
MainUtil.createPlot(player.getUUID(), plot); MainUtil.createPlot(player.getUUID(), plot);
@ -74,7 +74,7 @@ public class DebugClaimTest extends SubCommand {
if (args.length < 3) { if (args.length < 3) {
return !MainUtil.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}"); return !MainUtil.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
} }
String world = args[0]; final String world = args[0];
if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) { if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) {
return !MainUtil.sendMessage(null, "&cInvalid plot world!"); return !MainUtil.sendMessage(null, "&cInvalid plot world!");
} }
@ -100,12 +100,12 @@ public class DebugClaimTest extends SubCommand {
continue; continue;
} }
final Location loc = manager.getSignLoc(plotworld, plot); final Location loc = manager.getSignLoc(plotworld, plot);
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
boolean result = AChunkManager.manager.loadChunk(world, chunk); final boolean result = AChunkManager.manager.loadChunk(world, chunk);
if (!result) { if (!result) {
continue; continue;
} }
String[] lines = BlockManager.manager.getSign(loc); final String[] lines = BlockManager.manager.getSign(loc);
if (lines != null) { if (lines != null) {
String line = lines[2]; String line = lines[2];
if ((line != null) && (line.length() > 2)) { if ((line != null) && (line.length() > 2)) {

View File

@ -27,9 +27,9 @@ import com.intellectualcrafters.plot.object.Location;
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.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.AChunkManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class DebugClear extends SubCommand { public class DebugClear extends SubCommand {
@ -63,7 +63,7 @@ public class DebugClear extends SubCommand {
return false; return false;
} }
MainUtil.runners.put(plot, 1); MainUtil.runners.put(plot, 1);
ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() { AChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
@Override @Override
public void run() { public void run() {
MainUtil.runners.remove(plot); MainUtil.runners.remove(plot);
@ -77,9 +77,9 @@ public class DebugClear extends SubCommand {
} }
return true; return true;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null || !(PlotSquared.getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) { if ((plot == null) || !(PlotSquared.getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) { if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
@ -96,7 +96,7 @@ public class DebugClear extends SubCommand {
return false; return false;
} }
MainUtil.runners.put(plot, 1); MainUtil.runners.put(plot, 1);
ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() { AChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
@Override @Override
public void run() { public void run() {
MainUtil.runners.remove(plot); MainUtil.runners.remove(plot);

View File

@ -111,8 +111,8 @@ public class DebugExec extends SubCommand {
if (uuid == null) { if (uuid == null) {
return MainUtil.sendMessage(null, "player not found: " + args[1]); return MainUtil.sendMessage(null, "player not found: " + args[1]);
} }
BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid); final BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
if ((op == null) || op.getLastPlayed() == 0) { if ((op == null) || (op.getLastPlayed() == 0)) {
return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]); return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]);
} }
final Timestamp stamp = new Timestamp(op.getLastPlayed()); final Timestamp stamp = new Timestamp(op.getLastPlayed());

View File

@ -36,13 +36,13 @@ public class DebugRoadRegen extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer player, final String... args) { public boolean execute(final PlotPlayer player, final String... args) {
Location loc = player.getLocation(); final Location loc = player.getLocation();
String world = loc.getWorld(); final String world = loc.getWorld();
if (!(PlotSquared.getPlotWorld(world) instanceof HybridPlotWorld)) { if (!(PlotSquared.getPlotWorld(world) instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD); return sendMessage(player, C.NOT_IN_PLOT_WORLD);
} }
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
boolean result = HybridUtils.manager.regenerateRoad(world, chunk); final boolean result = HybridUtils.manager.regenerateRoad(world, chunk);
if (result) { if (result) {
MainUtil.update(loc); MainUtil.update(loc);
} }

View File

@ -39,7 +39,7 @@ public class Delete extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
@ -52,7 +52,7 @@ public class Delete extends SubCommand {
} }
assert plot != null; assert plot != null;
final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world); final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
if (PlotSquared.economy != null && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) { if ((PlotSquared.economy != null) && 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) {
EconHandler.depositPlayer(plr, c); EconHandler.depositPlayer(plr, c);
@ -66,7 +66,7 @@ public class Delete extends SubCommand {
final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true); final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true);
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
if (result) { if (result) {
boolean result2 = MainUtil.clearAsPlayer(plot, true, new Runnable() { final boolean result2 = MainUtil.clearAsPlayer(plot, true, new Runnable() {
@Override @Override
public void run() { public void run() {
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start)); MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));

View File

@ -43,7 +43,7 @@ public class Denied extends SubCommand {
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
return true; return true;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -57,7 +57,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>"); MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
return false; return false;
} }
Location loc = player.getLocation(); final Location loc = player.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT); MainUtil.sendMessage(player, C.NOT_IN_PLOT);

View File

@ -42,7 +42,7 @@ public class Helpers extends SubCommand {
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
return true; return true;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -49,9 +49,9 @@ public class Inbox extends SubCommand {
report = true; report = true;
} }
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null && !report) { if ((plot == null) && !report) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
} }
if ((plot != null) && !plot.hasOwner()) { if ((plot != null) && !plot.hasOwner()) {

View File

@ -53,7 +53,7 @@ public class Info extends SubCommand {
Plot plot; Plot plot;
String world; String world;
if (player != null) { if (player != null) {
Location loc = player.getLocation(); final Location loc = player.getLocation();
world = loc.getWorld(); world = loc.getWorld();
if (!PlotSquared.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);

View File

@ -37,7 +37,7 @@ public class Kick extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
@ -50,7 +50,7 @@ public class Kick extends SubCommand {
MainUtil.sendMessage(plr, "&c/plot kick <player>"); MainUtil.sendMessage(plr, "&c/plot kick <player>");
return false; return false;
} }
PlotPlayer player = UUIDHandler.getPlayer(args[0]); final PlotPlayer player = UUIDHandler.getPlayer(args[0]);
if (player == null) { if (player == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false; return false;

View File

@ -22,8 +22,6 @@ package com.intellectualcrafters.plot.commands;
import java.util.ArrayList; import java.util.ArrayList;
import net.milkbowl.vault.economy.Economy;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.PlotSquared;
@ -73,7 +71,7 @@ public class Merge extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
@ -107,7 +105,7 @@ public class Merge extends SubCommand {
PlotId bot = MainUtil.getBottomPlot(plot).id; PlotId bot = MainUtil.getBottomPlot(plot).id;
PlotId top = MainUtil.getTopPlot(plot).id; PlotId top = MainUtil.getTopPlot(plot).id;
ArrayList<PlotId> plots; ArrayList<PlotId> plots;
String world = plr.getLocation().getWorld(); final String world = plr.getLocation().getWorld();
switch (direction) { switch (direction) {
case 0: // north = -y case 0: // north = -y
plots = MainUtil.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); plots = MainUtil.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
@ -141,11 +139,10 @@ public class Merge extends SubCommand {
} }
} }
final PlotWorld plotWorld = PlotSquared.getPlotWorld(world); final PlotWorld plotWorld = PlotSquared.getPlotWorld(world);
if (PlotSquared.economy != null && plotWorld.USE_ECONOMY) { if ((PlotSquared.economy != null) && 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 = PlotSquared.economy;
if (EconHandler.getBalance(plr) < cost) { if (EconHandler.getBalance(plr) < cost) {
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + ""); sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
return false; return false;
@ -156,7 +153,7 @@ public class Merge extends SubCommand {
} }
//FIXME PlotMergeEvent //FIXME PlotMergeEvent
// boolean result = event.isCancelled(); // boolean result = event.isCancelled();
boolean result = false; final boolean result = false;
if (result) { if (result) {
MainUtil.sendMessage(plr, "&cMerge has been cancelled"); MainUtil.sendMessage(plr, "&cMerge has been cancelled");
return false; return false;

View File

@ -42,7 +42,7 @@ public class MusicSubcommand extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer player, final String... args) { public boolean execute(final PlotPlayer player, final String... args) {
Location loc = player.getLocation(); final Location loc = player.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);

View File

@ -43,7 +43,7 @@ public class Rate extends SubCommand {
sendMessage(plr, C.RATING_NOT_VALID); sendMessage(plr, C.RATING_NOT_VALID);
return true; return true;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -75,7 +75,7 @@ public class Schematic extends SubCommand {
break; break;
} }
final Location loc = plr.getLocation(); final Location loc = plr.getLocation();
Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
sendMessage(plr, C.NOT_IN_PLOT); sendMessage(plr, C.NOT_IN_PLOT);
break; break;
@ -163,7 +163,7 @@ public class Schematic extends SubCommand {
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent"); sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
break; break;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final int l1 = schematic.getSchematicDimension().getX(); final int l1 = schematic.getSchematicDimension().getX();
final int l2 = schematic.getSchematicDimension().getZ(); final int l2 = schematic.getSchematicDimension().getZ();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
@ -236,8 +236,7 @@ public class Schematic extends SubCommand {
break; break;
} }
case "export": case "export":
case "save": case "save": {
{
if (!Permissions.hasPermission(plr, "plots.schematic.save")) { if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
return false; return false;
@ -249,7 +248,7 @@ public class Schematic extends SubCommand {
final String world; final String world;
final Plot p2; final Plot p2;
if (plr != null) { if (plr != null) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -59,7 +59,7 @@ public class Set extends SubCommand {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
@ -90,7 +90,7 @@ 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"); final String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message)); MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
return false; return false;
} }

View File

@ -50,7 +50,7 @@ public class SetOwner extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if ((plot == null) || (plot.owner == null)) { if ((plot == null) || (plot.owner == null)) {
MainUtil.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
@ -66,7 +66,7 @@ public class SetOwner extends SubCommand {
} }
final String world = loc.getWorld(); final String world = loc.getWorld();
final PlotId bot = MainUtil.getBottomPlot(plot).id; final PlotId bot = MainUtil.getBottomPlot(plot).id;
final PlotId top = MainUtil.getTopPlot( plot).id; final PlotId top = MainUtil.getTopPlot(plot).id;
final ArrayList<PlotId> plots = MainUtil.getPlotSelectionIds(bot, top); final ArrayList<PlotId> plots = MainUtil.getPlotSelectionIds(bot, top);
for (final PlotId id : plots) { for (final PlotId id : plots) {
final Plot current = PlotSquared.getPlots(world).get(id); final Plot current = PlotSquared.getPlots(world).get(id);

View File

@ -180,5 +180,4 @@ public class Setup extends SubCommand {
return false; return false;
} }
} }

View File

@ -49,7 +49,7 @@ public class Swap extends SubCommand {
MainUtil.sendMessage(plr, C.SWAP_SYNTAX); MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
return false; return false;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -48,8 +48,8 @@ public class TP extends SubCommand {
} }
final String id = args[0]; final String id = args[0];
PlotId plotid; PlotId plotid;
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
String pworld = loc.getWorld(); final String pworld = loc.getWorld();
String world = pworld; String world = pworld;
if (args.length == 2) { if (args.length == 2) {
if (BlockManager.manager.isWorld(args[1])) { if (BlockManager.manager.isWorld(args[1])) {

View File

@ -34,7 +34,7 @@ public class Target extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location ploc = plr.getLocation(); final Location ploc = plr.getLocation();
if (!PlotSquared.isPlotWorld(ploc.getWorld())) { if (!PlotSquared.isPlotWorld(ploc.getWorld())) {
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD); MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false; return false;

View File

@ -43,7 +43,7 @@ public class Template extends SubCommand {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
return false; return false;
} }
String world = args[1]; final String world = args[1];
final PlotWorld plotworld = PlotSquared.getPlotWorld(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
if (!BlockManager.manager.isWorld(world) || (plotworld == null)) { if (!BlockManager.manager.isWorld(world) || (plotworld == null)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);

View File

@ -39,7 +39,6 @@ import com.intellectualcrafters.plot.util.AChunkManager;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
public class Trim extends SubCommand { public class Trim extends SubCommand {
public static boolean TASK = false; public static boolean TASK = false;
@ -165,7 +164,7 @@ public class Trim extends SubCommand {
if (Trim.TASK) { if (Trim.TASK) {
return false; return false;
} }
final long startOld = System.currentTimeMillis(); System.currentTimeMillis();
sendMessage("Collecting region data..."); sendMessage("Collecting region data...");
final ArrayList<Plot> plots = new ArrayList<>(); final ArrayList<Plot> plots = new ArrayList<>();
plots.addAll(PlotSquared.getPlots(world).values()); plots.addAll(PlotSquared.getPlots(world).values());
@ -191,10 +190,10 @@ public class Trim extends SubCommand {
final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id); final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
final Location pos3 = new Location(world, pos1.getX(), 64, pos2.getZ()); final Location pos3 = new Location(world, pos1.getX(), 64, pos2.getZ());
final Location pos4 = new Location(world, pos2.getX(), 64, pos1.getZ()); final Location pos4 = new Location(world, pos2.getX(), 64, pos1.getZ());
chunks.remove(ChunkManager.getChunkChunk(pos1)); chunks.remove(AChunkManager.getChunkChunk(pos1));
chunks.remove(ChunkManager.getChunkChunk(pos2)); chunks.remove(AChunkManager.getChunkChunk(pos2));
chunks.remove(ChunkManager.getChunkChunk(pos3)); chunks.remove(AChunkManager.getChunkChunk(pos3));
chunks.remove(ChunkManager.getChunkChunk(pos4)); chunks.remove(AChunkManager.getChunkChunk(pos4));
} }
} }
}, 20); }, 20);

View File

@ -43,7 +43,7 @@ public class Trusted extends SubCommand {
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
return true; return true;
} }
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -20,8 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import net.milkbowl.vault.economy.Economy;
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.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
@ -41,7 +39,7 @@ public class Unclaim extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
@ -54,10 +52,9 @@ public class Unclaim extends SubCommand {
} }
assert plot != null; assert plot != null;
final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world); final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
if (PlotSquared.economy != null && pWorld.USE_ECONOMY) { if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY) {
final double c = pWorld.SELL_PRICE; final double c = pWorld.SELL_PRICE;
if (c > 0d) { if (c > 0d) {
final Economy economy = PlotSquared.economy;
EconHandler.depositPlayer(plr, c); EconHandler.depositPlayer(plr, c);
sendMessage(plr, C.ADDED_BALANCE, c + ""); sendMessage(plr, C.ADDED_BALANCE, c + "");
} }

View File

@ -47,7 +47,7 @@ public class Unlink extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
@ -68,7 +68,7 @@ public class Unlink extends SubCommand {
} }
public static boolean unlinkPlot(final Plot plot) { public static boolean unlinkPlot(final Plot plot) {
String world = plot.world; final String world = plot.world;
final PlotId pos1 = MainUtil.getBottomPlot(plot).id; final PlotId pos1 = MainUtil.getBottomPlot(plot).id;
final PlotId pos2 = MainUtil.getTopPlot(plot).id; final PlotId pos2 = MainUtil.getTopPlot(plot).id;
final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2); final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2);

View File

@ -106,7 +106,7 @@ public class Configuration {
@Override @Override
public boolean validateValue(final String string) { public boolean validateValue(final String string) {
try { try {
int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase()); final int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase());
if (biome == -1) { if (biome == -1) {
return false; return false;
} }

View File

@ -38,8 +38,8 @@ public class AugmentedPopulator extends BlockPopulator {
private final int tx; private final int tx;
private final int tz; private final int tz;
public static void removePopulator(String worldname, PlotCluster cluster) { public static void removePopulator(final String worldname, final PlotCluster cluster) {
World world = Bukkit.getWorld(worldname); final World world = Bukkit.getWorld(worldname);
for (final Iterator<BlockPopulator> iterator = world.getPopulators().iterator(); iterator.hasNext();) { for (final Iterator<BlockPopulator> iterator = world.getPopulators().iterator(); iterator.hasNext();) {
final BlockPopulator populator = iterator.next(); final BlockPopulator populator = iterator.next();
if (populator instanceof AugmentedPopulator) { if (populator instanceof AugmentedPopulator) {
@ -153,7 +153,7 @@ public class AugmentedPopulator extends BlockPopulator {
} }
private void populateBiome(final World world, final int x, final int z) { private void populateBiome(final World world, final int x, final int z) {
Biome biome = Biome.valueOf(this.plotworld.PLOT_BIOME); final Biome biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
if (this.b) { if (this.b) {
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) { for (int j = 0; j < 16; j++) {

View File

@ -21,8 +21,8 @@ import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
public class BukkitHybridUtils extends HybridUtils { public class BukkitHybridUtils extends HybridUtils {
@Override @Override
public int checkModified(int threshhold, String worldname, int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock[] blocks) { public int checkModified(final int threshhold, final String worldname, final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks) {
World world = BukkitUtil.getWorld(worldname); final World world = BukkitUtil.getWorld(worldname);
int count = 0; int count = 0;
for (int y = y1; y <= y2; y++) { for (int y = y1; y <= y2; y++) {
for (int x = x1; x <= x2; x++) { for (int x = x1; x <= x2; x++) {
@ -49,9 +49,9 @@ public class BukkitHybridUtils extends HybridUtils {
} }
@Override @Override
public int get_ey(String worldname, int sx, int ex, int sz, int ez, int sy) { public int get_ey(final String worldname, final int sx, final int ex, final int sz, final int ez, final int sy) {
World world = BukkitUtil.getWorld(worldname); final World world = BukkitUtil.getWorld(worldname);
int maxY = world.getMaxHeight(); final int maxY = world.getMaxHeight();
int ey = sy; int ey = sy;
for (int x = sx; x <= ex; x++) { for (int x = sx; x <= ex; x++) {
for (int z = sz; z <= ez; z++) { for (int z = sz; z <= ez; z++) {
@ -69,8 +69,8 @@ public class BukkitHybridUtils extends HybridUtils {
} }
@Override @Override
public void regenerateChunkChunk(String worldname, ChunkLoc loc) { public void regenerateChunkChunk(final String worldname, final ChunkLoc loc) {
World world = BukkitUtil.getWorld(worldname); final World world = BukkitUtil.getWorld(worldname);
final int sx = loc.x << 5; final int sx = loc.x << 5;
final int sz = loc.z << 5; final int sz = loc.z << 5;
for (int x = sx; x < (sx + 32); x++) { for (int x = sx; x < (sx + 32); x++) {
@ -84,7 +84,7 @@ public class BukkitHybridUtils extends HybridUtils {
for (int z = sz; z < (sz + 32); z++) { for (int z = sz; z < (sz + 32); z++) {
final Chunk chunk = world.getChunkAt(x, z); final Chunk chunk = world.getChunkAt(x, z);
chunks2.add(chunk); chunks2.add(chunk);
regenerateRoad(worldname, new ChunkLoc(x,z)); regenerateRoad(worldname, new ChunkLoc(x, z));
} }
} }
SetBlockManager.setBlockManager.update(chunks2); SetBlockManager.setBlockManager.update(chunks2);
@ -99,7 +99,7 @@ public class BukkitHybridUtils extends HybridUtils {
return false; return false;
} }
final List<ChunkLoc> chunks = AChunkManager.manager.getChunkChunks(world); final List<ChunkLoc> chunks = AChunkManager.manager.getChunkChunks(world);
final Plugin plugin = (Plugin) BukkitMain.THIS; final Plugin plugin = BukkitMain.THIS;
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -52,8 +52,8 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1); final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
int x, z; int x, z;
z = bottom.getZ(); z = bottom.getZ();
int length = top.getX() - bottom.getX(); final int length = top.getX() - bottom.getX();
int size = (length) * 4 * (dpw.WALL_HEIGHT); final int size = (length) * 4 * (dpw.WALL_HEIGHT);
final int[] xl = new int[size]; final int[] xl = new int[size];
final int[] yl = new int[size]; final int[] yl = new int[size];
final int[] zl = new int[size]; final int[] zl = new int[size];
@ -108,9 +108,9 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
return false; return false;
} }
final Location bottom = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid); final Location bottom = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid);
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1,0,1); final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
int length = top.getX() - bottom.getX(); final int length = top.getX() - bottom.getX();
int size = (length) * 4; final int size = (length) * 4;
final int[] xl = new int[size]; final int[] xl = new int[size];
final int[] yl = new int[size]; final int[] yl = new int[size];
final int[] zl = new int[size]; final int[] zl = new int[size];
@ -118,7 +118,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
int x, z; int x, z;
z = bottom.getZ(); z = bottom.getZ();
int i = 0; int i = 0;
int y = dpw.WALL_HEIGHT + 1; final int y = dpw.WALL_HEIGHT + 1;
for (x = bottom.getX(); x <= (top.getX() - 1); x++) { for (x = bottom.getX(); x <= (top.getX() - 1); x++) {
xl[i] = x; xl[i] = x;
zl[i] = z; zl[i] = z;
@ -258,7 +258,6 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
*/ */
@Override @Override
public boolean finishPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) { public boolean finishPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) {
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
final PlotId pos1 = plotIds.get(0); final PlotId pos1 = plotIds.get(0);
final PlotBlock block = ((ClassicPlotWorld) plotworld).WALL_BLOCK; final PlotBlock block = ((ClassicPlotWorld) plotworld).WALL_BLOCK;
if (block.id != 0) { if (block.id != 0) {

View File

@ -116,7 +116,7 @@ public class HybridPop extends BlockPopulator {
} }
this.X = cx << 4; this.X = cx << 4;
this.Z = cz << 4; this.Z = cz << 4;
final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(w.getName()); PlotSquared.getPlotManager(w.getName());
final RegionWrapper plot = AChunkManager.CURRENT_PLOT_CLEAR; final RegionWrapper plot = AChunkManager.CURRENT_PLOT_CLEAR;
if (plot != null) { if (plot != null) {
short sx = (short) ((this.X) % this.size); short sx = (short) ((this.X) % this.size);

View File

@ -88,7 +88,7 @@ public abstract class HybridUtils {
public abstract boolean scheduleRoadUpdate(final String world); public abstract boolean scheduleRoadUpdate(final String world);
public boolean regenerateRoad(String world, final ChunkLoc chunk) { public boolean regenerateRoad(final String world, final ChunkLoc chunk) {
final int x = chunk.x << 4; final int x = chunk.x << 4;
final int z = chunk.z << 4; final int z = chunk.z << 4;
final int ex = x + 15; final int ex = x + 15;
@ -97,7 +97,7 @@ public abstract class HybridUtils {
if (!plotworld.ROAD_SCHEMATIC_ENABLED) { if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
return false; return false;
} }
PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotId id1 = manager.getPlotId(plotworld, x, 0, z); final PlotId id1 = manager.getPlotId(plotworld, x, 0, z);
final PlotId id2 = manager.getPlotId(plotworld, ex, 0, ez); final PlotId id2 = manager.getPlotId(plotworld, ex, 0, ez);
boolean toCheck = false; boolean toCheck = false;

View File

@ -32,7 +32,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
} }
@Override @Override
public PlotId getPlotIdAbs(final PlotWorld plotworld, int x, int y, int z) { public PlotId getPlotIdAbs(final PlotWorld plotworld, int x, final int y, int z) {
final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld); final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld);
// get plot size // get plot size
final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH; final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH;
@ -70,7 +70,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
} }
@Override @Override
public PlotId getPlotId(final PlotWorld plotworld, int x, int y, int z) { public PlotId getPlotId(final PlotWorld plotworld, int x, final int y, int z) {
final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld); final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld);
if (plotworld == null) { if (plotworld == null) {
return null; return null;
@ -99,7 +99,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
final boolean eastWest = (rx <= pathWidthLower) || (rx > end); final boolean eastWest = (rx <= pathWidthLower) || (rx > end);
if (northSouth && eastWest) { if (northSouth && eastWest) {
// This means you are in the intersection // This means you are in the intersection
Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, y, z + dpw.ROAD_WIDTH); final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, y, z + dpw.ROAD_WIDTH);
final PlotId id = MainUtil.getPlotAbs(loc); final PlotId id = MainUtil.getPlotAbs(loc);
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id); final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
if (plot == null) { if (plot == null) {
@ -112,7 +112,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
} }
if (northSouth) { if (northSouth) {
// You are on a road running West to East (yeah, I named the var poorly) // You are on a road running West to East (yeah, I named the var poorly)
Location loc = new Location(plotworld.worldname, x, y, z + dpw.ROAD_WIDTH); final Location loc = new Location(plotworld.worldname, x, y, z + dpw.ROAD_WIDTH);
final PlotId id = MainUtil.getPlotAbs(loc); final PlotId id = MainUtil.getPlotAbs(loc);
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id); final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
if (plot == null) { if (plot == null) {
@ -125,7 +125,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
Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, y, z); final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, y, z);
final PlotId id = MainUtil.getPlotAbs(loc); final PlotId id = MainUtil.getPlotAbs(loc);
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id); final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
if (plot == null) { if (plot == null) {
@ -166,10 +166,10 @@ public abstract class SquarePlotManager extends GridPlotManager {
final int topX = MainUtil.getPlotTopLoc(plot.world, plot.id).getX() + 1; final int topX = MainUtil.getPlotTopLoc(plot.world, plot.id).getX() + 1;
final int bottomZ = MainUtil.getPlotBottomLoc(plot.world, plot.id).getZ() - 1; final int bottomZ = MainUtil.getPlotBottomLoc(plot.world, plot.id).getZ() - 1;
final int topZ = MainUtil.getPlotTopLoc(plot.world, plot.id).getZ() + 1; final int topZ = MainUtil.getPlotTopLoc(plot.world, plot.id).getZ() + 1;
int size = (topX - bottomX + 1) * (topZ - bottomZ + 1); final int size = ((topX - bottomX) + 1) * ((topZ - bottomZ) + 1);
int[] xb = new int[size]; final int[] xb = new int[size];
int[] zb = new int[size]; final int[] zb = new int[size];
int[] biomes = new int[size]; final int[] biomes = new int[size];
int index = 0; int index = 0;
for (int x = bottomX; x <= topX; x++) { for (int x = bottomX; x <= topX; x++) {
for (int z = bottomZ; z <= topZ; z++) { for (int z = bottomZ; z <= topZ; z++) {

View File

@ -51,7 +51,7 @@ public class ForceFieldListener implements Listener {
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !BukkitPlayerFunctions.isInPlot(oPlayer) || !BukkitPlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) { if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !BukkitPlayerFunctions.isInPlot(oPlayer) || !BukkitPlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
continue; continue;
} }
UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer)); final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer));
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
players.add(oPlayer); players.add(oPlayer);
} }
@ -65,7 +65,7 @@ public class ForceFieldListener implements Listener {
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !BukkitPlayerFunctions.isInPlot(oPlayer) || !BukkitPlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) { if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !BukkitPlayerFunctions.isInPlot(oPlayer) || !BukkitPlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
continue; continue;
} }
UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer)); final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer));
if (plot.isAdded(uuid)) { if (plot.isAdded(uuid)) {
return oPlayer; return oPlayer;
} }
@ -99,15 +99,15 @@ public class ForceFieldListener implements Listener {
@EventHandler @EventHandler
public void onPlotEntry(final PlayerMoveEvent event) { public void onPlotEntry(final PlayerMoveEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
Location loc = pp.getLocation(); final Location loc = pp.getLocation();
Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return; return;
} }
if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) { if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) {
if (!PlotListener.booleanFlag(plot, "forcefield", false)) { if (!PlotListener.booleanFlag(plot, "forcefield", false)) {
UUID uuid = pp.getUUID(); final UUID uuid = pp.getUUID();
if (plot.isAdded(uuid)) { if (plot.isAdded(uuid)) {
final Set<Player> players = getNearbyPlayers(player, plot); final Set<Player> players = getNearbyPlayers(player, plot);
for (final Player oPlayer : players) { for (final Player oPlayer : players) {

View File

@ -71,6 +71,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerEggThrowEvent; import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -82,7 +83,9 @@ import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.event.world.ChunkLoadEvent; 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 org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -125,6 +128,28 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler
public void worldLoad(final WorldLoadEvent event) {
UUIDHandler.cacheAll(event.getWorld().getName());
}
@EventHandler
public void PlayerCommand(final PlayerCommandPreprocessEvent event) {
final String message = event.getMessage();
if (message.toLowerCase().startsWith("/plotme")) {
final Plugin plotme = Bukkit.getPluginManager().getPlugin("PlotMe");
if (plotme == null) {
final Player player = event.getPlayer();
if (Settings.USE_PLOTME_ALIAS) {
player.performCommand(message.replace("/plotme", "plots"));
} else {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
}
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void onChunkLoad(final ChunkLoadEvent event) { public static void onChunkLoad(final ChunkLoadEvent event) {
final String worldname = event.getWorld().getName(); final String worldname = event.getWorld().getName();
@ -145,7 +170,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!player.hasPlayedBefore()) { if (!player.hasPlayedBefore()) {
player.saveData(); player.saveData();
} }
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
final String username = pp.getName(); final String username = pp.getName();
final StringWrapper name = new StringWrapper(username); final StringWrapper name = new StringWrapper(username);
final UUID uuid = pp.getUUID(); final UUID uuid = pp.getUUID();
@ -190,7 +215,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
passed = false; passed = false;
} }
if (passed) { if (passed) {
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
return; return;
} }
@ -198,7 +223,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Plot plot = getCurrentPlot(t); Plot plot = getCurrentPlot(t);
if (plot != null) { if (plot != null) {
if (plot.denied.size() > 0) { if (plot.denied.size() > 0) {
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (plot.isDenied(pp.getUUID())) { if (plot.isDenied(pp.getUUID())) {
if (!Permissions.hasPermission(pp, "plots.admin.entry.denied")) { if (!Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied");
@ -264,7 +289,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) { if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) {
return; return;
} }
@ -272,7 +297,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (!plot.isAdded(pp.getUUID())) { if (!plot.isAdded(pp.getUUID())) {
final Flag destroy = FlagManager.getPlotFlag(plot, "break"); final Flag destroy = FlagManager.getPlotFlag(plot, "break");
final Block block = event.getBlock(); final Block block = event.getBlock();
@ -288,7 +313,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
return; return;
} }
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) { if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) {
return; return;
} }
@ -324,7 +349,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} else { } else {
final Iterator<Block> iter = event.blockList().iterator(); final Iterator<Block> iter = event.blockList().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
final Block b = iter.next(); iter.next();
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
iter.remove(); iter.remove();
} }
@ -334,7 +359,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public static void onWorldChanged(final PlayerChangedWorldEvent event) { public static void onWorldChanged(final PlayerChangedWorldEvent event) {
PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer()); final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer());
((BukkitPlayer) player).hasPerm = null; ((BukkitPlayer) player).hasPerm = null;
((BukkitPlayer) player).noPerm = null; ((BukkitPlayer) player).noPerm = null;
} }
@ -356,7 +381,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Player p = (Player) e; final Player p = (Player) e;
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
event.setCancelled(true); event.setCancelled(true);
@ -365,14 +390,14 @@ 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()) {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
} else { } else {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!plot.isAdded(pp.getUUID())) { if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) { if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
@ -482,7 +507,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
public static void onBlockPistonExtend(final BlockPistonExtendEvent e) { public static void onBlockPistonExtend(final BlockPistonExtendEvent e) {
if (isInPlot(BukkitUtil.getLocation(e.getBlock().getLocation()))) { if (isInPlot(BukkitUtil.getLocation(e.getBlock().getLocation()))) {
for (final Block block : e.getBlocks()) { for (final Block block : e.getBlocks()) {
Plot plot = getCurrentPlot(BukkitUtil.getLocation(block.getLocation())); final Plot plot = getCurrentPlot(BukkitUtil.getLocation(block.getLocation()));
if (plot != null) { if (plot != null) {
if (isPlotArea(BukkitUtil.getLocation(e.getBlock().getLocation()))) { if (isPlotArea(BukkitUtil.getLocation(e.getBlock().getLocation()))) {
e.setCancelled(true); e.setCancelled(true);
@ -511,11 +536,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
final List<BlockState> blocks = e.getBlocks(); final List<BlockState> blocks = e.getBlocks();
boolean remove = false;
for (int i = blocks.size() - 1; i >= 0; i--) { for (int i = blocks.size() - 1; i >= 0; i--) {
final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation()); final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (plot == null || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
e.getBlocks().remove(i); e.getBlocks().remove(i);
} }
} }
@ -539,7 +563,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()) {
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { if (Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
return; return;
} }
@ -551,7 +575,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;
} }
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (!plot.isAdded(pp.getUUID())) { if (!plot.isAdded(pp.getUUID())) {
if (Permissions.hasPermission(pp, "plots.admin.interact.other")) { if (Permissions.hasPermission(pp, "plots.admin.interact.other")) {
return; return;
@ -562,7 +586,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
return; return;
} }
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(pp, "plots.admin.interact.road")) { if (Permissions.hasPermission(pp, "plots.admin.interact.road")) {
return; return;
} }
@ -578,7 +602,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (event.getEntity() instanceof Player) { if (event.getEntity() instanceof Player) {
return; return;
} }
Location loc = BukkitUtil.getLocation(event.getLocation()); final Location loc = BukkitUtil.getLocation(event.getLocation());
final String world = loc.getWorld(); final String world = loc.getWorld();
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
@ -602,28 +626,24 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public static void onBlockIgnite(final BlockIgniteEvent e) { public static void onBlockIgnite(final BlockIgniteEvent e) {
Player player = e.getPlayer(); final Player player = e.getPlayer();
final Block b = e.getBlock(); final Block b = e.getBlock();
final Location loc; final Location loc;
if (b != null) { if (b != null) {
loc = BukkitUtil.getLocation(b.getLocation()); loc = BukkitUtil.getLocation(b.getLocation());
} } else {
else { final Entity ent = e.getIgnitingEntity();
Entity ent = e.getIgnitingEntity();
if (ent != null) { if (ent != null) {
loc = BukkitUtil.getLocation(ent); loc = BukkitUtil.getLocation(ent);
} } else {
else {
if (player != null) { if (player != null) {
loc = BukkitUtil.getLocation(player); loc = BukkitUtil.getLocation(player);
} } else {
else {
return; return;
} }
} }
} }
final String world; final String world;
if (e.getBlock() != null) { if (e.getBlock() != null) {
world = e.getBlock().getWorld().getName(); world = e.getBlock().getWorld().getName();
@ -649,7 +669,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
final Player p = e.getPlayer(); final Player p = e.getPlayer();
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
e.setCancelled(true); e.setCancelled(true);
@ -658,15 +678,16 @@ 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()) {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
} else { } else {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!plot.isAdded(pp.getUUID())) if (!Permissions.hasPermission(pp, "plots.admin.build.other")) { if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true); e.setCancelled(true);
@ -676,17 +697,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 onTeleport(final PlayerTeleportEvent event) { public static void onTeleport(final PlayerTeleportEvent event) {
final Location f = BukkitUtil.getLocation(event.getFrom()); final Location f = BukkitUtil.getLocation(event.getFrom());
final Location t = BukkitUtil.getLocation(event.getTo()); final Location t = BukkitUtil.getLocation(event.getTo());
final Location q = new Location(t.getWorld(), t.getX(), 64, t.getZ()); final Location q = new Location(t.getWorld(), t.getX(), 64, t.getZ());
Player player = event.getPlayer(); final Player player = event.getPlayer();
if (isPlotWorld(q)) { if (isPlotWorld(q)) {
if (isInPlot(q)) { if (isInPlot(q)) {
final Plot plot = getCurrentPlot(q); final Plot plot = getCurrentPlot(q);
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (plot.isDenied(pp.getUUID())) { if (plot.isDenied(pp.getUUID())) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.YOU_BE_DENIED); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.YOU_BE_DENIED);
event.setCancelled(true); event.setCancelled(true);
@ -715,7 +737,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Block b = e.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()).getBlock(); final Block b = e.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()).getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer()); final PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (Permissions.hasPermission(pp, "plots.admin.build.road")) { if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
return; return;
@ -760,7 +782,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler @EventHandler
public static void onLeave(final PlayerQuitEvent event) { public static void onLeave(final PlayerQuitEvent event) {
String name = event.getPlayer().getName(); final String name = event.getPlayer().getName();
if (SetupUtils.setupMap.containsKey(name)) { if (SetupUtils.setupMap.containsKey(name)) {
SetupUtils.setupMap.remove(name); SetupUtils.setupMap.remove(name);
} }
@ -783,7 +805,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (Permissions.hasPermission(pp, "plots.admin.build.road")) { if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
return; return;
@ -825,7 +847,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
if (isPlotWorld(loc)) { if (isPlotWorld(loc)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!isInPlot(loc)) { if (!isInPlot(loc)) {
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
@ -862,7 +884,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (r instanceof Player) { if (r instanceof Player) {
final Player p = (Player) r; final Player p = (Player) r;
final Location l = BukkitUtil.getLocation(e.getEntity()); final Location l = BukkitUtil.getLocation(e.getEntity());
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!Permissions.hasPermission(pp, "plots.admin.destroy.road")) { if (!Permissions.hasPermission(pp, "plots.admin.destroy.road")) {
@ -900,7 +922,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation()); final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
@ -948,8 +970,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Entity d = e.getAttacker(); final Entity d = e.getAttacker();
if (d instanceof Player) { if (d instanceof Player) {
final Player p = (Player) d; final Player p = (Player) d;
final PlotWorld pW = PlotSquared.getPlotWorld(l.getWorld()); PlotSquared.getPlotWorld(l.getWorld());
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) { if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.road");
@ -1006,7 +1028,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!isInPlot(l)) { if (!isInPlot(l)) {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!Permissions.hasPermission(pp, "plots.admin.pve.road")) { if (!Permissions.hasPermission(pp, "plots.admin.pve.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.road");
e.setCancelled(true); e.setCancelled(true);
@ -1015,7 +1037,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()) {
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!Permissions.hasPermission(pp, "plots.admin.pve.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.pve.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.unowned"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.unowned");
e.setCancelled(true); e.setCancelled(true);
@ -1028,7 +1050,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
assert plot != null; assert plot != null;
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!plot.isAdded(pp.getUUID())) { if (!plot.isAdded(pp.getUUID())) {
if ((a instanceof Monster) && FlagManager.isPlotFlagTrue(plot, "hostile-attack")) { if ((a instanceof Monster) && FlagManager.isPlotFlagTrue(plot, "hostile-attack")) {
return; return;
@ -1060,7 +1082,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location l = BukkitUtil.getLocation(e.getEgg().getLocation()); final Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) { if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.road");
@ -1095,7 +1117,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;
} }
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (Permissions.hasPermission(pp, "plots.admin")) { if (Permissions.hasPermission(pp, "plots.admin")) {
return; return;
} }

View File

@ -2,7 +2,6 @@ package com.intellectualcrafters.plot.listeners;
import java.util.UUID; import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; 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;
@ -18,11 +17,11 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
public class PlayerEvents_1_8 extends PlotListener implements Listener { public class PlayerEvents_1_8 extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void onInteract(final PlayerInteractAtEntityEvent e) { public void onInteract(final PlayerInteractAtEntityEvent e) {
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation()); final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
final Player p = e.getPlayer(); e.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer()); final PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
if (!isInPlot(l)) { if (!isInPlot(l)) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road"); MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
@ -36,7 +35,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
e.setCancelled(true); e.setCancelled(true);
} }
} else { } else {
UUID uuid = pp.getUUID(); final UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
if (isPlotArea(l)) { if (isPlotArea(l)) {

View File

@ -107,19 +107,19 @@ public class PlotPlusListener extends PlotListener implements Listener {
} }
event.setCancelled(true); event.setCancelled(true);
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player)); final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player));
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (plot == null) { if (plot == null) {
MainUtil.sendMessage(pp, C.NOT_IN_PLOT); MainUtil.sendMessage(pp, C.NOT_IN_PLOT);
return; return;
} }
UUID uuid = pp.getUUID(); final UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
MainUtil.sendMessage(pp, C.NO_PLOT_PERMS); MainUtil.sendMessage(pp, C.NO_PLOT_PERMS);
return; return;
} }
final Set<Player> plotPlayers = new HashSet<>(); final Set<Player> plotPlayers = new HashSet<>();
for (final Player p : player.getWorld().getPlayers()) { for (final Player p : player.getWorld().getPlayers()) {
Plot newPlot = MainUtil.getPlot(BukkitUtil.getLocation(player)); final Plot newPlot = MainUtil.getPlot(BukkitUtil.getLocation(player));
if (plot.equals(newPlot)) { if (plot.equals(newPlot)) {
plotPlayers.add(p); plotPlayers.add(p);
} }
@ -173,12 +173,12 @@ public class PlotPlusListener extends PlotListener implements Listener {
@EventHandler @EventHandler
public void onItemPickup(final PlayerPickupItemEvent event) { public void onItemPickup(final PlayerPickupItemEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
final Plot plot = MainUtil.getPlot(pp.getLocation()); final Plot plot = MainUtil.getPlot(pp.getLocation());
if (plot == null) { if (plot == null) {
return; return;
} }
UUID uuid = pp.getUUID(); final UUID uuid = pp.getUUID();
if (plot.isAdded(uuid) && booleanFlag(plot, "drop-protection", false)) { if (plot.isAdded(uuid) && booleanFlag(plot, "drop-protection", false)) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -187,12 +187,12 @@ public class PlotPlusListener extends PlotListener implements Listener {
@EventHandler @EventHandler
public void onItemDrop(final PlayerDropItemEvent event) { public void onItemDrop(final PlayerDropItemEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
final Plot plot = MainUtil.getPlot(pp.getLocation()); final Plot plot = MainUtil.getPlot(pp.getLocation());
if (plot == null) { if (plot == null) {
return; return;
} }
UUID uuid = pp.getUUID(); final UUID uuid = pp.getUUID();
if (plot.isAdded(uuid) && booleanFlag(plot, "item-drop", false)) { if (plot.isAdded(uuid) && booleanFlag(plot, "item-drop", false)) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -211,7 +211,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
return; return;
} }
final Player trespasser = event.getPlayer(); final Player trespasser = event.getPlayer();
PlotPlayer pt = BukkitUtil.getPlayer(trespasser); final PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
if (pp.getUUID().equals(pt.getUUID())) { if (pp.getUUID().equals(pt.getUUID())) {
return; return;
} }
@ -227,8 +227,8 @@ public class PlotPlusListener extends PlotListener implements Listener {
@EventHandler @EventHandler
public void onPlayerQuit(final PlayerQuitEvent event) { public void onPlayerQuit(final PlayerQuitEvent event) {
Player player = event.getPlayer(); final Player player = event.getPlayer();
String name = player.getName(); final String name = player.getName();
if (feedRunnable.containsKey(name)) { if (feedRunnable.containsKey(name)) {
feedRunnable.remove(name); feedRunnable.remove(name);
} }
@ -239,14 +239,14 @@ public class PlotPlusListener extends PlotListener implements Listener {
@EventHandler @EventHandler
public void onPlotLeave(final PlayerLeavePlotEvent event) { public void onPlotLeave(final PlayerLeavePlotEvent event) {
Player leaver = event.getPlayer(); final Player leaver = event.getPlayer();
leaver.playEffect(leaver.getLocation(), Effect.RECORD_PLAY, 0); leaver.playEffect(leaver.getLocation(), Effect.RECORD_PLAY, 0);
final Plot plot = event.getPlot(); final Plot plot = event.getPlot();
if (FlagManager.getPlotFlag(plot, "farewell") != null) { if (FlagManager.getPlotFlag(plot, "farewell") != null) {
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "farewell").getValueString())); event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "farewell").getValueString()));
} }
PlotPlayer pl = BukkitUtil.getPlayer(leaver); final PlotPlayer pl = BukkitUtil.getPlayer(leaver);
String name = pl.getName(); pl.getName();
if (feedRunnable.containsKey(leaver)) { if (feedRunnable.containsKey(leaver)) {
feedRunnable.remove(leaver); feedRunnable.remove(leaver);
} }

View File

@ -106,8 +106,8 @@ public class WorldEditListener implements Listener {
if ((p.getItemInHand() == null) || (p.getItemInHand().getType() == Material.AIR)) { if ((p.getItemInHand() == null) || (p.getItemInHand().getType() == Material.AIR)) {
return; return;
} }
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
com.intellectualcrafters.plot.object.Location loc = pp.getLocation(); final com.intellectualcrafters.plot.object.Location loc = pp.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot != null) { if (plot != null) {
if (plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(pp.getUUID()))) { if (plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(pp.getUUID()))) {
@ -119,7 +119,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();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!PlotSquared.isPlotWorld(p.getWorld().getName()) || Permissions.hasPermission(pp, "plots.worldedit.bypass")) { if (!PlotSquared.isPlotWorld(p.getWorld().getName()) || Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
return; return;
} }
@ -170,7 +170,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();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
PWE.removeMask(pp); PWE.removeMask(pp);
@ -178,7 +178,7 @@ public class WorldEditListener implements Listener {
return; return;
} }
if (isPlotWorld(l)) { if (isPlotWorld(l)) {
com.intellectualcrafters.plot.object.Location loc = BukkitUtil.getLocation(l); final com.intellectualcrafters.plot.object.Location loc = BukkitUtil.getLocation(l);
PWE.setMask(pp, loc, false); PWE.setMask(pp, loc, false);
} else { } else {
PWE.removeMask(pp); PWE.removeMask(pp);
@ -193,14 +193,14 @@ 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();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
if (!PWE.hasMask(pp)) { if (!PWE.hasMask(pp)) {
return; return;
} }
} }
com.intellectualcrafters.plot.object.Location locf = BukkitUtil.getLocation(f); final com.intellectualcrafters.plot.object.Location locf = BukkitUtil.getLocation(f);
com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t); final com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
if ((locf.getX() != loct.getX()) || (locf.getZ() != loct.getZ())) { if ((locf.getX() != loct.getX()) || (locf.getZ() != loct.getZ())) {
final PlotId idF = MainUtil.getPlotId(locf); final PlotId idF = MainUtil.getPlotId(locf);
final PlotId idT = MainUtil.getPlotId(loct); final PlotId idT = MainUtil.getPlotId(loct);
@ -212,8 +212,8 @@ 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) {
Player p = e.getPlayer(); final Player p = e.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
return; return;
} }
@ -224,7 +224,7 @@ public class WorldEditListener implements Listener {
return; return;
} }
if (isPlotWorld(t)) { if (isPlotWorld(t)) {
com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t); final com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
PWE.setMask(pp, loct, false); PWE.setMask(pp, loct, false);
return; return;
} }
@ -236,14 +236,14 @@ 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();
PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
if (!PWE.hasMask(pp)) { if (!PWE.hasMask(pp)) {
return; return;
} }
} }
final Location t = e.getTo(); final Location t = e.getTo();
com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t); final com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
final Location f = e.getFrom(); final Location f = e.getFrom();
if (!PlotSquared.isPlotWorld(loct.getWorld())) { if (!PlotSquared.isPlotWorld(loct.getWorld())) {
if (isPlotWorld(f)) { if (isPlotWorld(f)) {

View File

@ -12,27 +12,27 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player), as it caches player objects. * Please do not use this method. Instead use BukkitUtil.getPlayer(Player), as it caches player objects.
* @param player * @param player
*/ */
public BukkitOfflinePlayer(OfflinePlayer player) { public BukkitOfflinePlayer(final OfflinePlayer player) {
this.player = player; this.player = player;
} }
@Override @Override
public UUID getUUID() { public UUID getUUID() {
return player.getUniqueId(); return this.player.getUniqueId();
} }
@Override @Override
public long getLastPlayed() { public long getLastPlayed() {
return player.getLastPlayed(); return this.player.getLastPlayed();
} }
@Override @Override
public boolean isOnline() { public boolean isOnline() {
return player.isOnline(); return this.player.isOnline();
} }
@Override @Override
public String getName() { public String getName() {
return player.getName(); return this.player.getName();
} }
} }

View File

@ -21,7 +21,7 @@ public class BukkitPlayer implements PlotPlayer {
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player), as it caches player objects. * Please do not use this method. Instead use BukkitUtil.getPlayer(Player), as it caches player objects.
* @param player * @param player
*/ */
public BukkitPlayer(Player player) { public BukkitPlayer(final Player player) {
this.player = player; this.player = player;
} }
@ -39,29 +39,29 @@ public class BukkitPlayer implements PlotPlayer {
} }
@Override @Override
public boolean hasPermission(String perm) { public boolean hasPermission(final String perm) {
if (noPerm.contains(perm)) { if (this.noPerm.contains(perm)) {
return false; return false;
} }
if (hasPerm.contains(perm)) { if (this.hasPerm.contains(perm)) {
return true; return true;
} }
boolean result = player.hasPermission(perm); final boolean result = this.player.hasPermission(perm);
if (!result) { if (!result) {
noPerm.add(perm); this.noPerm.add(perm);
return false; return false;
} }
hasPerm.add(perm); this.hasPerm.add(perm);
return true; return true;
} }
@Override @Override
public void sendMessage(String message) { public void sendMessage(final String message) {
this.player.sendMessage(message); this.player.sendMessage(message);
} }
@Override @Override
public void teleport(Location loc) { public void teleport(final Location loc) {
this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ())); this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ()));
} }
@ -74,7 +74,7 @@ public class BukkitPlayer implements PlotPlayer {
} }
return true; return true;
} }
boolean result = this.player.isOp(); final boolean result = this.player.isOp();
if (!result) { if (!result) {
this.op = 1; this.op = 1;
return false; return false;
@ -86,7 +86,7 @@ public class BukkitPlayer implements PlotPlayer {
@Override @Override
public String getName() { public String getName() {
if (this.name == null) { if (this.name == null) {
this.name = player.getName(); this.name = this.player.getName();
} }
return this.name; return this.name;
} }
@ -97,8 +97,8 @@ public class BukkitPlayer implements PlotPlayer {
} }
@Override @Override
public void setCompassTarget(Location loc) { public void setCompassTarget(final Location loc) {
player.setCompassTarget(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ())); this.player.setCompassTarget(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ()));
} }

View File

@ -51,7 +51,7 @@ public class InfoInventory implements InventoryHolder {
} }
public InfoInventory build() { public InfoInventory build() {
UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(player)); final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(this.player));
final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.getOwner()), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.isAdded(uuid), "&cIs Denied: &6" + this.plot.isDenied(uuid)); final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.getOwner()), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.isAdded(uuid), "&cIs Denied: &6" + this.plot.isDenied(uuid));
final ItemStack helpers = getItem(Material.EMERALD, "&cHelpers", "&cAmount: &6" + this.plot.helpers.size(), "&8Click to view a list of the plot helpers"); final ItemStack helpers = getItem(Material.EMERALD, "&cHelpers", "&cAmount: &6" + this.plot.helpers.size(), "&8Click to view a list of the plot helpers");
final ItemStack trusted = getItem(Material.EMERALD, "&cTrusted", "&cAmount: &6" + this.plot.trusted.size(), "&8Click to view a list of trusted players"); final ItemStack trusted = getItem(Material.EMERALD, "&cTrusted", "&cAmount: &6" + this.plot.trusted.size(), "&8Click to view a list of trusted players");

View File

@ -61,9 +61,7 @@ public abstract class PlotWorld {
// make non static and static_default_valu + add config option // make non static and static_default_valu + add config option
public static int[] BLOCKS; public static int[] BLOCKS;
static { static {
BLOCKS = new int[] { BLOCKS = new int[] { 1, 2, 3, 4, 5, 7, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 35, 41, 42, 43, 45, 47, 48, 49, 52, 56, 57, 58, 61, 62, 73, 74, 80, 82, 84, 86, 87, 88, 91, 97, 98, 99, 100, 103, 110, 112, 120, 121, 123, 124, 125, 129, 133, 153, 155, 159, 162, 165, 166, 168, 170, 172, 173, 174, 179, 181 };
1,2,3,4,5,7,14,15,16,17,19,21,22,23,24,25,35,41,42,43,45,47,48,49,52,56,57,58,61,62,73,74,80,82,84,86,87,88,91,97,98,99,100,103,110,112,120,121,123,124,125,129,133,153,155,159,162,165,166,168,170,172,173,174,179,181
};
} }
public final String worldname; public final String worldname;
public boolean AUTO_MERGE; public boolean AUTO_MERGE;
@ -109,7 +107,7 @@ public abstract class PlotWorld {
this.SCHEMATIC_FILE = config.getString("schematic.file"); this.SCHEMATIC_FILE = config.getString("schematic.file");
this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim"); this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim");
this.SCHEMATICS = config.getStringList("schematic.schematics"); this.SCHEMATICS = config.getStringList("schematic.schematics");
this.USE_ECONOMY = config.getBoolean("economy.use") && PlotSquared.economy != null; this.USE_ECONOMY = config.getBoolean("economy.use") && (PlotSquared.economy != null);
this.PLOT_PRICE = config.getDouble("economy.prices.claim"); this.PLOT_PRICE = config.getDouble("economy.prices.claim");
this.MERGE_PRICE = config.getDouble("economy.prices.merge"); this.MERGE_PRICE = config.getDouble("economy.prices.merge");
this.SELL_PRICE = config.getDouble("economy.prices.sell"); this.SELL_PRICE = config.getDouble("economy.prices.sell");

View File

@ -6,19 +6,19 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
public class EconHandler { public class EconHandler {
// TODO economy shit // TODO economy shit
public static double getBalance(PlotPlayer player) { public static double getBalance(final PlotPlayer player) {
return PlotSquared.economy.getBalance(player.getName()); return PlotSquared.economy.getBalance(player.getName());
} }
public static void withdrawPlayer(PlotPlayer player, double amount) { public static void withdrawPlayer(final PlotPlayer player, final double amount) {
PlotSquared.economy.withdrawPlayer(player.getName(), amount); PlotSquared.economy.withdrawPlayer(player.getName(), amount);
} }
public static void depositPlayer(PlotPlayer player, double amount) { public static void depositPlayer(final PlotPlayer player, final double amount) {
PlotSquared.economy.depositPlayer(player.getName(), amount); PlotSquared.economy.depositPlayer(player.getName(), amount);
} }
public static void depositPlayer(OfflinePlotPlayer player, double amount) { public static void depositPlayer(final OfflinePlotPlayer player, final double amount) {
PlotSquared.economy.depositPlayer(player.getName(), amount); PlotSquared.economy.depositPlayer(player.getName(), amount);
} }
} }

View File

@ -171,7 +171,7 @@ public class ExpireManager {
continue; continue;
} }
final BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid); final BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
if ((op == null) || op.getLastPlayed() == 0) { if ((op == null) || (op.getLastPlayed() == 0)) {
continue; continue;
} }
long last = op.getLastPlayed(); long last = op.getLastPlayed();

View File

@ -847,7 +847,7 @@ public class MainUtil {
public static boolean sendMessage(final PlotPlayer plr, String msg, final boolean prefix) { public static boolean sendMessage(final PlotPlayer plr, String msg, final boolean prefix) {
msg = colorise('&', msg); msg = colorise('&', msg);
String prefixStr = colorise('&', C.PREFIX.s()); final String prefixStr = colorise('&', C.PREFIX.s());
if ((msg.length() > 0) && !msg.equals("")) { if ((msg.length() > 0) && !msg.equals("")) {
if (plr == null) { if (plr == null) {
PlotSquared.log(prefixStr + msg); PlotSquared.log(prefixStr + msg);
@ -931,18 +931,18 @@ public class MainUtil {
* @param plr * @param plr
* @param msg Was used to wrap the chat client length (Packets out--) * @param msg Was used to wrap the chat client length (Packets out--)
*/ */
public static void sendMessageWrapped(final PlotPlayer plr, String msg) { public static void sendMessageWrapped(final PlotPlayer plr, final String msg) {
// if (msg.length() > 65) { // if (msg.length() > 65) {
// final String[] ss = wordWrap(msg, 65); // final String[] ss = wordWrap(msg, 65);
// final StringBuilder b = new StringBuilder(); // final StringBuilder b = new StringBuilder();
// for (final String p : ss) { // for (final String p : ss) {
// b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n "); // b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n ");
// } // }
// msg = b.toString(); // msg = b.toString();
// } // }
// if (msg.endsWith("\n")) { // if (msg.endsWith("\n")) {
// msg = msg.substring(0, msg.length() - 2); // msg = msg.substring(0, msg.length() - 2);
// } // }
plr.sendMessage(msg); plr.sendMessage(msg);
} }
@ -1066,7 +1066,7 @@ public class MainUtil {
* @param p * @param p
* @return * @return
*/ */
public static int getAllowedPlots(final PlotPlayer p, int current) { public static int getAllowedPlots(final PlotPlayer p, final int current) {
return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS, current); return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS, current);
} }

View File

@ -56,7 +56,7 @@ public class BukkitPlayerFunctions {
*/ */
public static void clear(final Player player, final String world, final Plot plot, final boolean isDelete) { public static void clear(final Player player, final String world, final Plot plot, final boolean isDelete) {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
Runnable whenDone = new Runnable() { final Runnable whenDone = new Runnable() {
@Override @Override
public void run() { public void run() {
if ((player != null) && player.isOnline()) { if ((player != null) && player.isOnline()) {

View File

@ -1,7 +1,6 @@
package com.intellectualcrafters.plot.util.bukkit; package com.intellectualcrafters.plot.util.bukkit;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
@ -29,11 +28,11 @@ public class BukkitTaskManager extends TaskManager {
@Override @Override
public void taskLaterAsync(final Runnable r, final int delay) { public void taskLaterAsync(final Runnable r, final int delay) {
BukkitTask runnable = BukkitMain.THIS.getServer().getScheduler().runTaskLaterAsynchronously(BukkitMain.THIS, r, delay); BukkitMain.THIS.getServer().getScheduler().runTaskLaterAsynchronously(BukkitMain.THIS, r, delay);
} }
@Override @Override
public void cancelTask(int task) { public void cancelTask(final int task) {
if (task != -1) { if (task != -1) {
Bukkit.getScheduler().cancelTask(task); Bukkit.getScheduler().cancelTask(task);
} }

View File

@ -30,8 +30,8 @@ public class BukkitUtil extends BlockManager {
private static Player lastPlayer = null; private static Player lastPlayer = null;
private static PlotPlayer lastPlotPlayer = null; private static PlotPlayer lastPlotPlayer = null;
public static void removePlayer(String plr) { public static void removePlayer(final String plr) {
if (lastPlayer != null && lastPlayer.getName().equals(plr)) { if ((lastPlayer != null) && lastPlayer.getName().equals(plr)) {
lastPlayer = null; lastPlayer = null;
lastPlotPlayer = null; lastPlotPlayer = null;
} }
@ -39,11 +39,11 @@ public class BukkitUtil extends BlockManager {
} }
@Override @Override
public boolean isWorld(String world) { public boolean isWorld(final String world) {
return getWorld(world) != null; return getWorld(world) != null;
} }
public static PlotPlayer getPlayer(Player player) { public static PlotPlayer getPlayer(final Player player) {
if (player == lastPlayer) { if (player == lastPlayer) {
return lastPlotPlayer; return lastPlotPlayer;
} }
@ -58,7 +58,7 @@ public class BukkitUtil extends BlockManager {
return getWorld(loc.getWorld()).getBiome(loc.getX(), loc.getZ()).name(); return getWorld(loc.getWorld()).getBiome(loc.getX(), loc.getZ()).name();
} }
public static Location getLocation(org.bukkit.Location loc) { public static Location getLocation(final org.bukkit.Location loc) {
return new Location(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); return new Location(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
} }
@ -188,22 +188,22 @@ public class BukkitUtil extends BlockManager {
} }
@Override @Override
public void functionSetBiomes(String worldname, int[] x, int[] z, int[] biome) { public void functionSetBiomes(final String worldname, final int[] x, final int[] z, final int[] biome) {
World world = getWorld(worldname); final World world = getWorld(worldname);
Biome[] biomes = Biome.values(); final Biome[] biomes = Biome.values();
for (int i = 0; i < x.length; i++) { for (int i = 0; i < x.length; i++) {
world.setBiome(x[i], z[i], biomes[biome[i]]); world.setBiome(x[i], z[i], biomes[biome[i]]);
} }
} }
@Override @Override
public void functionSetBlock(String worldname, int x, int y, int z, int id, byte data) { public void functionSetBlock(final String worldname, final int x, final int y, final int z, final int id, final byte data) {
BukkitUtil.setBlock(getWorld(worldname), x, y, z, id, data); BukkitUtil.setBlock(getWorld(worldname), x, y, z, id, data);
} }
@Override @Override
public String[] getSign(Location loc) { public String[] getSign(final Location loc) {
Block block = getWorld(loc.getWorld()).getBlockAt(loc.getX(), loc.getY(), loc.getZ()); final Block block = getWorld(loc.getWorld()).getBlockAt(loc.getX(), loc.getY(), loc.getZ());
if (block != null) { if (block != null) {
if (block.getState() instanceof Sign) { if (block.getState() instanceof Sign) {
final Sign sign = (Sign) block.getState(); final Sign sign = (Sign) block.getState();
@ -214,19 +214,19 @@ public class BukkitUtil extends BlockManager {
} }
@Override @Override
public Location getSpawn(String world) { public Location getSpawn(final String world) {
org.bukkit.Location temp = getWorld(world).getSpawnLocation(); final org.bukkit.Location temp = getWorld(world).getSpawnLocation();
return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ()); return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ());
} }
@Override @Override
public int getHeighestBlock(Location loc) { public int getHeighestBlock(final Location loc) {
return getWorld(loc.getWorld()).getHighestBlockAt(loc.getX(), loc.getZ()).getY(); return getWorld(loc.getWorld()).getHighestBlockAt(loc.getX(), loc.getZ()).getY();
} }
@Override @Override
public int getBiomeFromString(String biomeStr) { public int getBiomeFromString(final String biomeStr) {
Biome biome = Biome.valueOf(biomeStr.toUpperCase()); final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
if (biome == null) { if (biome == null) {
return -1; return -1;
} }
@ -235,17 +235,17 @@ public class BukkitUtil extends BlockManager {
@Override @Override
public String[] getBiomeList() { public String[] getBiomeList() {
Biome[] biomes = Biome.values(); final Biome[] biomes = Biome.values();
String[] list = new String[biomes.length]; final String[] list = new String[biomes.length];
for (int i = 0; i< biomes.length; i++) { for (int i = 0; i < biomes.length; i++) {
list[i] = biomes[i].name(); list[i] = biomes[i].name();
} }
return list; return list;
} }
@Override @Override
public int getBlockIdFromString(String block) { public int getBlockIdFromString(final String block) {
Material material = Material.valueOf(block.toUpperCase()); final Material material = Material.valueOf(block.toUpperCase());
if (material == null) { if (material == null) {
return -1; return -1;
} }

View File

@ -758,12 +758,12 @@ public class ChunkManager extends AChunkManager {
} }
@Override @Override
public boolean loadChunk(String world, ChunkLoc loc) { public boolean loadChunk(final String world, final ChunkLoc loc) {
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(false); return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(false);
} }
@Override @Override
public void swap(String world, PlotId id, PlotId plotid) { public void swap(final String world, final PlotId id, final PlotId plotid) {
// FIXME swap plots // FIXME swap plots
} }
} }

View File

@ -44,7 +44,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
public class PWE { public class PWE {
public static void setMask(final PlotPlayer p, final Location l, final boolean force) { public static void setMask(final PlotPlayer p, final Location l, final boolean force) {
try { try {
LocalSession s = WorldEdit.getInstance().getSession(p.getName()); final LocalSession s = WorldEdit.getInstance().getSession(p.getName());
if (!PlotSquared.isPlotWorld(l.getWorld())) { if (!PlotSquared.isPlotWorld(l.getWorld())) {
removeMask(p); removeMask(p);
} }
@ -63,7 +63,6 @@ public class PWE {
final Vector bvec = new Vector(bloc.getX() + 1, bloc.getY(), bloc.getZ() + 1); final Vector bvec = new Vector(bloc.getX() + 1, bloc.getY(), bloc.getZ() + 1);
final Vector tvec = new Vector(tloc.getX(), tloc.getY(), tloc.getZ()); final Vector tvec = new Vector(tloc.getX(), tloc.getY(), tloc.getZ());
// FIXME unchecked casting // FIXME unchecked casting
final LocalWorld lw = PlotSquared.worldEdit.wrapPlayer(((BukkitPlayer) p).player).getWorld(); final LocalWorld lw = PlotSquared.worldEdit.wrapPlayer(((BukkitPlayer) p).player).getWorld();
final CuboidRegion region = new CuboidRegion(lw, bvec, tvec); final CuboidRegion region = new CuboidRegion(lw, bvec, tvec);
@ -85,7 +84,7 @@ public class PWE {
} }
public static boolean hasMask(final PlotPlayer p) { public static boolean hasMask(final PlotPlayer p) {
LocalSession s = WorldEdit.getInstance().getSession(p.getName()); final LocalSession s = WorldEdit.getInstance().getSession(p.getName());
return !noMask(s); return !noMask(s);
} }
@ -96,7 +95,7 @@ public class PWE {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void setNoMask(final PlotPlayer p) { public static void setNoMask(final PlotPlayer p) {
try { try {
LocalSession s = WorldEdit.getInstance().getSession(p.getName()); final LocalSession s = WorldEdit.getInstance().getSession(p.getName());
final com.sk89q.worldedit.bukkit.BukkitPlayer plr = PlotSquared.worldEdit.wrapPlayer(((BukkitPlayer) p).player); final com.sk89q.worldedit.bukkit.BukkitPlayer plr = PlotSquared.worldEdit.wrapPlayer(((BukkitPlayer) p).player);
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)));
@ -112,7 +111,7 @@ public class PWE {
public static void removeMask(final PlotPlayer p) { public static void removeMask(final PlotPlayer p) {
try { try {
LocalSession s = WorldEdit.getInstance().getSession(p.getName()); final LocalSession s = WorldEdit.getInstance().getSession(p.getName());
removeMask(p, s); removeMask(p, s);
} catch (final Exception e) { } catch (final Exception e) {
// throw new // throw new

View File

@ -17,10 +17,10 @@ public abstract class SetBlockManager extends AbstractSetBlock {
public abstract void update(List<Chunk> list); public abstract void update(List<Chunk> list);
@Override @Override
public void update(String worldname, List<ChunkLoc> chunkLocs) { public void update(final String worldname, final List<ChunkLoc> chunkLocs) {
World world = BukkitUtil.getWorld(worldname); final World world = BukkitUtil.getWorld(worldname);
ArrayList<Chunk> chunks = new ArrayList<Chunk>(); final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
for (ChunkLoc loc : chunkLocs) { for (final ChunkLoc loc : chunkLocs) {
chunks.add(world.getChunkAt(loc.x, loc.z)); chunks.add(world.getChunkAt(loc.x, loc.z));
} }
setBlockManager.update(chunks); setBlockManager.update(chunks);

View File

@ -77,7 +77,7 @@ public class UUIDHandler {
return uuidMap.containsKey(name); return uuidMap.containsKey(name);
} }
public static void cacheAll(String world) { public static void cacheAll(final String world) {
if (CACHED) { if (CACHED) {
return; return;
} }
@ -168,8 +168,8 @@ public class UUIDHandler {
return null; return null;
} }
public static PlotPlayer getPlayer(UUID uuid) { public static PlotPlayer getPlayer(final UUID uuid) {
for (PlotPlayer player : players.values()) { for (final PlotPlayer player : players.values()) {
if (player.getUUID().equals(uuid)) { if (player.getUUID().equals(uuid)) {
return player; return player;
} }
@ -177,7 +177,7 @@ public class UUIDHandler {
return null; return null;
} }
public static PlotPlayer getPlayer(String name) { public static PlotPlayer getPlayer(final String name) {
return players.get(name); return players.get(name);
} }