mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Rename DBFunc#everyone to DBFunc#EVERYONE, and create two string constants 🐱
This commit is contained in:
parent
3c64376abe
commit
a8b4729845
@ -100,7 +100,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
UUID owner = UUIDHandler.getUUID(name, null);
|
UUID owner = UUIDHandler.getUUID(name, null);
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
if ("*".equals(name)) {
|
if ("*".equals(name)) {
|
||||||
owner = DBFunc.everyone;
|
owner = DBFunc.EVERYONE;
|
||||||
} else {
|
} else {
|
||||||
if (checkUUID || checkUUID2) {
|
if (checkUUID || checkUUID2) {
|
||||||
byte[] bytes = resultSet.getBytes(column);
|
byte[] bytes = resultSet.getBytes(column);
|
||||||
@ -165,7 +165,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
UUID denied = UUIDHandler.getUUID(name, null);
|
UUID denied = UUIDHandler.getUUID(name, null);
|
||||||
if (denied == null) {
|
if (denied == null) {
|
||||||
if ("*".equals(name)) {
|
if ("*".equals(name)) {
|
||||||
denied = DBFunc.everyone;
|
denied = DBFunc.EVERYONE;
|
||||||
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
||||||
byte[] bytes = resultSet.getBytes("playerid");
|
byte[] bytes = resultSet.getBytes("playerid");
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
@ -200,7 +200,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
UUID helper = UUIDHandler.getUUID(name, null);
|
UUID helper = UUIDHandler.getUUID(name, null);
|
||||||
if (helper == null) {
|
if (helper == null) {
|
||||||
if ("*".equals(name)) {
|
if ("*".equals(name)) {
|
||||||
helper = DBFunc.everyone;
|
helper = DBFunc.EVERYONE;
|
||||||
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
||||||
byte[] bytes = resultSet.getBytes("playerid");
|
byte[] bytes = resultSet.getBytes("playerid");
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
|
@ -102,7 +102,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
UUID owner = UUIDHandler.getUUID(name, null);
|
UUID owner = UUIDHandler.getUUID(name, null);
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
if (name.equals("*")) {
|
if (name.equals("*")) {
|
||||||
owner = DBFunc.everyone;
|
owner = DBFunc.EVERYONE;
|
||||||
} else {
|
} else {
|
||||||
if (checkUUID) {
|
if (checkUUID) {
|
||||||
byte[] bytes = resultSet.getBytes("ownerid");
|
byte[] bytes = resultSet.getBytes("ownerid");
|
||||||
@ -148,7 +148,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String player = resultSet.getString("player");
|
String player = resultSet.getString("player");
|
||||||
UUID denied = player.equals("*") ? DBFunc.everyone : UUID.fromString(player);
|
UUID denied = player.equals("*") ? DBFunc.EVERYONE : UUID.fromString(player);
|
||||||
plot.getDenied().add(denied);
|
plot.getDenied().add(denied);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String player = resultSet.getString("player");
|
String player = resultSet.getString("player");
|
||||||
UUID allowed = player.equals("*") ? DBFunc.everyone : UUID.fromString(player);
|
UUID allowed = player.equals("*") ? DBFunc.EVERYONE : UUID.fromString(player);
|
||||||
plot.getTrusted().add(allowed);
|
plot.getTrusted().add(allowed);
|
||||||
}
|
}
|
||||||
resultSet.close();
|
resultSet.close();
|
||||||
|
@ -678,8 +678,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
|
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
|
||||||
.equals(event.getTo().getWorld())) {
|
.equals(event.getTo().getWorld())) {
|
||||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
|
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
|
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
org.bukkit.Location to = event.getTo();
|
org.bukkit.Location to = event.getTo();
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -796,14 +796,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Set last location
|
// Set last location
|
||||||
Location loc = BukkitUtil.getLocation(to);
|
Location loc = BukkitUtil.getLocation(to);
|
||||||
pp.setMeta("location", loc);
|
pp.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(loc);
|
Plot now = area.getPlot(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -857,14 +857,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Set last location
|
// Set last location
|
||||||
Location loc = BukkitUtil.getLocation(to);
|
Location loc = BukkitUtil.getLocation(to);
|
||||||
pp.setMeta("location", loc);
|
pp.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(loc);
|
Plot now = area.getPlot(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -1094,8 +1094,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
// Delete last location
|
// Delete last location
|
||||||
pp.deleteMeta("location");
|
pp.deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
Plot plot = (Plot) pp.deleteMeta("lastplot");
|
Plot plot = (Plot) pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
plotExit(pp, plot);
|
plotExit(pp, plot);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
startUuidCatching();
|
startUuidCatching();
|
||||||
} else {
|
} else {
|
||||||
// Start these separately
|
// Start these separately
|
||||||
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
|
UUIDHandler.add(new StringWrapper("*"), DBFunc.EVERYONE);
|
||||||
startExpiryTasks();
|
startExpiryTasks();
|
||||||
startPlotMeConversion();
|
startPlotMeConversion();
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
debug("Starting UUID caching");
|
debug("Starting UUID caching");
|
||||||
UUIDHandler.startCaching(new Runnable() {
|
UUIDHandler.startCaching(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
|
UUIDHandler.add(new StringWrapper("*"), DBFunc.EVERYONE);
|
||||||
foreachPlotRaw(new RunnableVal<Plot>() {
|
foreachPlotRaw(new RunnableVal<Plot>() {
|
||||||
@Override public void run(Plot plot) {
|
@Override public void run(Plot plot) {
|
||||||
if (plot.hasOwner() && plot.temp != -1) {
|
if (plot.hasOwner() && plot.temp != -1) {
|
||||||
|
@ -37,7 +37,7 @@ public class Add extends Command {
|
|||||||
int size = plot.getTrusted().size() + plot.getMembers().size();
|
int size = plot.getTrusted().size() + plot.getMembers().size();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iter.next();
|
||||||
if (uuid == DBFunc.everyone && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
|
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
@ -63,7 +63,7 @@ public class Add extends Command {
|
|||||||
@Override // Success
|
@Override // Success
|
||||||
public void run() {
|
public void run() {
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
if (uuid != DBFunc.everyone) {
|
if (uuid != DBFunc.EVERYONE) {
|
||||||
if (!plot.removeTrusted(uuid)) {
|
if (!plot.removeTrusted(uuid)) {
|
||||||
if (plot.getDenied().contains(uuid)) {
|
if (plot.getDenied().contains(uuid)) {
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
|
@ -349,22 +349,22 @@ import java.util.*;
|
|||||||
Command cmd = MainCommand.getInstance().getCommand(args[3]);
|
Command cmd = MainCommand.getInstance().getCommand(args[3]);
|
||||||
String[] params = Arrays.copyOfRange(args, 4, args.length);
|
String[] params = Arrays.copyOfRange(args, 4, args.length);
|
||||||
if ("true".equals(args[1])) {
|
if ("true".equals(args[1])) {
|
||||||
Location loc = player.getMeta("location");
|
Location loc = player.getMeta(PlotPlayer.META_LOCATION);
|
||||||
Plot plot = player.getMeta("lastplot");
|
Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
for (Plot current : PlotSquared.get().getBasePlots()) {
|
for (Plot current : PlotSquared.get().getBasePlots()) {
|
||||||
player.setMeta("location", current.getBottomAbs());
|
player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs());
|
||||||
player.setMeta("lastplot", current);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, current);
|
||||||
cmd.execute(player, params, null, null);
|
cmd.execute(player, params, null, null);
|
||||||
}
|
}
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
player.deleteMeta("location");
|
player.deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
} else {
|
} else {
|
||||||
player.setMeta("location", loc);
|
player.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
}
|
}
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
player.deleteMeta("lastplot");
|
player.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
} else {
|
} else {
|
||||||
player.setMeta("lastplot", plot);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
|
||||||
}
|
}
|
||||||
player.sendMessage("&c> " + (System.currentTimeMillis() - start));
|
player.sendMessage("&c> " + (System.currentTimeMillis() - start));
|
||||||
return true;
|
return true;
|
||||||
|
@ -46,7 +46,7 @@ public class Deny extends SubCommand {
|
|||||||
Iterator<UUID> iter = uuids.iterator();
|
Iterator<UUID> iter = uuids.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iter.next();
|
||||||
if (uuid == DBFunc.everyone && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions
|
Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) {
|
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
@ -61,13 +61,13 @@ public class Deny extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid != DBFunc.everyone) {
|
if (uuid != DBFunc.EVERYONE) {
|
||||||
plot.removeMember(uuid);
|
plot.removeMember(uuid);
|
||||||
plot.removeTrusted(uuid);
|
plot.removeTrusted(uuid);
|
||||||
}
|
}
|
||||||
plot.addDenied(uuid);
|
plot.addDenied(uuid);
|
||||||
EventUtil.manager.callDenied(player, plot, uuid, true);
|
EventUtil.manager.callDenied(player, plot, uuid, true);
|
||||||
if (!uuid.equals(DBFunc.everyone)) {
|
if (!uuid.equals(DBFunc.EVERYONE)) {
|
||||||
handleKick(UUIDHandler.getPlayer(uuid), plot);
|
handleKick(UUIDHandler.getPlayer(uuid), plot);
|
||||||
} else {
|
} else {
|
||||||
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
|
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
|
||||||
|
@ -92,8 +92,8 @@ public class Info extends SubCommand {
|
|||||||
}
|
}
|
||||||
boolean hasOwner = plot.hasOwner();
|
boolean hasOwner = plot.hasOwner();
|
||||||
// Wildcard player {added}
|
// Wildcard player {added}
|
||||||
boolean containsEveryone = plot.getTrusted().contains(DBFunc.everyone);
|
boolean containsEveryone = plot.getTrusted().contains(DBFunc.EVERYONE);
|
||||||
boolean trustedEveryone = plot.getMembers().contains(DBFunc.everyone);
|
boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE);
|
||||||
// Unclaimed?
|
// Unclaimed?
|
||||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||||
MainUtil
|
MainUtil
|
||||||
|
@ -43,7 +43,7 @@ public class Kick extends SubCommand {
|
|||||||
}
|
}
|
||||||
Set<PlotPlayer> players = new HashSet<>();
|
Set<PlotPlayer> players = new HashSet<>();
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.EVERYONE) {
|
||||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||||
if (pp == player || Permissions
|
if (pp == player || Permissions
|
||||||
.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
||||||
|
@ -206,12 +206,12 @@ import java.util.Arrays;
|
|||||||
Location newLoc = newPlot.getCenter();
|
Location newLoc = newPlot.getCenter();
|
||||||
if (player.canTeleport(newLoc)) {
|
if (player.canTeleport(newLoc)) {
|
||||||
// Save meta
|
// Save meta
|
||||||
loc = player.getMeta("location");
|
loc = player.getMeta(PlotPlayer.META_LOCATION);
|
||||||
plot = player.getMeta("lastplot");
|
plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
tp = true;
|
tp = true;
|
||||||
// Set loc
|
// Set loc
|
||||||
player.setMeta("location", newLoc);
|
player.setMeta(PlotPlayer.META_LOCATION, newLoc);
|
||||||
player.setMeta("lastplot", newPlot);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, newPlot);
|
||||||
} else {
|
} else {
|
||||||
C.BORDER.send(player);
|
C.BORDER.send(player);
|
||||||
}
|
}
|
||||||
@ -269,14 +269,14 @@ import java.util.Arrays;
|
|||||||
// Reset command scope //
|
// Reset command scope //
|
||||||
if (tp && !(player instanceof ConsolePlayer)) {
|
if (tp && !(player instanceof ConsolePlayer)) {
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
player.deleteMeta("location");
|
player.deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
} else {
|
} else {
|
||||||
player.setMeta("location", loc);
|
player.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
}
|
}
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
player.deleteMeta("lastplot");
|
player.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
} else {
|
} else {
|
||||||
player.setMeta("lastplot", plot);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class Remove extends SubCommand {
|
|||||||
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
||||||
if (!uuids.isEmpty()) {
|
if (!uuids.isEmpty()) {
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.EVERYONE) {
|
||||||
if (plot.removeTrusted(uuid)) {
|
if (plot.removeTrusted(uuid)) {
|
||||||
EventUtil.manager.callTrusted(player, plot, uuid, false);
|
EventUtil.manager.callTrusted(player, plot, uuid, false);
|
||||||
count++;
|
count++;
|
||||||
|
@ -38,7 +38,7 @@ public class Trust extends Command {
|
|||||||
int size = plot.getTrusted().size() + plot.getMembers().size();
|
int size = plot.getTrusted().size() + plot.getMembers().size();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iter.next();
|
||||||
if (uuid == DBFunc.everyone && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
|
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
@ -64,7 +64,7 @@ public class Trust extends Command {
|
|||||||
@Override // Success
|
@Override // Success
|
||||||
public void run() {
|
public void run() {
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
if (uuid != DBFunc.everyone) {
|
if (uuid != DBFunc.EVERYONE) {
|
||||||
if (!plot.removeMember(uuid)) {
|
if (!plot.removeMember(uuid)) {
|
||||||
if (plot.getDenied().contains(uuid)) {
|
if (plot.getDenied().contains(uuid)) {
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
|
@ -9,7 +9,7 @@ import java.util.*;
|
|||||||
public interface AbstractDB {
|
public interface AbstractDB {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The UUID that will count as everyone.
|
* The UUID that will count as EVERYONE.
|
||||||
*/
|
*/
|
||||||
UUID everyone = UUID.fromString("1-1-3-3-7");
|
UUID everyone = UUID.fromString("1-1-3-3-7");
|
||||||
|
|
||||||
|
@ -17,7 +17,9 @@ public class DBFunc {
|
|||||||
/**
|
/**
|
||||||
* The "global" uuid.
|
* The "global" uuid.
|
||||||
*/
|
*/
|
||||||
public static final UUID everyone = UUID.fromString("1-1-3-3-7");
|
// TODO: Use this instead. public static final UUID EVERYONE = UUID.fromString("4aa2aaa4-c06b-485c-bc58-186aa1780d9b");
|
||||||
|
public static final UUID EVERYONE = UUID.fromString("1-1-3-3-7");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Database Manager
|
* Abstract Database Manager
|
||||||
*/
|
*/
|
||||||
|
@ -21,14 +21,14 @@ public class PlotListener {
|
|||||||
.hasPermission(player, "plots.admin.entry.denied")) {
|
.hasPermission(player, "plots.admin.entry.denied")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot last = player.getMeta("lastplot");
|
Plot last = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if ((last != null) && !last.getId().equals(plot.getId())) {
|
if ((last != null) && !last.getId().equals(plot.getId())) {
|
||||||
plotExit(player, last);
|
plotExit(player, last);
|
||||||
}
|
}
|
||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
ExpireManager.IMP.handleEntry(player, plot);
|
ExpireManager.IMP.handleEntry(player, plot);
|
||||||
}
|
}
|
||||||
player.setMeta("lastplot", plot);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
|
||||||
EventUtil.manager.callEntry(player, plot);
|
EventUtil.manager.callEntry(player, plot);
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
Map<Flag<?>, Object> flags = FlagManager.getPlotFlags(plot);
|
Map<Flag<?>, Object> flags = FlagManager.getPlotFlags(plot);
|
||||||
@ -160,7 +160,7 @@ public class PlotListener {
|
|||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
Plot lastPlot = player.getMeta("lastplot");
|
Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId())) {
|
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId())) {
|
||||||
Map<String, String> replacements = new HashMap<>();
|
Map<String, String> replacements = new HashMap<>();
|
||||||
replacements.put("%x%", String.valueOf(lastPlot.getId().x));
|
replacements.put("%x%", String.valueOf(lastPlot.getId().x));
|
||||||
@ -185,7 +185,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean plotExit(final PlotPlayer player, Plot plot) {
|
public static boolean plotExit(final PlotPlayer player, Plot plot) {
|
||||||
Object previous = player.deleteMeta("lastplot");
|
Object previous = player.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
EventUtil.manager.callLeave(player, plot);
|
EventUtil.manager.callLeave(player, plot);
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
PlotArea pw = plot.getArea();
|
PlotArea pw = plot.getArea();
|
||||||
@ -194,7 +194,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
if (Flags.DENY_EXIT.isTrue(plot)) {
|
if (Flags.DENY_EXIT.isTrue(plot)) {
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
player.setMeta("lastplot", previous);
|
player.setMeta(PlotPlayer.META_LAST_PLOT, previous);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class ConsolePlayer extends PlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUID getUUID() {
|
@Override public UUID getUUID() {
|
||||||
return DBFunc.everyone;
|
return DBFunc.EVERYONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public long getLastPlayed() {
|
@Override public long getLastPlayed() {
|
||||||
@ -66,8 +66,8 @@ public class ConsolePlayer extends PlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void teleport(Location location) {
|
@Override public void teleport(Location location) {
|
||||||
setMeta("lastplot", location.getPlot());
|
setMeta(PlotPlayer.META_LAST_PLOT, location.getPlot());
|
||||||
setMeta("location", location);
|
setMeta(PlotPlayer.META_LOCATION, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean isOnline() {
|
@Override public boolean isOnline() {
|
||||||
|
@ -384,10 +384,10 @@ public class Plot {
|
|||||||
if (getMembers().contains(uuid)) {
|
if (getMembers().contains(uuid)) {
|
||||||
return isOnline();
|
return isOnline();
|
||||||
}
|
}
|
||||||
if (getTrusted().contains(uuid) || getTrusted().contains(DBFunc.everyone)) {
|
if (getTrusted().contains(uuid) || getTrusted().contains(DBFunc.EVERYONE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (getMembers().contains(DBFunc.everyone)) {
|
if (getMembers().contains(DBFunc.EVERYONE)) {
|
||||||
return isOnline();
|
return isOnline();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -400,7 +400,7 @@ public class Plot {
|
|||||||
* @return boolean false if the player is allowed to enter
|
* @return boolean false if the player is allowed to enter
|
||||||
*/
|
*/
|
||||||
public boolean isDenied(UUID uuid) {
|
public boolean isDenied(UUID uuid) {
|
||||||
return this.denied != null && (this.denied.contains(DBFunc.everyone) && !this.isAdded(uuid)
|
return this.denied != null && (this.denied.contains(DBFunc.EVERYONE) && !this.isAdded(uuid)
|
||||||
|| !this.isAdded(uuid) && this.denied.contains(uuid));
|
|| !this.isAdded(uuid) && this.denied.contains(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1737,7 +1737,7 @@ public class Plot {
|
|||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public boolean removeDenied(UUID uuid) {
|
public boolean removeDenied(UUID uuid) {
|
||||||
if (uuid == DBFunc.everyone && !denied.contains(uuid)) {
|
if (uuid == DBFunc.EVERYONE && !denied.contains(uuid)) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(getDenied())) {
|
for (UUID other : new HashSet<>(getDenied())) {
|
||||||
result = rmvDenied(other) || result;
|
result = rmvDenied(other) || result;
|
||||||
@ -1765,7 +1765,7 @@ public class Plot {
|
|||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public boolean removeTrusted(UUID uuid) {
|
public boolean removeTrusted(UUID uuid) {
|
||||||
if (uuid == DBFunc.everyone && !trusted.contains(uuid)) {
|
if (uuid == DBFunc.EVERYONE && !trusted.contains(uuid)) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(getTrusted())) {
|
for (UUID other : new HashSet<>(getTrusted())) {
|
||||||
result = rmvTrusted(other) || result;
|
result = rmvTrusted(other) || result;
|
||||||
@ -1796,7 +1796,7 @@ public class Plot {
|
|||||||
if (this.members == null) {
|
if (this.members == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid == DBFunc.everyone && !members.contains(uuid)) {
|
if (uuid == DBFunc.EVERYONE && !members.contains(uuid)) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(this.members)) {
|
for (UUID other : new HashSet<>(this.members)) {
|
||||||
result = rmvMember(other) || result;
|
result = rmvMember(other) || result;
|
||||||
|
@ -691,7 +691,7 @@ public abstract class PlotArea {
|
|||||||
|
|
||||||
public boolean addPlot(Plot plot) {
|
public boolean addPlot(Plot plot) {
|
||||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||||
pp.setMeta("lastplot", plot);
|
pp.setMeta(PlotPlayer.META_LAST_PLOT, plot);
|
||||||
}
|
}
|
||||||
return this.plots.put(plot.getId(), plot) == null;
|
return this.plots.put(plot.getId(), plot) == null;
|
||||||
}
|
}
|
||||||
@ -730,7 +730,7 @@ public abstract class PlotArea {
|
|||||||
public boolean addPlotIfAbsent(Plot plot) {
|
public boolean addPlotIfAbsent(Plot plot) {
|
||||||
if (this.plots.putIfAbsent(plot.getId(), plot) == null) {
|
if (this.plots.putIfAbsent(plot.getId(), plot) == null) {
|
||||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||||
pp.setMeta("lastplot", plot);
|
pp.setMeta(PlotPlayer.META_LAST_PLOT, plot);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -69,13 +69,13 @@ public class PlotCluster {
|
|||||||
|
|
||||||
public boolean isAdded(UUID uuid) {
|
public boolean isAdded(UUID uuid) {
|
||||||
return this.owner.equals(uuid) || this.invited.contains(uuid) || this.invited
|
return this.owner.equals(uuid) || this.invited.contains(uuid) || this.invited
|
||||||
.contains(DBFunc.everyone) || this.helpers.contains(uuid) || this.helpers
|
.contains(DBFunc.EVERYONE) || this.helpers.contains(uuid) || this.helpers
|
||||||
.contains(DBFunc.everyone);
|
.contains(DBFunc.EVERYONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasHelperRights(UUID uuid) {
|
public boolean hasHelperRights(UUID uuid) {
|
||||||
return this.owner.equals(uuid) || this.helpers.contains(uuid) || this.helpers
|
return this.owner.equals(uuid) || this.helpers.contains(uuid) || this.helpers
|
||||||
.contains(DBFunc.everyone);
|
.contains(DBFunc.EVERYONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -22,6 +22,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
* The abstract class supporting {@code BukkitPlayer} and {@code SpongePlayer}.
|
* The abstract class supporting {@code BukkitPlayer} and {@code SpongePlayer}.
|
||||||
*/
|
*/
|
||||||
public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||||
|
|
||||||
|
public static final String META_LAST_PLOT = "lastplot";
|
||||||
|
public static final String META_LOCATION = "location";
|
||||||
|
|
||||||
private Map<String, byte[]> metaMap = new HashMap<>();
|
private Map<String, byte[]> metaMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +123,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
* @return the plot the player is standing on or null if standing on a road or not in a {@link PlotArea}
|
* @return the plot the player is standing on or null if standing on a road or not in a {@link PlotArea}
|
||||||
*/
|
*/
|
||||||
public Plot getCurrentPlot() {
|
public Plot getCurrentPlot() {
|
||||||
Plot value = getMeta("lastplot");
|
Plot value = getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (value == null && !Settings.Enabled_Components.EVENTS) {
|
if (value == null && !Settings.Enabled_Components.EVENTS) {
|
||||||
return getLocation().getPlot();
|
return getLocation().getPlot();
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ public class MainUtil {
|
|||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
return C.NONE.s();
|
return C.NONE.s();
|
||||||
}
|
}
|
||||||
if (owner.equals(DBFunc.everyone)) {
|
if (owner.equals(DBFunc.EVERYONE)) {
|
||||||
return C.EVERYONE.s();
|
return C.EVERYONE.s();
|
||||||
}
|
}
|
||||||
String name = UUIDHandler.getName(owner);
|
String name = UUIDHandler.getName(owner);
|
||||||
@ -686,7 +686,7 @@ public class MainUtil {
|
|||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
if ("*".equals(name)) {
|
if ("*".equals(name)) {
|
||||||
result.add(DBFunc.everyone);
|
result.add(DBFunc.EVERYONE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (name.length() > 16) {
|
if (name.length() > 16) {
|
||||||
|
@ -429,7 +429,7 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getAccountAge(Plot plot) {
|
public long getAccountAge(Plot plot) {
|
||||||
if (!plot.hasOwner() || Objects.equals(DBFunc.everyone, plot.owner)
|
if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.owner)
|
||||||
|| UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
|
|| UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
|
||||||
return Long.MAX_VALUE;
|
return Long.MAX_VALUE;
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getAge(Plot plot) {
|
public long getAge(Plot plot) {
|
||||||
if (!plot.hasOwner() || Objects.equals(DBFunc.everyone, plot.owner)
|
if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.owner)
|
||||||
|| UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
|
|| UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -372,8 +372,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
if (event.getTo() == null || event.getFrom() == null) {
|
if (event.getTo() == null || event.getFrom() == null) {
|
||||||
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
|
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
|
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cn.nukkit.level.Location from = event.getFrom();
|
cn.nukkit.level.Location from = event.getFrom();
|
||||||
@ -386,14 +386,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Set last location
|
// Set last location
|
||||||
Location loc = NukkitUtil.getLocation(to);
|
Location loc = NukkitUtil.getLocation(to);
|
||||||
pp.setMeta("location", loc);
|
pp.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(loc);
|
Plot now = area.getPlot(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -447,11 +447,11 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
pp.setMeta("location", loc);
|
pp.setMeta("location", loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(loc);
|
Plot now = area.getPlot(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -505,14 +505,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Set last location
|
// Set last location
|
||||||
Location loc = NukkitUtil.getLocation(to);
|
Location loc = NukkitUtil.getLocation(to);
|
||||||
pp.setMeta("location", loc);
|
pp.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(loc);
|
Plot now = area.getPlot(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -563,14 +563,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Set last location
|
// Set last location
|
||||||
Location loc = NukkitUtil.getLocation(to);
|
Location loc = NukkitUtil.getLocation(to);
|
||||||
pp.setMeta("location", loc);
|
pp.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(loc);
|
Plot now = area.getPlot(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
|
@ -668,11 +668,11 @@ import java.util.function.Predicate;
|
|||||||
pp.setMeta("location", loc);
|
pp.setMeta("location", loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlotAbs(loc);
|
Plot now = area.getPlotAbs(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !PlotListener.plotExit(pp, lastPlot)) {
|
if (lastPlot != null && !PlotListener.plotExit(pp, lastPlot)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -715,14 +715,14 @@ import java.util.function.Predicate;
|
|||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Set last location
|
// Set last location
|
||||||
Location loc = SpongeUtil.getLocation(to);
|
Location loc = SpongeUtil.getLocation(to);
|
||||||
pp.setMeta("location", loc);
|
pp.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
pp.deleteMeta("lastplot");
|
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlotAbs(loc);
|
Plot now = area.getPlotAbs(loc);
|
||||||
Plot lastPlot = pp.getMeta("lastplot");
|
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if (lastPlot != null && !PlotListener.plotExit(pp, lastPlot)) {
|
if (lastPlot != null && !PlotListener.plotExit(pp, lastPlot)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
|
Loading…
Reference in New Issue
Block a user