Rename DBFunc#everyone to DBFunc#EVERYONE, and create two string constants 🐱

This commit is contained in:
sauilitired 2018-11-14 23:51:56 +01:00
parent 3c64376abe
commit a8b4729845
24 changed files with 95 additions and 89 deletions

View File

@ -100,7 +100,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
UUID owner = UUIDHandler.getUUID(name, null);
if (owner == null) {
if ("*".equals(name)) {
owner = DBFunc.everyone;
owner = DBFunc.EVERYONE;
} else {
if (checkUUID || checkUUID2) {
byte[] bytes = resultSet.getBytes(column);
@ -165,7 +165,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
UUID denied = UUIDHandler.getUUID(name, null);
if (denied == null) {
if ("*".equals(name)) {
denied = DBFunc.everyone;
denied = DBFunc.EVERYONE;
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
byte[] bytes = resultSet.getBytes("playerid");
if (bytes != null) {
@ -200,7 +200,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
UUID helper = UUIDHandler.getUUID(name, null);
if (helper == null) {
if ("*".equals(name)) {
helper = DBFunc.everyone;
helper = DBFunc.EVERYONE;
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
byte[] bytes = resultSet.getBytes("playerid");
if (bytes != null) {

View File

@ -102,7 +102,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
UUID owner = UUIDHandler.getUUID(name, null);
if (owner == null) {
if (name.equals("*")) {
owner = DBFunc.everyone;
owner = DBFunc.EVERYONE;
} else {
if (checkUUID) {
byte[] bytes = resultSet.getBytes("ownerid");
@ -148,7 +148,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
continue;
}
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);
}
@ -166,7 +166,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
continue;
}
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);
}
resultSet.close();

View File

@ -678,8 +678,8 @@ public class PlayerEvents extends PlotListener implements Listener {
public void onTeleport(PlayerTeleportEvent event) {
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
.equals(event.getTo().getWorld())) {
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
org.bukkit.Location to = event.getTo();
if (to != null) {
Player player = event.getPlayer();
@ -796,14 +796,14 @@ public class PlayerEvents extends PlotListener implements Listener {
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
// Set last location
Location loc = BukkitUtil.getLocation(to);
pp.setMeta("location", loc);
pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
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());
// Set last location
Location loc = BukkitUtil.getLocation(to);
pp.setMeta("location", loc);
pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
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();
PlotPlayer pp = BukkitUtil.getPlayer(player);
// Delete last location
pp.deleteMeta("location");
Plot plot = (Plot) pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LOCATION);
Plot plot = (Plot) pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
if (plot != null) {
plotExit(pp, plot);
}

View File

@ -160,7 +160,7 @@ import java.util.zip.ZipInputStream;
startUuidCatching();
} else {
// Start these separately
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
UUIDHandler.add(new StringWrapper("*"), DBFunc.EVERYONE);
startExpiryTasks();
startPlotMeConversion();
}
@ -326,7 +326,7 @@ import java.util.zip.ZipInputStream;
debug("Starting UUID caching");
UUIDHandler.startCaching(new Runnable() {
@Override public void run() {
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
UUIDHandler.add(new StringWrapper("*"), DBFunc.EVERYONE);
foreachPlotRaw(new RunnableVal<Plot>() {
@Override public void run(Plot plot) {
if (plot.hasOwner() && plot.temp != -1) {

View File

@ -37,7 +37,7 @@ public class Add extends Command {
int size = plot.getTrusted().size() + plot.getMembers().size();
while (iter.hasNext()) {
UUID uuid = iter.next();
if (uuid == DBFunc.everyone && !(
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
@ -63,7 +63,7 @@ public class Add extends Command {
@Override // Success
public void run() {
for (UUID uuid : uuids) {
if (uuid != DBFunc.everyone) {
if (uuid != DBFunc.EVERYONE) {
if (!plot.removeTrusted(uuid)) {
if (plot.getDenied().contains(uuid)) {
plot.removeDenied(uuid);

View File

@ -349,22 +349,22 @@ import java.util.*;
Command cmd = MainCommand.getInstance().getCommand(args[3]);
String[] params = Arrays.copyOfRange(args, 4, args.length);
if ("true".equals(args[1])) {
Location loc = player.getMeta("location");
Plot plot = player.getMeta("lastplot");
Location loc = player.getMeta(PlotPlayer.META_LOCATION);
Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
for (Plot current : PlotSquared.get().getBasePlots()) {
player.setMeta("location", current.getBottomAbs());
player.setMeta("lastplot", current);
player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs());
player.setMeta(PlotPlayer.META_LAST_PLOT, current);
cmd.execute(player, params, null, null);
}
if (loc == null) {
player.deleteMeta("location");
player.deleteMeta(PlotPlayer.META_LOCATION);
} else {
player.setMeta("location", loc);
player.setMeta(PlotPlayer.META_LOCATION, loc);
}
if (plot == null) {
player.deleteMeta("lastplot");
player.deleteMeta(PlotPlayer.META_LAST_PLOT);
} else {
player.setMeta("lastplot", plot);
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
}
player.sendMessage("&c> " + (System.currentTimeMillis() - start));
return true;

View File

@ -46,7 +46,7 @@ public class Deny extends SubCommand {
Iterator<UUID> iter = uuids.iterator();
while (iter.hasNext()) {
UUID uuid = iter.next();
if (uuid == DBFunc.everyone && !(
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) {
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));
return false;
}
if (uuid != DBFunc.everyone) {
if (uuid != DBFunc.EVERYONE) {
plot.removeMember(uuid);
plot.removeTrusted(uuid);
}
plot.addDenied(uuid);
EventUtil.manager.callDenied(player, plot, uuid, true);
if (!uuid.equals(DBFunc.everyone)) {
if (!uuid.equals(DBFunc.EVERYONE)) {
handleKick(UUIDHandler.getPlayer(uuid), plot);
} else {
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {

View File

@ -92,8 +92,8 @@ public class Info extends SubCommand {
}
boolean hasOwner = plot.hasOwner();
// Wildcard player {added}
boolean containsEveryone = plot.getTrusted().contains(DBFunc.everyone);
boolean trustedEveryone = plot.getMembers().contains(DBFunc.everyone);
boolean containsEveryone = plot.getTrusted().contains(DBFunc.EVERYONE);
boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE);
// Unclaimed?
if (!hasOwner && !containsEveryone && !trustedEveryone) {
MainUtil

View File

@ -43,7 +43,7 @@ public class Kick extends SubCommand {
}
Set<PlotPlayer> players = new HashSet<>();
for (UUID uuid : uuids) {
if (uuid == DBFunc.everyone) {
if (uuid == DBFunc.EVERYONE) {
for (PlotPlayer pp : plot.getPlayersInPlot()) {
if (pp == player || Permissions
.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) {

View File

@ -206,12 +206,12 @@ import java.util.Arrays;
Location newLoc = newPlot.getCenter();
if (player.canTeleport(newLoc)) {
// Save meta
loc = player.getMeta("location");
plot = player.getMeta("lastplot");
loc = player.getMeta(PlotPlayer.META_LOCATION);
plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
tp = true;
// Set loc
player.setMeta("location", newLoc);
player.setMeta("lastplot", newPlot);
player.setMeta(PlotPlayer.META_LOCATION, newLoc);
player.setMeta(PlotPlayer.META_LAST_PLOT, newPlot);
} else {
C.BORDER.send(player);
}
@ -269,14 +269,14 @@ import java.util.Arrays;
// Reset command scope //
if (tp && !(player instanceof ConsolePlayer)) {
if (loc == null) {
player.deleteMeta("location");
player.deleteMeta(PlotPlayer.META_LOCATION);
} else {
player.setMeta("location", loc);
player.setMeta(PlotPlayer.META_LOCATION, loc);
}
if (plot == null) {
player.deleteMeta("lastplot");
player.deleteMeta(PlotPlayer.META_LAST_PLOT);
} else {
player.setMeta("lastplot", plot);
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
}
}
}

View File

@ -65,7 +65,7 @@ public class Remove extends SubCommand {
Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
if (!uuids.isEmpty()) {
for (UUID uuid : uuids) {
if (uuid == DBFunc.everyone) {
if (uuid == DBFunc.EVERYONE) {
if (plot.removeTrusted(uuid)) {
EventUtil.manager.callTrusted(player, plot, uuid, false);
count++;

View File

@ -38,7 +38,7 @@ public class Trust extends Command {
int size = plot.getTrusted().size() + plot.getMembers().size();
while (iter.hasNext()) {
UUID uuid = iter.next();
if (uuid == DBFunc.everyone && !(
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
@ -64,7 +64,7 @@ public class Trust extends Command {
@Override // Success
public void run() {
for (UUID uuid : uuids) {
if (uuid != DBFunc.everyone) {
if (uuid != DBFunc.EVERYONE) {
if (!plot.removeMember(uuid)) {
if (plot.getDenied().contains(uuid)) {
plot.removeDenied(uuid);

View File

@ -9,7 +9,7 @@ import java.util.*;
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");

View File

@ -17,7 +17,9 @@ public class DBFunc {
/**
* 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
*/

View File

@ -21,14 +21,14 @@ public class PlotListener {
.hasPermission(player, "plots.admin.entry.denied")) {
return false;
}
Plot last = player.getMeta("lastplot");
Plot last = player.getMeta(PlotPlayer.META_LAST_PLOT);
if ((last != null) && !last.getId().equals(plot.getId())) {
plotExit(player, last);
}
if (ExpireManager.IMP != null) {
ExpireManager.IMP.handleEntry(player, plot);
}
player.setMeta("lastplot", plot);
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
EventUtil.manager.callEntry(player, plot);
if (plot.hasOwner()) {
Map<Flag<?>, Object> flags = FlagManager.getPlotFlags(plot);
@ -160,7 +160,7 @@ public class PlotListener {
.isEmpty()) {
TaskManager.runTaskLaterAsync(new Runnable() {
@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())) {
Map<String, String> replacements = new HashMap<>();
replacements.put("%x%", String.valueOf(lastPlot.getId().x));
@ -185,7 +185,7 @@ public class PlotListener {
}
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);
if (plot.hasOwner()) {
PlotArea pw = plot.getArea();
@ -194,7 +194,7 @@ public class PlotListener {
}
if (Flags.DENY_EXIT.isTrue(plot)) {
if (previous != null) {
player.setMeta("lastplot", previous);
player.setMeta(PlotPlayer.META_LAST_PLOT, previous);
}
return false;
}

View File

@ -46,7 +46,7 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override public UUID getUUID() {
return DBFunc.everyone;
return DBFunc.EVERYONE;
}
@Override public long getLastPlayed() {
@ -66,8 +66,8 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override public void teleport(Location location) {
setMeta("lastplot", location.getPlot());
setMeta("location", location);
setMeta(PlotPlayer.META_LAST_PLOT, location.getPlot());
setMeta(PlotPlayer.META_LOCATION, location);
}
@Override public boolean isOnline() {

View File

@ -384,10 +384,10 @@ public class Plot {
if (getMembers().contains(uuid)) {
return isOnline();
}
if (getTrusted().contains(uuid) || getTrusted().contains(DBFunc.everyone)) {
if (getTrusted().contains(uuid) || getTrusted().contains(DBFunc.EVERYONE)) {
return true;
}
if (getMembers().contains(DBFunc.everyone)) {
if (getMembers().contains(DBFunc.EVERYONE)) {
return isOnline();
}
return false;
@ -400,7 +400,7 @@ public class Plot {
* @return boolean false if the player is allowed to enter
*/
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));
}
@ -1737,7 +1737,7 @@ public class Plot {
* @param uuid
*/
public boolean removeDenied(UUID uuid) {
if (uuid == DBFunc.everyone && !denied.contains(uuid)) {
if (uuid == DBFunc.EVERYONE && !denied.contains(uuid)) {
boolean result = false;
for (UUID other : new HashSet<>(getDenied())) {
result = rmvDenied(other) || result;
@ -1765,7 +1765,7 @@ public class Plot {
* @param uuid
*/
public boolean removeTrusted(UUID uuid) {
if (uuid == DBFunc.everyone && !trusted.contains(uuid)) {
if (uuid == DBFunc.EVERYONE && !trusted.contains(uuid)) {
boolean result = false;
for (UUID other : new HashSet<>(getTrusted())) {
result = rmvTrusted(other) || result;
@ -1796,7 +1796,7 @@ public class Plot {
if (this.members == null) {
return false;
}
if (uuid == DBFunc.everyone && !members.contains(uuid)) {
if (uuid == DBFunc.EVERYONE && !members.contains(uuid)) {
boolean result = false;
for (UUID other : new HashSet<>(this.members)) {
result = rmvMember(other) || result;

View File

@ -691,7 +691,7 @@ public abstract class PlotArea {
public boolean addPlot(Plot plot) {
for (PlotPlayer pp : plot.getPlayersInPlot()) {
pp.setMeta("lastplot", plot);
pp.setMeta(PlotPlayer.META_LAST_PLOT, plot);
}
return this.plots.put(plot.getId(), plot) == null;
}
@ -730,7 +730,7 @@ public abstract class PlotArea {
public boolean addPlotIfAbsent(Plot plot) {
if (this.plots.putIfAbsent(plot.getId(), plot) == null) {
for (PlotPlayer pp : plot.getPlayersInPlot()) {
pp.setMeta("lastplot", plot);
pp.setMeta(PlotPlayer.META_LAST_PLOT, plot);
}
return true;
}

View File

@ -69,13 +69,13 @@ public class PlotCluster {
public boolean isAdded(UUID uuid) {
return this.owner.equals(uuid) || this.invited.contains(uuid) || this.invited
.contains(DBFunc.everyone) || this.helpers.contains(uuid) || this.helpers
.contains(DBFunc.everyone);
.contains(DBFunc.EVERYONE) || this.helpers.contains(uuid) || this.helpers
.contains(DBFunc.EVERYONE);
}
public boolean hasHelperRights(UUID uuid) {
return this.owner.equals(uuid) || this.helpers.contains(uuid) || this.helpers
.contains(DBFunc.everyone);
.contains(DBFunc.EVERYONE);
}
public String getName() {

View File

@ -22,6 +22,10 @@ import java.util.concurrent.atomic.AtomicInteger;
* The abstract class supporting {@code BukkitPlayer} and {@code SpongePlayer}.
*/
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<>();
/**
@ -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}
*/
public Plot getCurrentPlot() {
Plot value = getMeta("lastplot");
Plot value = getMeta(PlotPlayer.META_LAST_PLOT);
if (value == null && !Settings.Enabled_Components.EVENTS) {
return getLocation().getPlot();
}

View File

@ -329,7 +329,7 @@ public class MainUtil {
if (owner == null) {
return C.NONE.s();
}
if (owner.equals(DBFunc.everyone)) {
if (owner.equals(DBFunc.EVERYONE)) {
return C.EVERYONE.s();
}
String name = UUIDHandler.getName(owner);
@ -686,7 +686,7 @@ public class MainUtil {
return Collections.emptySet();
}
if ("*".equals(name)) {
result.add(DBFunc.everyone);
result.add(DBFunc.EVERYONE);
continue;
}
if (name.length() > 16) {

View File

@ -429,7 +429,7 @@ public class ExpireManager {
}
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) {
return Long.MAX_VALUE;
}
@ -442,7 +442,7 @@ public class ExpireManager {
}
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) {
return 0;
}

View File

@ -372,8 +372,8 @@ public class PlayerEvents extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event) {
if (event.getTo() == null || event.getFrom() == null) {
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
NukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
cn.nukkit.level.Location from = event.getFrom();
@ -386,14 +386,14 @@ public class PlayerEvents extends PlotListener implements Listener {
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
// Set last location
Location loc = NukkitUtil.getLocation(to);
pp.setMeta("location", loc);
pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
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);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
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());
// Set last location
Location loc = NukkitUtil.getLocation(to);
pp.setMeta("location", loc);
pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
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());
// Set last location
Location loc = NukkitUtil.getLocation(to);
pp.setMeta("location", loc);
pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);

View File

@ -668,11 +668,11 @@ import java.util.function.Predicate;
pp.setMeta("location", loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlotAbs(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !PlotListener.plotExit(pp, lastPlot)) {
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());
// Set last location
Location loc = SpongeUtil.getLocation(to);
pp.setMeta("location", loc);
pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = loc.getPlotArea();
if (area == null) {
pp.deleteMeta("lastplot");
pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return;
}
Plot now = area.getPlotAbs(loc);
Plot lastPlot = pp.getMeta("lastplot");
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) {
if (lastPlot != null && !PlotListener.plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);