mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
cleanup
This commit is contained in:
parent
625d19b5d0
commit
f2c9e4933a
@ -12,10 +12,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -69,11 +66,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
public static BukkitMain THIS = 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) {
|
||||
try {
|
||||
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
|
||||
public void onEnable() {
|
||||
THIS = this;
|
||||
@ -124,6 +99,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
} else {
|
||||
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
|
||||
}
|
||||
System.out.print("REGISTERING EVENTS");
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
}
|
||||
|
||||
@ -160,7 +136,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
@Override
|
||||
public void registerCommands() {
|
||||
final MainCommand command = new MainCommand();
|
||||
new MainCommand();
|
||||
final BukkitCommand bcmd = new BukkitCommand();
|
||||
final PluginCommand plotCommand = getCommand("plots");
|
||||
plotCommand.setExecutor(bcmd);
|
||||
@ -184,6 +160,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
long ticked = 0l;
|
||||
long error = 0l;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.ticked > 36_000L) {
|
||||
@ -351,32 +328,28 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
@Override
|
||||
public UUIDWrapper initUUIDHandler() {
|
||||
boolean checkVersion = checkVersion(1, 7, 6);
|
||||
final boolean checkVersion = checkVersion(1, 7, 6);
|
||||
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;
|
||||
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
||||
}
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = true;
|
||||
}
|
||||
else if (checkVersion) {
|
||||
} else if (checkVersion) {
|
||||
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = true;
|
||||
}
|
||||
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");
|
||||
}
|
||||
else {
|
||||
log(C.PREFIX.s()+" &6PlotSquared is using online UUIDs");
|
||||
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 {
|
||||
log(C.PREFIX.s() + " &6PlotSquared is using online UUIDs");
|
||||
}
|
||||
return UUIDHandler.uuidWrapper;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class Auto extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
|
||||
return false;
|
||||
}
|
||||
int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
|
||||
final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
|
||||
final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots);
|
||||
if ((diff + (size_x * size_z)) > 0) {
|
||||
if (diff < 0) {
|
||||
|
@ -21,7 +21,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
@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) {
|
||||
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), commandLabel, args);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class Buy extends SubCommand {
|
||||
if (PlotSquared.economy == null) {
|
||||
return sendMessage(plr, C.ECON_DISABLED);
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final String world = loc.getWorld();
|
||||
if (!PlotSquared.isPlotWorld(world)) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||
@ -67,7 +67,7 @@ public class Buy extends SubCommand {
|
||||
if (plot == null) {
|
||||
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)) {
|
||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||
}
|
||||
@ -91,14 +91,14 @@ public class Buy extends SubCommand {
|
||||
price += plotworld.PLOT_PRICE * size;
|
||||
initPrice += plotworld.SELL_PRICE * size;
|
||||
}
|
||||
if (PlotSquared.economy != null && price > 0d) {
|
||||
if ((PlotSquared.economy != null) && (price > 0d)) {
|
||||
if (EconHandler.getBalance(plr) < price) {
|
||||
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price);
|
||||
}
|
||||
EconHandler.withdrawPlayer(plr, price);
|
||||
sendMessage(plr, C.REMOVED_BALANCE, price + "");
|
||||
EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner), initPrice);
|
||||
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
||||
final PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
||||
if (owner != null) {
|
||||
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + "");
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
@ -50,16 +48,16 @@ public class Claim extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
// FIXME claim plot event
|
||||
// final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
|
||||
// Bukkit.getPluginManager().callEvent(event);
|
||||
// boolean result = event.isCancelled();
|
||||
boolean result = false;
|
||||
// final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
|
||||
// Bukkit.getPluginManager().callEvent(event);
|
||||
// boolean result = event.isCancelled();
|
||||
final boolean result = false;
|
||||
|
||||
if (!result) {
|
||||
MainUtil.createPlot(player.getUUID(), plot);
|
||||
MainUtil.setSign(player.getName(), plot);
|
||||
MainUtil.sendMessage(player, C.CLAIMED);
|
||||
Location loc = player.getLocation();
|
||||
final Location loc = player.getLocation();
|
||||
if (teleport) {
|
||||
MainUtil.teleportPlayer(player, loc, plot);
|
||||
}
|
||||
@ -90,12 +88,12 @@ public class Claim extends SubCommand {
|
||||
if (args.length >= 1) {
|
||||
schematic = args[0];
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
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)) {
|
||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||
}
|
||||
@ -103,7 +101,7 @@ public class Claim extends SubCommand {
|
||||
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
||||
}
|
||||
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;
|
||||
if (cost > 0d) {
|
||||
if (EconHandler.getBalance(plr) < cost) {
|
||||
|
@ -62,12 +62,12 @@ public class Clear extends SubCommand {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
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);
|
||||
}
|
||||
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;
|
||||
final long start = System.currentTimeMillis();
|
||||
boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() {
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||
|
@ -307,7 +307,7 @@ public class Cluster extends SubCommand {
|
||||
cluster.invited.add(uuid);
|
||||
final String world = plr.getLocation().getWorld();
|
||||
DBFunc.setInvited(world, cluster, uuid);
|
||||
PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||
if (player != null) {
|
||||
MainUtil.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
|
||||
}
|
||||
@ -354,7 +354,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
cluster.invited.remove(uuid);
|
||||
DBFunc.removeInvited(cluster, uuid);
|
||||
PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||
if (player != null) {
|
||||
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ public class Comment extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer player, final String... args) {
|
||||
Location loc = player.getLocation();
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
final Location loc = player.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return sendMessage(player, C.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -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) {
|
||||
// FIXME call claim event
|
||||
// boolean result = event result
|
||||
boolean result = true;
|
||||
final boolean result = true;
|
||||
|
||||
if (!result) {
|
||||
MainUtil.createPlot(player.getUUID(), plot);
|
||||
@ -74,7 +74,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
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}");
|
||||
}
|
||||
String world = args[0];
|
||||
final String world = args[0];
|
||||
if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) {
|
||||
return !MainUtil.sendMessage(null, "&cInvalid plot world!");
|
||||
}
|
||||
@ -100,12 +100,12 @@ public class DebugClaimTest extends SubCommand {
|
||||
continue;
|
||||
}
|
||||
final Location loc = manager.getSignLoc(plotworld, plot);
|
||||
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
boolean result = AChunkManager.manager.loadChunk(world, chunk);
|
||||
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
final boolean result = AChunkManager.manager.loadChunk(world, chunk);
|
||||
if (!result) {
|
||||
continue;
|
||||
}
|
||||
String[] lines = BlockManager.manager.getSign(loc);
|
||||
final String[] lines = BlockManager.manager.getSign(loc);
|
||||
if (lines != null) {
|
||||
String line = lines[2];
|
||||
if ((line != null) && (line.length() > 2)) {
|
||||
|
@ -27,9 +27,9 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.AChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class DebugClear extends SubCommand {
|
||||
@ -63,7 +63,7 @@ public class DebugClear extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
MainUtil.runners.put(plot, 1);
|
||||
ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
|
||||
AChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.runners.remove(plot);
|
||||
@ -77,9 +77,9 @@ public class DebugClear extends SubCommand {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
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);
|
||||
}
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
@ -96,7 +96,7 @@ public class DebugClear extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
MainUtil.runners.put(plot, 1);
|
||||
ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
|
||||
AChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.runners.remove(plot);
|
||||
|
@ -111,8 +111,8 @@ public class DebugExec extends SubCommand {
|
||||
if (uuid == null) {
|
||||
return MainUtil.sendMessage(null, "player not found: " + args[1]);
|
||||
}
|
||||
BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||
if ((op == null) || op.getLastPlayed() == 0) {
|
||||
final BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||
if ((op == null) || (op.getLastPlayed() == 0)) {
|
||||
return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]);
|
||||
}
|
||||
final Timestamp stamp = new Timestamp(op.getLastPlayed());
|
||||
|
@ -36,13 +36,13 @@ public class DebugRoadRegen extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer player, final String... args) {
|
||||
Location loc = player.getLocation();
|
||||
String world = loc.getWorld();
|
||||
final Location loc = player.getLocation();
|
||||
final String world = loc.getWorld();
|
||||
if (!(PlotSquared.getPlotWorld(world) instanceof HybridPlotWorld)) {
|
||||
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
boolean result = HybridUtils.manager.regenerateRoad(world, chunk);
|
||||
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
final boolean result = HybridUtils.manager.regenerateRoad(world, chunk);
|
||||
if (result) {
|
||||
MainUtil.update(loc);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class Delete extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -52,7 +52,7 @@ public class Delete extends SubCommand {
|
||||
}
|
||||
assert plot != null;
|
||||
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;
|
||||
if (c > 0d) {
|
||||
EconHandler.depositPlayer(plr, c);
|
||||
@ -66,7 +66,7 @@ public class Delete extends SubCommand {
|
||||
final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true);
|
||||
final long start = System.currentTimeMillis();
|
||||
if (result) {
|
||||
boolean result2 = MainUtil.clearAsPlayer(plot, true, new Runnable() {
|
||||
final boolean result2 = MainUtil.clearAsPlayer(plot, true, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||
|
@ -43,7 +43,7 @@ public class Denied extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -57,7 +57,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||
return false;
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
final Location loc = player.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
||||
|
@ -42,7 +42,7 @@ public class Helpers extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -49,9 +49,9 @@ public class Inbox extends SubCommand {
|
||||
report = true;
|
||||
}
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null && !report) {
|
||||
if ((plot == null) && !report) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if ((plot != null) && !plot.hasOwner()) {
|
||||
|
@ -53,7 +53,7 @@ public class Info extends SubCommand {
|
||||
Plot plot;
|
||||
String world;
|
||||
if (player != null) {
|
||||
Location loc = player.getLocation();
|
||||
final Location loc = player.getLocation();
|
||||
world = loc.getWorld();
|
||||
if (!PlotSquared.isPlotWorld(world)) {
|
||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
|
@ -37,7 +37,7 @@ public class Kick extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -50,7 +50,7 @@ public class Kick extends SubCommand {
|
||||
MainUtil.sendMessage(plr, "&c/plot kick <player>");
|
||||
return false;
|
||||
}
|
||||
PlotPlayer player = UUIDHandler.getPlayer(args[0]);
|
||||
final PlotPlayer player = UUIDHandler.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||
return false;
|
||||
|
@ -22,8 +22,6 @@ package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
@ -73,7 +71,7 @@ public class Merge extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -107,7 +105,7 @@ public class Merge extends SubCommand {
|
||||
PlotId bot = MainUtil.getBottomPlot(plot).id;
|
||||
PlotId top = MainUtil.getTopPlot(plot).id;
|
||||
ArrayList<PlotId> plots;
|
||||
String world = plr.getLocation().getWorld();
|
||||
final String world = plr.getLocation().getWorld();
|
||||
switch (direction) {
|
||||
case 0: // north = -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);
|
||||
if (PlotSquared.economy != null && plotWorld.USE_ECONOMY) {
|
||||
if ((PlotSquared.economy != null) && plotWorld.USE_ECONOMY) {
|
||||
double cost = plotWorld.MERGE_PRICE;
|
||||
cost = plots.size() * cost;
|
||||
if (cost > 0d) {
|
||||
final Economy economy = PlotSquared.economy;
|
||||
if (EconHandler.getBalance(plr) < cost) {
|
||||
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
|
||||
return false;
|
||||
@ -156,7 +153,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
//FIXME PlotMergeEvent
|
||||
// boolean result = event.isCancelled();
|
||||
boolean result = false;
|
||||
final boolean result = false;
|
||||
if (result) {
|
||||
MainUtil.sendMessage(plr, "&cMerge has been cancelled");
|
||||
return false;
|
||||
|
@ -42,7 +42,7 @@ public class MusicSubcommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer player, final String... args) {
|
||||
Location loc = player.getLocation();
|
||||
final Location loc = player.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
||||
|
@ -43,7 +43,7 @@ public class Rate extends SubCommand {
|
||||
sendMessage(plr, C.RATING_NOT_VALID);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -75,8 +75,8 @@ public class Schematic extends SubCommand {
|
||||
break;
|
||||
}
|
||||
final Location loc = plr.getLocation();
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
sendMessage(plr, C.NOT_IN_PLOT);
|
||||
break;
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class Schematic extends SubCommand {
|
||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
||||
break;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final int l1 = schematic.getSchematicDimension().getX();
|
||||
final int l2 = schematic.getSchematicDimension().getZ();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
@ -236,8 +236,7 @@ public class Schematic extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "export":
|
||||
case "save":
|
||||
{
|
||||
case "save": {
|
||||
if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
|
||||
return false;
|
||||
@ -249,7 +248,7 @@ public class Schematic extends SubCommand {
|
||||
final String world;
|
||||
final Plot p2;
|
||||
if (plr != null) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -59,7 +59,7 @@ public class Set extends SubCommand {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -90,7 +90,7 @@ public class Set extends SubCommand {
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("flag")) {
|
||||
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));
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class SetOwner extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if ((plot == null) || (plot.owner == null)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -66,7 +66,7 @@ public class SetOwner extends SubCommand {
|
||||
}
|
||||
final String world = loc.getWorld();
|
||||
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);
|
||||
for (final PlotId id : plots) {
|
||||
final Plot current = PlotSquared.getPlots(world).get(id);
|
||||
|
@ -180,5 +180,4 @@ public class Setup extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class Swap extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
|
||||
return false;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -48,8 +48,8 @@ public class TP extends SubCommand {
|
||||
}
|
||||
final String id = args[0];
|
||||
PlotId plotid;
|
||||
Location loc = plr.getLocation();
|
||||
String pworld = loc.getWorld();
|
||||
final Location loc = plr.getLocation();
|
||||
final String pworld = loc.getWorld();
|
||||
String world = pworld;
|
||||
if (args.length == 2) {
|
||||
if (BlockManager.manager.isWorld(args[1])) {
|
||||
|
@ -34,7 +34,7 @@ public class Target extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location ploc = plr.getLocation();
|
||||
final Location ploc = plr.getLocation();
|
||||
if (!PlotSquared.isPlotWorld(ploc.getWorld())) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||
return false;
|
||||
|
@ -43,7 +43,7 @@ public class Template extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
|
||||
return false;
|
||||
}
|
||||
String world = args[1];
|
||||
final String world = args[1];
|
||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||
if (!BlockManager.manager.isWorld(world) || (plotworld == null)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
||||
|
@ -39,7 +39,6 @@ import com.intellectualcrafters.plot.util.AChunkManager;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
||||
|
||||
public class Trim extends SubCommand {
|
||||
public static boolean TASK = false;
|
||||
@ -165,7 +164,7 @@ public class Trim extends SubCommand {
|
||||
if (Trim.TASK) {
|
||||
return false;
|
||||
}
|
||||
final long startOld = System.currentTimeMillis();
|
||||
System.currentTimeMillis();
|
||||
sendMessage("Collecting region data...");
|
||||
final ArrayList<Plot> plots = new ArrayList<>();
|
||||
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 pos3 = new Location(world, pos1.getX(), 64, pos2.getZ());
|
||||
final Location pos4 = new Location(world, pos2.getX(), 64, pos1.getZ());
|
||||
chunks.remove(ChunkManager.getChunkChunk(pos1));
|
||||
chunks.remove(ChunkManager.getChunkChunk(pos2));
|
||||
chunks.remove(ChunkManager.getChunkChunk(pos3));
|
||||
chunks.remove(ChunkManager.getChunkChunk(pos4));
|
||||
chunks.remove(AChunkManager.getChunkChunk(pos1));
|
||||
chunks.remove(AChunkManager.getChunkChunk(pos2));
|
||||
chunks.remove(AChunkManager.getChunkChunk(pos3));
|
||||
chunks.remove(AChunkManager.getChunkChunk(pos4));
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
|
@ -43,7 +43,7 @@ public class Trusted extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -20,8 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
@ -41,7 +39,7 @@ public class Unclaim extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -54,10 +52,9 @@ public class Unclaim extends SubCommand {
|
||||
}
|
||||
assert plot != null;
|
||||
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;
|
||||
if (c > 0d) {
|
||||
final Economy economy = PlotSquared.economy;
|
||||
EconHandler.depositPlayer(plr, c);
|
||||
sendMessage(plr, C.ADDED_BALANCE, c + "");
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class Unlink extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
@ -68,7 +68,7 @@ public class Unlink extends SubCommand {
|
||||
}
|
||||
|
||||
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 pos2 = MainUtil.getTopPlot(plot).id;
|
||||
final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2);
|
||||
|
@ -106,7 +106,7 @@ public class Configuration {
|
||||
@Override
|
||||
public boolean validateValue(final String string) {
|
||||
try {
|
||||
int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase());
|
||||
final int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase());
|
||||
if (biome == -1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -147,9 +147,9 @@ public class Settings {
|
||||
* MongoDB enabled?
|
||||
*/
|
||||
public static boolean USE_MONGO = false; /*
|
||||
* TODO: Implement Mongo
|
||||
* @Brandon
|
||||
*/
|
||||
* TODO: Implement Mongo
|
||||
* @Brandon
|
||||
*/
|
||||
/**
|
||||
* SQLite enabled?
|
||||
*/
|
||||
|
@ -38,8 +38,8 @@ public class AugmentedPopulator extends BlockPopulator {
|
||||
private final int tx;
|
||||
private final int tz;
|
||||
|
||||
public static void removePopulator(String worldname, PlotCluster cluster) {
|
||||
World world = Bukkit.getWorld(worldname);
|
||||
public static void removePopulator(final String worldname, final PlotCluster cluster) {
|
||||
final World world = Bukkit.getWorld(worldname);
|
||||
for (final Iterator<BlockPopulator> iterator = world.getPopulators().iterator(); iterator.hasNext();) {
|
||||
final BlockPopulator populator = iterator.next();
|
||||
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) {
|
||||
Biome biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
|
||||
final Biome biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
|
||||
if (this.b) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
|
@ -21,8 +21,8 @@ import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
|
||||
public class BukkitHybridUtils extends HybridUtils {
|
||||
|
||||
@Override
|
||||
public int checkModified(int threshhold, String worldname, int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock[] blocks) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
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) {
|
||||
final World world = BukkitUtil.getWorld(worldname);
|
||||
int count = 0;
|
||||
for (int y = y1; y <= y2; y++) {
|
||||
for (int x = x1; x <= x2; x++) {
|
||||
@ -49,9 +49,9 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get_ey(String worldname, int sx, int ex, int sz, int ez, int sy) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
int maxY = world.getMaxHeight();
|
||||
public int get_ey(final String worldname, final int sx, final int ex, final int sz, final int ez, final int sy) {
|
||||
final World world = BukkitUtil.getWorld(worldname);
|
||||
final int maxY = world.getMaxHeight();
|
||||
int ey = sy;
|
||||
for (int x = sx; x <= ex; x++) {
|
||||
for (int z = sz; z <= ez; z++) {
|
||||
@ -69,8 +69,8 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateChunkChunk(String worldname, ChunkLoc loc) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
public void regenerateChunkChunk(final String worldname, final ChunkLoc loc) {
|
||||
final World world = BukkitUtil.getWorld(worldname);
|
||||
final int sx = loc.x << 5;
|
||||
final int sz = loc.z << 5;
|
||||
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++) {
|
||||
final Chunk chunk = world.getChunkAt(x, z);
|
||||
chunks2.add(chunk);
|
||||
regenerateRoad(worldname, new ChunkLoc(x,z));
|
||||
regenerateRoad(worldname, new ChunkLoc(x, z));
|
||||
}
|
||||
}
|
||||
SetBlockManager.setBlockManager.update(chunks2);
|
||||
@ -99,7 +99,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
return false;
|
||||
}
|
||||
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() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -52,8 +52,8 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
|
||||
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
|
||||
int x, z;
|
||||
z = bottom.getZ();
|
||||
int length = top.getX() - bottom.getX();
|
||||
int size = (length) * 4 * (dpw.WALL_HEIGHT);
|
||||
final int length = top.getX() - bottom.getX();
|
||||
final int size = (length) * 4 * (dpw.WALL_HEIGHT);
|
||||
final int[] xl = new int[size];
|
||||
final int[] yl = new int[size];
|
||||
final int[] zl = new int[size];
|
||||
@ -108,9 +108,9 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
|
||||
return false;
|
||||
}
|
||||
final Location bottom = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid);
|
||||
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1,0,1);
|
||||
int length = top.getX() - bottom.getX();
|
||||
int size = (length) * 4;
|
||||
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
|
||||
final int length = top.getX() - bottom.getX();
|
||||
final int size = (length) * 4;
|
||||
final int[] xl = new int[size];
|
||||
final int[] yl = new int[size];
|
||||
final int[] zl = new int[size];
|
||||
@ -118,7 +118,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
|
||||
int x, z;
|
||||
z = bottom.getZ();
|
||||
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++) {
|
||||
xl[i] = x;
|
||||
zl[i] = z;
|
||||
@ -258,7 +258,6 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
|
||||
*/
|
||||
@Override
|
||||
public boolean finishPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) {
|
||||
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
||||
final PlotId pos1 = plotIds.get(0);
|
||||
final PlotBlock block = ((ClassicPlotWorld) plotworld).WALL_BLOCK;
|
||||
if (block.id != 0) {
|
||||
|
@ -116,7 +116,7 @@ public class HybridPop extends BlockPopulator {
|
||||
}
|
||||
this.X = cx << 4;
|
||||
this.Z = cz << 4;
|
||||
final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(w.getName());
|
||||
PlotSquared.getPlotManager(w.getName());
|
||||
final RegionWrapper plot = AChunkManager.CURRENT_PLOT_CLEAR;
|
||||
if (plot != null) {
|
||||
short sx = (short) ((this.X) % this.size);
|
||||
|
@ -88,7 +88,7 @@ public abstract class HybridUtils {
|
||||
|
||||
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 z = chunk.z << 4;
|
||||
final int ex = x + 15;
|
||||
@ -97,7 +97,7 @@ public abstract class HybridUtils {
|
||||
if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
|
||||
return false;
|
||||
}
|
||||
PlotManager manager = PlotSquared.getPlotManager(world);
|
||||
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||
final PlotId id1 = manager.getPlotId(plotworld, x, 0, z);
|
||||
final PlotId id2 = manager.getPlotId(plotworld, ex, 0, ez);
|
||||
boolean toCheck = false;
|
||||
|
@ -32,7 +32,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
}
|
||||
|
||||
@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);
|
||||
// get plot size
|
||||
final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH;
|
||||
@ -70,7 +70,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (plotworld == null) {
|
||||
return null;
|
||||
@ -99,7 +99,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
final boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
||||
if (northSouth && eastWest) {
|
||||
// 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 Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
||||
if (plot == null) {
|
||||
@ -112,7 +112,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
}
|
||||
if (northSouth) {
|
||||
// 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 Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
||||
if (plot == null) {
|
||||
@ -125,7 +125,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
}
|
||||
if (eastWest) {
|
||||
// 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 Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
||||
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 bottomZ = MainUtil.getPlotBottomLoc(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);
|
||||
int[] xb = new int[size];
|
||||
int[] zb = new int[size];
|
||||
int[] biomes = new int[size];
|
||||
final int size = ((topX - bottomX) + 1) * ((topZ - bottomZ) + 1);
|
||||
final int[] xb = new int[size];
|
||||
final int[] zb = new int[size];
|
||||
final int[] biomes = new int[size];
|
||||
int index = 0;
|
||||
for (int x = bottomX; x <= topX; x++) {
|
||||
for (int z = bottomZ; z <= topZ; z++) {
|
||||
|
@ -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)) {
|
||||
continue;
|
||||
}
|
||||
UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer));
|
||||
final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer));
|
||||
if (!plot.isAdded(uuid)) {
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer));
|
||||
final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(oPlayer));
|
||||
if (plot.isAdded(uuid)) {
|
||||
return oPlayer;
|
||||
}
|
||||
@ -99,15 +99,15 @@ public class ForceFieldListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlotEntry(final PlayerMoveEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Location loc = pp.getLocation();
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final Location loc = pp.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) {
|
||||
if (!PlotListener.booleanFlag(plot, "forcefield", false)) {
|
||||
UUID uuid = pp.getUUID();
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (plot.isAdded(uuid)) {
|
||||
final Set<Player> players = getNearbyPlayers(player, plot);
|
||||
for (final Player oPlayer : players) {
|
||||
|
@ -71,6 +71,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
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.StructureGrowEvent;
|
||||
import org.bukkit.event.world.WorldInitEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
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)
|
||||
public static void onChunkLoad(final ChunkLoadEvent event) {
|
||||
final String worldname = event.getWorld().getName();
|
||||
@ -145,7 +170,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (!player.hasPlayedBefore()) {
|
||||
player.saveData();
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final String username = pp.getName();
|
||||
final StringWrapper name = new StringWrapper(username);
|
||||
final UUID uuid = pp.getUUID();
|
||||
@ -190,7 +215,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
passed = false;
|
||||
}
|
||||
if (passed) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
MainUtil.sendMessage(pp, C.BORDER);
|
||||
return;
|
||||
}
|
||||
@ -198,7 +223,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
Plot plot = getCurrentPlot(t);
|
||||
if (plot != null) {
|
||||
if (plot.denied.size() > 0) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (plot.isDenied(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "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;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
return;
|
||||
}
|
||||
@ -272,7 +297,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
final Flag destroy = FlagManager.getPlotFlag(plot, "break");
|
||||
final Block block = event.getBlock();
|
||||
@ -288,7 +313,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
return;
|
||||
}
|
||||
@ -324,7 +349,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
final Iterator<Block> iter = event.blockList().iterator();
|
||||
while (iter.hasNext()) {
|
||||
final Block b = iter.next();
|
||||
iter.next();
|
||||
if (isPlotArea(loc)) {
|
||||
iter.remove();
|
||||
}
|
||||
@ -334,7 +359,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
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).noPerm = null;
|
||||
}
|
||||
@ -356,7 +381,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final Player p = (Player) e;
|
||||
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||
if (!isInPlot(loc)) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
event.setCancelled(true);
|
||||
@ -365,14 +390,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
final Plot plot = getCurrentPlot(loc);
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} 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 (isPlotArea(loc)) {
|
||||
@ -482,7 +507,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
public static void onBlockPistonExtend(final BlockPistonExtendEvent e) {
|
||||
if (isInPlot(BukkitUtil.getLocation(e.getBlock().getLocation()))) {
|
||||
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 (isPlotArea(BukkitUtil.getLocation(e.getBlock().getLocation()))) {
|
||||
e.setCancelled(true);
|
||||
@ -511,11 +536,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
final List<BlockState> blocks = e.getBlocks();
|
||||
boolean remove = false;
|
||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||
final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
|
||||
Plot plot = getCurrentPlot(loc);
|
||||
if (plot == null || !plot.hasOwner()) {
|
||||
final Plot plot = getCurrentPlot(loc);
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
e.getBlocks().remove(i);
|
||||
}
|
||||
}
|
||||
@ -539,7 +563,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (isInPlot(loc)) {
|
||||
final Plot plot = getCurrentPlot(loc);
|
||||
if (!plot.hasOwner()) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
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()))) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
return;
|
||||
@ -562,7 +586,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
return;
|
||||
}
|
||||
@ -578,7 +602,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (event.getEntity() instanceof Player) {
|
||||
return;
|
||||
}
|
||||
Location loc = BukkitUtil.getLocation(event.getLocation());
|
||||
final Location loc = BukkitUtil.getLocation(event.getLocation());
|
||||
final String world = loc.getWorld();
|
||||
if (!isPlotWorld(world)) {
|
||||
return;
|
||||
@ -602,28 +626,24 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public static void onBlockIgnite(final BlockIgniteEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
final Player player = e.getPlayer();
|
||||
final Block b = e.getBlock();
|
||||
final Location loc;
|
||||
if (b != null) {
|
||||
loc = BukkitUtil.getLocation(b.getLocation());
|
||||
}
|
||||
else {
|
||||
Entity ent = e.getIgnitingEntity();
|
||||
} else {
|
||||
final Entity ent = e.getIgnitingEntity();
|
||||
if (ent != null) {
|
||||
loc = BukkitUtil.getLocation(ent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (player != null) {
|
||||
loc = BukkitUtil.getLocation(player);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final String world;
|
||||
if (e.getBlock() != null) {
|
||||
world = e.getBlock().getWorld().getName();
|
||||
@ -649,7 +669,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
final Player p = e.getPlayer();
|
||||
if (!isInPlot(loc)) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
e.setCancelled(true);
|
||||
@ -658,19 +678,21 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
final Plot plot = getCurrentPlot(loc);
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!plot.isAdded(pp.getUUID())) if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (isPlotArea(loc)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (isPlotArea(loc)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -682,11 +704,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final Location f = BukkitUtil.getLocation(event.getFrom());
|
||||
final Location t = BukkitUtil.getLocation(event.getTo());
|
||||
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 (isInPlot(q)) {
|
||||
final Plot plot = getCurrentPlot(q);
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (plot.isDenied(pp.getUUID())) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.YOU_BE_DENIED);
|
||||
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 Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||
if (isPlotWorld(loc)) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
||||
if (!isInPlot(loc)) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
return;
|
||||
@ -760,7 +782,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
|
||||
@EventHandler
|
||||
public static void onLeave(final PlayerQuitEvent event) {
|
||||
String name = event.getPlayer().getName();
|
||||
final String name = event.getPlayer().getName();
|
||||
if (SetupUtils.setupMap.containsKey(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());
|
||||
if (isPlotWorld(loc)) {
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!isInPlot(loc)) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
return;
|
||||
@ -825,7 +847,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||
if (isPlotWorld(loc)) {
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!isInPlot(loc)) {
|
||||
if (!Permissions.hasPermission(pp, "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) {
|
||||
final Player p = (Player) r;
|
||||
final Location l = BukkitUtil.getLocation(e.getEntity());
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (isPlotWorld(l)) {
|
||||
if (!isInPlot(l)) {
|
||||
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());
|
||||
if (isPlotWorld(l)) {
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!isInPlot(l)) {
|
||||
if (!Permissions.hasPermission(pp, "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();
|
||||
if (d instanceof Player) {
|
||||
final Player p = (Player) d;
|
||||
final PlotWorld pW = PlotSquared.getPlotWorld(l.getWorld());
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
PlotSquared.getPlotWorld(l.getWorld());
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!isInPlot(l)) {
|
||||
if (!Permissions.hasPermission(pp, "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;
|
||||
}
|
||||
if (!isInPlot(l)) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.road");
|
||||
e.setCancelled(true);
|
||||
@ -1015,7 +1037,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
final Plot plot = getCurrentPlot(l);
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.unowned");
|
||||
e.setCancelled(true);
|
||||
@ -1028,7 +1050,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
assert plot != null;
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if ((a instanceof Monster) && FlagManager.isPlotFlagTrue(plot, "hostile-attack")) {
|
||||
return;
|
||||
@ -1060,7 +1082,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
|
||||
if (isPlotWorld(l)) {
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!isInPlot(l)) {
|
||||
if (!Permissions.hasPermission(pp, "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)) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin")) {
|
||||
return;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
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 {
|
||||
@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());
|
||||
if (isPlotWorld(l)) {
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
||||
e.getPlayer();
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
||||
if (!isInPlot(l)) {
|
||||
if (!Permissions.hasPermission(pp, "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);
|
||||
}
|
||||
} else {
|
||||
UUID uuid = pp.getUUID();
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (!plot.isAdded(uuid)) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
if (isPlotArea(l)) {
|
||||
|
@ -107,19 +107,19 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
}
|
||||
event.setCancelled(true);
|
||||
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player));
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(pp, C.NOT_IN_PLOT);
|
||||
return;
|
||||
}
|
||||
UUID uuid = pp.getUUID();
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (!plot.isAdded(uuid)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PLOT_PERMS);
|
||||
return;
|
||||
}
|
||||
final Set<Player> plotPlayers = new HashSet<>();
|
||||
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)) {
|
||||
plotPlayers.add(p);
|
||||
}
|
||||
@ -173,12 +173,12 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
@EventHandler
|
||||
public void onItemPickup(final PlayerPickupItemEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final Plot plot = MainUtil.getPlot(pp.getLocation());
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
UUID uuid = pp.getUUID();
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (plot.isAdded(uuid) && booleanFlag(plot, "drop-protection", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -187,12 +187,12 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
@EventHandler
|
||||
public void onItemDrop(final PlayerDropItemEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final Plot plot = MainUtil.getPlot(pp.getLocation());
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
UUID uuid = pp.getUUID();
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (plot.isAdded(uuid) && booleanFlag(plot, "item-drop", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -211,7 +211,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Player trespasser = event.getPlayer();
|
||||
PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
|
||||
final PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
|
||||
if (pp.getUUID().equals(pt.getUUID())) {
|
||||
return;
|
||||
}
|
||||
@ -227,8 +227,8 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(final PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName();
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName();
|
||||
if (feedRunnable.containsKey(name)) {
|
||||
feedRunnable.remove(name);
|
||||
}
|
||||
@ -239,14 +239,14 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlotLeave(final PlayerLeavePlotEvent event) {
|
||||
Player leaver = event.getPlayer();
|
||||
final Player leaver = event.getPlayer();
|
||||
leaver.playEffect(leaver.getLocation(), Effect.RECORD_PLAY, 0);
|
||||
final Plot plot = event.getPlot();
|
||||
if (FlagManager.getPlotFlag(plot, "farewell") != null) {
|
||||
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "farewell").getValueString()));
|
||||
}
|
||||
PlotPlayer pl = BukkitUtil.getPlayer(leaver);
|
||||
String name = pl.getName();
|
||||
final PlotPlayer pl = BukkitUtil.getPlayer(leaver);
|
||||
pl.getName();
|
||||
if (feedRunnable.containsKey(leaver)) {
|
||||
feedRunnable.remove(leaver);
|
||||
}
|
||||
|
@ -106,8 +106,8 @@ public class WorldEditListener implements Listener {
|
||||
if ((p.getItemInHand() == null) || (p.getItemInHand().getType() == Material.AIR)) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
com.intellectualcrafters.plot.object.Location loc = pp.getLocation();
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final com.intellectualcrafters.plot.object.Location loc = pp.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot != null) {
|
||||
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)
|
||||
public void onPlayerCommand(final PlayerCommandPreprocessEvent e) {
|
||||
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")) {
|
||||
return;
|
||||
}
|
||||
@ -170,7 +170,7 @@ public class WorldEditListener implements Listener {
|
||||
public void onPlayerJoin(final PlayerJoinEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
final Location l = p.getLocation();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (isPlotWorld(l)) {
|
||||
PWE.removeMask(pp);
|
||||
@ -178,7 +178,7 @@ public class WorldEditListener implements Listener {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
PWE.removeMask(pp);
|
||||
@ -193,14 +193,14 @@ public class WorldEditListener implements Listener {
|
||||
}
|
||||
final Location f = e.getFrom();
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (!PWE.hasMask(pp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
com.intellectualcrafters.plot.object.Location locf = BukkitUtil.getLocation(f);
|
||||
com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
|
||||
final com.intellectualcrafters.plot.object.Location locf = BukkitUtil.getLocation(f);
|
||||
final com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
|
||||
if ((locf.getX() != loct.getX()) || (locf.getZ() != loct.getZ())) {
|
||||
final PlotId idF = MainUtil.getPlotId(locf);
|
||||
final PlotId idT = MainUtil.getPlotId(loct);
|
||||
@ -212,8 +212,8 @@ public class WorldEditListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPortal(final PlayerPortalEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final Player p = e.getPlayer();
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
return;
|
||||
}
|
||||
@ -224,7 +224,7 @@ public class WorldEditListener implements Listener {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@ -236,14 +236,14 @@ public class WorldEditListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onTeleport(final PlayerTeleportEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (!PWE.hasMask(pp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
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();
|
||||
if (!PlotSquared.isPlotWorld(loct.getWorld())) {
|
||||
if (isPlotWorld(f)) {
|
||||
|
@ -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.
|
||||
* @param player
|
||||
*/
|
||||
public BukkitOfflinePlayer(OfflinePlayer player) {
|
||||
public BukkitOfflinePlayer(final OfflinePlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return player.getUniqueId();
|
||||
return this.player.getUniqueId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastPlayed() {
|
||||
return player.getLastPlayed();
|
||||
return this.player.getLastPlayed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return player.isOnline();
|
||||
return this.player.isOnline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return player.getName();
|
||||
return this.player.getName();
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
* @param player
|
||||
*/
|
||||
public BukkitPlayer(Player player) {
|
||||
public BukkitPlayer(final Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@ -39,29 +39,29 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String perm) {
|
||||
if (noPerm.contains(perm)) {
|
||||
public boolean hasPermission(final String perm) {
|
||||
if (this.noPerm.contains(perm)) {
|
||||
return false;
|
||||
}
|
||||
if (hasPerm.contains(perm)) {
|
||||
if (this.hasPerm.contains(perm)) {
|
||||
return true;
|
||||
}
|
||||
boolean result = player.hasPermission(perm);
|
||||
final boolean result = this.player.hasPermission(perm);
|
||||
if (!result) {
|
||||
noPerm.add(perm);
|
||||
this.noPerm.add(perm);
|
||||
return false;
|
||||
}
|
||||
hasPerm.add(perm);
|
||||
this.hasPerm.add(perm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
public void sendMessage(final String message) {
|
||||
this.player.sendMessage(message);
|
||||
}
|
||||
|
||||
@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()));
|
||||
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
boolean result = this.player.isOp();
|
||||
final boolean result = this.player.isOp();
|
||||
if (!result) {
|
||||
this.op = 1;
|
||||
return false;
|
||||
@ -86,7 +86,7 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
@Override
|
||||
public String getName() {
|
||||
if (this.name == null) {
|
||||
this.name = player.getName();
|
||||
this.name = this.player.getName();
|
||||
}
|
||||
return this.name;
|
||||
}
|
||||
@ -97,8 +97,8 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassTarget(Location loc) {
|
||||
player.setCompassTarget(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ()));
|
||||
public void setCompassTarget(final Location loc) {
|
||||
this.player.setCompassTarget(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class InfoInventory implements InventoryHolder {
|
||||
}
|
||||
|
||||
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 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");
|
||||
|
@ -61,9 +61,7 @@ public abstract class PlotWorld {
|
||||
// make non static and static_default_valu + add config option
|
||||
public static int[] BLOCKS;
|
||||
static {
|
||||
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
|
||||
};
|
||||
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 };
|
||||
}
|
||||
public final String worldname;
|
||||
public boolean AUTO_MERGE;
|
||||
@ -109,7 +107,7 @@ public abstract class PlotWorld {
|
||||
this.SCHEMATIC_FILE = config.getString("schematic.file");
|
||||
this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim");
|
||||
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.MERGE_PRICE = config.getDouble("economy.prices.merge");
|
||||
this.SELL_PRICE = config.getDouble("economy.prices.sell");
|
||||
|
@ -6,19 +6,19 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
||||
public class EconHandler {
|
||||
// TODO economy shit
|
||||
public static double getBalance(PlotPlayer player) {
|
||||
public static double getBalance(final PlotPlayer player) {
|
||||
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);
|
||||
}
|
||||
|
||||
public static void depositPlayer(PlotPlayer player, double amount) {
|
||||
public static void depositPlayer(final PlotPlayer player, final double 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);
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ public class ExpireManager {
|
||||
continue;
|
||||
}
|
||||
final BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||
if ((op == null) || op.getLastPlayed() == 0) {
|
||||
if ((op == null) || (op.getLastPlayed() == 0)) {
|
||||
continue;
|
||||
}
|
||||
long last = op.getLastPlayed();
|
||||
|
@ -847,7 +847,7 @@ public class MainUtil {
|
||||
|
||||
public static boolean sendMessage(final PlotPlayer plr, String msg, final boolean prefix) {
|
||||
msg = colorise('&', msg);
|
||||
String prefixStr = colorise('&', C.PREFIX.s());
|
||||
final String prefixStr = colorise('&', C.PREFIX.s());
|
||||
if ((msg.length() > 0) && !msg.equals("")) {
|
||||
if (plr == null) {
|
||||
PlotSquared.log(prefixStr + msg);
|
||||
@ -931,18 +931,18 @@ public class MainUtil {
|
||||
* @param plr
|
||||
* @param msg Was used to wrap the chat client length (Packets out--)
|
||||
*/
|
||||
public static void sendMessageWrapped(final PlotPlayer plr, String msg) {
|
||||
// if (msg.length() > 65) {
|
||||
// final String[] ss = wordWrap(msg, 65);
|
||||
// final StringBuilder b = new StringBuilder();
|
||||
// for (final String p : ss) {
|
||||
// b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n ");
|
||||
// }
|
||||
// msg = b.toString();
|
||||
// }
|
||||
// if (msg.endsWith("\n")) {
|
||||
// msg = msg.substring(0, msg.length() - 2);
|
||||
// }
|
||||
public static void sendMessageWrapped(final PlotPlayer plr, final String msg) {
|
||||
// if (msg.length() > 65) {
|
||||
// final String[] ss = wordWrap(msg, 65);
|
||||
// final StringBuilder b = new StringBuilder();
|
||||
// for (final String p : ss) {
|
||||
// b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n ");
|
||||
// }
|
||||
// msg = b.toString();
|
||||
// }
|
||||
// if (msg.endsWith("\n")) {
|
||||
// msg = msg.substring(0, msg.length() - 2);
|
||||
// }
|
||||
plr.sendMessage(msg);
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ public class MainUtil {
|
||||
* @param p
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -235,17 +235,17 @@ public class ReflectionUtils {
|
||||
Collections.addAll(methods, this.clazz.getMethods());
|
||||
Collections.addAll(methods, this.clazz.getDeclaredMethods());
|
||||
findMethod: for (final Method m : methods) {
|
||||
final Class<?>[] methodTypes = m.getParameterTypes();
|
||||
if (methodTypes.length != classes.length) {
|
||||
continue;
|
||||
}
|
||||
for (final Class aClass : classes) {
|
||||
if (!Arrays.equals(classes, methodTypes)) {
|
||||
continue findMethod;
|
||||
}
|
||||
return new RefMethod(m);
|
||||
}
|
||||
final Class<?>[] methodTypes = m.getParameterTypes();
|
||||
if (methodTypes.length != classes.length) {
|
||||
continue;
|
||||
}
|
||||
for (final Class aClass : classes) {
|
||||
if (!Arrays.equals(classes, methodTypes)) {
|
||||
continue findMethod;
|
||||
}
|
||||
return new RefMethod(m);
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("no such method");
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class BukkitPlayerFunctions {
|
||||
*/
|
||||
public static void clear(final Player player, final String world, final Plot plot, final boolean isDelete) {
|
||||
final long start = System.currentTimeMillis();
|
||||
Runnable whenDone = new Runnable() {
|
||||
final Runnable whenDone = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if ((player != null) && player.isOnline()) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.intellectualcrafters.plot.util.bukkit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.intellectualcrafters.plot.BukkitMain;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
@ -29,11 +28,11 @@ public class BukkitTaskManager extends TaskManager {
|
||||
|
||||
@Override
|
||||
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
|
||||
public void cancelTask(int task) {
|
||||
public void cancelTask(final int task) {
|
||||
if (task != -1) {
|
||||
Bukkit.getScheduler().cancelTask(task);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public class BukkitUtil extends BlockManager {
|
||||
private static Player lastPlayer = null;
|
||||
private static PlotPlayer lastPlotPlayer = null;
|
||||
|
||||
public static void removePlayer(String plr) {
|
||||
if (lastPlayer != null && lastPlayer.getName().equals(plr)) {
|
||||
public static void removePlayer(final String plr) {
|
||||
if ((lastPlayer != null) && lastPlayer.getName().equals(plr)) {
|
||||
lastPlayer = null;
|
||||
lastPlotPlayer = null;
|
||||
}
|
||||
@ -39,11 +39,11 @@ public class BukkitUtil extends BlockManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWorld(String world) {
|
||||
public boolean isWorld(final String world) {
|
||||
return getWorld(world) != null;
|
||||
}
|
||||
|
||||
public static PlotPlayer getPlayer(Player player) {
|
||||
public static PlotPlayer getPlayer(final Player player) {
|
||||
if (player == lastPlayer) {
|
||||
return lastPlotPlayer;
|
||||
}
|
||||
@ -58,7 +58,7 @@ public class BukkitUtil extends BlockManager {
|
||||
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());
|
||||
}
|
||||
|
||||
@ -188,22 +188,22 @@ public class BukkitUtil extends BlockManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void functionSetBiomes(String worldname, int[] x, int[] z, int[] biome) {
|
||||
World world = getWorld(worldname);
|
||||
Biome[] biomes = Biome.values();
|
||||
public void functionSetBiomes(final String worldname, final int[] x, final int[] z, final int[] biome) {
|
||||
final World world = getWorld(worldname);
|
||||
final Biome[] biomes = Biome.values();
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
world.setBiome(x[i], z[i], biomes[biome[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSign(Location loc) {
|
||||
Block block = getWorld(loc.getWorld()).getBlockAt(loc.getX(), loc.getY(), loc.getZ());
|
||||
public String[] getSign(final Location loc) {
|
||||
final Block block = getWorld(loc.getWorld()).getBlockAt(loc.getX(), loc.getY(), loc.getZ());
|
||||
if (block != null) {
|
||||
if (block.getState() instanceof Sign) {
|
||||
final Sign sign = (Sign) block.getState();
|
||||
@ -214,19 +214,19 @@ public class BukkitUtil extends BlockManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getSpawn(String world) {
|
||||
org.bukkit.Location temp = getWorld(world).getSpawnLocation();
|
||||
public Location getSpawn(final String world) {
|
||||
final org.bukkit.Location temp = getWorld(world).getSpawnLocation();
|
||||
return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeighestBlock(Location loc) {
|
||||
public int getHeighestBlock(final Location loc) {
|
||||
return getWorld(loc.getWorld()).getHighestBlockAt(loc.getX(), loc.getZ()).getY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeFromString(String biomeStr) {
|
||||
Biome biome = Biome.valueOf(biomeStr.toUpperCase());
|
||||
public int getBiomeFromString(final String biomeStr) {
|
||||
final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
|
||||
if (biome == null) {
|
||||
return -1;
|
||||
}
|
||||
@ -235,17 +235,17 @@ public class BukkitUtil extends BlockManager {
|
||||
|
||||
@Override
|
||||
public String[] getBiomeList() {
|
||||
Biome[] biomes = Biome.values();
|
||||
String[] list = new String[biomes.length];
|
||||
for (int i = 0; i< biomes.length; i++) {
|
||||
final Biome[] biomes = Biome.values();
|
||||
final String[] list = new String[biomes.length];
|
||||
for (int i = 0; i < biomes.length; i++) {
|
||||
list[i] = biomes[i].name();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockIdFromString(String block) {
|
||||
Material material = Material.valueOf(block.toUpperCase());
|
||||
public int getBlockIdFromString(final String block) {
|
||||
final Material material = Material.valueOf(block.toUpperCase());
|
||||
if (material == null) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -758,12 +758,12 @@ public class ChunkManager extends AChunkManager {
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
public class PWE {
|
||||
public static void setMask(final PlotPlayer p, final Location l, final boolean force) {
|
||||
try {
|
||||
LocalSession s = WorldEdit.getInstance().getSession(p.getName());
|
||||
final LocalSession s = WorldEdit.getInstance().getSession(p.getName());
|
||||
if (!PlotSquared.isPlotWorld(l.getWorld())) {
|
||||
removeMask(p);
|
||||
}
|
||||
@ -63,7 +63,6 @@ public class PWE {
|
||||
final Vector bvec = new Vector(bloc.getX() + 1, bloc.getY(), bloc.getZ() + 1);
|
||||
final Vector tvec = new Vector(tloc.getX(), tloc.getY(), tloc.getZ());
|
||||
|
||||
|
||||
// FIXME unchecked casting
|
||||
final LocalWorld lw = PlotSquared.worldEdit.wrapPlayer(((BukkitPlayer) p).player).getWorld();
|
||||
final CuboidRegion region = new CuboidRegion(lw, bvec, tvec);
|
||||
@ -85,7 +84,7 @@ public class PWE {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -96,7 +95,7 @@ public class PWE {
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setNoMask(final PlotPlayer p) {
|
||||
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 Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
|
||||
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
|
||||
@ -112,7 +111,7 @@ public class PWE {
|
||||
|
||||
public static void removeMask(final PlotPlayer p) {
|
||||
try {
|
||||
LocalSession s = WorldEdit.getInstance().getSession(p.getName());
|
||||
final LocalSession s = WorldEdit.getInstance().getSession(p.getName());
|
||||
removeMask(p, s);
|
||||
} catch (final Exception e) {
|
||||
// throw new
|
||||
|
@ -17,10 +17,10 @@ public abstract class SetBlockManager extends AbstractSetBlock {
|
||||
public abstract void update(List<Chunk> list);
|
||||
|
||||
@Override
|
||||
public void update(String worldname, List<ChunkLoc> chunkLocs) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
for (ChunkLoc loc : chunkLocs) {
|
||||
public void update(final String worldname, final List<ChunkLoc> chunkLocs) {
|
||||
final World world = BukkitUtil.getWorld(worldname);
|
||||
final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
for (final ChunkLoc loc : chunkLocs) {
|
||||
chunks.add(world.getChunkAt(loc.x, loc.z));
|
||||
}
|
||||
setBlockManager.update(chunks);
|
||||
|
@ -77,7 +77,7 @@ public class UUIDHandler {
|
||||
return uuidMap.containsKey(name);
|
||||
}
|
||||
|
||||
public static void cacheAll(String world) {
|
||||
public static void cacheAll(final String world) {
|
||||
if (CACHED) {
|
||||
return;
|
||||
}
|
||||
@ -168,8 +168,8 @@ public class UUIDHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PlotPlayer getPlayer(UUID uuid) {
|
||||
for (PlotPlayer player : players.values()) {
|
||||
public static PlotPlayer getPlayer(final UUID uuid) {
|
||||
for (final PlotPlayer player : players.values()) {
|
||||
if (player.getUUID().equals(uuid)) {
|
||||
return player;
|
||||
}
|
||||
@ -177,7 +177,7 @@ public class UUIDHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PlotPlayer getPlayer(String name) {
|
||||
public static PlotPlayer getPlayer(final String name) {
|
||||
return players.get(name);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user