It's probably better to put it here actually.

This commit is contained in:
Jesse Boyd 2014-10-18 11:37:30 -07:00
parent 6c614d1eec
commit 9ba5e3f91b
4 changed files with 39 additions and 27 deletions

View File

@ -219,10 +219,8 @@ public class Plot implements Cloneable {
* @param uuid * @param uuid
*/ */
public void addDenied(UUID uuid) { public void addDenied(UUID uuid) {
if (!denied.contains(uuid)) {
this.denied.add(uuid); this.denied.add(uuid);
} }
}
/** /**
* Add someone as a helper (use DBFunc as well) * Add someone as a helper (use DBFunc as well)
@ -230,10 +228,8 @@ public class Plot implements Cloneable {
* @param uuid * @param uuid
*/ */
public void addHelper(UUID uuid) { public void addHelper(UUID uuid) {
if (!helpers.contains(uuid)) {
this.helpers.add(uuid); this.helpers.add(uuid);
} }
}
/** /**
* Add someone as a trusted user (use DBFunc as well) * Add someone as a trusted user (use DBFunc as well)
@ -241,10 +237,8 @@ public class Plot implements Cloneable {
* @param uuid * @param uuid
*/ */
public void addTrusted(UUID uuid) { public void addTrusted(UUID uuid) {
if (!trusted.contains(uuid)) {
this.trusted.add(uuid); this.trusted.add(uuid);
} }
}
/** /**
* Get plot display name * Get plot display name

View File

@ -48,8 +48,12 @@ public class Denied extends SubCommand {
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
if (args[1].equalsIgnoreCase("*")) { if (args[1].equalsIgnoreCase("*")) {
UUID uuid = DBFunc.everyone; UUID uuid = DBFunc.everyone;
if (!plot.denied.contains(uuid)) {
plot.addDenied(uuid); plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED); PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
return true; return true;
} }
@ -63,10 +67,12 @@ public class Denied extends SubCommand {
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } * C.PLAYER_HAS_NOT_BEEN_ON); return true; }
*/ */
UUID uuid = UUIDHandler.getUUID(args[1]); UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.denied.contains(uuid)) {
plot.addDenied(uuid); plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED); PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
if ((Bukkit.getPlayer(uuid) != null) && Bukkit.getPlayer(uuid).isOnline()) { if ((Bukkit.getPlayer(uuid) != null) && Bukkit.getPlayer(uuid).isOnline()) {
Plot pl = PlayerFunctions.getCurrentPlot(Bukkit.getPlayer((uuid))); Plot pl = PlayerFunctions.getCurrentPlot(Bukkit.getPlayer((uuid)));

View File

@ -45,8 +45,12 @@ public class Helpers extends SubCommand {
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
if (args[1].equalsIgnoreCase("*")) { if (args[1].equalsIgnoreCase("*")) {
UUID uuid = DBFunc.everyone; UUID uuid = DBFunc.everyone;
if (!plot.helpers.contains(uuid)) {
plot.addHelper(uuid); plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED); PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
return true; return true;
} }
@ -60,10 +64,12 @@ public class Helpers extends SubCommand {
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } * C.PLAYER_HAS_NOT_BEEN_ON); return true; }
*/ */
UUID uuid = UUIDHandler.getUUID(args[1]); UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.helpers.contains(uuid)) {
plot.addHelper(uuid); plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true); PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED); PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
} }
else else

View File

@ -45,8 +45,12 @@ public class Trusted extends SubCommand {
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
if (args[1].equalsIgnoreCase("*")) { if (args[1].equalsIgnoreCase("*")) {
UUID uuid = DBFunc.everyone; UUID uuid = DBFunc.everyone;
if (!plot.trusted.contains(uuid)) {
plot.addTrusted(uuid); plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED); PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
return true; return true;
} }
@ -60,10 +64,12 @@ public class Trusted extends SubCommand {
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } * C.PLAYER_HAS_NOT_BEEN_ON); return true; }
*/ */
UUID uuid = UUIDHandler.getUUID(args[1]); UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.trusted.contains(uuid)) {
plot.addTrusted(uuid); plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1])); DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true); PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
}
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED); PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
} }
else else