mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Trusted/Helpers changes
This commit is contained in:
parent
bde2e45e6b
commit
7c643ed535
@ -29,8 +29,8 @@ public class Helpers extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasBeenOnServer(String name) {
|
private boolean hasBeenOnServer(String name) {
|
||||||
Player plr;
|
Player plr = Bukkit.getPlayerExact(name);
|
||||||
if ((plr = Bukkit.getPlayer(name)) == null) {
|
if (plr == null) {
|
||||||
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
||||||
if (oplr == null) {
|
if (oplr == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -74,11 +74,15 @@ public class Helpers extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if ((Bukkit.getPlayer(args[1]) != null) && Bukkit.getPlayer(args[1]).isOnline()) {
|
if ((Bukkit.getPlayerExact(args[1]) != null)) {
|
||||||
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
if (uuid == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
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);
|
||||||
@ -101,11 +105,15 @@ public class Helpers extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if (Bukkit.getPlayer(args[1]).isOnline()) {
|
if (Bukkit.getPlayerExact(args[1]) != null) {
|
||||||
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
if (uuid == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!plot.helpers.contains(uuid)) {
|
if (!plot.helpers.contains(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
||||||
return true;
|
return true;
|
||||||
|
@ -29,8 +29,8 @@ public class Trusted extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasBeenOnServer(String name) {
|
private boolean hasBeenOnServer(String name) {
|
||||||
Player plr;
|
Player plr = Bukkit.getPlayerExact(name);
|
||||||
if ((plr = Bukkit.getPlayer(name)) == null) {
|
if (plr == null) {
|
||||||
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
||||||
if (oplr == null) {
|
if (oplr == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -74,11 +74,15 @@ public class Trusted extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if ((Bukkit.getPlayer(args[1]) != null) && Bukkit.getPlayer(args[1]).isOnline()) {
|
if ((Bukkit.getPlayerExact(args[1]) != null)) {
|
||||||
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
if (uuid == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
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);
|
||||||
@ -101,11 +105,15 @@ public class Trusted extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if (Bukkit.getPlayer(args[1]).isOnline()) {
|
if (Bukkit.getPlayerExact(args[1]) != null) {
|
||||||
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
if (uuid == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!plot.trusted.contains(uuid)) {
|
if (!plot.trusted.contains(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
|
PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
|
||||||
return true;
|
return true;
|
||||||
|
@ -456,13 +456,12 @@ public class PlayerEvents implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onStructureGrow(final StructureGrowEvent e) {
|
public void onStructureGrow(final StructureGrowEvent e) {
|
||||||
List<BlockState> blocks = e.getBlocks();
|
List<BlockState> blocks = e.getBlocks();
|
||||||
boolean f = false;
|
boolean remove = false;
|
||||||
for (int i = 0; i < blocks.size(); i++) {
|
for (int i = blocks.size() -1; i >= 0; i--) {
|
||||||
if (f || isPlotWorld(blocks.get(i).getLocation())) {
|
if (remove || isPlotWorld(blocks.get(i).getLocation())) {
|
||||||
f = true;
|
remove = true;
|
||||||
if (!isInPlot(blocks.get(i).getLocation())) {
|
if (!isInPlot(blocks.get(i).getLocation())) {
|
||||||
e.getBlocks().remove(i);
|
e.getBlocks().remove(i);
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user