mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Variable renaming
This commit is contained in:
@ -25,8 +25,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
return false;
|
||||
}
|
||||
|
||||
Location loc = player.getLocation();
|
||||
Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -5,12 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Expression;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -123,7 +118,8 @@ public class Auto extends SubCommand {
|
||||
} else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) {
|
||||
plot.claim(player, true, schematic, false);
|
||||
if (area.AUTO_MERGE) {
|
||||
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
|
||||
plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(),
|
||||
true);
|
||||
}
|
||||
} else {
|
||||
DBFunc.delete(plot);
|
||||
|
@ -20,13 +20,14 @@ public class Claim extends SubCommand {
|
||||
if (args.length >= 1) {
|
||||
schematic = args[0];
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
int currentPlots =
|
||||
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
|
||||
int currentPlots = Settings.Limit.GLOBAL ?
|
||||
player.getPlotCount() :
|
||||
player.getPlotCount(location.getWorld());
|
||||
int grants = 0;
|
||||
if (currentPlots >= player.getAllowedPlots()) {
|
||||
if (player.hasPersistentMeta("grantedPlots")) {
|
||||
@ -89,7 +90,7 @@ public class Claim extends SubCommand {
|
||||
@Override public void run(Object value) {
|
||||
plot.claim(player, true, finalSchematic, false);
|
||||
if (area.AUTO_MERGE) {
|
||||
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
|
||||
plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), true);
|
||||
}
|
||||
}
|
||||
}), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED));
|
||||
|
@ -32,7 +32,7 @@ public class Comment extends SubCommand {
|
||||
StringMan.join(CommentManager.inboxes.keySet(), "|"));
|
||||
return false;
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
Location location = player.getLocation();
|
||||
PlotId id;
|
||||
try {
|
||||
id = PlotId.fromString(args[1]);
|
||||
@ -44,7 +44,7 @@ public class Comment extends SubCommand {
|
||||
int index;
|
||||
if (plot == null) {
|
||||
index = 1;
|
||||
plot = loc.getPlotAbs();
|
||||
plot = location.getPlotAbs();
|
||||
} else {
|
||||
if (args.length < 4) {
|
||||
sendMessage(player, Captions.COMMENT_SYNTAX,
|
||||
@ -59,7 +59,7 @@ public class Comment extends SubCommand {
|
||||
}
|
||||
String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " ");
|
||||
PlotComment comment =
|
||||
new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(),
|
||||
new PlotComment(location.getWorld(), id, message, player.getName(), inbox.toString(),
|
||||
System.currentTimeMillis());
|
||||
boolean result = inbox.addComment(plot, comment);
|
||||
if (!result) {
|
||||
|
@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
requiredType = RequiredType.NONE) public class Copy extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
Plot plot1 = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot1 = location.getPlotAbs();
|
||||
if (plot1 == null) {
|
||||
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
if (!(loc.getPlotArea() instanceof HybridPlotWorld)) {
|
||||
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
HybridUtils.manager.setupRoadSchematic(plot);
|
||||
|
@ -55,13 +55,13 @@ public class DebugClaimTest extends SubCommand {
|
||||
MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId());
|
||||
continue;
|
||||
}
|
||||
Location loc = manager.getSignLoc(plot);
|
||||
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||
Location location = manager.getSignLoc(plot);
|
||||
ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4);
|
||||
boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false);
|
||||
if (!result) {
|
||||
continue;
|
||||
}
|
||||
String[] lines = WorldUtil.IMP.getSign(loc);
|
||||
String[] lines = WorldUtil.IMP.getSign(location);
|
||||
if (lines != null) {
|
||||
String line = lines[2];
|
||||
if (line != null && line.length() > 2) {
|
||||
|
@ -369,17 +369,17 @@ import java.util.concurrent.CompletableFuture;
|
||||
Command cmd = MainCommand.getInstance().getCommand(args[3]);
|
||||
String[] params = Arrays.copyOfRange(args, 4, args.length);
|
||||
if ("true".equals(args[1])) {
|
||||
Location loc = player.getMeta(PlotPlayer.META_LOCATION);
|
||||
Location location = player.getMeta(PlotPlayer.META_LOCATION);
|
||||
Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||
for (Plot current : PlotSquared.get().getBasePlots()) {
|
||||
player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs());
|
||||
player.setMeta(PlotPlayer.META_LAST_PLOT, current);
|
||||
cmd.execute(player, params, null, null);
|
||||
}
|
||||
if (loc == null) {
|
||||
if (location == null) {
|
||||
player.deleteMeta(PlotPlayer.META_LOCATION);
|
||||
} else {
|
||||
player.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||
player.setMeta(PlotPlayer.META_LOCATION, location);
|
||||
}
|
||||
if (plot == null) {
|
||||
player.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||
|
@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -43,8 +42,8 @@ public class DebugRoadRegen extends SubCommand {
|
||||
}
|
||||
|
||||
public boolean regenPlot(PlotPlayer player) {
|
||||
Location loc = player.getLocation();
|
||||
PlotArea area = loc.getPlotArea();
|
||||
Location location = player.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
@ -82,8 +81,8 @@ public class DebugRoadRegen extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
Location loc = player.getLocation();
|
||||
PlotArea area = loc.getPlotArea();
|
||||
Location location = player.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
|
@ -3,8 +3,16 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Expression;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
|
||||
@CommandDeclaration(command = "delete", permission = "plots.delete",
|
||||
@ -16,8 +24,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
// The syntax also works with any command: /plot <plot> <command>
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
@ -30,8 +38,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
}
|
||||
final PlotArea plotArea = plot.getArea();
|
||||
final java.util.Set<Plot> plots = plot.getConnectedPlots();
|
||||
final int currentPlots =
|
||||
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
|
||||
final int currentPlots = Settings.Limit.GLOBAL ?
|
||||
player.getPlotCount() :
|
||||
player.getPlotCount(location.getWorld());
|
||||
Runnable run = new Runnable() {
|
||||
@Override public void run() {
|
||||
if (plot.getRunning() > 0) {
|
||||
|
@ -97,8 +97,8 @@ import java.util.UUID;
|
||||
if (player.getGameMode() == PlotGameMode.SPECTATOR) {
|
||||
player.stopSpectating();
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld());
|
||||
Location location = player.getLocation();
|
||||
Location spawn = WorldUtil.IMP.getSpawn(location.getWorld());
|
||||
MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED);
|
||||
if (plot.equals(spawn.getPlot())) {
|
||||
Location newSpawn =
|
||||
|
@ -19,8 +19,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
|
||||
requiredType = RequiredType.NONE) public class Done extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ import java.util.*;
|
||||
"/plot flag <set|remove|add|list|info>");
|
||||
return false;
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
return false;
|
||||
|
@ -193,7 +193,7 @@ public class MainCommand extends Command {
|
||||
// Clear perm caching //
|
||||
player.deleteMeta("perm");
|
||||
// Optional command scope //
|
||||
Location loc = null;
|
||||
Location location = null;
|
||||
Plot plot = null;
|
||||
boolean tp = false;
|
||||
if (args.length >= 2) {
|
||||
@ -205,7 +205,7 @@ public class MainCommand extends Command {
|
||||
Location newLoc = newPlot.getCenter();
|
||||
if (player.canTeleport(newLoc)) {
|
||||
// Save meta
|
||||
loc = player.getMeta(PlotPlayer.META_LOCATION);
|
||||
location = player.getMeta(PlotPlayer.META_LOCATION);
|
||||
plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||
tp = true;
|
||||
// Set loc
|
||||
@ -262,10 +262,10 @@ public class MainCommand extends Command {
|
||||
}
|
||||
// Reset command scope //
|
||||
if (tp && !(player instanceof ConsolePlayer)) {
|
||||
if (loc == null) {
|
||||
if (location == null) {
|
||||
player.deleteMeta(PlotPlayer.META_LOCATION);
|
||||
} else {
|
||||
player.setMeta(PlotPlayer.META_LOCATION, loc);
|
||||
player.setMeta(PlotPlayer.META_LOCATION, location);
|
||||
}
|
||||
if (plot == null) {
|
||||
player.deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||
|
@ -52,8 +52,8 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocationFull();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocationFull();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
@ -135,8 +135,8 @@ public class Merge extends SubCommand {
|
||||
if (direction == Direction.ALL) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
|
||||
MainUtil.sendMessage(player,
|
||||
Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw())));
|
||||
MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated()
|
||||
.replaceAll("%dir%", direction(location.getYaw())));
|
||||
return false;
|
||||
}
|
||||
final boolean terrain;
|
||||
|
@ -15,8 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
requiredType = RequiredType.PLAYER) public class Move extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
Plot plot1 = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot1 = location.getPlotAbs();
|
||||
if (plot1 == null) {
|
||||
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -20,8 +24,8 @@ import java.util.Locale;
|
||||
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait");
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
public abstract class SetCommand extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
Plot plot = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -25,11 +25,10 @@ public class SetHome extends SetCommand {
|
||||
}
|
||||
case "":
|
||||
Plot base = plot.getBasePlot(false);
|
||||
Location bot = base.getBottomAbs();
|
||||
Location loc = player.getLocationFull();
|
||||
BlockLoc rel =
|
||||
new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(),
|
||||
loc.getYaw(), loc.getPitch());
|
||||
Location bottom = base.getBottomAbs();
|
||||
Location location = player.getLocationFull();
|
||||
BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(),
|
||||
location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch());
|
||||
base.setHome(rel);
|
||||
return MainUtil.sendMessage(player, Captions.POSITION_SET);
|
||||
default:
|
||||
|
@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
public class Swap extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
Plot plot1 = loc.getPlotAbs();
|
||||
Location location = player.getLocation();
|
||||
Plot plot1 = location.getPlotAbs();
|
||||
if (plot1 == null) {
|
||||
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -138,18 +138,18 @@ public class PlotListener {
|
||||
final PlotBlock block = PlotBlock.get(id);
|
||||
final String rawId = block.getRawId().toString();
|
||||
if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) {
|
||||
Location loc = player.getLocation();
|
||||
Location lastLoc = player.getMeta("music");
|
||||
if (lastLoc != null) {
|
||||
player.playMusic(lastLoc, PlotBlock.get("air"));
|
||||
Location location = player.getLocation();
|
||||
Location lastLocation = player.getMeta("music");
|
||||
if (lastLocation != null) {
|
||||
player.playMusic(lastLocation, PlotBlock.get("air"));
|
||||
if (PlotBlock.isEverything(block) || block.isAir()) {
|
||||
player.deleteMeta("music");
|
||||
}
|
||||
}
|
||||
if (!(PlotBlock.isEverything(block) || block.isAir())) {
|
||||
try {
|
||||
player.setMeta("music", loc);
|
||||
player.playMusic(loc, block);
|
||||
player.setMeta("music", location);
|
||||
player.playMusic(location, block);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.UUID;
|
||||
@ -15,15 +16,15 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
|
||||
private ConsolePlayer() {
|
||||
PlotArea area = PlotSquared.get().getFirstPlotArea();
|
||||
Location loc;
|
||||
Location location;
|
||||
if (area != null) {
|
||||
RegionWrapper region = area.getRegion();
|
||||
loc = new Location(area.worldname, region.minX + region.maxX / 2, 0,
|
||||
location = new Location(area.worldname, region.minX + region.maxX / 2, 0,
|
||||
region.minZ + region.maxZ / 2);
|
||||
} else {
|
||||
loc = new Location("world", 0, 0, 0);
|
||||
location = new Location("world", 0, 0, 0);
|
||||
}
|
||||
setMeta("location", loc);
|
||||
setMeta("location", location);
|
||||
}
|
||||
|
||||
public static ConsolePlayer getConsole() {
|
||||
@ -34,7 +35,7 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override public boolean canTeleport(@Nonnull Location loc) {
|
||||
@Override public boolean canTeleport(@NotNull Location location) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,7 +51,7 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
return getLocation();
|
||||
}
|
||||
|
||||
@Nonnull @Override public UUID getUUID() {
|
||||
@NotNull @Override public UUID getUUID() {
|
||||
return DBFunc.EVERYONE;
|
||||
}
|
||||
|
||||
|
@ -1212,18 +1212,18 @@ public class Plot {
|
||||
Location[] corners = getCorners();
|
||||
Location top = corners[0];
|
||||
Location bot = corners[1];
|
||||
Location loc = new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
|
||||
Location location =
|
||||
new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
|
||||
MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()));
|
||||
if (!isLoaded()) {
|
||||
return loc;
|
||||
return location;
|
||||
}
|
||||
int y =
|
||||
isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), loc.getX(), loc.getZ()) : 62;
|
||||
int y = WorldUtil.IMP.getHighestBlock(getWorldName(), location.getX(), location.getZ());
|
||||
if (area.ALLOW_SIGNS) {
|
||||
y = Math.max(y, getManager().getSignLoc(this).getY());
|
||||
}
|
||||
loc.setY(1 + y);
|
||||
return loc;
|
||||
location.setY(1 + y);
|
||||
return location;
|
||||
}
|
||||
|
||||
public Location getSide() {
|
||||
@ -1248,18 +1248,19 @@ public class Plot {
|
||||
if (home == null || home.x == 0 && home.z == 0) {
|
||||
return this.getDefaultHome(true);
|
||||
} else {
|
||||
Location bot = this.getBottomAbs();
|
||||
Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y,
|
||||
bot.getZ() + home.z, home.yaw, home.pitch);
|
||||
Location bottom = this.getBottomAbs();
|
||||
Location location =
|
||||
new Location(bottom.getWorld(), bottom.getX() + home.x, bottom.getY() + home.y,
|
||||
bottom.getZ() + home.z, home.yaw, home.pitch);
|
||||
if (!isLoaded()) {
|
||||
return loc;
|
||||
return location;
|
||||
}
|
||||
if (!WorldUtil.IMP.getBlock(loc).isAir()) {
|
||||
loc.setY(Math.max(
|
||||
1 + WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()),
|
||||
bot.getY()));
|
||||
if (!WorldUtil.IMP.getBlock(location).isAir()) {
|
||||
location.setY(Math.max(1 + WorldUtil.IMP
|
||||
.getHighestBlock(this.getWorldName(), location.getX(), location.getZ()),
|
||||
bottom.getY()));
|
||||
}
|
||||
return loc;
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1426,9 +1427,9 @@ public class Plot {
|
||||
if (!this.area.ALLOW_SIGNS) {
|
||||
return;
|
||||
}
|
||||
Location loc = manager.getSignLoc(this);
|
||||
Location location = manager.getSignLoc(this);
|
||||
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false);
|
||||
queue.setBlock(loc.getX(), loc.getY(), loc.getZ(), PlotBlock.get("air"));
|
||||
queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air"));
|
||||
queue.flush();
|
||||
}
|
||||
|
||||
@ -1568,8 +1569,8 @@ public class Plot {
|
||||
* @return the name of the biome
|
||||
*/
|
||||
public String getBiome() {
|
||||
Location loc = this.getCenter();
|
||||
return WorldUtil.IMP.getBiome(loc.getWorld(), loc.getX(), loc.getZ());
|
||||
Location location = this.getCenter();
|
||||
return WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ());
|
||||
}
|
||||
|
||||
//TODO Better documentation needed.
|
||||
@ -1589,9 +1590,9 @@ public class Plot {
|
||||
* Returns the bottom location for the plot.
|
||||
*/
|
||||
public Location getBottomAbs() {
|
||||
Location loc = getManager().getPlotBottomLocAbs(this.id);
|
||||
loc.setWorld(getWorldName());
|
||||
return loc;
|
||||
Location location = getManager().getPlotBottomLocAbs(this.id);
|
||||
location.setWorld(getWorldName());
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2131,11 +2132,12 @@ public class Plot {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
final Location loc = this.getManager().getSignLoc(this);
|
||||
final Location location = this.getManager().getSignLoc(this);
|
||||
String[] lines = TaskManager.IMP.sync(new RunnableVal<String[]>() {
|
||||
@Override public void run(String[] value) {
|
||||
ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false);
|
||||
this.value = WorldUtil.IMP.getSign(loc);
|
||||
ChunkManager.manager
|
||||
.loadChunk(location.getWorld(), location.getChunkLoc(), false);
|
||||
this.value = WorldUtil.IMP.getSign(location);
|
||||
}
|
||||
});
|
||||
if (lines == null) {
|
||||
|
@ -132,8 +132,8 @@ public class PlotCluster {
|
||||
toReturn = center.getHome();
|
||||
if (toReturn.getY() == 0) {
|
||||
PlotManager manager = this.area.getPlotManager();
|
||||
Location loc = manager.getSignLoc(center);
|
||||
toReturn.setY(loc.getY());
|
||||
Location location = manager.getSignLoc(center);
|
||||
toReturn.setY(location.getY());
|
||||
}
|
||||
} else {
|
||||
toReturn = getClusterBottom().add(home.x, home.y, home.z);
|
||||
|
@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.google.common.base.Preconditions;
|
||||
import lombok.NonNull;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -335,14 +336,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
*
|
||||
* @return UUID
|
||||
*/
|
||||
@Override @Nonnull public abstract UUID getUUID();
|
||||
@Override @NotNull public abstract UUID getUUID();
|
||||
|
||||
public boolean canTeleport(@Nonnull final Location loc) {
|
||||
Preconditions.checkNotNull(loc, "Specified location cannot be null");
|
||||
public boolean canTeleport(@NotNull final Location location) {
|
||||
Preconditions.checkNotNull(location, "Specified location cannot be null");
|
||||
final Location current = getLocationFull();
|
||||
teleport(loc);
|
||||
teleport(location);
|
||||
boolean result = true;
|
||||
if (!getLocation().equals(loc)) {
|
||||
if (!getLocation().equals(location)) {
|
||||
result = false;
|
||||
}
|
||||
teleport(current);
|
||||
@ -493,10 +494,10 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(13);
|
||||
buffer.putShort((short) x);
|
||||
buffer.putShort((short) z);
|
||||
Location loc = getLocation();
|
||||
buffer.putInt(loc.getX());
|
||||
buffer.put((byte) loc.getY());
|
||||
buffer.putInt(loc.getZ());
|
||||
Location location = getLocation();
|
||||
buffer.putInt(location.getX());
|
||||
buffer.put((byte) location.getY());
|
||||
buffer.putInt(location.getZ());
|
||||
setPersistentMeta("quitLoc", buffer.array());
|
||||
} else if (hasPersistentMeta("quitLoc")) {
|
||||
removePersistentMeta("quitLoc");
|
||||
@ -596,11 +597,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
final Location loc = new Location(plot.getWorldName(), x, y, z);
|
||||
final Location location = new Location(plot.getWorldName(), x, y, z);
|
||||
if (plot.isLoaded()) {
|
||||
TaskManager.runTask(() -> {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
teleport(loc);
|
||||
teleport(location);
|
||||
sendMessage(
|
||||
Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX
|
||||
+ "," + plotZ + ")");
|
||||
@ -612,7 +613,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
TaskManager.runTask(() -> {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
if (plot.isLoaded()) {
|
||||
teleport(loc);
|
||||
teleport(location);
|
||||
sendMessage(Captions.TELEPORTED_TO_PLOT.f()
|
||||
+ " (quitLoc-unloaded) (" + plotX + "," + plotZ
|
||||
+ ")");
|
||||
|
@ -80,22 +80,22 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue {
|
||||
int bx = minX;
|
||||
int bz = minZ;
|
||||
PlotArea area = PlotSquared.get().getPlotArea(getWorld(), null);
|
||||
Location loc = new Location(getWorld(), bx, 0, bz);
|
||||
Location location = new Location(getWorld(), bx, 0, bz);
|
||||
if (area != null) {
|
||||
PlotManager manager = area.getPlotManager();
|
||||
for (int x = 0; x < 16; x++) {
|
||||
loc.setX(bx + x);
|
||||
location.setX(bx + x);
|
||||
for (int z = 0; z < 16; z++) {
|
||||
loc.setZ(bz + z);
|
||||
task.run(area.getPlotAbs(loc), x, z);
|
||||
location.setZ(bz + z);
|
||||
task.run(area.getPlotAbs(location), x, z);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
loc.setX(bx + x);
|
||||
location.setX(bx + x);
|
||||
for (int z = 0; z < 16; z++) {
|
||||
loc.setZ(bz + z);
|
||||
task.run(loc.getPlotAbs(), x, z);
|
||||
location.setZ(bz + z);
|
||||
task.run(location.getPlotAbs(), x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user