This commit is contained in:
boy0001 2014-10-06 22:42:49 +11:00
parent dc80fce05d
commit 1dd0b5de5f
4 changed files with 24 additions and 15 deletions

View File

@ -423,7 +423,7 @@ public class PlotHelper {
public static boolean createPlot(Player player, Plot plot) {
@SuppressWarnings("deprecation")
World w = plot.getWorld();
Plot p = new Plot(plot.id, player.getUniqueId(), plot.settings.getBiome(), null, null, w.getName());
Plot p = new Plot(plot.id, player.getUniqueId(), plot.settings.getBiome(), new ArrayList<UUID>(), new ArrayList<UUID>(), w.getName());
PlotMain.updatePlot(p);
DBFunc.createPlot(p);
DBFunc.createPlotSettings(DBFunc.getId(w.getName(), p.id), p);
@ -824,10 +824,12 @@ public class PlotHelper {
int startZ = (pos1.getBlockZ() / 16) * 16;
int chunkX = 16 + pos2.getBlockX();
int chunkZ = 16 + pos2.getBlockZ();
int plotMinX = getPlotBottomLoc(world, plot.id).getBlockX() + 1;
int plotMinZ = getPlotBottomLoc(world, plot.id).getBlockZ() + 1;
int plotMaxX = getPlotTopLoc(world, plot.id).getBlockX();
int plotMaxZ = getPlotTopLoc(world, plot.id).getBlockZ();
Location l1 = getPlotBottomLoc(world, plot.id);
Location l2 = getPlotTopLoc(world, plot.id);
int plotMinX = l1.getBlockX() + 1;
int plotMinZ = l1.getBlockZ() + 1;
int plotMaxX = l2.getBlockX();
int plotMaxZ = l2.getBlockZ();
Location min = null;
Location max = null;
for (int i = startX; i < chunkX; i += 16) {
@ -878,7 +880,7 @@ public class PlotHelper {
if (max.getBlockX() > plotMaxX) {
max.setX(plotMaxX);
}
if (max.getBlockX() > plotMaxZ) {
if (max.getBlockZ() > plotMaxZ) {
max.setZ(plotMaxZ);
}

View File

@ -65,7 +65,7 @@ public enum Command {
/**
*
*/
DELETE("delete", "d", new CommandPermission("plots.clear.delete")),
DELETE("delete", "d", new CommandPermission("plots.delete")),
/**
*
*/

View File

@ -38,7 +38,7 @@ public class Delete extends SubCommand {
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
return false;
}
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId()))) && !plr.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}

View File

@ -31,10 +31,9 @@ public class Denied extends SubCommand {
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS);
}
@SuppressWarnings("deprecated")
private boolean hasBeenOnServer(String name) {
Player plr;
if ((plr = Bukkit.getPlayer(name)) == null) {
Player plr = Bukkit.getPlayerExact(name);
if (plr == null) {
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
if (oplr == null) {
return false;
@ -78,11 +77,15 @@ public class Denied extends SubCommand {
return true;
}
UUID uuid = null;
if ((Bukkit.getPlayer(args[1]) != null) && Bukkit.getPlayer(args[1]).isOnline()) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
if ((Bukkit.getPlayerExact(args[1]) != null)) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}
if (uuid == null) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
@ -112,8 +115,8 @@ public class Denied extends SubCommand {
return true;
}
UUID uuid = null;
if (Bukkit.getPlayer(args[1]).isOnline()) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
if (Bukkit.getPlayerExact(args[1])!=null) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}
@ -121,6 +124,10 @@ public class Denied extends SubCommand {
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
return true;
}
if (uuid == null) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
plot.removeDenied(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);