Merge pull request #2461 from IntellectualSites/midnight-ideas

@N0tMyFaultOG has some random ideas sometimes
This commit is contained in:
Matt 2019-09-06 21:16:30 -04:00 committed by GitHub
commit 12538c7c27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
112 changed files with 1043 additions and 1293 deletions

View File

@ -3,13 +3,15 @@ __*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and wil
<!--- In order to create a valid issue report you have to follow this template. --> <!--- In order to create a valid issue report you have to follow this template. -->
<!--- Incomplete reports might be marked as invalid. --> <!--- Incomplete reports might be marked as invalid. -->
<!-- Feature requests and enhancements may be suggested at https://github.com/IntellectualSites/PlotSquaredSuggestions. --> <!-- Feature requests and enhancements may be suggested at https://github.com/IntellectualSites/PlotSquaredSuggestions. -->
**Debug paste link:** **[REQUIRED] PlotSquared Version Number:** <!--- Enter /plot version in game or in your console and copy the output here -->
<!--- Enter /plot debugpaste in game or in your console and copy the output here -->
**[REQUIRED] Spigot/Paper Version Number:** **[REQUIRED] Spigot/Paper Version Number:**
**[REQUIRED] Minecraft Version Number:** **[REQUIRED] Minecraft Version Number:**
**Links to worlds.yml file and settings.yml file:**
<!--- Copy and paste the information to the service of your choosing and provide the link here. -->
**[REQUIRED] Description of the problem:** **[REQUIRED] Description of the problem:**
**Any relevant console output or screenshots:** **Any relevant console output or screenshots:**

17
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,17 @@
## Overview
<!-- Please describe which issue this Pull Request targets
If there is no issue, please create one so we can look into it before approving your PR.
You can do so here: https://github.com/IntellectualSites/PlotSquared/issues/new/choose
-->
**Fixes #{issue number}**
## Description
## Checklist
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
- [] I included all information required in the sections above
- [] I tested my changes and approved their functionality
- [] I ensured my changes do not break other parts of the code
- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/PlotSquared/blob/breaking/CONTRIBUTING.md)

View File

@ -22,7 +22,7 @@ dependencies {
implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT")
compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0")
compile("io.papermc:paperlib:1.0.2") compile("io.papermc:paperlib:1.0.2")
implementation ("net.kyori:text-adapter-bukkit:3.0.3") implementation("net.kyori:text-adapter-bukkit:3.0.3")
compile("net.milkbowl.vault:VaultAPI:1.7") { compile("net.milkbowl.vault:VaultAPI:1.7") {
exclude(module: "bukkit") exclude(module: "bukkit")
} }

View File

@ -54,8 +54,8 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
@ -132,8 +132,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
// Check for updates // Check for updates
if (PlotSquared.get().getUpdateUtility() != null) { if (PlotSquared.get().getUpdateUtility() != null) {
final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(), updateUtility
((updateDescription, throwable) -> { .checkForUpdate(this.getPluginVersionString(), ((updateDescription, throwable) -> {
Bukkit.getScheduler().runTask(BukkitMain.this, () -> { Bukkit.getScheduler().runTask(BukkitMain.this, () -> {
getLogger().info("-------- PlotSquared Update Check --------"); getLogger().info("-------- PlotSquared Update Check --------");
if (throwable != null) { if (throwable != null) {
@ -289,11 +289,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public void registerCommands() { @Override public void registerCommands() {
final BukkitCommand bukkitCommand = new BukkitCommand(); final BukkitCommand bukkitCommand = new BukkitCommand();
final PluginCommand plotCommand = getCommand("plots"); final PluginCommand plotCommand = getCommand("plots");
if (plotCommand != null) { plotCommand.setExecutor(bukkitCommand);
plotCommand.setExecutor(bukkitCommand); plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot")); plotCommand.setTabCompleter(bukkitCommand);
plotCommand.setTabCompleter(bukkitCommand);
}
} }
@Override public File getDirectory() { @Override public File getDirectory() {
@ -600,15 +598,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
@Override public QueueProvider initBlockQueue() { @Override public QueueProvider initBlockQueue() {
//TODO Figure out why this code is still here yet isn't being called anywhere. try {
// try { new SendChunk();
// new SendChunk(); MainUtil.canSendChunk = true;
// MainUtil.canSendChunk = true; } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
// } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) { PlotSquared.debug(
// PlotSquared.debug( SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
// SendChunk.class + " does not support " + StringMan.getString(getServerVersion())); MainUtil.canSendChunk = false;
// MainUtil.canSendChunk = false; }
// }
return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class); return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class);
} }
@ -803,5 +800,4 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public LegacyMappings getLegacyMappings() { @Override public LegacyMappings getLegacyMappings() {
return this.legacyMappings; return this.legacyMappings;
} }
} }

View File

@ -7,8 +7,8 @@ import lombok.Setter;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -30,8 +30,8 @@ public final class PlotAutoMergeEvent extends PlotEvent implements Cancellable {
* @param plot Plot that was merged * @param plot Plot that was merged
* @param plots A list of plots involved in the event * @param plots A list of plots involved in the event
*/ */
public PlotAutoMergeEvent(@NotNull final World world, @NotNull final Plot plot, public PlotAutoMergeEvent(@Nonnull final World world, @Nonnull final Plot plot,
@NotNull final List<PlotId> plots) { @Nonnull final List<PlotId> plots) {
super(plot); super(plot);
this.world = world; this.world = world;
this.plots = plots; this.plots = plots;

View File

@ -6,7 +6,8 @@ import lombok.Setter;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/** /**
* Event called when several plots are merged * Event called when several plots are merged
@ -28,8 +29,8 @@ public final class PlotMergeEvent extends PlotEvent implements Cancellable {
* @param dir The direction of the merge * @param dir The direction of the merge
* @param max Max merge size * @param max Max merge size
*/ */
public PlotMergeEvent(@NotNull final World world, @NotNull final Plot plot, public PlotMergeEvent(@Nonnull final World world, @Nonnull final Plot plot,
@NotNull final int dir, @NotNull final int max) { @Nonnull final int dir, @Nonnull final int max) {
super(plot); super(plot);
this.world = world; this.world = world;
this.dir = dir; this.dir = dir;

View File

@ -8,8 +8,8 @@ import org.bukkit.World;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -31,8 +31,8 @@ public final class PlotUnlinkEvent extends Event implements Cancellable {
* @param world World in which the event occurred * @param world World in which the event occurred
* @param plots Plots that are involved in the event * @param plots Plots that are involved in the event
*/ */
public PlotUnlinkEvent(@NotNull final World world, @NotNull final PlotArea area, public PlotUnlinkEvent(@Nonnull final World world, @Nonnull final PlotArea area,
@NotNull final List<PlotId> plots) { @Nonnull final List<PlotId> plots) {
this.plots = plots; this.plots = plots;
this.world = world; this.world = world;
this.area = area; this.area = area;

View File

@ -85,10 +85,10 @@ import java.util.regex.Pattern;
int distance = Bukkit.getViewDistance() * 16; int distance = Bukkit.getViewDistance() * 16;
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) { for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
PlotPlayer player = entry.getValue(); PlotPlayer player = entry.getValue();
Location location = player.getLocation(); Location loc = player.getLocation();
if (location.getWorld().equals(world)) { if (loc.getWorld().equals(world)) {
if (16 * Math.abs(location.getX() - x) / 16 > distance if (16 * Math.abs(loc.getX() - x) / 16 > distance
|| 16 * Math.abs(location.getZ() - z) / 16 > distance) { || 16 * Math.abs(loc.getZ() - z) / 16 > distance) {
continue; continue;
} }
((BukkitPlayer) player).player.sendBlockChange(bloc, data); ((BukkitPlayer) player).player.sendBlockChange(bloc, data);
@ -314,12 +314,12 @@ import java.util.regex.Pattern;
case POWERED_RAIL: case POWERED_RAIL:
return; return;
default:*/ default:*/
Location location = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return; return;
} }
Plot plot = location.getOwnedPlot(); Plot plot = loc.getOwnedPlot();
if (plot == null) { if (plot == null) {
return; return;
} }
@ -369,11 +369,12 @@ import java.util.regex.Pattern;
switch (event.getChangedType()) { switch (event.getChangedType()) {
case COMPARATOR: { case COMPARATOR: {
Block block = event.getBlock(); Block block = event.getBlock();
Location location = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
if (location.isPlotArea()) { PlotArea area = loc.getPlotArea();
if (area == null) {
return; return;
} }
Plot plot = location.getOwnedPlotAbs(); Plot plot = area.getOwnedPlotAbs(loc);
if (plot == null) { if (plot == null) {
return; return;
} }
@ -390,12 +391,12 @@ import java.util.regex.Pattern;
case TURTLE_HELMET: case TURTLE_HELMET:
case TURTLE_SPAWN_EGG: { case TURTLE_SPAWN_EGG: {
Block block = event.getBlock(); Block block = event.getBlock();
Location location = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return; return;
} }
Plot plot = area.getOwnedPlotAbs(location); Plot plot = area.getOwnedPlotAbs(loc);
if (plot == null) { if (plot == null) {
return; return;
} }
@ -412,30 +413,30 @@ import java.util.regex.Pattern;
case STICKY_PISTON: case STICKY_PISTON:
org.bukkit.block.data.Directional piston = org.bukkit.block.data.Directional piston =
(org.bukkit.block.data.Directional) block.getBlockData(); (org.bukkit.block.data.Directional) block.getBlockData();
Location location = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return; return;
} }
Plot plot = area.getOwnedPlotAbs(location); Plot plot = area.getOwnedPlotAbs(loc);
if (plot == null) { if (plot == null) {
return; return;
} }
switch (piston.getFacing()) { switch (piston.getFacing()) {
case EAST: case EAST:
location.setX(location.getX() + 1); loc.setX(loc.getX() + 1);
break; break;
case SOUTH: case SOUTH:
location.setX(location.getX() - 1); loc.setX(loc.getX() - 1);
break; break;
case WEST: case WEST:
location.setZ(location.getZ() + 1); loc.setZ(loc.getZ() + 1);
break; break;
case NORTH: case NORTH:
location.setZ(location.getZ() - 1); loc.setZ(loc.getZ() - 1);
break; break;
} }
Plot newPlot = area.getOwnedPlotAbs(location); Plot newPlot = area.getOwnedPlotAbs(loc);
if (!plot.equals(newPlot)) { if (!plot.equals(newPlot)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -469,15 +470,15 @@ import java.util.regex.Pattern;
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) { @EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
Projectile entity = event.getEntity(); Projectile entity = event.getEntity();
Location location = BukkitUtil.getLocation(entity); Location loc = BukkitUtil.getLocation(entity);
if (!PlotSquared.get().hasPlotArea(location.getWorld())) { if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
return true; return true;
} }
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return true; return true;
} }
Plot plot = area.getPlot(location); Plot plot = area.getPlot(loc);
ProjectileSource shooter = entity.getShooter(); ProjectileSource shooter = entity.getShooter();
if (shooter instanceof Player) { if (shooter instanceof Player) {
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter); PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
@ -522,22 +523,22 @@ import java.util.regex.Pattern;
return; return;
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); PlotPlayer pp = BukkitUtil.getPlayer(player);
Location location = plotPlayer.getLocation(); Location loc = pp.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return; return;
} }
String[] parts = msg.split(" "); String[] parts = msg.split(" ");
Plot plot = plotPlayer.getCurrentPlot(); Plot plot = pp.getCurrentPlot();
// Check WorldEdit // Check WorldEdit
switch (parts[0].toLowerCase()) { switch (parts[0].toLowerCase()) {
case "up": case "up":
case "/up": case "/up":
case "worldedit:up": case "worldedit:up":
case "worldedit:/up": case "worldedit:/up":
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -547,7 +548,7 @@ import java.util.regex.Pattern;
} }
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS); Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
if (flag.isPresent() && !Permissions if (flag.isPresent() && !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { .hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
List<String> blocked_cmds = flag.get(); List<String> blocked_cmds = flag.get();
String part = parts[0]; String part = parts[0];
if (parts[0].contains(":")) { if (parts[0].contains(":")) {
@ -591,13 +592,13 @@ import java.util.regex.Pattern;
} }
if (pattern.matcher(msg).matches()) { if (pattern.matcher(msg).matches()) {
String perm; String perm;
if (plot.isAdded(plotPlayer.getUUID())) { if (plot.isAdded(pp.getUUID())) {
perm = "plots.admin.command.blocked-cmds.shared"; perm = "plots.admin.command.blocked-cmds.shared";
} else { } else {
perm = "plots.admin.command.blocked-cmds.other"; perm = "plots.admin.command.blocked-cmds.other";
} }
if (!Permissions.hasPermission(plotPlayer, perm)) { if (!Permissions.hasPermission(pp, perm)) {
MainUtil.sendMessage(plotPlayer, Captions.COMMAND_BLOCKED); MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED);
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
@ -618,10 +619,10 @@ import java.util.regex.Pattern;
UUID uuid = pp.getUUID(); UUID uuid = pp.getUUID();
UUIDHandler.add(sw, uuid); UUIDHandler.add(sw, uuid);
Location location = pp.getLocation(); Location loc = pp.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area != null) { if (area != null) {
Plot plot = area.getPlot(location); Plot plot = area.getPlot(loc);
if (plot != null) { if (plot != null) {
plotEntry(pp, plot); plotEntry(pp, plot);
} }
@ -640,7 +641,7 @@ import java.util.regex.Pattern;
&& PlotSquared.get().getUpdateUtility() != null) { && PlotSquared.get().getUpdateUtility() != null) {
final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class); final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class);
updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(), updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(),
((updateDescription, throwable) -> { ((updateDescription, throwable) -> {
if (throwable != null) { if (throwable != null) {
bukkitMain.getLogger().severe(String bukkitMain.getLogger().severe(String
@ -687,27 +688,27 @@ import java.util.regex.Pattern;
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();
PlotPlayer plotPlayer = PlotPlayer.wrap(player); PlotPlayer pp = PlotPlayer.wrap(player);
Location location = BukkitUtil.getLocation(to); Location loc = BukkitUtil.getLocation(to);
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return; return;
} }
Plot plot = area.getPlot(location); Plot plot = area.getPlot(loc);
if (plot != null) { if (plot != null) {
final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot);
if (!result) { if (!result) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
Captions.PERMISSION_ADMIN_ENTRY_DENIED); Captions.PERMISSION_ADMIN_ENTRY_DENIED);
event.setCancelled(true); event.setCancelled(true);
if (lastLoc != null) { if (lastLoc != null) {
plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc); pp.setMeta(PlotPlayer.META_LOCATION, lastLoc);
} }
if (lastPlot != null) { if (lastPlot != null) {
plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot); pp.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot);
} }
} else { } else {
plotEntry(plotPlayer, plot); plotEntry(pp, plot);
} }
} }
} }
@ -808,14 +809,14 @@ import java.util.regex.Pattern;
// Cancel teleport // Cancel teleport
TaskManager.TELEPORT_QUEUE.remove(pp.getName()); TaskManager.TELEPORT_QUEUE.remove(pp.getName());
// Set last location // Set last location
Location location = BukkitUtil.getLocation(to); Location loc = BukkitUtil.getLocation(to);
pp.setMeta(PlotPlayer.META_LOCATION, location); pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
pp.deleteMeta(PlotPlayer.META_LAST_PLOT); pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return; return;
} }
Plot now = area.getPlot(location); Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) { if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
@ -868,14 +869,14 @@ import java.util.regex.Pattern;
// Cancel teleport // Cancel teleport
TaskManager.TELEPORT_QUEUE.remove(pp.getName()); TaskManager.TELEPORT_QUEUE.remove(pp.getName());
// Set last location // Set last location
Location location = BukkitUtil.getLocation(to); Location loc = BukkitUtil.getLocation(to);
pp.setMeta(PlotPlayer.META_LOCATION, location); pp.setMeta(PlotPlayer.META_LOCATION, loc);
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
pp.deleteMeta(PlotPlayer.META_LAST_PLOT); pp.deleteMeta(PlotPlayer.META_LAST_PLOT);
return; return;
} }
Plot now = area.getPlot(location); Plot now = area.getPlot(loc);
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
if (now == null) { if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
@ -1122,10 +1123,10 @@ import java.util.regex.Pattern;
if (Settings.Enabled_Components.PERMISSION_CACHE) { if (Settings.Enabled_Components.PERMISSION_CACHE) {
pp.deleteMeta("perm"); pp.deleteMeta("perm");
} }
Location location = pp.getLocation(); Location loc = pp.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (location.isPlotArea()) { if (loc.isPlotArea()) {
plot = location.getPlot(); plot = loc.getPlot();
if (plot != null) { if (plot != null) {
plotEntry(pp, plot); plotEntry(pp, plot);
} }
@ -2268,17 +2269,17 @@ import java.util.regex.Pattern;
Entity ignitingEntity = event.getIgnitingEntity(); Entity ignitingEntity = event.getIgnitingEntity();
Block block = event.getBlock(); Block block = event.getBlock();
BlockIgniteEvent.IgniteCause igniteCause = event.getCause(); BlockIgniteEvent.IgniteCause igniteCause = event.getCause();
Location location1; Location loc;
if (block != null) { if (block != null) {
location1 = BukkitUtil.getLocation(block.getLocation()); loc = BukkitUtil.getLocation(block.getLocation());
} else if (ignitingEntity != null) { } else if (ignitingEntity != null) {
location1 = BukkitUtil.getLocation(ignitingEntity); loc = BukkitUtil.getLocation(ignitingEntity);
} else if (player != null) { } else if (player != null) {
location1 = BukkitUtil.getLocation(player); loc = BukkitUtil.getLocation(player);
} else { } else {
return; return;
} }
PlotArea area = location1.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return; return;
} }
@ -2287,7 +2288,7 @@ import java.util.regex.Pattern;
return; return;
} }
Plot plot = area.getOwnedPlotAbs(location1); Plot plot = area.getOwnedPlotAbs(loc);
if (player != null) { if (player != null) {
PlotPlayer pp = BukkitUtil.getPlayer(player); PlotPlayer pp = BukkitUtil.getPlayer(player);
if (plot == null) { if (plot == null) {

View File

@ -30,8 +30,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod(); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
try { try {
this.mustSave = classChunk.getField("mustSave").getRealField(); this.mustSave = classChunk.getField("mustSave").getRealField();
} catch (NoSuchFieldException e) { } catch (Throwable ignore) {
e.printStackTrace(); ignore.printStackTrace();
} }
Bukkit.getPluginManager().registerEvents(this, plugin); Bukkit.getPluginManager().registerEvents(this, plugin);
} }

View File

@ -25,6 +25,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.RegisteredListener; import org.bukkit.plugin.RegisteredListener;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -55,7 +56,7 @@ public class BukkitPlayer extends PlotPlayer {
super.populatePersistentMetaMap(); super.populatePersistentMetaMap();
} }
@NotNull @Override public Location getLocation() { @Override public Location getLocation() {
final Location location = super.getLocation(); final Location location = super.getLocation();
return location == null ? BukkitUtil.getLocation(this.player) : location; return location == null ? BukkitUtil.getLocation(this.player) : location;
} }
@ -71,8 +72,8 @@ public class BukkitPlayer extends PlotPlayer {
return this.player.getLastPlayed(); return this.player.getLastPlayed();
} }
@Override public boolean canTeleport(@NotNull final Location location) { @Override public boolean canTeleport(@NotNull final Location loc) {
final org.bukkit.Location to = BukkitUtil.getLocation(location); final org.bukkit.Location to = BukkitUtil.getLocation(loc);
final org.bukkit.Location from = player.getLocation(); final org.bukkit.Location from = player.getLocation();
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
callEvent(event); callEvent(event);
@ -183,7 +184,7 @@ public class BukkitPlayer extends PlotPlayer {
} }
} }
@Override public void teleport(@NotNull final Location location) { @Override public void teleport(@Nonnull final Location location) {
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
return; return;
} }
@ -228,7 +229,7 @@ public class BukkitPlayer extends PlotPlayer {
} }
} }
@NotNull @Override public PlotGameMode getGameMode() { @Nonnull @Override public PlotGameMode getGameMode() {
switch (this.player.getGameMode()) { switch (this.player.getGameMode()) {
case ADVENTURE: case ADVENTURE:
return PlotGameMode.ADVENTURE; return PlotGameMode.ADVENTURE;

View File

@ -351,8 +351,8 @@ public class BukkitChunkManager extends ChunkManager {
int bz = min.getZ(); int bz = min.getZ();
for (int x1 = 0; x1 < 16; x1++) { for (int x1 = 0; x1 < 16; x1++) {
for (int z1 = 0; z1 < 16; z1++) { for (int z1 = 0; z1 < 16; z1++) {
PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1); PlotLoc loc = new PlotLoc(bx + x1, bz + z1);
BaseBlock[] ids = map.allBlocks.get(plotLoc); BaseBlock[] ids = map.allBlocks.get(loc);
if (ids != null) { if (ids != null) {
for (int y = 0; y < Math.min(128, ids.length); y++) { for (int y = 0; y < Math.min(128, ids.length); y++) {
BaseBlock id = ids[y]; BaseBlock id = ids[y];
@ -387,18 +387,17 @@ public class BukkitChunkManager extends ChunkManager {
return true; return true;
} }
@Override public boolean loadChunk(String world, ChunkLoc chunkLoc, boolean force) { @Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) {
return BukkitUtil.getWorld(world).getChunkAt(chunkLoc.x, chunkLoc.z).load(force); return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
} }
@Override @SuppressWarnings("deprecation") @Override
public void unloadChunk(final String world, final ChunkLoc chunkLoc, final boolean save, public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
final boolean safe) { final boolean safe) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask( TaskManager.runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save));
() -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save));
} else { } else {
BukkitUtil.getWorld(world).unloadChunk(chunkLoc.x, chunkLoc.z, save); BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save);
} }
} }
@ -615,9 +614,9 @@ public class BukkitChunkManager extends ChunkManager {
void saveEntitiesOut(Chunk chunk, RegionWrapper region) { void saveEntitiesOut(Chunk chunk, RegionWrapper region) {
for (Entity entity : chunk.getEntities()) { for (Entity entity : chunk.getEntities()) {
Location location = BukkitUtil.getLocation(entity); Location loc = BukkitUtil.getLocation(entity);
int x = location.getX(); int x = loc.getX();
int z = location.getZ(); int z = loc.getZ();
if (isIn(region, x, z)) { if (isIn(region, x, z)) {
continue; continue;
} }
@ -637,9 +636,9 @@ public class BukkitChunkManager extends ChunkManager {
void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ, void saveEntitiesIn(Chunk chunk, RegionWrapper region, int offsetX, int offsetZ,
boolean delete) { boolean delete) {
for (Entity entity : chunk.getEntities()) { for (Entity entity : chunk.getEntities()) {
Location location = BukkitUtil.getLocation(entity); Location loc = BukkitUtil.getLocation(entity);
int x = location.getX(); int x = loc.getX();
int z = location.getZ(); int z = loc.getZ();
if (!isIn(region, x, z)) { if (!isIn(region, x, z)) {
continue; continue;
} }

View File

@ -1,6 +1,22 @@
package com.github.intellectualsites.plotsquared.bukkit.util; package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.events.*; import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotDeniedEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotHelperEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotTrustedEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerTeleportToPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotAutoMergeEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotChangeOwnerEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotClearEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotComponentSetEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotDeleteEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagAddEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagRemoveEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotMergeEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotRateEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotUnlinkEvent;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -14,9 +30,9 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -25,93 +41,91 @@ import java.util.UUID;
*/ */
public final class BukkitEventUtil extends EventUtil { public final class BukkitEventUtil extends EventUtil {
@Nullable public Player getPlayer(final PlotPlayer player) { @Nullable public Player getPlayer(final PlotPlayer player) {
if (player instanceof BukkitPlayer) { if (player instanceof BukkitPlayer) {
return ((BukkitPlayer) player).player; return ((BukkitPlayer) player).player;
}
return null;
} }
return null;
}
private boolean callEvent(@NotNull final Event event) { private boolean callEvent(@Nonnull final Event event) {
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled();
} }
@Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) {
return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto));
} }
@Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) {
return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot));
} }
@Override public boolean callComponentSet(Plot plot, String component) { @Override public boolean callComponentSet(Plot plot, String component) {
return callEvent(new PlotComponentSetEvent(plot, component)); return callEvent(new PlotComponentSetEvent(plot, component));
} }
@Override public boolean callClear(Plot plot) { @Override public boolean callClear(Plot plot) {
return callEvent(new PlotClearEvent(plot)); return callEvent(new PlotClearEvent(plot));
} }
@Override public boolean callDelete(Plot plot) { @Override public boolean callDelete(Plot plot) {
return callEvent(new PlotDeleteEvent(plot)); return callEvent(new PlotDeleteEvent(plot));
} }
@Override public boolean callFlagAdd(Flag flag, Plot plot) { @Override public boolean callFlagAdd(Flag flag, Plot plot) {
return callEvent(new PlotFlagAddEvent(flag, plot)); return callEvent(new PlotFlagAddEvent(flag, plot));
} }
@Override public boolean callFlagRemove(Flag<?> flag, Plot plot, Object value) { @Override public boolean callFlagRemove(Flag<?> flag, Plot plot, Object value) {
return callEvent(new PlotFlagRemoveEvent(flag, plot)); return callEvent(new PlotFlagRemoveEvent(flag, plot));
} }
@Override public boolean callMerge(Plot plot, int dir, int max) { @Override public boolean callMerge(Plot plot, int dir, int max) {
return callEvent( return callEvent(new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max));
new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); }
}
@Override public boolean callAutoMerge(Plot plot, List<PlotId> plots) { @Override public boolean callAutoMerge(Plot plot, List<PlotId> plots) {
return callEvent( return callEvent(new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots));
new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); }
}
@Override public boolean callUnlink(PlotArea area, List<PlotId> plots) { @Override public boolean callUnlink(PlotArea area, List<PlotId> plots) {
return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots));
} }
@Override public void callEntry(PlotPlayer player, Plot plot) { @Override public void callEntry(PlotPlayer player, Plot plot) {
callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot));
} }
@Override public void callLeave(PlotPlayer player, Plot plot) { @Override public void callLeave(PlotPlayer player, Plot plot) {
callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot));
} }
@Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added));
} }
@Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added));
} }
@Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
} }
@Override @Override
public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner,
boolean hasOldOwner) { boolean hasOldOwner) {
return callEvent( return callEvent(
new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner));
} }
@Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) {
PlotRateEvent event = new PlotRateEvent(player, rating, plot); PlotRateEvent event = new PlotRateEvent(player, rating, plot);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return null; return null;
}
return event.getRating();
} }
return event.getRating();
}
} }

View File

@ -27,9 +27,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@ -243,7 +242,7 @@ import java.util.Set;
location.getBlockZ()); location.getBlockZ());
} }
@NotNull public static Location getLocationFull(@NonNull final Entity entity) { public static Location getLocationFull(@NonNull final Entity entity) {
final org.bukkit.Location location = entity.getLocation(); final org.bukkit.Location location = entity.getLocation();
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()),
MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(),

View File

@ -42,6 +42,7 @@ public class SendChunk {
* Constructor. * Constructor.
*/ */
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
RefConstructor tempMapChunk;
RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer"); RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle"); this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk"); RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
@ -49,7 +50,8 @@ public class SendChunk {
RefClass classChunk = getRefClass("{nms}.Chunk"); RefClass classChunk = getRefClass("{nms}.Chunk");
this.methodInitLighting = classChunk.getMethod("initLighting"); this.methodInitLighting = classChunk.getMethod("initLighting");
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk"); RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class);
this.mapChunk = tempMapChunk;
RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer"); RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
this.connection = classEntityPlayer.getField("playerConnection"); this.connection = classEntityPlayer.getField("playerConnection");
RefClass classPacket = getRefClass("{nms}.Packet"); RefClass classPacket = getRefClass("{nms}.Packet");

View File

@ -31,13 +31,13 @@ import java.util.ArrayDeque;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit;
public class SQLUUIDHandler extends UUIDHandlerImplementation { public class SQLUUIDHandler extends UUIDHandlerImplementation {
final int MAX_REQUESTS = 500; final int MAX_REQUESTS = 500;
private final String PROFILE_URL = private final String PROFILE_URL =
"https://sessionserver.mojang.com/session/minecraft/profile/"; "https://sessionserver.mojang.com/session/minecraft/profile/";
private final int INTERVAL = 12000;
private final JSONParser jsonParser = new JSONParser(); private final JSONParser jsonParser = new JSONParser();
private final SQLite sqlite; private final SQLite sqlite;
@ -133,10 +133,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
"Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)"); "Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)");
} }
try { try {
//Mojang allows requests every 10 minutes according to https://wiki.vg/Mojang_API Thread.sleep(INTERVAL * 50);
//15 Minutes is chosen here since system timers are not always precise
//and it should provide enough time where Mojang won't block requests.
TimeUnit.MINUTES.sleep(15);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
break; break;
@ -145,6 +142,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
if (whenDone != null) { if (whenDone != null) {
whenDone.run(); whenDone.run();
} }
return;
}); });
}); });
} catch (SQLException e) { } catch (SQLException e) {

View File

@ -126,7 +126,6 @@ permissions:
plots.toggle: true plots.toggle: true
plots.toggle.titles: true plots.toggle.titles: true
plots.toggle.chat: true plots.toggle.chat: true
plots.toggle.time: true
plots.set.biome: true plots.set.biome: true
plots.set.home: true plots.set.home: true
plots.set.alias: true plots.set.alias: true

View File

@ -1,20 +0,0 @@
# Contributing
If you feel like you can improve the plugin any way, then you are
more than welcome to contribute to PlotSquared. It would be highly
appreciated if you made sure to test your code before committing it,
as it will save us a lot of time and effort.
### Code Style
If you are planning to commit any changes to the project,
it would be highly appreciated if you were to follow the
project code style conventions. To make this easier we have
provided settings that can be imported into your IDE.
**Eclipse:**
`Window > Preferences > Java > Code Style > Formatter`
Press `Import` and select `...path/to/project/code_style.xml`
**IntelliJ:**
`File > Settings > Editor > Code Style`. Next to "Scheme" there is a cog wheel, press that and then
`Import Scheme > IntelliJ IDEA Code Style XML` and then select `..path/to/project/code_style.xml`

View File

@ -5,7 +5,7 @@ def textVersion = "3.0.2"
dependencies { dependencies {
implementation("org.yaml:snakeyaml:1.23") implementation("org.yaml:snakeyaml:1.23")
implementation ("com.google.code.gson:gson:2.8.0") { implementation("com.google.code.gson:gson:2.8.0") {
because("Minecraft uses GSON 2.8.0") because("Minecraft uses GSON 2.8.0")
force = true force = true
} }
@ -14,10 +14,10 @@ dependencies {
testCompileOnly("org.projectlombok:lombok:1.18.8") testCompileOnly("org.projectlombok:lombok:1.18.8")
annotationProcessor("org.projectlombok:lombok:1.18.8") annotationProcessor("org.projectlombok:lombok:1.18.8")
testAnnotationProcessor("org.projectlombok:lombok:1.18.8") testAnnotationProcessor("org.projectlombok:lombok:1.18.8")
implementation ("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT") implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")
implementation ("com.squareup.okhttp3:okhttp:3.14.0") implementation("com.squareup.okhttp3:okhttp:3.14.0")
implementation ("com.squareup.okio:okio:2.2.2") implementation("com.squareup.okio:okio:2.2.2")
implementation ("org.jetbrains.kotlin:kotlin-stdlib:1.3.30") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.30")
} }
sourceCompatibility = 1.8 sourceCompatibility = 1.8

View File

@ -33,7 +33,7 @@ public abstract class Argument<T> {
} }
}; };
public static final Argument<String> PlayerName = public static final Argument<String> PlayerName =
new Argument<String>("PlayerName", "Dinnerbone") { new Argument<String>("PlayerName", "<player>") {
@Override public String parse(String in) { @Override public String parse(String in) {
return in.length() <= 16 ? in : null; return in.length() <= 16 ? in : null;
} }

View File

@ -263,7 +263,7 @@ public abstract class Command {
/** /**
* @param player Caller * @param player Caller
* @param args Arguments * @param args Arguments
* @param confirm Instance, Success, Failure * @param confirm Instance, Success, Failure
* @return CompletableFuture true if the command executed fully, false in * @return CompletableFuture true if the command executed fully, false in
* any other case * any other case

View File

@ -6,6 +6,7 @@ package com.github.intellectualsites.plotsquared.configuration;
*/ */
class ConfigurationOptions { class ConfigurationOptions {
private final Configuration configuration; private final Configuration configuration;
private char pathSeparator = '.';
private boolean copyDefaults = false; private boolean copyDefaults = false;
protected ConfigurationOptions(Configuration configuration) { protected ConfigurationOptions(Configuration configuration) {
@ -25,12 +26,28 @@ class ConfigurationOptions {
* Gets the char that will be used to separate {@link * Gets the char that will be used to separate {@link
* ConfigurationSection}s. * ConfigurationSection}s.
* *
* <p> This value is always '.'. * <p>This value does not affect how the {@link Configuration} is stored,
* only in how you access the data. The default value is '.'.
* *
* @return Path separator * @return Path separator
*/ */
char pathSeparator() { public char pathSeparator() {
return '.'; return pathSeparator;
}
/**
* Sets the char that will be used to separate {@link
* ConfigurationSection}s.
*
* <p>This value does not affect how the {@link Configuration} is stored,
* only in how you access the data. The default value is '.'.
*
* @param value Path separator
* @return This object, for chaining
*/
public ConfigurationOptions pathSeparator(char value) {
pathSeparator = value;
return this;
} }
/** /**

View File

@ -18,4 +18,8 @@ public class MemoryConfigurationOptions extends ConfigurationOptions {
return this; return this;
} }
@Override public MemoryConfigurationOptions pathSeparator(char value) {
super.pathSeparator(value);
return this;
}
} }

View File

@ -25,6 +25,11 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
return this; return this;
} }
@Override public FileConfigurationOptions pathSeparator(char value) {
super.pathSeparator(value);
return this;
}
/** /**
* Gets the header that will be applied to the top of the saved output. * Gets the header that will be applied to the top of the saved output.
* *

View File

@ -5,6 +5,7 @@ package com.github.intellectualsites.plotsquared.configuration.file;
* YamlConfiguration}. * YamlConfiguration}.
*/ */
public class YamlConfigurationOptions extends FileConfigurationOptions { public class YamlConfigurationOptions extends FileConfigurationOptions {
private int indent = 2;
YamlConfigurationOptions(YamlConfiguration configuration) { YamlConfigurationOptions(YamlConfiguration configuration) {
super(configuration); super(configuration);
@ -19,6 +20,11 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
return this; return this;
} }
@Override public YamlConfigurationOptions pathSeparator(char value) {
super.pathSeparator(value);
return this;
}
@Override public YamlConfigurationOptions header(String value) { @Override public YamlConfigurationOptions header(String value) {
super.header(value); super.header(value);
return this; return this;
@ -36,8 +42,27 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
* *
* @return How much to indent by * @return How much to indent by
*/ */
int indent() { public int indent() {
return 2; return indent;
} }
/**
* Sets how much spaces should be used to indent each line.
*
* <p>The minimum value this may be is 2, and the maximum is 9.
*
* @param value New indent
* @return This object, for chaining
*/
public YamlConfigurationOptions indent(int value) {
if (value < 2) {
throw new IllegalArgumentException("Indent must be at least 2 characters");
}
if (value > 9) {
throw new IllegalArgumentException("Indent cannot be greater than 9 characters");
}
indent = value;
return this;
}
} }

View File

@ -63,12 +63,12 @@ public interface IPlotMain extends ILogger {
*/ */
String getPluginVersionString(); String getPluginVersionString();
default String getPluginName() { String getPluginName();
return "PlotSquared";
}
/** /**
* Gets the version of Minecraft that is running. * Gets the version of Minecraft that is running.
*
* @return
*/ */
int[] getServerVersion(); int[] getServerVersion();
@ -101,7 +101,7 @@ public interface IPlotMain extends ILogger {
/** /**
* The task manager will run and manage Minecraft tasks. * The task manager will run and manage Minecraft tasks.
* *
* @return the PlotSquared task manager * @return
*/ */
TaskManager getTaskManager(); TaskManager getTaskManager();
@ -138,39 +138,49 @@ public interface IPlotMain extends ILogger {
/** /**
* Gets the economy provider. * Gets the economy provider.
* *
* @return the PlotSquared economy manager * @return
*/ */
EconHandler getEconomyHandler(); EconHandler getEconomyHandler();
/** /**
* Gets the {@link QueueProvider} class. * Gets the {@link QueueProvider} class.
*
* @return
*/ */
QueueProvider initBlockQueue(); QueueProvider initBlockQueue();
/** /**
* Gets the {@link WorldUtil} class. * Gets the {@link WorldUtil} class.
*
* @return
*/ */
WorldUtil initWorldUtil(); WorldUtil initWorldUtil();
/** /**
* Gets the EventUtil class. * Gets the EventUtil class.
*
* @return
*/ */
EventUtil initEventUtil(); EventUtil initEventUtil();
/** /**
* Gets the chunk manager. * Gets the chunk manager.
* *
* @return the PlotSquared chunk manager * @return
*/ */
ChunkManager initChunkManager(); ChunkManager initChunkManager();
/** /**
* Gets the {@link SetupUtils} class. * Gets the {@link SetupUtils} class.
*
* @return
*/ */
SetupUtils initSetupUtils(); SetupUtils initSetupUtils();
/** /**
* Gets {@link HybridUtils} class. * Gets {@link HybridUtils} class.
*
* @return
*/ */
HybridUtils initHybridUtils(); HybridUtils initHybridUtils();
@ -189,28 +199,32 @@ public interface IPlotMain extends ILogger {
/** /**
* Gets the {@link UUIDHandlerImplementation} which will cache and * Gets the {@link UUIDHandlerImplementation} which will cache and
* provide UUIDs. * provide UUIDs.
*
* @return
*/ */
UUIDHandlerImplementation initUUIDHandler(); UUIDHandlerImplementation initUUIDHandler();
/** /**
* Gets the {@link InventoryUtil} class (used for implementation specific * Gets the {@link InventoryUtil} class (used for implementation specific
* inventory guis). * inventory guis).
*
* @return
*/ */
InventoryUtil initInventoryUtil(); InventoryUtil initInventoryUtil();
/** /**
* Unregisters a {@link PlotPlayer} from cache e.g. if they have logged off. * Unregisters a {@link PlotPlayer} from cache e.g. if they have logged off.
* *
* @param player the player to remove * @param player
*/ */
void unregister(PlotPlayer player); void unregister(PlotPlayer player);
/** /**
* Gets the generator wrapper for a world (world) and generator (name). * Gets the generator wrapper for a world (world) and generator (name).
* *
* @param world the world to get the generator from * @param world
* @param name the name of the generator * @param name
* @return the generator being used for the provided world * @return
*/ */
GeneratorWrapper<?> getGenerator(String world, String name); GeneratorWrapper<?> getGenerator(String world, String name);
@ -218,7 +232,7 @@ public interface IPlotMain extends ILogger {
/** /**
* Register the chunk processor which will clean out chunks that have too * Register the chunk processor which will clean out chunks that have too
* many block states or entities. * many blockstates or entities.
*/ */
void registerChunkProcessor(); void registerChunkProcessor();

View File

@ -33,8 +33,8 @@ import com.sk89q.worldedit.WorldEdit;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import lombok.Setter; import lombok.Setter;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.*; import java.io.*;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -251,12 +251,12 @@ import java.util.zip.ZipInputStream;
copyFile("addplots.js", Settings.Paths.SCRIPTS); copyFile("addplots.js", Settings.Paths.SCRIPTS);
copyFile("addsigns.js", Settings.Paths.SCRIPTS); copyFile("addsigns.js", Settings.Paths.SCRIPTS);
copyFile("automerge.js", Settings.Paths.SCRIPTS); copyFile("automerge.js", Settings.Paths.SCRIPTS);
copyFile("fixborders.js", Settings.Paths.SCRIPTS);
copyFile("furthest.js", Settings.Paths.SCRIPTS); copyFile("furthest.js", Settings.Paths.SCRIPTS);
copyFile("mycommand.js", Settings.Paths.SCRIPTS); copyFile("mycommand.js", Settings.Paths.SCRIPTS);
copyFile("setbiomes.js", Settings.Paths.SCRIPTS); copyFile("setbiomes.js", Settings.Paths.SCRIPTS);
copyFile("start.js", Settings.Paths.SCRIPTS); copyFile("start.js", Settings.Paths.SCRIPTS);
copyFile("town.template", Settings.Paths.TEMPLATES); copyFile("town.template", Settings.Paths.TEMPLATES);
copyFile("skyblock.template", Settings.Paths.TEMPLATES);
copyFile("bridge.template", Settings.Paths.TEMPLATES); copyFile("bridge.template", Settings.Paths.TEMPLATES);
copyFile("de-DE.yml", Settings.Paths.TRANSLATIONS); copyFile("de-DE.yml", Settings.Paths.TRANSLATIONS);
copyFile("es-ES.yml", Settings.Paths.TRANSLATIONS); copyFile("es-ES.yml", Settings.Paths.TRANSLATIONS);
@ -1601,7 +1601,7 @@ import java.util.zip.ZipInputStream;
this.version = PlotVersion.tryParse(versionString, commitString, dateString); this.version = PlotVersion.tryParse(versionString, commitString, dateString);
Settings.DATE = Settings.DATE =
new Date(100 + version.year, version.month, version.day).toGMTString(); new Date(100 + version.year, version.month, version.day).toGMTString();
Settings.BUILD = "https://ci.athion.net/job/PlotSquared/" + version.build; Settings.BUILD = "https://ci.athion.net/job/PlotSquared-Releases/" + version.build;
Settings.COMMIT = Settings.COMMIT =
"https://github.com/IntellectualSites/PlotSquared/commit/" + Integer "https://github.com/IntellectualSites/PlotSquared/commit/" + Integer
.toHexString(version.hash); .toHexString(version.hash);
@ -1623,7 +1623,7 @@ import java.util.zip.ZipInputStream;
final Properties properties = new Properties(); final Properties properties = new Properties();
properties.load(bufferedReader); properties.load(bufferedReader);
final boolean enabled = final boolean enabled =
Boolean.parseBoolean(properties.getOrDefault("enabled", true).toString()); Boolean.valueOf(properties.getOrDefault("enabled", true).toString());
if (enabled) { if (enabled) {
this.updateUtility = new UpdateUtility(properties.getProperty("path"), this.updateUtility = new UpdateUtility(properties.getProperty("path"),
properties.getProperty("job"), properties.getProperty("artifact")); properties.getProperty("job"), properties.getProperty("artifact"));
@ -1777,15 +1777,15 @@ import java.util.zip.ZipInputStream;
*/ */
private void setupStyle() { private void setupStyle() {
if (this.version != null) { if (this.version != null) {
this.style.set("version", this.version.toString()); this.style.set("Version", this.version.toString());
} }
Map<String, Object> o = new HashMap<>(4); Map<String, Object> object = new HashMap<>(4);
o.put("color.1", "6"); object.put("color.1", "6");
o.put("color.2", "7"); object.put("color.2", "7");
o.put("color.3", "8"); object.put("color.3", "8");
o.put("color.4", "3"); object.put("color.4", "3");
if (!this.style.contains("color")) { if (!this.style.contains("color")) {
for (Entry<String, Object> node : o.entrySet()) { for (Entry<String, Object> node : object.entrySet()) {
this.style.set(node.getKey(), node.getValue()); this.style.set(node.getKey(), node.getValue());
} }
} }

View File

@ -24,19 +24,12 @@ public class PlotVersion {
public static PlotVersion tryParse(String version, String commit, String date) { public static PlotVersion tryParse(String version, String commit, String date) {
try { try {
return new PlotVersion(version, commit, date); return new PlotVersion(version, commit, date);
} catch (Exception e) { } catch (Exception ignore) {
e.printStackTrace(); ignore.printStackTrace();
return new PlotVersion(0, 0, 0, 0, 0); return new PlotVersion(0, 0, 0, 0, 0);
} }
} }
public String versionString() {
if (hash == 0 && build == 0) {
return "NoVer-SNAPSHOT";
} else {
return "4." + build;
}
}
@Override public String toString() { @Override public String toString() {
if (hash == 0 && build == 0) { if (hash == 0 && build == 0) {
return "PlotSquared-NoVer-SNAPSHOT"; return "PlotSquared-NoVer-SNAPSHOT";

View File

@ -49,7 +49,7 @@ import java.util.concurrent.CompletableFuture;
continue; continue;
} }
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
iterator.remove(); iterator.remove();
continue; continue;
} }

View File

@ -21,12 +21,12 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length == 0) { if (args.length == 0) {
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <value>"); Captions.COMMAND_SYNTAX.send(player, getUsage());
return false; return false;
} }
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }
@ -64,7 +64,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
} }
break; break;
default: default:
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set|remove> <alias>"); Captions.COMMAND_SYNTAX.send(player, getUsage());
result = false; result = false;
} }

View File

@ -5,14 +5,19 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.*; 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.util.ByteArrayUtilities; import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import org.jetbrains.annotations.Nullable; import javax.annotation.Nullable;
import java.util.Set; import java.util.Set;
@CommandDeclaration(command = "auto", permission = "plots.auto", @CommandDeclaration(command = "auto", permission = "plots.auto",
@ -118,8 +123,7 @@ public class Auto extends SubCommand {
} else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) { } else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) {
plot.claim(player, true, schematic, false); plot.claim(player, true, schematic, false);
if (area.AUTO_MERGE) { if (area.AUTO_MERGE) {
plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
true);
} }
} else { } else {
DBFunc.delete(plot); DBFunc.delete(plot);
@ -249,9 +253,6 @@ public class Auto extends SubCommand {
for (int j = start.y; j <= end.y; j++) { for (int j = start.y; j <= end.y; j++) {
Plot plot = plotarea.getPlotAbs(new PlotId(i, j)); Plot plot = plotarea.getPlotAbs(new PlotId(i, j));
boolean teleport = i == end.x && j == end.y; boolean teleport = i == end.x && j == end.y;
if (plot == null) {
return false;
}
plot.claim(player, teleport, null); plot.claim(player, teleport, null);
} }
} }

View File

@ -17,7 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
int biome = WorldUtil.IMP.getBiomeFromString(value); int biome = WorldUtil.IMP.getBiomeFromString(value);
if (biome == -1) { if (biome == -1) {
String biomes = StringMan String biomes = StringMan
.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.getTranslated()); .join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
Captions.NEED_BIOME.send(player); Captions.NEED_BIOME.send(player);
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes); Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes);

View File

@ -20,14 +20,13 @@ public class Claim extends SubCommand {
if (args.length >= 1) { if (args.length >= 1) {
schematic = args[0]; schematic = args[0];
} }
Location location = player.getLocation(); Location loc = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return sendMessage(player, Captions.NOT_IN_PLOT); return sendMessage(player, Captions.NOT_IN_PLOT);
} }
int currentPlots = Settings.Limit.GLOBAL ? int currentPlots =
player.getPlotCount() : Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
player.getPlotCount(location.getWorld());
int grants = 0; int grants = 0;
if (currentPlots >= player.getAllowedPlots()) { if (currentPlots >= player.getAllowedPlots()) {
if (player.hasPersistentMeta("grantedPlots")) { if (player.hasPersistentMeta("grantedPlots")) {
@ -90,7 +89,7 @@ public class Claim extends SubCommand {
@Override public void run(Object value) { @Override public void run(Object value) {
plot.claim(player, true, finalSchematic, false); plot.claim(player, true, finalSchematic, false);
if (area.AUTO_MERGE) { if (area.AUTO_MERGE) {
plot.autoMerge(Direction.ALL, Integer.MAX_VALUE, player.getUUID(), true); plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
} }
} }
}), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED)); }), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED));

View File

@ -32,7 +32,7 @@ public class Comment extends SubCommand {
StringMan.join(CommentManager.inboxes.keySet(), "|")); StringMan.join(CommentManager.inboxes.keySet(), "|"));
return false; return false;
} }
Location location = player.getLocation(); Location loc = player.getLocation();
PlotId id; PlotId id;
try { try {
id = PlotId.fromString(args[1]); id = PlotId.fromString(args[1]);
@ -44,7 +44,7 @@ public class Comment extends SubCommand {
int index; int index;
if (plot == null) { if (plot == null) {
index = 1; index = 1;
plot = location.getPlotAbs(); plot = loc.getPlotAbs();
} else { } else {
if (args.length < 4) { if (args.length < 4) {
sendMessage(player, Captions.COMMENT_SYNTAX, sendMessage(player, Captions.COMMENT_SYNTAX,
@ -59,7 +59,7 @@ public class Comment extends SubCommand {
} }
String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " ");
PlotComment comment = PlotComment comment =
new PlotComment(location.getWorld(), id, message, player.getName(), inbox.toString(), new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(),
System.currentTimeMillis()); System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment); boolean result = inbox.addComment(plot, comment);
if (!result) { if (!result) {

View File

@ -20,6 +20,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@CommandDeclaration(command = "condense", permission = "plots.admin", @CommandDeclaration(command = "condense", permission = "plots.admin",
usage = "/plot condense <area> <start|stop|info> [radius]",
description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand { requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand {
@ -27,7 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
MainUtil.sendMessage(player, "/plot condense <area> <start|stop|info> [radius]"); MainUtil.sendMessage(player, getUsage());
return false; return false;
} }
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);

View File

@ -12,7 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@CommandDeclaration(command = "continue", @CommandDeclaration(command = "continue",
description = "Continue a plot that was previously marked as done", description = "Continue a plot that was previously marked as done",
permission = "plots.continue", category = CommandCategory.SETTINGS, permission = "plots.continue", category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE) public class Continue extends SubCommand { requiredType = RequiredType.PLAYER) public class Continue extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();

View File

@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
requiredType = RequiredType.NONE) public class Copy extends SubCommand { requiredType = RequiredType.NONE) public class Copy extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = loc.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
} }

View File

@ -16,17 +16,16 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand { usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return sendMessage(player, Captions.NOT_IN_PLOT); return sendMessage(player, Captions.NOT_IN_PLOT);
} }
if (!(location.getPlotArea() instanceof HybridPlotWorld)) { if (!(loc.getPlotArea() instanceof HybridPlotWorld)) {
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
} }
HybridUtils.manager.setupRoadSchematic(plot); HybridUtils.manager.setupRoadSchematic(plot);
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SCHEMATIC_ROAD_CREATED);
"$1Saved new road schematic. To test the road, fly to a few other plots and use /plot debugroadregen");
return true; return true;
} }
} }

View File

@ -48,7 +48,7 @@ import java.util.Map.Entry;
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length < 1) { if (args.length < 1) {
MainUtil.sendMessage(player, "/plot database [area] <sqlite|mysql|import>"); MainUtil.sendMessage(player, getUsage());
return false; return false;
} }
List<Plot> plots; List<Plot> plots;
@ -60,7 +60,7 @@ import java.util.Map.Entry;
plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots()); plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots());
} }
if (args.length < 1) { if (args.length < 1) {
MainUtil.sendMessage(player, "/plot database [world] <sqlite|mysql|import>"); MainUtil.sendMessage(player, getUsage());
MainUtil.sendMessage(player, "[arg] indicates an optional argument"); MainUtil.sendMessage(player, "[arg] indicates an optional argument");
return false; return false;
} }

View File

@ -55,13 +55,13 @@ public class DebugClaimTest extends SubCommand {
MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId()); MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId());
continue; continue;
} }
Location location = manager.getSignLoc(plot); Location loc = manager.getSignLoc(plot);
ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4); ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false); boolean result = ChunkManager.manager.loadChunk(area.worldname, chunk, false);
if (!result) { if (!result) {
continue; continue;
} }
String[] lines = WorldUtil.IMP.getSign(location); String[] lines = WorldUtil.IMP.getSign(loc);
if (lines != null) { if (lines != null) {
String line = lines[2]; String line = lines[2];
if (line != null && line.length() > 2) { if (line != null && line.length() > 2) {

View File

@ -369,17 +369,17 @@ import java.util.concurrent.CompletableFuture;
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 location = player.getMeta(PlotPlayer.META_LOCATION); Location loc = player.getMeta(PlotPlayer.META_LOCATION);
Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT); Plot plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
for (Plot current : PlotSquared.get().getBasePlots()) { for (Plot current : PlotSquared.get().getBasePlots()) {
player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs()); player.setMeta(PlotPlayer.META_LOCATION, current.getBottomAbs());
player.setMeta(PlotPlayer.META_LAST_PLOT, current); player.setMeta(PlotPlayer.META_LAST_PLOT, current);
cmd.execute(player, params, null, null); cmd.execute(player, params, null, null);
} }
if (location == null) { if (loc == null) {
player.deleteMeta(PlotPlayer.META_LOCATION); player.deleteMeta(PlotPlayer.META_LOCATION);
} else { } else {
player.setMeta(PlotPlayer.META_LOCATION, location); player.setMeta(PlotPlayer.META_LOCATION, loc);
} }
if (plot == null) { if (plot == null) {
player.deleteMeta(PlotPlayer.META_LAST_PLOT); player.deleteMeta(PlotPlayer.META_LAST_PLOT);

View File

@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; 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.generator.HybridUtils;
import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -22,24 +23,28 @@ public class DebugRoadRegen extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length < 1) { if (args.length < 1) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
DebugRoadRegen.USAGE);
return false; return false;
} }
String kind = args[0].toLowerCase(); String kind = args[0].toLowerCase();
switch (kind) { switch (kind) {
case "plot": case "plot":
return regenPlot(player); return regenPlot(player);
case "region": case "region":
return regenRegion(player, Arrays.copyOfRange(args, 1, args.length)); return regenRegion(player, Arrays.copyOfRange(args, 1, args.length));
default: default:
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
DebugRoadRegen.USAGE);
return false; return false;
} }
} }
public boolean regenPlot(PlotPlayer player) { public boolean regenPlot(PlotPlayer player) {
Location location = player.getLocation(); Location loc = player.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
} }
@ -77,8 +82,8 @@ public class DebugRoadRegen extends SubCommand {
return false; return false;
} }
Location location = player.getLocation(); Location loc = player.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
} }

View File

@ -3,29 +3,21 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Expression; import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.util.*;
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", @CommandDeclaration(command = "delete", permission = "plots.delete",
description = "Delete the plot you stand on", usage = "/plot delete", description = "Delete the plot you stand on", usage = "/plot delete",
aliases = {"dispose", "del"}, category = CommandCategory.CLAIMING, aliases = {"dispose", "del", "unclaim"}, category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE, confirmation = true) public class Delete extends SubCommand { requiredType = RequiredType.NONE, confirmation = true) public class Delete extends SubCommand {
// Note: To delete a specific plot use /plot <plot> delete // Note: To delete a specific plot use /plot <plot> delete
// The syntax also works with any command: /plot <plot> <command> // The syntax also works with any command: /plot <plot> <command>
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }
@ -38,9 +30,8 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
} }
final PlotArea plotArea = plot.getArea(); final PlotArea plotArea = plot.getArea();
final java.util.Set<Plot> plots = plot.getConnectedPlots(); final java.util.Set<Plot> plots = plot.getConnectedPlots();
final int currentPlots = Settings.Limit.GLOBAL ? final int currentPlots =
player.getPlotCount() : Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
player.getPlotCount(location.getWorld());
Runnable run = new Runnable() { Runnable run = new Runnable() {
@Override public void run() { @Override public void run() {
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {

View File

@ -56,7 +56,7 @@ import java.util.UUID;
continue; continue;
} }
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.CANT_REMOVE_OWNER, MainUtil.getName(uuid));
return false; return false;
} }
@ -97,8 +97,8 @@ import java.util.UUID;
if (player.getGameMode() == PlotGameMode.SPECTATOR) { if (player.getGameMode() == PlotGameMode.SPECTATOR) {
player.stopSpectating(); player.stopSpectating();
} }
Location location = player.getLocation(); Location loc = player.getLocation();
Location spawn = WorldUtil.IMP.getSpawn(location.getWorld()); Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld());
MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED); MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED);
if (plot.equals(spawn.getPlot())) { if (plot.equals(spawn.getPlot())) {
Location newSpawn = Location newSpawn =

View File

@ -19,8 +19,8 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
requiredType = RequiredType.NONE) public class Done extends SubCommand { requiredType = RequiredType.NONE) public class Done extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }

View File

@ -76,7 +76,7 @@ import java.net.URL;
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD); Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD);
return false; return false;
} }
MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512"); MainUtil.sendMessage(player, Captions.MCA_FILE_SIZE);
plot.addRunning(); plot.addRunning();
WorldUtil.IMP.saveWorld(world); WorldUtil.IMP.saveWorld(world);
WorldUtil.IMP.upload(plot, null, null, new RunnableVal<URL>() { WorldUtil.IMP.upload(plot, null, null, new RunnableVal<URL>() {

View File

@ -24,9 +24,10 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.util.*; import java.util.*;
@CommandDeclaration(command = "setflag", aliases = {"f", "flag", @CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf", "setflag"},
"setflag"}, usage = "/plot flag <set|remove|add|list|info> <flag> <value>", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") usage = "/plot flag <set|remove|add|list|info> <flag> <value>", description = "Set plot flags",
public class FlagCmd extends SubCommand { category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE,
permission = "plots.flag") public class FlagCmd extends SubCommand {
private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) {
key = key.toLowerCase(); key = key.toLowerCase();
@ -86,12 +87,11 @@ public class FlagCmd extends SubCommand {
* plot flag list * plot flag list
*/ */
if (args.length == 0) { if (args.length == 0) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
"/plot flag <set|remove|add|list|info>");
return false; return false;
} }
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
return false; return false;
@ -310,7 +310,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
MainUtil MainUtil
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>"); .sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
return false; return false;
} }
} }

View File

@ -14,7 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "help", description = "Get this help menu", aliases = {"he", "?"}, @CommandDeclaration(command = "help", description = "Get this help menu", aliases = "?",
category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use")
public class Help extends Command { public class Help extends Command {
public Help(Command parent) { public Help(Command parent) {

View File

@ -14,8 +14,9 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.util.List; import java.util.List;
@CommandDeclaration(command = "inbox", description = "Review the comments for a plot", @CommandDeclaration(command = "inbox", description = "Review the comments for a plot",
usage = "/plot inbox [inbox] [delete <index>|clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) usage = "/plot inbox [inbox] [delete <index>|clear|page]", permission = "plots.inbox",
public class Inbox extends SubCommand { category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) public class Inbox
extends SubCommand {
public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) { public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
if (oldComments == null || oldComments.isEmpty()) { if (oldComments == null || oldComments.isEmpty()) {
@ -70,8 +71,7 @@ public class Inbox extends SubCommand {
return false; return false;
} }
if (args.length == 0) { if (args.length == 0) {
sendMessage(player, Captions.COMMAND_SYNTAX, sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
"/plot inbox [inbox] [delete <index>|clear|page]");
for (final CommentInbox inbox : CommentManager.inboxes.values()) { for (final CommentInbox inbox : CommentManager.inboxes.values()) {
if (inbox.canRead(plot, player)) { if (inbox.canRead(plot, player)) {
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() { if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
@ -148,15 +148,8 @@ public class Inbox extends SubCommand {
} }
PlotComment comment = value.get(index - 1); PlotComment comment = value.get(index - 1);
inbox.removeComment(plot, comment); inbox.removeComment(plot, comment);
boolean success = plot.removeComment(comment); plot.removeComment(comment);
if (success) { MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, comment.comment);
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS,
comment.comment);
} else {
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_FAILURE,
comment.comment);
}
} }
})) { })) {
sendMessage(player, Captions.NOT_IN_PLOT); sendMessage(player, Captions.NOT_IN_PLOT);
@ -172,14 +165,13 @@ public class Inbox extends SubCommand {
if (!comments.isEmpty()) { if (!comments.isEmpty()) {
plot.removeComments(comments); plot.removeComments(comments);
} }
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, "*"); MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*");
return true; return true;
default: default:
try { try {
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
sendMessage(player, Captions.COMMAND_SYNTAX, sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
"/plot inbox [inbox] [delete <index>|clear|page]");
return false; return false;
} }
} }

View File

@ -17,7 +17,7 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "kick", aliases = {"k"}, description = "Kick a player from your plot", @CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot",
permission = "plots.kick", usage = "/plot kick <player>", category = CommandCategory.TELEPORT, permission = "plots.kick", usage = "/plot kick <player>", category = CommandCategory.TELEPORT,
requiredType = RequiredType.PLAYER) public class Kick extends SubCommand { requiredType = RequiredType.PLAYER) public class Kick extends SubCommand {

View File

@ -16,7 +16,7 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "leave", @CommandDeclaration(command = "leave",
description = "Removes self from being trusted or a member of the plot", description = "Removes self from being trusted or a member of the plot",
permission = "plots.leave", category = CommandCategory.CLAIMING, permission = "plots.leave", category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE) public class Leave extends Command { requiredType = RequiredType.PLAYER) public class Leave extends Command {
public Leave() { public Leave() {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }

View File

@ -19,7 +19,7 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
@CommandDeclaration(command = "load", aliases = {"restore"}, category = CommandCategory.SCHEMATIC, @CommandDeclaration(command = "load", aliases = "restore", category = CommandCategory.SCHEMATIC,
requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load", requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load",
usage = "/plot load") public class Load extends SubCommand { usage = "/plot load") public class Load extends SubCommand {

View File

@ -193,19 +193,19 @@ public class MainCommand extends Command {
// Clear perm caching // // Clear perm caching //
player.deleteMeta("perm"); player.deleteMeta("perm");
// Optional command scope // // Optional command scope //
Location location = null; Location loc = null;
Plot plot = null; Plot plot = null;
boolean tp = false; boolean tp = false;
if (args.length >= 2) { if (args.length >= 2) {
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
Plot newPlot = Plot.fromString(area, args[0]); Plot newPlot = Plot.fromString(area, args[0]);
if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea() if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea()
.equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_SUDO_AREA)) .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN))
&& !newPlot.isDenied(player.getUUID())) { && !newPlot.isDenied(player.getUUID())) {
Location newLoc = newPlot.getCenter(); Location newLoc = newPlot.getCenter();
if (player.canTeleport(newLoc)) { if (player.canTeleport(newLoc)) {
// Save meta // Save meta
location = player.getMeta(PlotPlayer.META_LOCATION); loc = player.getMeta(PlotPlayer.META_LOCATION);
plot = player.getMeta(PlotPlayer.META_LAST_PLOT); plot = player.getMeta(PlotPlayer.META_LAST_PLOT);
tp = true; tp = true;
// Set loc // Set loc
@ -262,10 +262,10 @@ public class MainCommand extends Command {
} }
// Reset command scope // // Reset command scope //
if (tp && !(player instanceof ConsolePlayer)) { if (tp && !(player instanceof ConsolePlayer)) {
if (location == null) { if (loc == null) {
player.deleteMeta(PlotPlayer.META_LOCATION); player.deleteMeta(PlotPlayer.META_LOCATION);
} else { } else {
player.setMeta(PlotPlayer.META_LOCATION, location); player.setMeta(PlotPlayer.META_LOCATION, loc);
} }
if (plot == null) { if (plot == null) {
player.deleteMeta(PlotPlayer.META_LAST_PLOT); player.deleteMeta(PlotPlayer.META_LAST_PLOT);

View File

@ -3,7 +3,6 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Direction;
import com.github.intellectualsites.plotsquared.plot.object.Expression; import com.github.intellectualsites.plotsquared.plot.object.Expression;
import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.Plot;
@ -18,10 +17,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.util.UUID; import java.util.UUID;
import static com.github.intellectualsites.plotsquared.plot.object.Direction.getFromIndex;
@CommandDeclaration(command = "merge", aliases = "m", @CommandDeclaration(command = "merge", aliases = "m",
description = "Merge the plot you are standing on, with another plot", description = "Merge the plot you are standing on with another plot",
permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]", permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]",
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true) category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true)
public class Merge extends SubCommand { public class Merge extends SubCommand {
@ -52,8 +49,8 @@ public class Merge extends SubCommand {
} }
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocationFull(); Location loc = player.getLocationFull();
final Plot plot = location.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }
@ -85,20 +82,20 @@ public class Merge extends SubCommand {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1)); MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1));
return false; return false;
} }
Direction direction = Direction.ALL; int direction = -1;
if (args.length == 0) { if (args.length == 0) {
switch (direction(player.getLocationFull().getYaw())) { switch (direction(player.getLocationFull().getYaw())) {
case "NORTH": case "NORTH":
direction = Direction.NORTH; direction = 0;
break; break;
case "EAST": case "EAST":
direction = Direction.EAST; direction = 1;
break; break;
case "SOUTH": case "SOUTH":
direction = Direction.SOUTH; direction = 2;
break; break;
case "WEST": case "WEST":
direction = Direction.WEST; direction = 3;
break; break;
} }
} else { } else {
@ -113,7 +110,7 @@ public class Merge extends SubCommand {
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated());
return true; return true;
} }
if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) { if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) {
EconHandler.manager.withdrawMoney(player, price); EconHandler.manager.withdrawMoney(player, price);
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price));
@ -127,16 +124,16 @@ public class Merge extends SubCommand {
} }
for (int i = 0; i < values.length; i++) { for (int i = 0; i < values.length; i++) {
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) {
direction = getFromIndex(i); direction = i;
break; break;
} }
} }
} }
if (direction == Direction.ALL) { if (direction == -1) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated() MainUtil.sendMessage(player,
.replaceAll("%dir%", direction(location.getYaw()))); Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw())));
return false; return false;
} }
final boolean terrain; final boolean terrain;
@ -159,8 +156,7 @@ public class Merge extends SubCommand {
return true; return true;
} }
Plot adjacent = plot.getRelative(direction); Plot adjacent = plot.getRelative(direction);
if (adjacent == null || !adjacent.hasOwner() || adjacent if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4)
.getMerged((direction.getIndex() + 2) % 4)
|| adjacent.isOwner(uuid)) { || adjacent.isOwner(uuid)) {
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
return false; return false;
@ -177,7 +173,7 @@ public class Merge extends SubCommand {
continue; continue;
} }
isOnline = true; isOnline = true;
final Direction dir = direction; final int dir = direction;
Runnable run = () -> { Runnable run = () -> {
MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED);
plot.autoMerge(dir, maxSize - size, owner, terrain); plot.autoMerge(dir, maxSize - size, owner, terrain);

View File

@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
*/ */
@CommandDeclaration(command = "middle", aliases = {"center", "centre"}, @CommandDeclaration(command = "middle", aliases = {"center", "centre"},
description = "Teleports you to the center of the plot", usage = "/plot middle", description = "Teleports you to the center of the plot", usage = "/plot middle",
category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE) public class Middle category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) public class Middle
extends SubCommand { extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] arguments) { @Override public boolean onCommand(PlotPlayer player, String[] arguments) {
@ -20,9 +20,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
if (plot == null) { if (plot == null) {
return sendMessage(player, Captions.NOT_IN_PLOT); return sendMessage(player, Captions.NOT_IN_PLOT);
} }
if (!plot.hasOwner()) {
return sendMessage(player, Captions.PLOT_UNOWNED);
}
player.teleport(plot.getCenter()); player.teleport(plot.getCenter());
return true; return true;
} }

View File

@ -11,12 +11,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot", @CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot",
aliases = {"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING, permission = "plots.move", category = CommandCategory.CLAIMING,
requiredType = RequiredType.PLAYER) public class Move extends SubCommand { requiredType = RequiredType.PLAYER) public class Move extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = loc.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
} }

View File

@ -3,11 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.*;
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.Arrays;
import java.util.Collection; import java.util.Collection;
@ -24,8 +20,8 @@ import java.util.Locale;
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait"); "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait");
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }

View File

@ -17,7 +17,7 @@ import java.util.UUID;
@CommandDeclaration(command = "setowner", permission = "plots.set.owner", @CommandDeclaration(command = "setowner", permission = "plots.set.owner",
description = "Set the plot owner", usage = "/plot setowner <player>", description = "Set the plot owner", usage = "/plot setowner <player>",
aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING, aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { requiredType = RequiredType.PLAYER, confirmation = true) public class Owner extends SetCommand {
@Override public boolean set(final PlotPlayer player, final Plot plot, String value) { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) {
Set<Plot> plots = plot.getConnectedPlots(); Set<Plot> plots = plot.getConnectedPlots();

View File

@ -22,8 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21"); "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21");
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki");
// MainUtil.sendMessage(player, MainUtil.sendMessage(player,
// "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); "$2>> $1&lNewest Version$2: $1" + getNewestVersionString());
} }
}); });
return true; return true;

View File

@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", @CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight",
category = CommandCategory.DEBUG) public class Relight extends Command { category = CommandCategory.DEBUG, requiredType = RequiredType.PLAYER) public class Relight extends Command {
public Relight() { public Relight() {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }

View File

@ -19,7 +19,7 @@ import java.util.UUID;
@CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"}, @CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"},
description = "Remove a player from a plot", usage = "/plot remove <player>", description = "Remove a player from a plot", usage = "/plot remove <player>",
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER,
permission = "plots.remove") public class Remove extends SubCommand { permission = "plots.remove") public class Remove extends SubCommand {
public Remove() { public Remove() {

View File

@ -25,7 +25,7 @@ import java.util.UUID;
@CommandDeclaration(command = "schematic", permission = "plots.schematic", @CommandDeclaration(command = "schematic", permission = "plots.schematic",
description = "Schematic command", aliases = {"sch", "schem"}, description = "Schematic command", aliases = {"sch", "schem"},
category = CommandCategory.SCHEMATIC, usage = "/plot schematic <arg...>") category = CommandCategory.SCHEMATIC, usage = "/plot schematic <test|save|saveall|paste>")
public class SchematicCmd extends SubCommand { public class SchematicCmd extends SubCommand {
private boolean running = false; private boolean running = false;
@ -62,7 +62,7 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
if (this.running) { if (this.running) {
MainUtil.sendMessage(player, "&cTask is already running."); MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
return false; return false;
} }
final String location = args[1]; final String location = args[1];
@ -148,8 +148,7 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD_ARGS);
"&cNeed world argument. Use &7/plot sch exportall <area>");
return false; return false;
} }
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
@ -160,19 +159,17 @@ public class SchematicCmd extends SubCommand {
Collection<Plot> plots = area.getPlots(); Collection<Plot> plots = area.getPlots();
if (plots.isEmpty()) { if (plots.isEmpty()) {
MainUtil MainUtil
.sendMessage(player, "&cInvalid world. Use &7/plot sch exportall <area>"); .sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD);
return false; return false;
} }
boolean result = SchematicHandler.manager.exportAll(plots, null, null, boolean result = SchematicHandler.manager.exportAll(plots, null, null,
() -> MainUtil.sendMessage(player, "&aFinished mass export")); () -> MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_FINISHED));
if (!result) { if (!result) {
MainUtil.sendMessage(player, "&cTask is already running."); MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
return false; return false;
} else { } else {
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED);
"&3Plot&8->&3Schematic&8: &7Mass export has started. This may take a while."); MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_COUNT, plots.size());
MainUtil.sendMessage(player,
"&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots...");
} }
break; break;
} }
@ -184,7 +181,7 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
if (this.running) { if (this.running) {
MainUtil.sendMessage(player, "&cTask is already running."); MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
return false; return false;
} }
Location location = player.getLocation(); Location location = player.getLocation();
@ -203,14 +200,14 @@ public class SchematicCmd extends SubCommand {
} }
ArrayList<Plot> plots = Lists.newArrayList(plot); ArrayList<Plot> plots = Lists.newArrayList(plot);
boolean result = SchematicHandler.manager.exportAll(plots, null, null, () -> { boolean result = SchematicHandler.manager.exportAll(plots, null, null, () -> {
MainUtil.sendMessage(player, "&aFinished export"); MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_SINGLE_FINISHED);
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
}); });
if (!result) { if (!result) {
MainUtil.sendMessage(player, "&cTask is already running."); MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
return false; return false;
} else { } else {
MainUtil.sendMessage(player, "&7Starting export..."); MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED);
} }
break; break;
case "list": { case "list": {

View File

@ -10,6 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket; import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@ -44,6 +45,7 @@ import java.util.stream.IntStream;
} }
@Override public boolean set(PlotPlayer player, final Plot plot, String value) { @Override public boolean set(PlotPlayer player, final Plot plot, String value) {
PlotArea plotArea = player.getLocation().getPlotArea();
PlotManager manager = player.getLocation().getPlotManager(); PlotManager manager = player.getLocation().getPlotManager();
String[] components = manager.getPlotComponents(plot.getId()); String[] components = manager.getPlotComponents(plot.getId());
boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID()); boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID());
@ -126,7 +128,7 @@ import java.util.stream.IntStream;
} }
MainUtil MainUtil
.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan .sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan
.join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted())); .join(newValues, Captions.BLOCK_LIST_SEPARATOR.formatted()));
return false; return false;
} }

View File

@ -11,8 +11,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
public abstract class SetCommand extends SubCommand { public abstract class SetCommand extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }

View File

@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@CommandDeclaration(command = "sethome", permission = "plots.set.home", @CommandDeclaration(command = "sethome", permission = "plots.set.home",
description = "Set the plot home to your current position", usage = "/plot sethome [none]", description = "Set the plot home to your current position", usage = "/plot sethome [none]",
aliases = {"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) aliases = {"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
public class SetHome extends SetCommand { public class SetHome extends SetCommand {
@Override public boolean set(PlotPlayer player, Plot plot, String value) { @Override public boolean set(PlotPlayer player, Plot plot, String value) {
@ -25,10 +25,11 @@ public class SetHome extends SetCommand {
} }
case "": case "":
Plot base = plot.getBasePlot(false); Plot base = plot.getBasePlot(false);
Location bottom = base.getBottomAbs(); Location bot = base.getBottomAbs();
Location location = player.getLocationFull(); Location loc = player.getLocationFull();
BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(), BlockLoc rel =
location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()); new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(),
loc.getYaw(), loc.getPitch());
base.setHome(rel); base.setHome(rel);
return MainUtil.sendMessage(player, Captions.POSITION_SET); return MainUtil.sendMessage(player, Captions.POSITION_SET);
default: default:

View File

@ -16,8 +16,8 @@ import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import lombok.*; import lombok.*;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -288,11 +288,6 @@ import java.util.Map.Entry;
MainUtil.sendMessage(player, "&cYou need to choose a world name!"); MainUtil.sendMessage(player, "&cYou need to choose a world name!");
return false; return false;
} }
if (!d(args[0])) {
MainUtil.sendMessage(player,
"Non [a-z0-9_.-] character in the world name: " + args[0]);
return false;
}
if (WorldUtil.IMP.isWorld(args[0])) { if (WorldUtil.IMP.isWorld(args[0])) {
if (PlotSquared.get().hasPlotArea(args[0])) { if (PlotSquared.get().hasPlotArea(args[0])) {
MainUtil.sendMessage(player, "&cThat world name is already taken!"); MainUtil.sendMessage(player, "&cThat world name is already taken!");
@ -322,11 +317,6 @@ import java.util.Map.Entry;
return false; return false;
} }
private static boolean d(String s) {
return s.chars().allMatch((i) -> {
return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46;
});
}
private static final class StepPickGenerator extends SetupStep { private static final class StepPickGenerator extends SetupStep {
@Getter private String generator; @Getter private String generator;

View File

@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
public class Swap extends SubCommand { public class Swap extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocation(); Location loc = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = loc.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
} }

View File

@ -113,8 +113,7 @@ import java.util.zip.ZipOutputStream;
return true; return true;
} }
} }
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
"/plot template <import|export> <world> [template]");
return true; return true;
} }
final String world = args[1]; final String world = args[1];

View File

@ -9,14 +9,16 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use", @CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use",
usage = "/plot toggle <chat|chatspy|clear-confirmation|titles|worldedit>",
description = "Toggle per user settings", requiredType = RequiredType.NONE, description = "Toggle per user settings", requiredType = RequiredType.NONE,
category = CommandCategory.SETTINGS) public class Toggle extends Command { category = CommandCategory.SETTINGS) public class Toggle extends Command {
public Toggle() { public Toggle() {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@CommandDeclaration(command = "chatspy", aliases = {"spy"}, @CommandDeclaration(command = "chatspy", aliases = {"spy"},
permission = "plots.admin.command.chat", description = "Toggle admin chat spying") permission = "plots.admin.command.chat", description = "Toggle plot chat spy")
public void chatspy(Command command, PlotPlayer player, String[] args, public void chatspy(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -75,18 +77,6 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
} }
} }
@CommandDeclaration(command = "time", permission = "plots.toggle.time",
description = "Toggle plot time settings")
public void time(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "disabletime")) {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
} else {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
}
}
public boolean toggle(PlotPlayer player, String key) { public boolean toggle(PlotPlayer player, String key) {
if (player.getAttribute(key)) { if (player.getAttribute(key)) {
player.removeAttribute(key); player.removeAttribute(key);

View File

@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.PLAYER, @CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.PLAYER,
usage = "/plot trust <player>", usage = "/plot trust <player>",
description = "Allow a user to build in a plot while you are offline", description = "Allow a user to build in a plot and use WorldEdit while you are offline",
category = CommandCategory.SETTINGS) public class Trust extends Command { category = CommandCategory.SETTINGS) public class Trust extends Command {
public Trust() { public Trust() {
@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture;
continue; continue;
} }
if (currentPlot.isOwner(uuid)) { if (currentPlot.isOwner(uuid)) {
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
iterator.remove(); iterator.remove();
continue; continue;
} }

View File

@ -5,11 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
@CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"}, @CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"},
description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", description = "Unlink a mega-plot", usage = "/plot unlink [createroads]",
@ -17,8 +13,9 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
public class Unlink extends SubCommand { public class Unlink extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
return !sendMessage(player, Captions.NOT_IN_PLOT); return !sendMessage(player, Captions.NOT_IN_PLOT);
} }
@ -44,7 +41,7 @@ public class Unlink extends SubCommand {
} }
Runnable runnable = () -> { Runnable runnable = () -> {
if (!plot.unlinkPlot(createRoad, createRoad)) { if (!plot.unlinkPlot(createRoad, createRoad)) {
MainUtil.sendMessage(player, "&cUnlink has been cancelled"); MainUtil.sendMessage(player, Captions.UNMERGE_CANCELLED);
return; return;
} }
MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS); MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS);

View File

@ -16,7 +16,7 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "visit", permission = "plots.visit", @CommandDeclaration(command = "visit", permission = "plots.visit",
description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]", description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]",
aliases = {"v", "tp", "teleport", "goto", "home", "h"}, requiredType = RequiredType.PLAYER, aliases = {"v", "tp", "teleport", "goto", "home", "h", "warp"}, requiredType = RequiredType.PLAYER,
category = CommandCategory.TELEPORT) public class Visit extends Command { category = CommandCategory.TELEPORT) public class Visit extends Command {
public Visit() { public Visit() {

View File

@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass", @CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass",
description = "Force bypass of WorldEdit", aliases = {"wea"}, usage = "/plot weanywhere", description = "Force bypass of WorldEdit restrictions", aliases = {"wea"}, usage = "/plot weanywhere",
requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) @Deprecated requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) @Deprecated
public class WE_Anywhere extends SubCommand { public class WE_Anywhere extends SubCommand {

View File

@ -59,8 +59,8 @@ public enum Captions {
PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"),
PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"),
PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"),
PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD( PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"),
"plots.merge.keeproad", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad", "static.permissions"),
PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"),
PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"),
PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"),
@ -70,8 +70,8 @@ public enum Captions {
PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"),
PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"),
PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"),
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT( PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"),
"plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit", "static.permissions"),
PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"),
PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"), PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"),
PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"),
@ -124,8 +124,8 @@ public enum Captions {
PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"), PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"),
PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"), PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"),
PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"),
PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), PERMISSION_LIST_FOR_SALE( PERMISSION_GRANT("plots.grant.%s0", "static.permissions"),
"plots.list.forsale", "static.permissions"), PERMISSION_LIST_FOR_SALE("plots.list.forsale", "static.permissions"),
PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"), PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"),
PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"), PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"),
PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"), PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"),
@ -140,8 +140,8 @@ public enum Captions {
PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"), PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"),
PERMISSION_LIST_AREA("plots.list.area", "static.permissions"), PERMISSION_LIST_AREA("plots.list.area", "static.permissions"),
PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"), PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"),
PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER( PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"),
"plots.admin.command.setowner", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER("plots.admin.command.setowner", "static.permissions"),
PERMISSION_COMMENT("plots.comment", "static.permissions"), PERMISSION_COMMENT("plots.comment", "static.permissions"),
PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"), PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"), PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"),
@ -166,20 +166,19 @@ public enum Captions {
CONSOLE_JAVA_OUTDATED( CONSOLE_JAVA_OUTDATED(
"&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance " "&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance "
+ "and security. %s0 will require Java 8 in a future update.", + "and security. %s0 will require Java 8 in a future update.",
"static.console"), CONSOLE_PLEASE_ENABLE_METRICS( "static.console"),
CONSOLE_PLEASE_ENABLE_METRICS(
"&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. " "&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. "
+ "Bug fixes and new features are influenced on metrics.", "static.console"), + "Bug fixes and new features are influenced on metrics.", "static.console"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Confirm"> //<editor-fold desc="Confirm">
EXPIRED_CONFIRM("$2Confirmation has expired, please run the command again!", "Confirm"), EXPIRED_CONFIRM("$2Confirmation has expired, please run the command again!", "Confirm"),
FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"), FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"),
REQUIRES_CONFIRM( REQUIRES_CONFIRM("$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"),
"$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm",
"Confirm"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Move"> //<editor-fold desc="Move">
MOVE_SUCCESS("$4Successfully moved plot.", "Move"), COPY_SUCCESS("$4Successfully copied plot.", MOVE_SUCCESS("$4Successfully moved plot.", "Move"),
"Move"), COPY_SUCCESS("$4Successfully copied plot.", "Move"),
REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"), REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Area Create"> //<editor-fold desc="Area Create">
@ -188,8 +187,7 @@ public enum Captions {
//</editor-fold> //</editor-fold>
//<editor-fold desc="Web"> //<editor-fold desc="Web">
GENERATING_LINK("$1Processing plot...", "Web"), GENERATING_LINK("$1Processing plot...", "Web"),
GENERATING_LINK_FAILED( GENERATING_LINK_FAILED("$2Failed to generate download link!", "Web"),
"$2Failed to generate download link!", "Web"),
SAVE_FAILED("$2Failed to save", "Web"), SAVE_FAILED("$2Failed to save", "Web"),
LOAD_NULL("$2Please use $4/plot load $2to get a list of schematics", "Web"), LOAD_NULL("$2Please use $4/plot load $2to get a list of schematics", "Web"),
LOAD_FAILED("$2Failed to load schematic", "Web"), LOAD_FAILED("$2Failed to load schematic", "Web"),
@ -202,205 +200,148 @@ public enum Captions {
//<editor-fold desc="Cluster"> //<editor-fold desc="Cluster">
CLUSTER_AVAILABLE_ARGS( CLUSTER_AVAILABLE_ARGS(
"$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, " "$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, "
+ "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING( + "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"),
"$2There are $1%s$2 clusters in this world", "Cluster"), CLUSTER_LIST_ELEMENT("$2 - $1%s&-", CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"),
"Cluster"), CLUSTER_INTERSECTION( CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"),
"$2The proposed area overlaps with: %s0", "Cluster"), CLUSTER_OUTSIDE( CLUSTER_INTERSECTION("$2The proposed area overlaps with: %s0", "Cluster"),
"$2The proposed area is outside the plot area: %s0", "Cluster"), CLUSTER_ADDED( CLUSTER_OUTSIDE("$2The proposed area is outside the plot area: %s0", "Cluster"),
"$4Successfully created the cluster.", "Cluster"), CLUSTER_DELETED( CLUSTER_ADDED("$4Successfully created the cluster.", "Cluster"),
"$4Successfully deleted the cluster.", "Cluster"), CLUSTER_RESIZED( CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"),
"$4Successfully resized the cluster.", "Cluster"), CLUSTER_ADDED_USER( CLUSTER_RESIZED("$4Successfully resized the cluster.", "Cluster"),
"$4Successfully added user to the cluster.", "Cluster"), CANNOT_KICK_PLAYER( CLUSTER_ADDED_USER("$4Successfully added user to the cluster.", "Cluster"),
"$2You cannot kick that player", "Cluster"), CLUSTER_INVITED( CANNOT_KICK_PLAYER("$2You cannot kick that player", "Cluster"),
"$1You have been invited to the following cluster: $2%s", "Cluster"), CLUSTER_REMOVED( CLUSTER_INVITED("$1You have been invited to the following cluster: $2%s", "Cluster"),
"$1You have been removed from cluster: $2%s", "Cluster"), CLUSTER_KICKED_USER( CLUSTER_REMOVED("$1You have been removed from cluster: $2%s", "Cluster"),
"$4Successfully kicked the user", "Cluster"), INVALID_CLUSTER( CLUSTER_KICKED_USER("$4Successfully kicked the user", "Cluster"),
"$1Invalid cluster name: $2%s", "Cluster"), CLUSTER_NOT_ADDED( INVALID_CLUSTER("$1Invalid cluster name: $2%s", "Cluster"),
"$2That player was not added to the plot cluster", "Cluster"), CLUSTER_CANNOT_LEAVE( CLUSTER_NOT_ADDED("$2That player was not added to the plot cluster", "Cluster"),
"$1You must delete or transfer ownership before leaving", CLUSTER_CANNOT_LEAVE("$1You must delete or transfer ownership before leaving", "Cluster"),
"Cluster"), CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", "Cluster"),
"Cluster"), CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", "Cluster"),
"Cluster"), CLUSTER_REGENERATED("$4Successfully started cluster regeneration", CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"),
"Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"),
CLUSTER_INFO( CLUSTER_INFO("$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"),
"$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%",
"Cluster"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Border"> //<editor-fold desc="Border">
BORDER("$2You are outside the current map border", "Border"), BORDER("$2You are outside the current map border", "Border"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Un-Claim">
UNCLAIM_SUCCESS("$4You successfully unclaimed the plot.", "Unclaim"), UNCLAIM_FAILED(
"$2Could not unclaim the plot", "Unclaim"),
//</editor-fold>
//<editor-fold desc="WorldEdit Masks"> //<editor-fold desc="WorldEdit Masks">
WORLDEDIT_DELAYED("$2Please wait while we process your WorldEdit action...", WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", "WorldEdit Masks"),
"WorldEdit Masks"), WORLDEDIT_RUN("$2Apologies for the delay. Now executing: %s", WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.", "WorldEdit Masks"),
"WorldEdit Masks"), //</editor-fold>
REQUIRE_SELECTION_IN_MASK( //<editor-fold desc="GameMode">
"$2%s of your selection is not within your plot mask. You can only make edits within your plot.", GAMEMODE_WAS_BYPASSED("$1You bypassed the gamemode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"),
"WorldEdit Masks"), WORLDEDIT_VOLUME( //</editor-fold>
"$2You cannot select a volume of %current%. The maximum volume you can modify is %max%.", //<editor-fold desc="Height Limit">
"WorldEdit Masks"), HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}", "Height Limit"),
WORLDEDIT_ITERATIONS(
"$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%.",
"WorldEdit Masks"), WORLDEDIT_UNSAFE("$2Access to that command has been blocked",
"WorldEdit Masks"),
WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea",
"WorldEdit Masks"), WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.",
"WorldEdit Masks"),
WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted.",
"WorldEdit Masks"), WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted.",
"WorldEdit Masks"),
GAMEMODE_WAS_BYPASSED("$1You bypassed the GameMode ($2{gamemode}$1) $1set for $2{plot}",
"GameMode"), HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}",
"Height Limit"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Records"> //<editor-fold desc="Records">
NOTIFY_ENTER("$2%player $2entered your plot ($1%plot$2)", "Records"), NOTIFY_ENTER("$2%player $2entered your plot ($1%plot$2)", "Records"),
NOTIFY_LEAVE("$2%player $2left your plot ($1%plot$2)", "Records"), NOTIFY_LEAVE("$2%player $2left your plot ($1%plot$2)", "Records"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Swap"> //<editor-fold desc="Swap">
SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"), SWAP_DIMENSIONS( SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"),
"$2The proposed areas must have comparable dimensions", "Swap"), SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"),
SWAP_SYNTAX("$2/plot swap <id>", "Swap"),
SWAP_SYNTAX("$2/plot swap <id>", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"),
STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"), STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Comments"> //<editor-fold desc="Comment">
INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), NOT_VALID_INBOX_INDEX( INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"),
"$2No comment at index %s", "Comment"), NOT_VALID_INBOX_INDEX("$2No comment at index %s", "Comment"),
INBOX_ITEM("$2 - $4%s", "Comment"),
INBOX_ITEM("$2 - $4%s", "Comment"), COMMENT_SYNTAX("$2Use /plot comment [X;Z] <%s> <comment>", COMMENT_SYNTAX("$2Use /plot comment [X;Z] <%s> <comment>", "Comment"),
"Comment"), INVALID_INBOX("$2That is not a valid inbox.&-$1Accepted values: %s", "Comment"),
NO_PERM_INBOX("$2You do not have permission for that inbox", "Comment"),
INVALID_INBOX("$2That is not a valid inbox.&-$1Accepted values: %s", "Comment"), NO_PERM_INBOX( NO_PERM_INBOX_MODIFY("$2You do not have permission to modify that inbox", "Comment"),
"$2You do not have permission for that inbox", "Comment"), NO_PERM_INBOX_MODIFY( NO_PLOT_INBOX("$2You must stand in or supply a plot argument", "Comment"),
"$2You do not have permission to modify that inbox", "Comment"), NO_PLOT_INBOX( COMMENT_REMOVED_SUCCESS("$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"),
"$2You must stand in or supply a plot argument", "Comment"), COMMENT_REMOVED_SUCCESS( COMMENT_REMOVED_FAILURE("$4Failed to delete comment!", "Comment"),
"$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), COMMENT_REMOVED_FAILURE( COMMENT_ADDED("$4A comment has been left", "Comment"),
"$4Failed to delete comment!", "Comment"), COMMENT_ADDED("$4A comment has been left", COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"),
"Comment"), INBOX_EMPTY("$2No comments", "Comment"),
COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), INBOX_EMPTY(
"$2No comments", "Comment"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Console"> //<editor-fold desc="Console">
NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", "Console"),
"Console"), IS_CONSOLE("$2This command can only be executed by a player.", "Console"), IS_CONSOLE("$2This command can only be executed by a player.", "Console"),
//</editor-fold>
//<editor-fold desc="Inventory">
INVENTORY_USAGE("&cUsage: &6{usage}", "Inventory"), INVENTORY_DESC("&cDescription: &6{desc}",
"Inventory"),
INVENTORY_CATEGORY("&cCategory: &6{category}", "Inventory"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Clipboard"> //<editor-fold desc="Clipboard">
CLIPBOARD_SET( PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"),
"$2The current plot is now copied to your clipboard, use $1/plot paste$2 to paste it",
"Clipboard"), PASTED(
"$4The plot selection was successfully pasted. It has been cleared from your clipboard.",
"Clipboard"),
PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"), NO_CLIPBOARD(
"$2You don't have a selection in your clipboard", "Clipboard"),
CLIPBOARD_INFO(
"$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2",
"Clipboard"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Toggle"> //<editor-fold desc="Toggle">
TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"),
"Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"),
//</editor-fold>
//<editor-fold desc="Blocked Command">
COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"), COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Done"> //<editor-fold desc="Done">
DONE_ALREADY_DONE("$2This plot is already marked as done", "Done"),
DONE_ALREADY_DONE("$2This plot is already marked as done", "Done"), DONE_NOT_DONE( DONE_NOT_DONE("$2This plot is not marked as done.", "Done"),
"$2This plot is not marked as done.", "Done"), DONE_INSUFFICIENT_COMPLEXITY("$2This plot is too simple. Please add more detail before using this command.", "Done"),
DONE_SUCCESS("$1Successfully marked this plot as done.", "Done"),
DONE_INSUFFICIENT_COMPLEXITY(
"$2This plot is too simple. Please add more detail before using this command.",
"Done"), DONE_SUCCESS("$1Successfully marked this plot as done.", "Done"),
DONE_REMOVED("$1You may now continue building in this plot.", "Done"), DONE_REMOVED("$1You may now continue building in this plot.", "Done"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Ratings"> //<editor-fold desc="Ratings">
RATINGS_PURGED("$2Purged ratings for this plot", "Ratings"), RATING_NOT_VALID( RATINGS_PURGED("$2Purged ratings for this plot", "Ratings"),
"$2You need to specify a number between 1 and 10", "Ratings"), RATING_NOT_VALID("$2You need to specify a number between 1 and 10", "Ratings"),
RATING_ALREADY_EXISTS("$2You have already rated plot $2%s", "Ratings"),
RATING_ALREADY_EXISTS("$2You have already rated plot $2%s", "Ratings"), RATING_APPLIED( RATING_APPLIED("$4You successfully rated plot $2%s", "Ratings"),
"$4You successfully rated plot $2%s", "Ratings"), RATING_DISLIKED("$4You successfully disliked plot $2%s", "Ratings"),
RATING_LIKED("$4You successfully liked plot $2%s", "Ratings"),
RATING_DISLIKED("$4You successfully disliked plot $2%s", "Ratings"), RATING_LIKED( RATING_NOT_YOUR_OWN("$2You cannot rate your own plot", "Ratings"),
"$4You successfully liked plot $2%s", "Ratings"), RATING_NOT_DONE("$2You can only rate finished plots.", "Ratings"),
RATING_NOT_YOUR_OWN("$2You cannot rate your own plot", "Ratings"), RATING_NOT_DONE(
"$2You can only rate finished plots.", "Ratings"),
RATING_NOT_OWNED("$2You cannot rate a plot that is not claimed by anyone", "Ratings"), RATING_NOT_OWNED("$2You cannot rate a plot that is not claimed by anyone", "Ratings"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Tutorial"> //<editor-fold desc="Tutorial">
RATE_THIS("$2Rate this plot!", "Tutorial"), COMMENT_THIS( RATE_THIS("$2Rate this plot!", "Tutorial"),
"$2Leave some feedback on this plot: %s", "Tutorial"), COMMENT_THIS("$2Leave some feedback on this plot: %s", "Tutorial"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Economy"> //<editor-fold desc="Economy">
ECON_DISABLED("$2Economy is not enabled", "Economy"), CANNOT_AFFORD_PLOT( ECON_DISABLED("$2Economy is not enabled", "Economy"),
"$2You cannot afford to buy this plot. It costs $1%s", "Economy"), CANNOT_AFFORD_PLOT("$2You cannot afford to buy this plot. It costs $1%s", "Economy"),
NOT_FOR_SALE("$2This plot is not for sale", "Economy"),
NOT_FOR_SALE("$2This plot is not for sale", "Economy"), CANNOT_BUY_OWN( CANNOT_BUY_OWN("$2You cannot buy your own plot", "Economy"),
"$2You cannot buy your own plot", "Economy"), PLOT_SOLD("$4Your plot; $1%s0$4, has been sold to $1%s1$4 for $1$%s2", "Economy"),
CANNOT_AFFORD_MERGE("$2You cannot afford to merge the plots. It costs $1%s", "Economy"),
PLOT_SOLD("$4Your plot; $1%s0$4, has been sold to $1%s1$4 for $1$%s2", ADDED_BALANCE("$1%s $2has been added to your balance", "Economy"),
"Economy"), CANNOT_AFFORD_MERGE("$2You cannot afford to merge the plots. It costs $1%s", REMOVED_BALANCE("$1%s $2has been taken from your balance", "Economy"),
"Economy"),
ADDED_BALANCE("$1%s $2has been added to your balance", "Economy"), REMOVED_BALANCE(
"$1%s $2has been taken from your balance", "Economy"),
REMOVED_GRANTED_PLOT("$2You used %s plot grant(s), you've got $1%s $2left", "Economy"), REMOVED_GRANTED_PLOT("$2You used %s plot grant(s), you've got $1%s $2left", "Economy"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Setup"> //<editor-fold desc="Setup">
SETUP_INIT("$1Usage: $2/plot setup <value>", "Setup"), SETUP_STEP( SETUP_INIT("$1Usage: $2/plot setup <value>", "Setup"),
"$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"), SETUP_STEP("$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"),
SETUP_INVALID_ARG("$2%s0 is not a valid argument for step %s1. To cancel setup use: $1/plot setup cancel", "Setup"),
SETUP_INVALID_ARG( SETUP_VALID_ARG("$2Value $1%s0 $2set to %s1", "Setup"),
"$2%s0 is not a valid argument for step %s1. To cancel setup use: $1/plot setup cancel",
"Setup"), SETUP_VALID_ARG("$2Value $1%s0 $2set to %s1", "Setup"),
SETUP_FINISHED( SETUP_FINISHED(
"$4You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or " "$4You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or "
+ "your chosen world management plugin.", "Setup"), SETUP_WORLD_TAKEN( + "your chosen world management plugin.", "Setup"),
"$2%s is already a world", "Setup"), SETUP_WORLD_TAKEN("$2%s is already a world", "Setup"),
SETUP_MISSING_WORLD( SETUP_MISSING_WORLD(
"$2You need to specify a world name ($1/plot setup &l<world>$1 <generator>$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 -" "$2You need to specify a world name ($1/plot setup &l<world>$1 <generator>$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 -"
+ " $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), SETUP_MISSING_GENERATOR( + " $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"),
SETUP_MISSING_GENERATOR(
"$2You need to specify a generator ($1/plot setup <world> &l<generator>&r$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - " "$2You need to specify a generator ($1/plot setup <world> &l<generator>&r$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - "
+ "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), + "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"),
SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Schematic"> //<editor-fold desc="Schematics">
SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"),
SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", SCHEMATIC_MISSING_ARG("$2You need to specify an argument. Possible values: $1test <name>$2 , $1save$2 , $1paste $2, $1exportall$2, $1list", "Schematics"),
"Schematics"), SCHEMATIC_MISSING_ARG( SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s", "Schematics"),
"$2You need to specify an argument. Possible values: $1test <name>$2 , $1save$2 , $1paste $2, $1exportall$2, $1list", SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"),
"Schematics"), SCHEMATIC_PASTE_FAILED("$2Failed to paste the schematic", "Schematics"),
SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"),
SCHEMATIC_INVALID("$2That is not a valid schematic. Reason: $2%s",
"Schematics"), SCHEMATIC_VALID("$2That is a valid schematic", "Schematics"),
SCHEMATIC_PASTE_FAILED("$2Failed to paste the schematic",
"Schematics"), SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"),
SCHEMATIC_LIST("$4Saved Schematics: $1%s", "Schematics"), SCHEMATIC_LIST("$4Saved Schematics: $1%s", "Schematics"),
SCHEMATIC_ROAD_CREATED("$1Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen", "Schematics"),
MCA_FILE_SIZE("$1Note: The `.mca` files are 512x512", "Schematics"),
SCHEMATIC_EXPORTALL_STARTED("$1Starting export...", "Schematics"),
SCHEMATIC_EXPORTALL_WORLD_ARGS("$1Need world argument. Use $3/plot schem exportall <area>", "Schematics"),
SCHEMATIC_EXPORTALL_WORLD("$1Invalid world. Use &3/plot sch exportall <area>", "Schematics"),
SCHEMATIC_EXPORTALL_MASS_STARTED("$1Schematic mass export has been started. This may take a while", "Schematicss"),
SCHEMATIC_EXPORTALL_COUNT("$1Found $3%s $1plots...", "Schematics"),
SCHEMATIC_EXPORTALL_FINISHED("$1Finished mass export", "Schematics"),
SCHEMATIC_EXPORTALL_SINGLE_FINISHED("$1Finished export", "Schematics"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Titles"> //<editor-fold desc="Titles">
TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"),
@ -409,7 +350,6 @@ public enum Captions {
PREFIX_FAREWELL("$1%id%$2> ", "Titles"), PREFIX_FAREWELL("$1%id%$2> ", "Titles"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Core"> //<editor-fold desc="Core">
TASK_START("Starting task...", "Core"),
PREFIX("$3[$1P2$3] $2", "Core"), PREFIX("$3[$1P2$3] $2", "Core"),
ENABLED("$1%s0 is now enabled", "Core"), ENABLED("$1%s0 is now enabled", "Core"),
//</editor-fold> //</editor-fold>
@ -417,77 +357,50 @@ public enum Captions {
RELOADED_CONFIGS("$1Translations and world settings have been reloaded", "Reload"), RELOADED_CONFIGS("$1Translations and world settings have been reloaded", "Reload"),
RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), RELOAD_FAILED("$2Failed to reload file configurations", "Reload"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Description"> //<editor-fold desc="Desc">
DESC_SET("$2Plot description set", "Desc"), DESC_SET("$2Plot description set", "Desc"),
DESC_UNSET("$2Plot description unset", "Desc"), DESC_UNSET("$2Plot description unset", "Desc"),
MISSING_DESC("$2You need to specify a description", "Desc"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Alias"> //<editor-fold desc="Alias">
ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"),
ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", ALIAS_REMOVED("$2Plot alias removed", "Alias"),
"Alias"), ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"),
MISSING_ALIAS("$2You need to specify an alias", "Alias"), ALIAS_TOO_LONG(
"$2The alias must be < 50 characters in length", "Alias"),
ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Position"> //<editor-fold desc="Position">
POSITION_SET("$1Home position set to your current location", "Position"),
MISSING_POSITION("$2You need to specify a position. Possible values: $1none", POSITION_UNSET("$1Home position reset to the default location", "Position"),
"Position"), POSITION_SET("$1Home position set to your current location", "Position"), HOME_ARGUMENT("$2Use /plot set home [none]", "Position"),
POSITION_UNSET("$1Home position reset to the default location", "Position"), HOME_ARGUMENT(
"$2Use /plot set home [none]", "Position"),
INVALID_POSITION("$2That is not a valid position value", "Position"),
//</editor-fold>
//<editor-fold desc="Cap">
ENTITY_CAP("$2You are not allowed to spawn more mobs", "cap"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Permission"> //<editor-fold desc="Permission">
NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", "Permission"),
"Permission"),
NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"), NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"),
NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"), NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"),
NO_PLOT_PERMS("$2You must be the plot owner to perform this action", "Permission"), NO_PLOT_PERMS("$2You must be the plot owner to perform this action", "Permission"),
CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"),
CANT_CLAIM_MORE_CLUSTERS("$2You can't claim more clusters.", "Permission"), CANT_CLAIM_MORE_CLUSTERS("$2You can't claim more clusters.", "Permission"),
CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", "Permission"),
CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once", "Permission"),
"Permission"), CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once",
"Permission"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Merge"> //<editor-fold desc="Merge">
MERGE_NOT_VALID("$2This merge request is no longer valid.", "Merge"), MERGE_ACCEPTED( MERGE_NOT_VALID("$2This merge request is no longer valid.", "Merge"),
"$2The merge request has been accepted", "Merge"), MERGE_ACCEPTED("$2The merge request has been accepted", "Merge"),
SUCCESS_MERGE("$2Plots have been merged!", "Merge"),
SUCCESS_MERGE("$2Plots have been merged!", "Merge"), MERGE_REQUESTED( MERGE_REQUESTED("$2Successfully sent a merge request", "Merge"),
"$2Successfully sent a merge request", "Merge"), MERGE_REQUEST_CONFIRM("Merge request from %s", "Permission"),
NO_PERM_MERGE("$2You are not the owner of the plot: $1%plot%", "Merge"),
MERGE_REQUEST_CONFIRM("Merge request from %s", "Permission"), NO_PERM_MERGE( NO_AVAILABLE_AUTOMERGE("$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.", "Merge"),
"$2You are not the owner of the plot: $1%plot%", "Merge"), UNMERGE_CANCELLED("$1Unlink has been cancelled", "Merge"),
UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"),
NO_AVAILABLE_AUTOMERGE( UNLINK_SUCCESS("$2Successfully unlinked plots.", "Merge"),
"$2You do not own any adjacent plots in the specified direction or are not allowed to merge to the required size.",
"Merge"), UNLINK_REQUIRED("$2An unlink is required to do this.", "Merge"),
UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), UNLINK_SUCCESS(
"$2Successfully unlinked plots.", "Merge"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="CommandConfig"> //<editor-fold desc="CommandConfig">
NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"), DID_YOU_MEAN( NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"),
"$2Did you mean: $1%s", "CommandConfig"), DID_YOU_MEAN("$2Did you mean: $1%s", "CommandConfig"),
SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"),
NAME_LITTLE("$2%s0 name is too short, $1%s1$2<$1%s3", "CommandConfig"), NO_COMMANDS( COMMAND_SYNTAX("$1Usage: $2%s", "CommandConfig"),
"$2I'm sorry, but you're not permitted to use any subcommands.", "CommandConfig"),
SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"), COMMAND_SYNTAX(
"$1Usage: $2%s", "CommandConfig"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Errors"> //<editor-fold desc="Errors">
INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"),
INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"), INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"),
INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"), INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"),
INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"), INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"),
@ -496,129 +409,96 @@ public enum Captions {
NO_FREE_PLOTS("$2There are no free plots available", "Errors"), NO_FREE_PLOTS("$2There are no free plots available", "Errors"),
NOT_IN_PLOT("$2You're not in a plot", "Errors"), NOT_IN_PLOT("$2You're not in a plot", "Errors"),
NOT_LOADED("$2The plot could not be loaded", "Errors"), NOT_LOADED("$2The plot could not be loaded", "Errors"),
NOT_IN_CLUSTER( NOT_IN_CLUSTER("$2You must be within a plot cluster to perform that action", "Errors"),
"$2You must be within a plot cluster to perform that action", "Errors"),
NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"), NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"),
PLOTWORLD_INCOMPATIBLE("$2The two worlds must be compatible", "Errors"), PLOTWORLD_INCOMPATIBLE("$2The two worlds must be compatible", "Errors"),
NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"), NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"),
NOT_VALID_PLOT_WORLD("$2That is not a valid plot area (case sensitive)", "Errors"), NOT_VALID_PLOT_WORLD("$2That is not a valid plot area (case sensitive)", "Errors"),
NO_PLOTS("$2You don't have any plots", "Errors"), NO_PLOTS("$2You don't have any plots", "Errors"),
WAIT_FOR_TIMER( WAIT_FOR_TIMER("$2A set block timer is bound to either the current plot or you. Please wait for it to finish", "Errors"),
"$2A set block timer is bound to either the current plot or you. Please wait for it to finish", TASK_IN_PROCESS("$1Task is already running.", "Error"),
"Errors"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Paste">
DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"), DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"),
//</editor-fold>
//<editor-fold desc="Purge">
PURGE_SUCCESS("$4Successfully purged %s plots", "Purge"), PURGE_SUCCESS("$4Successfully purged %s plots", "Purge"),
//</editor-fold>
//<editor-fold desc="Trim"> //<editor-fold desc="Trim">
TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"), TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"),
NOT_VALID_HYBRID_PLOT_WORLD("The hybrid plot manager is required to perform this action", "Trim"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Block List"> //<editor-fold desc="Block List">
BLOCK_LIST_SEPARATOR("$1,$2 ", "Block List"),
BLOCK_LIST_SEPARATER("$1,$2 ", "Block List"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Biome"> //<editor-fold desc="Biome">
NEED_BIOME("$2You need to specify a valid biome.", "Biome"),
NEED_BIOME("$2You need to specify a valid biome.", "Biome"), BIOME_SET_TO( BIOME_SET_TO("$2Plot biome set to $2", "Biome"),
"$2Plot biome set to $2", "Biome"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Teleport"> //<editor-fold desc="Teleport">
TELEPORTED_TO_PLOT("$1You have been teleported", "Teleport"),
TELEPORTED_TO_PLOT("$1You have been teleported", "Teleport"), TELEPORTED_TO_ROAD( TELEPORTED_TO_ROAD("$2You got teleported to the road", "Teleport"),
"$2You got teleported to the road", "Teleport"), TELEPORT_IN_SECONDS("$1Teleporting in %s seconds. Do not move...", "Teleport"),
TELEPORT_FAILED("$2Teleportation cancelled due to movement or damage", "Teleport"),
TELEPORT_IN_SECONDS("$1Teleporting in %s seconds. Do not move...", "Teleport"), TELEPORT_FAILED(
"$2Teleportation cancelled due to movement or damage", "Teleport"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Set Block"> //<editor-fold desc="Set Block">
SET_BLOCK_ACTION_FINISHED("$1The last setblock action is now finished.", "Set Block"), SET_BLOCK_ACTION_FINISHED("$1The last setblock action is now finished.", "Set Block"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="AllowUnsafe"> //<editor-fold desc="unsafe">
DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"),
DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"), DEBUGALLOWUNSAFE_OFF( DEBUGALLOWUNSAFE_OFF("$2Unsafe actions disabled", "unsafe"),
"$2Unsafe actions disabled", "unsafe"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Debug"> //<editor-fold desc="Debug">
DEBUG_HEADER("$1Debug Information&-", "Debug"),
DEBUG_HEADER("$1Debug Information&-", "Debug"), DEBUG_SECTION("$2>> $1&l%val%", "Debug"), DEBUG_SECTION("$2>> $1&l%val%", "Debug"),
DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"), DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Invalid"> //<editor-fold desc="Invalid">
NOT_VALID_BLOCK("$2That's not a valid block: %s", "Invalid"),
NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"), NOT_VALID_BLOCK( NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"),
"$2That's not a valid block: %s", "Invalid"), NOT_VALID_NUMBER("$2That's not a valid number within the range: %s", "Invalid"),
NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"),
NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"), NOT_VALID_NUMBER( FOUND_NO_PLOTS("$2Found no plots with your search query", "Invalid"),
"$2That's not a valid number within the range: %s", "Invalid"),
NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"), PLOT_ID_FORM(
"$2The plot id must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"),
NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"), NO_SUCH_PLOT("$2There is no such plot",
"Invalid"),
PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"), FOUND_NO_PLOTS(
"$2Found no plots with your search query", "Invalid"),
FOUND_NO_PLOTS_FOR_PLAYER("$2No plots found for player: %s", "Invalid"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Need"> //<editor-fold desc="Need">
NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"),
NEED_BLOCK("$2You've got to specify a block", "Need"), NEED_BLOCK("$2You've got to specify a block", "Need"),
NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"),
NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"),
NEED_USER("$2You need to specify a username", "Need"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Near"> //<editor-fold desc="Near">
PLOT_NEAR("$1Players: %s0", "Near"), PLOT_NEAR("$1Players: %s0", "Near"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Info"> //<editor-fold desc="Info">
NONE("None", "Info"), NOW("Now", "Info"), NONE("None", "Info"),
NOW("Now", "Info"),
NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"), NEVER("Never", "Info"),
UNKNOWN("Unknown", "Info"),
SERVER("Server", "Info"), SERVER("Server", "Info"),
EVERYONE("Everyone", "Info"), EVERYONE("Everyone", "Info"),
PLOT_UNOWNED( PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"),
"$2The current plot must have an owner to perform this action", "Info"), PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER(
"$3&m---------&r $1INFO $3&m---------", false, "Info"),
PLOT_INFO_HIDDEN("$2You cannot view the information about this plot", "Info"), PLOT_INFO_HIDDEN("$2You cannot view the information about this plot", "Info"),
PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-" PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-"
+ "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-" + "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-"
+ "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-" + "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-"
+ "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"),
PLOT_INFO_FOOTER( PLOT_INFO_FOOTER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
"$3&m---------&r $1INFO $3&m---------", false, "Info"),
PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"),
PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"), PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"),
PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"),
PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"), PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"),
PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"),
PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"), PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"), PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"),
PLOT_INFO_LIKES("$1Like Ratio:$2 %likes%%", "Info"), PLOT_INFO_LIKES("$1Like Ratio:$2 %likes%%", "Info"),
PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"),
PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"), PLOT_INFO_ID("$1ID:$2 %id%", "Info"), PLOT_INFO_ID("$1ID:$2 %id%", "Info"),
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"), PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"), PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"),
PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"), PLOT_USER_LIST(" $1%user%$2,", "Info"), PLOT_USER_LIST(" $1%user%$2,", "Info"),
PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"),
PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"), INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"), INFO_SYNTAX_CONSOLE("$2/plot info X;Z", "Info"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Working"> //<editor-fold desc="Working">
GENERATING_COMPONENT("$1Started generating component from your settings", "Working"), GENERATING_COMPONENT("$1Started generating component from your settings", "Working"),
CLEARING_PLOT("$2Clearing plot async.", "Working"),
CLEARING_DONE("$4Clear completed! Took %sms.", "Working"), CLEARING_DONE("$4Clear completed! Took %sms.", "Working"),
DELETING_DONE("$4Delete completed! Took %sms.", "Working"), DELETING_DONE("$4Delete completed! Took %sms.", "Working"),
PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"), PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"),
@ -643,13 +523,15 @@ public enum Captions {
PLOT_CHAT_OFF("$4Plot chat disabled.", "Chat"), PLOT_CHAT_OFF("$4Plot chat disabled.", "Chat"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Deny"> //<editor-fold desc="Deny">
DENIED_REMOVED("$4You successfully undenied the player from this plot", "Deny"),
DENIED_ADDED("$4You successfully denied the player from this plot", "Deny"), DENIED_ADDED("$4You successfully denied the player from this plot", "Deny"),
DENIED_NEED_ARGUMENT("$2Arguments are missing. $1/plot denied add <name> $2or $1/plot denied remove <name>", "Deny"), DENIED_NEED_ARGUMENT("$2Arguments are missing. $1/plot denied add <name> $2or $1/plot denied remove <name>", "Deny"),
WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"),
YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"), YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"),
CANT_REMOVE_OWNER("$2You can't remove the plot owner", "Deny"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Kick">
YOU_GOT_KICKED("$4You got kicked!", "Kick"), YOU_GOT_KICKED("$4You got kicked!", "Kick"),
//</editor-fold>
//<editor-fold desc="Flag"> //<editor-fold desc="Flag">
FLAG_KEY("$2Key: %s", "Flag"), FLAG_KEY("$2Key: %s", "Flag"),
FLAG_TYPE("$2Type: %s", "Flag"), FLAG_TYPE("$2Type: %s", "Flag"),
@ -657,7 +539,6 @@ public enum Captions {
NOT_VALID_FLAG("$2That is not a valid flag", "Flag"), NOT_VALID_FLAG("$2That is not a valid flag", "Flag"),
NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", "Flag"), NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", "Flag"),
NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"), NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"),
FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"),
FLAG_NOT_REMOVED("$2The flag could not be removed", "Flag"), FLAG_NOT_REMOVED("$2The flag could not be removed", "Flag"),
FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), FLAG_NOT_ADDED("$2The flag could not be added", "Flag"),
FLAG_REMOVED("$4Successfully removed flag", "Flag"), FLAG_REMOVED("$4Successfully removed flag", "Flag"),
@ -666,22 +547,17 @@ public enum Captions {
//</editor-fold> //</editor-fold>
//<editor-fold desc="Trusted"> //<editor-fold desc="Trusted">
TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"),
TRUSTED_REMOVED("$4You successfully removed a trusted user from the plot", "Trusted"),
WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"),
PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"), PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Member"> //<editor-fold desc="Member">
REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"),
ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"),
ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"),
MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"),
MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"),
MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"), MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"),
PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Set Owner"> //<editor-fold desc="Owner">
SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER("$4You successfully set the plot owner", "Owner"),
SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"),
NOW_OWNER("$4You are now owner of plot %s", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"),
@ -701,10 +577,8 @@ public enum Captions {
HELP_DISPLAY_ALL_COMMANDS("Display all commands", "Help"), HELP_DISPLAY_ALL_COMMANDS("Display all commands", "Help"),
DIRECTION("$1Current direction: %dir%", "Help"), DIRECTION("$1Current direction: %dir%", "Help"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Generator_Bucket">
BUCKET_ENTRIES_IGNORED( BUCKET_ENTRIES_IGNORED("$2Total bucket values add up to 1 or more. Blocks without a specified chance will be ignored", "Generator_Bucket"),
"$2Total bucket values add up to 1 or more. Blocks without a spcified chance will be ignored",
"Generator_Bucket"),
/** /**
* Command Categories * Command Categories
@ -719,7 +593,6 @@ public enum Captions {
COMMAND_CATEGORY_DEBUG("Debug", "Category"), COMMAND_CATEGORY_DEBUG("Debug", "Category"),
COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"),
//<editor-fold desc="Grants"> //<editor-fold desc="Grants">
GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"),
GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"), GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"),
@ -729,18 +602,16 @@ public enum Captions {
/** /**
* Legacy Configuration Conversion * Legacy Configuration Conversion
*/ */
LEGACY_CONFIG_FOUND("A legacy configuration file was detected. Conversion will be attempted.", LEGACY_CONFIG_FOUND("A legacy configuration file was detected. Conversion will be attempted.", "LegacyConfig"),
"LegacyConfig"), LEGACY_CONFIG_BACKUP( LEGACY_CONFIG_BACKUP("A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.", "LegacyConfig"),
"A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.", LEGACY_CONFIG_REPLACED("> %s has been replaced with %s", "LegacyConfig"),
"LegacyConfig"), LEGACY_CONFIG_REPLACED("> %s has been replaced with %s", LEGACY_CONFIG_DONE(
"LegacyConfig"), LEGACY_CONFIG_DONE(
"The conversion has finished. PlotSquared will now be disabled and the new configuration file will" "The conversion has finished. PlotSquared will now be disabled and the new configuration file will"
+ " be used at next startup. Please review the new worlds.yml file. " + " be used at next startup. Please review the new worlds.yml file. "
+ "Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. " + "Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. "
+ "You need to re-generate the schematics.", + "You need to re-generate the schematics.",
"LegacyConfig"), LEGACY_CONFIG_CONVERSION_FAILED(
"Failed to convert the legacy configuration file. See stack trace for information.",
"LegacyConfig"), "LegacyConfig"),
LEGACY_CONFIG_CONVERSION_FAILED("Failed to convert the legacy configuration file. See stack trace for information.", "LegacyConfig"),
CUSTOM_STRING("-", "-"); CUSTOM_STRING("-", "-");
//@formatter:on //@formatter:on

View File

@ -1,19 +1,11 @@
package com.github.intellectualsites.plotsquared.plot.database; package com.github.intellectualsites.plotsquared.plot.database;
import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotCluster;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap; import javax.annotation.Nonnull;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public interface AbstractDB { public interface AbstractDB {
@ -231,7 +223,7 @@ public interface AbstractDB {
/** /**
* @param cluster PlotCluster Object * @param cluster PlotCluster Object
* @param uuid Player that should be removed * @param uuid Player that should be removed
*/ */
void setHelper(PlotCluster cluster, UUID uuid); void setHelper(PlotCluster cluster, UUID uuid);
@ -283,7 +275,7 @@ public interface AbstractDB {
/** /**
* Removes the specified comment from the given plot. * Removes the specified comment from the given plot.
* *
* @param plot the plot * @param plot the plot
* @param comment the comment to remove * @param comment the comment to remove
*/ */
void removeComment(Plot plot, PlotComment comment); void removeComment(Plot plot, PlotComment comment);
@ -291,7 +283,7 @@ public interface AbstractDB {
/** /**
* Clears the specified inbox on the given plot. * Clears the specified inbox on the given plot.
* *
* @param plot the plot * @param plot the plot
* @param inbox the inbox to clear * @param inbox the inbox to clear
*/ */
void clearInbox(Plot plot, String inbox); void clearInbox(Plot plot, String inbox);
@ -299,17 +291,17 @@ public interface AbstractDB {
/** /**
* Adds the specified comment to the given plot. * Adds the specified comment to the given plot.
* *
* @param plot the plot * @param plot the plot
* @param comment the comment to add * @param comment the comment to add
*/ */
void setComment(Plot plot, PlotComment comment); void setComment(Plot plot, PlotComment comment);
/** /**
* Gets Plot comments. * Gets Plot Comments.
* *
* @param plot The Plot to get comments from * @param plot The Plot to get comments from
*/ */
void getComments(@NotNull Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone); void getComments(@Nonnull Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone);
void createPlotAndSettings(Plot plot, Runnable whenDone); void createPlotAndSettings(Plot plot, Runnable whenDone);

View File

@ -1,21 +1,13 @@
package com.github.intellectualsites.plotsquared.plot.database; package com.github.intellectualsites.plotsquared.plot.database;
import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotCluster;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/** /**
* Database Functions * Database Functions
@ -82,8 +74,6 @@ public class DBFunc {
DBFunc.dbManager.validateAllPlots(plots); DBFunc.dbManager.validateAllPlots(plots);
} }
//TODO Consider Removal
/** /**
* Check if a {@link ResultSet} contains a column. * Check if a {@link ResultSet} contains a column.
* *
@ -91,7 +81,7 @@ public class DBFunc {
* @param name * @param name
* @return * @return
*/ */
@Deprecated public static boolean hasColumn(ResultSet resultSet, String name) { public static boolean hasColumn(ResultSet resultSet, String name) {
try { try {
ResultSetMetaData meta = resultSet.getMetaData(); ResultSetMetaData meta = resultSet.getMetaData();
int count = meta.getColumnCount(); int count = meta.getColumnCount();

View File

@ -12,8 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.sql.*; import java.sql.*;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -2170,7 +2170,7 @@ import java.util.concurrent.atomic.AtomicInteger;
}); });
} }
@Override public void getComments(@NotNull Plot plot, final String inbox, @Override public void getComments(@Nonnull Plot plot, final String inbox,
final RunnableVal<List<PlotComment>> whenDone) { final RunnableVal<List<PlotComment>> whenDone) {
addPlotTask(plot, new UniqueStatement("getComments_" + plot) { addPlotTask(plot, new UniqueStatement("getComments_" + plot) {
@Override public void set(PreparedStatement statement) throws SQLException { @Override public void set(PreparedStatement statement) throws SQLException {
@ -2942,7 +2942,7 @@ import java.util.concurrent.atomic.AtomicInteger;
boolean[] pm = plot.getMerged(); boolean[] pm = plot.getMerged();
boolean[] dm = dataPlot.getMerged(); boolean[] dm = dataPlot.getMerged();
if (pm[0] != dm[0] || pm[1] != dm[1]) { if (pm[0] != dm[0] || pm[1] != dm[1]) {
PlotSquared.debug(" - Correcting merge for: " + plot); PlotSquared.debug("&8 - &7Correcting merge for: " + plot);
setMerged(dataPlot, plot.getMerged()); setMerged(dataPlot, plot.getMerged());
} }
HashMap<Flag<?>, Object> pf = plot.getFlags(); HashMap<Flag<?>, Object> pf = plot.getFlags();
@ -2951,7 +2951,7 @@ import java.util.concurrent.atomic.AtomicInteger;
if (pf.size() != df.size() || !StringMan if (pf.size() != df.size() || !StringMan
.isEqual(StringMan.joinOrdered(pf.values(), ","), .isEqual(StringMan.joinOrdered(pf.values(), ","),
StringMan.joinOrdered(df.values(), ","))) { StringMan.joinOrdered(df.values(), ","))) {
PlotSquared.debug(" - Correcting flags for: " + plot); PlotSquared.debug("&8 - &7Correcting flags for: " + plot);
setFlags(plot, pf); setFlags(plot, pf);
} }
} }

View File

@ -27,6 +27,7 @@ public class GameModeFlag extends Flag<PlotGameMode> {
case "2": case "2":
return PlotGameMode.ADVENTURE; return PlotGameMode.ADVENTURE;
case "spectator": case "spectator":
case "sp":
case "3": case "3":
return PlotGameMode.SPECTATOR; return PlotGameMode.SPECTATOR;
default: default:

View File

@ -47,6 +47,9 @@ public class AugmentedUtils {
continue; continue;
} }
IndependentPlotGenerator generator = area.getGenerator(); IndependentPlotGenerator generator = area.getGenerator();
if (generator == null) {
continue;
}
// Mask // Mask
if (queue == null) { if (queue == null) {
queue = GlobalBlockQueue.IMP.getNewQueue(world, false); queue = GlobalBlockQueue.IMP.getNewQueue(world, false);

View File

@ -24,21 +24,29 @@ public class ClassicPlotManager extends SquarePlotManager {
BlockBucket blocks) { BlockBucket blocks) {
switch (component) { switch (component) {
case "floor": case "floor":
return setFloor(plotId, blocks); setFloor(plotId, blocks);
return true;
case "wall": case "wall":
return setWallFilling(plotId, blocks); setWallFilling(plotId, blocks);
return true;
case "all": case "all":
return setAll(plotId, blocks); setAll(plotId, blocks);
return true;
case "air": case "air":
return setAir(plotId, blocks); setAir(plotId, blocks);
return true;
case "main": case "main":
return setMain(plotId, blocks); setMain(plotId, blocks);
return true;
case "middle": case "middle":
return setMiddle(plotId, blocks); setMiddle(plotId, blocks);
return true;
case "outline": case "outline":
return setOutline(plotId, blocks); setOutline(plotId, blocks);
return true;
case "border": case "border":
return setWall(plotId, blocks); setWall(plotId, blocks);
return true;
} }
return false; return false;
} }
@ -46,7 +54,8 @@ public class ClassicPlotManager extends SquarePlotManager {
@Override public boolean unClaimPlot(Plot plot, Runnable whenDone) { @Override public boolean unClaimPlot(Plot plot, Runnable whenDone) {
setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING); setWallFilling(plot.getId(), classicPlotWorld.WALL_FILLING);
setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); setWall(plot.getId(), classicPlotWorld.WALL_BLOCK);
return GlobalBlockQueue.IMP.addTask(whenDone); GlobalBlockQueue.IMP.addTask(whenDone);
return true;
} }
public boolean setFloor(PlotId plotId, BlockBucket blocks) { public boolean setFloor(PlotId plotId, BlockBucket blocks) {
@ -61,7 +70,8 @@ public class ClassicPlotManager extends SquarePlotManager {
queue.setCuboid(pos1, pos2, blocks); queue.setCuboid(pos1, pos2, blocks);
} }
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setAll(PlotId plotId, BlockBucket blocks) { public boolean setAll(PlotId plotId, BlockBucket blocks) {
@ -76,7 +86,8 @@ public class ClassicPlotManager extends SquarePlotManager {
Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ);
queue.setCuboid(pos1, pos2, blocks); queue.setCuboid(pos1, pos2, blocks);
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setAir(PlotId plotId, BlockBucket blocks) { public boolean setAir(PlotId plotId, BlockBucket blocks) {
@ -92,7 +103,8 @@ public class ClassicPlotManager extends SquarePlotManager {
Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ); Location pos2 = new Location(classicPlotWorld.worldname, region.maxX, maxY, region.maxZ);
queue.setCuboid(pos1, pos2, blocks); queue.setCuboid(pos1, pos2, blocks);
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setMain(PlotId plotId, BlockBucket blocks) { public boolean setMain(PlotId plotId, BlockBucket blocks) {
@ -107,7 +119,8 @@ public class ClassicPlotManager extends SquarePlotManager {
new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT - 1, region.maxZ); new Location(classicPlotWorld.worldname, region.maxX, classicPlotWorld.PLOT_HEIGHT - 1, region.maxZ);
queue.setCuboid(pos1, pos2, blocks); queue.setCuboid(pos1, pos2, blocks);
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setMiddle(PlotId plotId, BlockBucket blocks) { public boolean setMiddle(PlotId plotId, BlockBucket blocks) {
@ -121,7 +134,8 @@ public class ClassicPlotManager extends SquarePlotManager {
int x = MathMan.average(corners[0].getX(), corners[1].getX()); int x = MathMan.average(corners[0].getX(), corners[1].getX());
int z = MathMan.average(corners[0].getZ(), corners[1].getZ()); int z = MathMan.average(corners[0].getZ(), corners[1].getZ());
queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks.getBlock()); queue.setBlock(x, classicPlotWorld.PLOT_HEIGHT, z, blocks.getBlock());
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setOutline(PlotId plotId, BlockBucket blocks) { public boolean setOutline(PlotId plotId, BlockBucket blocks) {
@ -173,7 +187,8 @@ public class ClassicPlotManager extends SquarePlotManager {
queue.setCuboid(pos1, pos2, blocks); queue.setCuboid(pos1, pos2, blocks);
} }
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setWallFilling(PlotId plotId, BlockBucket blocks) { public boolean setWallFilling(PlotId plotId, BlockBucket blocks) {
@ -220,7 +235,8 @@ public class ClassicPlotManager extends SquarePlotManager {
} }
} }
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
public boolean setWall(PlotId plotId, BlockBucket blocks) { public boolean setWall(PlotId plotId, BlockBucket blocks) {
@ -260,7 +276,8 @@ public class ClassicPlotManager extends SquarePlotManager {
queue.setBlock(x, y, z, blocks.getBlock()); queue.setBlock(x, y, z, blocks.getBlock());
} }
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
/** /**
@ -291,7 +308,8 @@ public class ClassicPlotManager extends SquarePlotManager {
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK); new Location(classicPlotWorld.worldname, ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1), classicPlotWorld.WALL_BLOCK);
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1),
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK);
return queue.enqueue(); queue.enqueue();
return true;
} }
@Override public boolean createRoadSouth(Plot plot) { @Override public boolean createRoadSouth(Plot plot) {
@ -319,7 +337,8 @@ public class ClassicPlotManager extends SquarePlotManager {
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK); new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez), classicPlotWorld.WALL_BLOCK);
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1),
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK);
return queue.enqueue(); queue.enqueue();
return true;
} }
@Override public boolean createRoadSouthEast(Plot plot) { @Override public boolean createRoadSouthEast(Plot plot) {
@ -337,7 +356,8 @@ public class ClassicPlotManager extends SquarePlotManager {
PlotBlock.get((short) 7, (byte) 0)); PlotBlock.get((short) 7, (byte) 0));
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1), queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz + 1),
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK); new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1), classicPlotWorld.ROAD_BLOCK);
return queue.enqueue(); queue.enqueue();
return true;
} }
@Override public boolean removeRoadEast(Plot plot) { @Override public boolean removeRoadEast(Plot plot) {
@ -357,7 +377,8 @@ public class ClassicPlotManager extends SquarePlotManager {
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK); new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK);
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1), queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1),
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK); new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT, ez - 1), classicPlotWorld.TOP_BLOCK);
return queue.enqueue(); queue.enqueue();
return true;
} }
@Override public boolean removeRoadSouth(Plot plot) { @Override public boolean removeRoadSouth(Plot plot) {
@ -377,7 +398,8 @@ public class ClassicPlotManager extends SquarePlotManager {
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK);
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz), queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz),
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT, ez), classicPlotWorld.TOP_BLOCK);
return queue.enqueue(); queue.enqueue();
return true;
} }
@Override public boolean removeRoadSouthEast(Plot plot) { @Override public boolean removeRoadSouthEast(Plot plot) {
@ -394,53 +416,38 @@ public class ClassicPlotManager extends SquarePlotManager {
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK); new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK);
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz), queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz),
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK); new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT, ez), classicPlotWorld.TOP_BLOCK);
return queue.enqueue(); queue.enqueue();
return true;
} }
/** /**
* Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED). * Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED).
*
* @return false if part of the merge failed, otherwise true if successful.
*/ */
@Override public boolean finishPlotMerge(List<PlotId> plotIds) { @Override public boolean finishPlotMerge(List<PlotId> plotIds) {
final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK;
boolean success = true; plotIds.forEach(id -> setWall(id, block));
for (PlotId plotId : plotIds) {
success &= setWall(plotId, block);
}
if (Settings.General.MERGE_REPLACE_WALL) { if (Settings.General.MERGE_REPLACE_WALL) {
final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING; final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING;
for (PlotId id : plotIds) { plotIds.forEach(id -> setWallFilling(id, wallBlock));
success &= setWallFilling(id, wallBlock);
}
} }
return success; return true;
} }
@Override public boolean finishPlotUnlink(List<PlotId> plotIds) { @Override public boolean finishPlotUnlink(List<PlotId> plotIds) {
final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK; final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK;
boolean success = true; plotIds.forEach(id -> setWall(id, block));
for (PlotId id : plotIds) { return true;
success &= setWall(id, block);
}
return success;
} }
/**
* Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed).
*
* @return true if the wall blocks were successfully set
*/
@Override public boolean regenerateAllPlotWalls() { @Override public boolean regenerateAllPlotWalls() {
boolean success = true;
for (Plot plot : classicPlotWorld.getPlots()) { for (Plot plot : classicPlotWorld.getPlots()) {
if (plot.hasOwner()) { if (plot.hasOwner()) {
success &= setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK); setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK);
} else { } else {
success &= setWall(plot.getId(), classicPlotWorld.WALL_BLOCK); setWall(plot.getId(), classicPlotWorld.WALL_BLOCK);
} }
} }
return success; return true;
} }
@Override public boolean startPlotMerge(List<PlotId> plotIds) { @Override public boolean startPlotMerge(List<PlotId> plotIds) {
@ -453,7 +460,8 @@ public class ClassicPlotManager extends SquarePlotManager {
@Override public boolean claimPlot(Plot plot) { @Override public boolean claimPlot(Plot plot) {
final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK; final BlockBucket claim = classicPlotWorld.CLAIMED_WALL_BLOCK;
return setWall(plot.getId(), claim); setWall(plot.getId(), claim);
return true;
} }
@Override public String[] getPlotComponents(PlotId plotId) { @Override public String[] getPlotComponents(PlotId plotId) {
@ -461,9 +469,7 @@ public class ClassicPlotManager extends SquarePlotManager {
} }
/** /**
* Retrieves the location of where a sign should be for a plot. * Remove sign for a plot.
* @param plot The plot
* @return The location where a sign should be
*/ */
@Override public Location getSignLoc(Plot plot) { @Override public Location getSignLoc(Plot plot) {
plot = plot.getBasePlot(false); plot = plot.getBasePlot(false);

View File

@ -46,7 +46,7 @@ import java.util.Locale;
* command - this may be useful if a config value can be changed at a later date, and has no impact on the actual * command - this may be useful if a config value can be changed at a later date, and has no impact on the actual
* world generation</p> * world generation</p>
*/ */
@NotNull @Override public ConfigurationNode[] getSettingNodes() { @Nonnull @Override public ConfigurationNode[] getSettingNodes() {
return new ConfigurationNode[] { return new ConfigurationNode[] {
new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height",
Configuration.INTEGER), Configuration.INTEGER),

View File

@ -12,7 +12,6 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -35,13 +34,13 @@ public class HybridPlotManager extends ClassicPlotManager {
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
+ hybridPlotWorld.worldname + File.separator; + hybridPlotWorld.worldname + File.separator;
try { try {
File sideRoad = File sideroad =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
+ "__TEMP_DIR__" + File.separator; + "__TEMP_DIR__" + File.separator;
if (sideRoad.exists()) { if (sideroad.exists()) {
files.add(new FileBytes(newDir + "sideroad.schem", files.add(new FileBytes(newDir + "sideroad.schem",
Files.readAllBytes(sideRoad.toPath()))); Files.readAllBytes(sideroad.toPath())));
} }
File intersection = File intersection =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "intersection.schem"); MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "intersection.schem");
@ -147,7 +146,8 @@ public class HybridPlotManager extends ClassicPlotManager {
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
createSchemAbs(queue, pos1, pos2); createSchemAbs(queue, pos1, pos2);
} }
return queue.enqueue(); queue.enqueue();
return true;
} }
/** /**
@ -221,9 +221,7 @@ public class HybridPlotManager extends ClassicPlotManager {
} }
/** /**
* Retrieves the location of where a sign should be for a plot. * Remove sign for a plot.
* @param plot The plot
* @return The location where a sign should be
*/ */
@Override public Location getSignLoc(Plot plot) { @Override public Location getSignLoc(Plot plot) {
return hybridPlotWorld.getSignLocation(plot); return hybridPlotWorld.getSignLocation(plot);

View File

@ -44,7 +44,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
super(worldName, id, generator, min, max); super(worldName, id, generator, min, max);
} }
@NotNull @Override @Override
protected PlotManager createManager() { protected PlotManager createManager() {
return new HybridPlotManager(this); return new HybridPlotManager(this);
} }

View File

@ -140,7 +140,7 @@ public abstract class HybridUtils {
} }
HybridUtils.UPDATE = true; HybridUtils.UPDATE = true;
Set<ChunkLoc> regions = new HashSet<>(); Set<ChunkLoc> regions = new HashSet<>();
regions.add(ChunkManager.getChunkChunk(plot.getCenter())); regions.add(ChunkManager.manager.getChunkChunk(plot.getCenter()));
return scheduleRoadUpdate(plot.getArea(), regions, extend); return scheduleRoadUpdate(plot.getArea(), regions, extend);
} }
@ -183,7 +183,7 @@ public abstract class HybridUtils {
ChunkLoc loc = iterator.next(); ChunkLoc loc = iterator.next();
iterator.remove(); iterator.remove();
PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z PlotSquared.debug("&3Updating .mcr: " + loc.x + ", " + loc.z
+ " (aprrox 1024 chunks)"); + " (approx 1024 chunks)");
PlotSquared.debug(" - Remaining: " + regions.size()); PlotSquared.debug(" - Remaining: " + regions.size());
chunks.addAll(getChunks(loc)); chunks.addAll(getChunks(loc));
System.gc(); System.gc();

View File

@ -122,7 +122,7 @@ public class PlotListener {
} }
} }
Optional<Long> timeFlag = plot.getFlag(Flags.TIME); Optional<Long> timeFlag = plot.getFlag(Flags.TIME);
if (timeFlag.isPresent() && !player.getAttribute("disabletime")) { if (timeFlag.isPresent()) {
try { try {
long time = timeFlag.get(); long time = timeFlag.get();
player.setTime(time); player.setTime(time);
@ -138,18 +138,18 @@ public class PlotListener {
final PlotBlock block = PlotBlock.get(id); final PlotBlock block = PlotBlock.get(id);
final String rawId = block.getRawId().toString(); final String rawId = block.getRawId().toString();
if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) { if (rawId.contains("disc") || PlotBlock.isEverything(block) || block.isAir()) {
Location location = player.getLocation(); Location loc = player.getLocation();
Location lastLocation = player.getMeta("music"); Location lastLoc = player.getMeta("music");
if (lastLocation != null) { if (lastLoc != null) {
player.playMusic(lastLocation, PlotBlock.get("air")); player.playMusic(lastLoc, PlotBlock.get("air"));
if (PlotBlock.isEverything(block) || block.isAir()) { if (PlotBlock.isEverything(block) || block.isAir()) {
player.deleteMeta("music"); player.deleteMeta("music");
} }
} }
if (!(PlotBlock.isEverything(block) || block.isAir())) { if (!(PlotBlock.isEverything(block) || block.isAir())) {
try { try {
player.setMeta("music", location); player.setMeta("music", loc);
player.playMusic(location, block); player.playMusic(loc, block);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }

View File

@ -107,7 +107,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) { if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true; this.BSblocked = true;
PlotSquared.debug( PlotSquared.debug(
Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getX() + "," Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getX() + ","
+ location.getZ()); + location.getZ());
} }
if (WEManager if (WEManager
@ -162,7 +162,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) { if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
this.Eblocked = true; this.Eblocked = true;
PlotSquared.debug( PlotSquared.debug(
Captions.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getBlockX() + ","
+ location.getBlockZ()); + location.getBlockZ());
} }
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),

View File

@ -5,8 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.UUID; import java.util.UUID;
public class ConsolePlayer extends PlotPlayer { public class ConsolePlayer extends PlotPlayer {
@ -15,15 +15,15 @@ public class ConsolePlayer extends PlotPlayer {
private ConsolePlayer() { private ConsolePlayer() {
PlotArea area = PlotSquared.get().getFirstPlotArea(); PlotArea area = PlotSquared.get().getFirstPlotArea();
Location location; Location loc;
if (area != null) { if (area != null) {
RegionWrapper region = area.getRegion(); RegionWrapper region = area.getRegion();
location = new Location(area.worldname, region.minX + region.maxX / 2, 0, loc = new Location(area.worldname, region.minX + region.maxX / 2, 0,
region.minZ + region.maxZ / 2); region.minZ + region.maxZ / 2);
} else { } else {
location = new Location("world", 0, 0, 0); loc = new Location("world", 0, 0, 0);
} }
setMeta("location", location); setMeta("location", loc);
} }
public static ConsolePlayer getConsole() { public static ConsolePlayer getConsole() {
@ -34,7 +34,7 @@ public class ConsolePlayer extends PlotPlayer {
return instance; return instance;
} }
@Override public boolean canTeleport(@NotNull Location location) { @Override public boolean canTeleport(@Nonnull Location loc) {
return true; return true;
} }
@ -42,7 +42,7 @@ public class ConsolePlayer extends PlotPlayer {
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
} }
@NotNull @Override public Location getLocation() { @Override public Location getLocation() {
return this.getMeta("location"); return this.getMeta("location");
} }
@ -50,7 +50,7 @@ public class ConsolePlayer extends PlotPlayer {
return getLocation(); return getLocation();
} }
@NotNull @Override public UUID getUUID() { @Nonnull @Override public UUID getUUID() {
return DBFunc.EVERYONE; return DBFunc.EVERYONE;
} }
@ -100,14 +100,14 @@ public class ConsolePlayer extends PlotPlayer {
return RequiredType.CONSOLE; return RequiredType.CONSOLE;
} }
@Override public void setWeather(@NotNull PlotWeather weather) { @Override public void setWeather(@Nonnull PlotWeather weather) {
} }
@NotNull @Override public PlotGameMode getGameMode() { @Nonnull @Override public PlotGameMode getGameMode() {
return PlotGameMode.NOT_SET; return PlotGameMode.NOT_SET;
} }
@Override public void setGameMode(@NotNull PlotGameMode gameMode) { @Override public void setGameMode(@Nonnull PlotGameMode gameMode) {
} }
@Override public void setTime(long time) { @Override public void setTime(long time) {
@ -120,7 +120,7 @@ public class ConsolePlayer extends PlotPlayer {
@Override public void setFlight(boolean fly) { @Override public void setFlight(boolean fly) {
} }
@Override public void playMusic(@NotNull Location location, @NotNull PlotBlock id) { @Override public void playMusic(@Nonnull Location location, @Nonnull PlotBlock id) {
} }
@Override public void kick(String message) { @Override public void kick(String message) {

View File

@ -1,9 +1,9 @@
package com.github.intellectualsites.plotsquared.plot.object; package com.github.intellectualsites.plotsquared.plot.object;
public enum Direction { public enum Direction {
ALL(-1, "all"), NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4,
"west"), NORTHEAST(4, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "southwest"), NORTHWEST(7,
"southwest"), NORTHWEST(7, "northwest"), "northwest"),
; ;
@ -16,15 +16,6 @@ public enum Direction {
this.name = name; this.name = name;
} }
public static Direction getFromIndex(int index) {
for (Direction value : values()) {
if (value.getIndex() == index) {
return value;
}
}
return NORTH;
}
public int getIndex() { public int getIndex() {
return index; return index;
} }

View File

@ -21,9 +21,9 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.PathIterator; import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
@ -46,14 +46,13 @@ import java.util.stream.Collectors;
public class Plot { public class Plot {
private static final int MAX_HEIGHT = 256; private static final int MAX_HEIGHT = 256;
/** /**
* @deprecated raw access is deprecated * @deprecated raw access is deprecated
*/ */
@Deprecated private static HashSet<Plot> connected_cache; @Deprecated private static HashSet<Plot> connected_cache;
private static HashSet<RegionWrapper> regions_cache; private static HashSet<RegionWrapper> regions_cache;
@NotNull private final PlotId id; private final PlotId id;
/** /**
* plot owner * plot owner
@ -63,12 +62,10 @@ public class Plot {
* @deprecated * @deprecated
*/ */
@Deprecated public UUID owner; @Deprecated public UUID owner;
/** /**
* Has the plot changed since the last save cycle? * Has the plot changed since the last save cycle?
*/ */
public boolean countsTowardsMax = true; public boolean countsTowardsMax = true;
/** /**
* Represents whatever the database manager needs it to: <br> * Represents whatever the database manager needs it to: <br>
* - A value of -1 usually indicates the plot will not be stored in the DB<br> * - A value of -1 usually indicates the plot will not be stored in the DB<br>
@ -77,28 +74,23 @@ public class Plot {
* @deprecated magical * @deprecated magical
*/ */
@Deprecated public int temp; @Deprecated public int temp;
/** /**
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br> * Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
* - Milliseconds since the epoch<br> * - Milliseconds since the epoch<br>
*/ */
private long timestamp; private long timestamp;
/** /**
* List of trusted (with plot permissions). * List of trusted (with plot permissions).
*/ */
private HashSet<UUID> trusted; private HashSet<UUID> trusted;
/** /**
* List of members users (with plot permissions). * List of members users (with plot permissions).
*/ */
private HashSet<UUID> members; private HashSet<UUID> members;
/** /**
* List of denied players. * List of denied players.
*/ */
private HashSet<UUID> denied; private HashSet<UUID> denied;
/** /**
* External settings class. * External settings class.
* - Please favor the methods over direct access to this class<br> * - Please favor the methods over direct access to this class<br>
@ -107,7 +99,6 @@ public class Plot {
private PlotSettings settings; private PlotSettings settings;
private PlotArea area; private PlotArea area;
/** /**
* Session only plot metadata (session is until the server stops)<br> * Session only plot metadata (session is until the server stops)<br>
* <br> * <br>
@ -116,7 +107,6 @@ public class Plot {
* @see FlagManager * @see FlagManager
*/ */
private ConcurrentHashMap<String, Object> meta; private ConcurrentHashMap<String, Object> meta;
/** /**
* The cached origin plot. * The cached origin plot.
* - The origin plot is used for plot grouping and relational data * - The origin plot is used for plot grouping and relational data
@ -127,12 +117,12 @@ public class Plot {
* Constructor for a new plot. * Constructor for a new plot.
* (Only changes after plot.create() will be properly set in the database) * (Only changes after plot.create() will be properly set in the database)
* *
* @param area the PlotArea where the plot is located * @param area the PlotArea where the plot is located
* @param id the plot id * @param id the plot id
* @param owner the plot owner * @param owner the plot owner
* @see Plot#getPlot(Location) for existing plots * @see Plot#getPlot(Location) for existing plots
*/ */
public Plot(PlotArea area, @NotNull PlotId id, UUID owner) { public Plot(PlotArea area, PlotId id, UUID owner) {
this.area = area; this.area = area;
this.id = id; this.id = id;
this.owner = owner; this.owner = owner;
@ -143,10 +133,10 @@ public class Plot {
* (Only changes after plot.create() will be properly set in the database) * (Only changes after plot.create() will be properly set in the database)
* *
* @param area the PlotArea where the plot is located * @param area the PlotArea where the plot is located
* @param id the plot id * @param id the plot id
* @see Plot#getPlot(Location) for existing plots * @see Plot#getPlot(Location) for existing plots
*/ */
public Plot(PlotArea area, @NotNull PlotId id) { public Plot(PlotArea area, PlotId id) {
this.area = area; this.area = area;
this.id = id; this.id = id;
} }
@ -156,13 +146,13 @@ public class Plot {
* The database will ignore any queries regarding temporary plots. * The database will ignore any queries regarding temporary plots.
* Please note that some bulk plot management functions may still affect temporary plots (TODO: fix this) * Please note that some bulk plot management functions may still affect temporary plots (TODO: fix this)
* *
* @param area the PlotArea where the plot is located * @param area the PlotArea where the plot is located
* @param id the plot id * @param id the plot id
* @param owner the owner of the plot * @param owner the owner of the plot
* @param temp Represents whatever the database manager needs it to * @param temp Represents whatever the database manager needs it to
* @see Plot#getPlot(Location) for existing plots * @see Plot#getPlot(Location) for existing plots
*/ */
public Plot(PlotArea area, @NotNull PlotId id, UUID owner, int temp) { public Plot(PlotArea area, PlotId id, UUID owner, int temp) {
this.area = area; this.area = area;
this.id = id; this.id = id;
this.owner = owner; this.owner = owner;
@ -172,14 +162,14 @@ public class Plot {
/** /**
* Constructor for a saved plots (Used by the database manager when plots are fetched) * Constructor for a saved plots (Used by the database manager when plots are fetched)
* *
* @param id the plot id * @param id the plot id
* @param owner the plot owner * @param owner the plot owner
* @param trusted the plot trusted players * @param trusted the plot trusted players
* @param denied the plot denied players * @param denied the plot denied players
* @param merged an array giving merged plots * @param merged array giving merged plots
* @see Plot#getPlot(Location) for existing plots * @see Plot#getPlot(Location) for existing plots
*/ */
public Plot(@NotNull PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members, public Plot(PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members,
HashSet<UUID> denied, String alias, BlockLoc position, Collection<Flag> flags, HashSet<UUID> denied, String alias, BlockLoc position, Collection<Flag> flags,
PlotArea area, boolean[] merged, long timestamp, int temp) { PlotArea area, boolean[] merged, long timestamp, int temp) {
this.id = id; this.id = id;
@ -204,8 +194,8 @@ public class Plot {
/** /**
* Gets a plot from a string e.g. [area];[id] * Gets a plot from a string e.g. [area];[id]
* *
* @param defaultArea if no area is specified * @param defaultArea If no area is specified
* @param string plot id/area + id * @param string plot id/area + id
* @return New or existing plot object * @return New or existing plot object
*/ */
public static Plot fromString(PlotArea defaultArea, String string) { public static Plot fromString(PlotArea defaultArea, String string) {
@ -336,7 +326,7 @@ public class Plot {
* @param uuid the player uuid * @param uuid the player uuid
* @return if the provided uuid is the owner of the plot * @return if the provided uuid is the owner of the plot
*/ */
public boolean isOwner(@NotNull UUID uuid) { public boolean isOwner(@Nonnull UUID uuid) {
if (uuid.equals(this.getOwner())) { if (uuid.equals(this.getOwner())) {
return true; return true;
} }
@ -462,7 +452,7 @@ public class Plot {
* *
* @return the PlotId for this plot * @return the PlotId for this plot
*/ */
@NotNull public PlotId getId() { public PlotId getId() {
return this.id; return this.id;
} }
@ -789,7 +779,7 @@ public class Plot {
/** /**
* Sets the plot owner (and update the database) * Sets the plot owner (and update the database)
* *
* @param owner uuid to set as owner * @param owner uuid to set as owner
* @param initiator player initiating set owner * @param initiator player initiating set owner
* @return boolean * @return boolean
*/ */
@ -874,15 +864,8 @@ public class Plot {
} }
Plot current = queue.poll(); Plot current = queue.poll();
if (Plot.this.area.TERRAIN != 0) { if (Plot.this.area.TERRAIN != 0) {
try { ChunkManager.manager
ChunkManager.manager .regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this);
.regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false,
this);
} catch (UnsupportedOperationException exception) {
MainUtil.sendMessage(null,
"Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience");
return;
}
return; return;
} }
manager.clearPlot(current, this); manager.clearPlot(current, this);
@ -936,8 +919,8 @@ public class Plot {
/** /**
* Unlink the plot and all connected plots. * Unlink the plot and all connected plots.
* *
* @param createRoad whether to recreate road
* @param createSign whether to recreate signs * @param createSign whether to recreate signs
* @param createRoad whether to recreate road
* @return success/!cancelled * @return success/!cancelled
*/ */
public boolean unlinkPlot(boolean createRoad, boolean createSign) { public boolean unlinkPlot(boolean createRoad, boolean createSign) {
@ -999,7 +982,7 @@ public class Plot {
* *
* @param name name * @param name name
*/ */
public void setSign(@NotNull String name) { public void setSign(@Nonnull String name) {
if (!isLoaded()) { if (!isLoaded()) {
return; return;
} }
@ -1009,7 +992,7 @@ public class Plot {
} }
PlotManager manager = this.area.getPlotManager(); PlotManager manager = this.area.getPlotManager();
if (this.area.ALLOW_SIGNS) { if (this.area.ALLOW_SIGNS) {
Location location = manager.getSignLoc(this); Location loc = manager.getSignLoc(this);
String id = this.id.x + ";" + this.id.y; String id = this.id.x + ";" + this.id.y;
String[] lines = String[] lines =
new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
@ -1019,9 +1002,7 @@ public class Plot {
"%plr%", name), "%plr%", name),
Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll( Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll(
"%plr%", name)}; "%plr%", name)};
WorldUtil.IMP WorldUtil.IMP.setSign(this.getWorldName(), loc.getX(), loc.getY(), loc.getZ(), lines);
.setSign(this.getWorldName(), location.getX(), location.getY(), location.getZ(),
lines);
} }
} }
@ -1218,18 +1199,18 @@ public class Plot {
Location[] corners = getCorners(); Location[] corners = getCorners();
Location top = corners[0]; Location top = corners[0];
Location bot = corners[1]; Location bot = corners[1];
Location location = Location loc = new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ())); MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()));
if (!isLoaded()) { if (!isLoaded()) {
return location; return loc;
} }
int y = WorldUtil.IMP.getHighestBlock(getWorldName(), location.getX(), location.getZ()); int y =
isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), loc.getX(), loc.getZ()) : 62;
if (area.ALLOW_SIGNS) { if (area.ALLOW_SIGNS) {
y = Math.max(y, getManager().getSignLoc(this).getY()); y = Math.max(y, getManager().getSignLoc(this).getY());
} }
location.setY(1 + y); loc.setY(1 + y);
return location; return loc;
} }
public Location getSide() { public Location getSide() {
@ -1254,19 +1235,18 @@ public class Plot {
if (home == null || home.x == 0 && home.z == 0) { if (home == null || home.x == 0 && home.z == 0) {
return this.getDefaultHome(true); return this.getDefaultHome(true);
} else { } else {
Location bottom = this.getBottomAbs(); Location bot = this.getBottomAbs();
Location location = Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y,
new Location(bottom.getWorld(), bottom.getX() + home.x, bottom.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch);
bottom.getZ() + home.z, home.yaw, home.pitch);
if (!isLoaded()) { if (!isLoaded()) {
return location; return loc;
} }
if (!WorldUtil.IMP.getBlock(location).isAir()) { if (!WorldUtil.IMP.getBlock(loc).isAir()) {
location.setY(Math.max(1 + WorldUtil.IMP loc.setY(Math.max(
.getHighestBlock(this.getWorldName(), location.getX(), location.getZ()), 1 + WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()),
bottom.getY())); bot.getY()));
} }
return location; return loc;
} }
} }
@ -1433,9 +1413,9 @@ public class Plot {
if (!this.area.ALLOW_SIGNS) { if (!this.area.ALLOW_SIGNS) {
return; return;
} }
Location location = manager.getSignLoc(this); Location loc = manager.getSignLoc(this);
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false); LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false);
queue.setBlock(location.getX(), location.getY(), location.getZ(), PlotBlock.get("air")); queue.setBlock(loc.getX(), loc.getY(), loc.getZ(), PlotBlock.get("air"));
queue.flush(); queue.flush();
} }
@ -1530,7 +1510,7 @@ public class Plot {
* @param notify notify * @param notify notify
* @return true if plot was created successfully * @return true if plot was created successfully
*/ */
public boolean create(@NotNull UUID uuid, final boolean notify) { public boolean create(@Nonnull UUID uuid, final boolean notify) {
this.owner = uuid; this.owner = uuid;
Plot existing = this.area.getOwnedPlotAbs(this.id); Plot existing = this.area.getOwnedPlotAbs(this.id);
if (existing != null) { if (existing != null) {
@ -1552,7 +1532,7 @@ public class Plot {
DBFunc.createPlotAndSettings(this, () -> { DBFunc.createPlotAndSettings(this, () -> {
PlotArea plotworld = Plot.this.area; PlotArea plotworld = Plot.this.area;
if (notify && plotworld.AUTO_MERGE) { if (notify && plotworld.AUTO_MERGE) {
Plot.this.autoMerge(Direction.ALL, Integer.MAX_VALUE, uuid, true); Plot.this.autoMerge(-1, Integer.MAX_VALUE, uuid, true);
} }
}); });
return true; return true;
@ -1575,8 +1555,8 @@ public class Plot {
* @return the name of the biome * @return the name of the biome
*/ */
public String getBiome() { public String getBiome() {
Location location = this.getCenter(); Location loc = this.getCenter();
return WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ()); return WorldUtil.IMP.getBiome(loc.getWorld(), loc.getX(), loc.getZ());
} }
//TODO Better documentation needed. //TODO Better documentation needed.
@ -1596,9 +1576,9 @@ public class Plot {
* Returns the bottom location for the plot. * Returns the bottom location for the plot.
*/ */
public Location getBottomAbs() { public Location getBottomAbs() {
Location location = getManager().getPlotBottomLocAbs(this.id); Location loc = getManager().getPlotBottomLocAbs(this.id);
location.setWorld(getWorldName()); loc.setWorld(getWorldName());
return location; return loc;
} }
/** /**
@ -1647,7 +1627,7 @@ public class Plot {
/** /**
* Moves the settings for a plot. * Moves the settings for a plot.
* *
* @param plot the plot to move * @param plot the plot to move
* @param whenDone * @param whenDone
* @return * @return
*/ */
@ -2029,11 +2009,17 @@ public class Plot {
* Sets the raw merge data<br> * Sets the raw merge data<br>
* - Updates DB<br> * - Updates DB<br>
* - Does not modify terrain<br> * - Does not modify terrain<br>
* ----------<br>
* 0 = north<br>
* 1 = east<br>
* 2 = south<br>
* 3 = west<br>
* ----------<br>
* *
* @param direction * @param direction
* @param value * @param value
*/ */
public void setMerged(Direction direction, boolean value) { public void setMerged(int direction, boolean value) {
if (this.getSettings().setMerged(direction, value)) { if (this.getSettings().setMerged(direction, value)) {
if (value) { if (value) {
Plot other = this.getRelative(direction).getBasePlot(false); Plot other = this.getRelative(direction).getBasePlot(false);
@ -2138,12 +2124,11 @@ public class Plot {
return null; return null;
} }
try { try {
final Location location = this.getManager().getSignLoc(this); final Location loc = this.getManager().getSignLoc(this);
String[] lines = TaskManager.IMP.sync(new RunnableVal<String[]>() { String[] lines = TaskManager.IMP.sync(new RunnableVal<String[]>() {
@Override public void run(String[] value) { @Override public void run(String[] value) {
ChunkManager.manager ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false);
.loadChunk(location.getWorld(), location.getChunkLoc(), false); this.value = WorldUtil.IMP.getSign(loc);
this.value = WorldUtil.IMP.getSign(location);
} }
}); });
if (lines == null) { if (lines == null) {
@ -2213,21 +2198,24 @@ public class Plot {
} }
/** /**
* Auto merge a plot in a specific direction. * Auto merge a plot in a specific direction<br>
* *
* @param dir the direction to merge * @param dir The direction to merge<br>
* @param max the max number of merges to do * -1 = All directions<br>
* @param uuid the UUID it is allowed to merge with * 0 = north<br>
* @param removeRoads whether to remove roads * 1 = east<br>
* 2 = south<br>
* 3 = west<br>
* @param max The max number of merges to do
* @param uuid The UUID it is allowed to merge with
* @param removeRoads Whether to remove roads
* @return true if a merge takes place * @return true if a merge takes place
*/ */
public boolean autoMerge(Direction dir, int max, UUID uuid, boolean removeRoads) { public boolean autoMerge(int dir, int max, UUID uuid, boolean removeRoads) {
//Ignore merging if there is no owner for the plot
if (this.owner == null) { if (this.owner == null) {
return false; return false;
} }
//Call the merge event if (!EventUtil.manager.callMerge(this, dir, max)) {
if (!EventUtil.manager.callMerge(this, dir.getIndex(), max)) {
return false; return false;
} }
Set<Plot> connected = this.getConnectedPlots(); Set<Plot> connected = this.getConnectedPlots();
@ -2243,7 +2231,7 @@ public class Plot {
} }
visited.add(current); visited.add(current);
Set<Plot> plots; Set<Plot> plots;
if ((dir == Direction.ALL || dir == Direction.NORTH) && !getMerged(Direction.NORTH)) { if ((dir == -1 || dir == 0) && !getMerged(Direction.NORTH)) {
Plot other = current.getRelative(Direction.NORTH); Plot other = current.getRelative(Direction.NORTH);
if (other != null && other.isOwner(uuid) && ( if (other != null && other.isOwner(uuid) && (
other.getBasePlot(false).equals(current.getBasePlot(false)) other.getBasePlot(false).equals(current.getBasePlot(false))
@ -2262,8 +2250,7 @@ public class Plot {
} }
} }
} }
if (max >= 0 && (dir == Direction.ALL || dir == Direction.EAST) && !current if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(Direction.EAST)) {
.getMerged(Direction.EAST)) {
Plot other = current.getRelative(Direction.EAST); Plot other = current.getRelative(Direction.EAST);
if (other != null && other.isOwner(uuid) && ( if (other != null && other.isOwner(uuid) && (
other.getBasePlot(false).equals(current.getBasePlot(false)) other.getBasePlot(false).equals(current.getBasePlot(false))
@ -2282,8 +2269,7 @@ public class Plot {
} }
} }
} }
if (max >= 0 && (dir == Direction.ALL || dir == Direction.SOUTH) && !getMerged( if (max >= 0 && (dir == -1 || dir == 2) && !getMerged(Direction.SOUTH)) {
Direction.SOUTH)) {
Plot other = current.getRelative(Direction.SOUTH); Plot other = current.getRelative(Direction.SOUTH);
if (other != null && other.isOwner(uuid) && ( if (other != null && other.isOwner(uuid) && (
other.getBasePlot(false).equals(current.getBasePlot(false)) other.getBasePlot(false).equals(current.getBasePlot(false))
@ -2302,8 +2288,7 @@ public class Plot {
} }
} }
} }
if (max >= 0 && (dir == Direction.ALL || dir == Direction.WEST) && !getMerged( if (max >= 0 && (dir == -1 || dir == 3) && !getMerged(Direction.WEST)) {
Direction.WEST)) {
Plot other = current.getRelative(Direction.WEST); Plot other = current.getRelative(Direction.WEST);
if (other != null && other.isOwner(uuid) && ( if (other != null && other.isOwner(uuid) && (
other.getBasePlot(false).equals(current.getBasePlot(false)) other.getBasePlot(false).equals(current.getBasePlot(false))
@ -2418,16 +2403,20 @@ public class Plot {
* @param direction * @param direction
* @return * @return
*/ */
@Deprecated public Plot getRelative(int direction) { public Plot getRelative(int direction) {
return this.area.getPlotAbs(this.id.getRelative(direction)); return this.area.getPlotAbs(this.id.getRelative(direction));
} }
/** /**
* Gets the plot in a relative direction * Gets the plot in a relative direction<br>
* 0 = north<br>
* 1 = east<br>
* 2 = south<br>
* 3 = west<br>
* Note: May be null if the partial plot area does not include the relative location * Note: May be null if the partial plot area does not include the relative location
* *
* @param direction * @param direction
* @return the plot relative to this one * @return
*/ */
public Plot getRelative(Direction direction) { public Plot getRelative(Direction direction) {
return this.area.getPlotAbs(this.id.getRelative(direction)); return this.area.getPlotAbs(this.id.getRelative(direction));
@ -2437,7 +2426,7 @@ public class Plot {
* Gets a set of plots connected (and including) this plot<br> * Gets a set of plots connected (and including) this plot<br>
* - This result is cached globally * - This result is cached globally
* *
* @return a Set of Plots connected to this Plot * @return
*/ */
public Set<Plot> getConnectedPlots() { public Set<Plot> getConnectedPlots() {
if (this.settings == null) { if (this.settings == null) {
@ -2462,10 +2451,10 @@ public class Plot {
// invalid merge // invalid merge
PlotSquared.debug("Fixing invalid merge: " + this); PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) { if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(Direction.SOUTH, true); tmp.getSettings().setMerged(2, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
} else { } else {
this.getSettings().setMerged(Direction.NORTH, false); this.getSettings().setMerged(0, false);
DBFunc.setMerged(this, this.getSettings().getMerged()); DBFunc.setMerged(this, this.getSettings().getMerged());
} }
} }
@ -2478,10 +2467,10 @@ public class Plot {
// invalid merge // invalid merge
PlotSquared.debug("Fixing invalid merge: " + this); PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) { if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(Direction.WEST, true); tmp.getSettings().setMerged(3, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
} else { } else {
this.getSettings().setMerged(Direction.EAST, false); this.getSettings().setMerged(1, false);
DBFunc.setMerged(this, this.getSettings().getMerged()); DBFunc.setMerged(this, this.getSettings().getMerged());
} }
} }
@ -2494,10 +2483,10 @@ public class Plot {
// invalid merge // invalid merge
PlotSquared.debug("Fixing invalid merge: " + this); PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) { if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(Direction.NORTH, true); tmp.getSettings().setMerged(0, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
} else { } else {
this.getSettings().setMerged(Direction.SOUTH, false); this.getSettings().setMerged(2, false);
DBFunc.setMerged(this, this.getSettings().getMerged()); DBFunc.setMerged(this, this.getSettings().getMerged());
} }
} }
@ -2510,10 +2499,10 @@ public class Plot {
// invalid merge // invalid merge
PlotSquared.debug("Fixing invalid merge: " + this); PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.owner)) { if (tmp.isOwnerAbs(this.owner)) {
tmp.getSettings().setMerged(Direction.EAST, true); tmp.getSettings().setMerged(1, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged()); DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
} else { } else {
this.getSettings().setMerged(Direction.WEST, false); this.getSettings().setMerged(3, false);
DBFunc.setMerged(this, this.getSettings().getMerged()); DBFunc.setMerged(this, this.getSettings().getMerged());
} }
} }
@ -2571,7 +2560,7 @@ public class Plot {
* *
* @return * @return
*/ */
@NotNull public HashSet<RegionWrapper> getRegions() { @Nonnull public HashSet<RegionWrapper> getRegions() {
if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) { if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) {
return regions_cache; return regions_cache;
} }
@ -2798,11 +2787,6 @@ public class Plot {
return false; return false;
} }
/**
* Checks if the owner of this Plot is online.
*
* @return true if the owner of the Plot is online
*/
public boolean isOnline() { public boolean isOnline() {
if (this.owner == null) { if (this.owner == null) {
return false; return false;
@ -2857,14 +2841,13 @@ public class Plot {
} }
/** /**
* Merges two plots. <br>- Assumes plots are directly next to each other <br> - saves to DB * Merges 2 plots Removes the road in-between <br>- Assumes plots are directly next to each other <br> - saves to DB
* *
* @param lesserPlot * @param lesserPlot
* @param removeRoads * @param removeRoads
*/ */
public void mergePlot(Plot lesserPlot, boolean removeRoads) { public void mergePlot(Plot lesserPlot, boolean removeRoads) {
Plot greaterPlot = this; Plot greaterPlot = this;
lesserPlot.removeSign();
if (lesserPlot.getId().x == greaterPlot.getId().x) { if (lesserPlot.getId().x == greaterPlot.getId().x) {
if (lesserPlot.getId().y > greaterPlot.getId().y) { if (lesserPlot.getId().y > greaterPlot.getId().y) {
Plot tmp = lesserPlot; Plot tmp = lesserPlot;
@ -2874,11 +2857,10 @@ public class Plot {
if (!lesserPlot.getMerged(Direction.SOUTH)) { if (!lesserPlot.getMerged(Direction.SOUTH)) {
lesserPlot.clearRatings(); lesserPlot.clearRatings();
greaterPlot.clearRatings(); greaterPlot.clearRatings();
lesserPlot.setMerged(Direction.SOUTH, true); lesserPlot.setMerged(2, true);
greaterPlot.setMerged(Direction.NORTH, true); greaterPlot.setMerged(0, true);
lesserPlot.mergeData(greaterPlot); lesserPlot.mergeData(greaterPlot);
if (removeRoads) { if (removeRoads) {
//lesserPlot.removeSign();
lesserPlot.removeRoadSouth(); lesserPlot.removeRoadSouth();
Plot diagonal = greaterPlot.getRelative(Direction.EAST); Plot diagonal = greaterPlot.getRelative(Direction.EAST);
if (diagonal.getMerged(Direction.NORTHWEST)) { if (diagonal.getMerged(Direction.NORTHWEST)) {
@ -2899,11 +2881,10 @@ public class Plot {
if (!lesserPlot.getMerged(Direction.EAST)) { if (!lesserPlot.getMerged(Direction.EAST)) {
lesserPlot.clearRatings(); lesserPlot.clearRatings();
greaterPlot.clearRatings(); greaterPlot.clearRatings();
lesserPlot.setMerged(Direction.EAST, true); lesserPlot.setMerged(1, true);
greaterPlot.setMerged(Direction.WEST, true); greaterPlot.setMerged(3, true);
lesserPlot.mergeData(greaterPlot); lesserPlot.mergeData(greaterPlot);
if (removeRoads) { if (removeRoads) {
//lesserPlot.removeSign();
Plot diagonal = greaterPlot.getRelative(Direction.SOUTH); Plot diagonal = greaterPlot.getRelative(Direction.SOUTH);
if (diagonal.getMerged(Direction.NORTHWEST)) { if (diagonal.getMerged(Direction.NORTHWEST)) {
lesserPlot.removeRoadSouthEast(); lesserPlot.removeRoadSouthEast();
@ -2916,7 +2897,6 @@ public class Plot {
} }
} }
} }
} }
/** /**
@ -3099,23 +3079,23 @@ public class Plot {
return getFlags().containsKey(flag); return getFlags().containsKey(flag);
} }
public boolean removeComment(PlotComment comment) { @SuppressWarnings("deprecation") public boolean removeComment(PlotComment comment) {
return getSettings().removeComment(comment); return getSettings().removeComment(comment);
} }
public void removeComments(List<PlotComment> comments) { @SuppressWarnings("deprecation") public void removeComments(List<PlotComment> comments) {
getSettings().removeComments(comments); getSettings().removeComments(comments);
} }
public List<PlotComment> getComments(String inbox) { @SuppressWarnings("deprecation") public List<PlotComment> getComments(String inbox) {
return getSettings().getComments(inbox); return getSettings().getComments(inbox);
} }
public void addComment(PlotComment comment) { @SuppressWarnings("deprecation") public void addComment(PlotComment comment) {
getSettings().addComment(comment); getSettings().addComment(comment);
} }
public void setComments(List<PlotComment> list) { @SuppressWarnings("deprecation") public void setComments(List<PlotComment> list) {
getSettings().setComments(list); getSettings().setComments(list);
} }

View File

@ -22,8 +22,9 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -36,12 +37,12 @@ public abstract class PlotArea {
public final String worldname; public final String worldname;
public final String id; public final String id;
@NotNull public final PlotManager manager; public final PlotManager manager;
public final int worldhash; public final int worldhash;
protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>(); protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
private final PlotId min; private final PlotId min;
private final PlotId max; private final PlotId max;
@NotNull private final IndependentPlotGenerator generator; private final IndependentPlotGenerator generator;
private final BlockBucket[][] blockBucketChunk; private final BlockBucket[][] blockBucketChunk;
public int MAX_PLOT_MEMBERS = 128; public int MAX_PLOT_MEMBERS = 128;
public boolean AUTO_MERGE = false; public boolean AUTO_MERGE = false;
@ -75,7 +76,7 @@ public abstract class PlotArea {
private ConcurrentHashMap<String, Object> meta; private ConcurrentHashMap<String, Object> meta;
private QuadMap<PlotCluster> clusters; private QuadMap<PlotCluster> clusters;
public PlotArea(@NotNull final String worldName, @Nullable final String id, public PlotArea(@Nonnull final String worldName, @Nullable final String id,
@NotNull IndependentPlotGenerator generator, @Nullable final PlotId min, @NotNull IndependentPlotGenerator generator, @Nullable final PlotId min,
@Nullable final PlotId max) { @Nullable final PlotId max) {
this.worldname = worldName; this.worldname = worldName;
@ -101,7 +102,7 @@ public abstract class PlotArea {
} }
} }
@NotNull protected abstract PlotManager createManager(); protected abstract PlotManager createManager();
public LocalBlockQueue getQueue(final boolean autoQueue) { public LocalBlockQueue getQueue(final boolean autoQueue) {
return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue); return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue);
@ -116,7 +117,10 @@ public abstract class PlotArea {
if (blockBucketChunk != null) { if (blockBucketChunk != null) {
return blockBucketChunk; return blockBucketChunk;
} }
return generator.generateBlockBucketChunk(this); if (generator != null) {
return generator.generateBlockBucketChunk(this);
}
return null;
} }
/** /**
@ -174,7 +178,7 @@ public abstract class PlotArea {
* *
* @return the {@link IndependentPlotGenerator} * @return the {@link IndependentPlotGenerator}
*/ */
@NotNull public IndependentPlotGenerator getGenerator() { public IndependentPlotGenerator getGenerator() {
return this.generator; return this.generator;
} }
@ -390,7 +394,7 @@ public abstract class PlotArea {
} }
} }
@NotNull @Override public String toString() { @Nonnull @Override public String toString() {
if (this.id == null) { if (this.id == null) {
return this.worldname; return this.worldname;
} else { } else {
@ -418,7 +422,7 @@ public abstract class PlotArea {
* @param location the location * @param location the location
* @return the {@code Plot} or null if none exists * @return the {@code Plot} or null if none exists
*/ */
@Nullable public Plot getPlotAbs(@NotNull final Location location) { @Nullable public Plot getPlotAbs(@Nonnull final Location location) {
final PlotId pid = final PlotId pid =
this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); this.manager.getPlotId(location.getX(), location.getY(), location.getZ());
if (pid == null) { if (pid == null) {
@ -433,7 +437,7 @@ public abstract class PlotArea {
* @param location the location * @param location the location
* @return base Plot * @return base Plot
*/ */
@Nullable public Plot getPlot(@NotNull final Location location) { @Nullable public Plot getPlot(@Nonnull final Location location) {
final PlotId pid = final PlotId pid =
this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); this.manager.getPlotId(location.getX(), location.getY(), location.getZ());
if (pid == null) { if (pid == null) {
@ -448,7 +452,7 @@ public abstract class PlotArea {
* @param location the location * @param location the location
* @return the base plot or null * @return the base plot or null
*/ */
@Nullable public Plot getOwnedPlot(@NotNull final Location location) { @Nullable public Plot getOwnedPlot(@Nonnull final Location location) {
final PlotId pid = final PlotId pid =
this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); this.manager.getPlotId(location.getX(), location.getY(), location.getZ());
if (pid == null) { if (pid == null) {
@ -464,7 +468,7 @@ public abstract class PlotArea {
* @param location the location * @param location the location
* @return Plot or null * @return Plot or null
*/ */
@Nullable public Plot getOwnedPlotAbs(@NotNull final Location location) { @Nullable public Plot getOwnedPlotAbs(@Nonnull final Location location) {
final PlotId pid = final PlotId pid =
this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); this.manager.getPlotId(location.getX(), location.getY(), location.getZ());
if (pid == null) { if (pid == null) {
@ -479,11 +483,11 @@ public abstract class PlotArea {
* @param id the {@code PlotId} * @param id the {@code PlotId}
* @return the plot or null * @return the plot or null
*/ */
@Nullable public Plot getOwnedPlotAbs(@NotNull final PlotId id) { @Nullable public Plot getOwnedPlotAbs(@Nonnull final PlotId id) {
return this.plots.get(id); return this.plots.get(id);
} }
@Nullable public Plot getOwnedPlot(@NotNull final PlotId id) { @Nullable public Plot getOwnedPlot(@Nonnull final PlotId id) {
Plot plot = this.plots.get(id); Plot plot = this.plots.get(id);
return plot == null ? null : plot.getBasePlot(false); return plot == null ? null : plot.getBasePlot(false);
} }
@ -492,17 +496,17 @@ public abstract class PlotArea {
return this.TYPE != 2 || getRegionAbs().isIn(x, z); return this.TYPE != 2 || getRegionAbs().isIn(x, z);
} }
public boolean contains(@NotNull final PlotId id) { public boolean contains(@Nonnull final PlotId id) {
return this.min == null || (id.x >= this.min.x && id.x <= this.max.x && id.y >= this.min.y return this.min == null || (id.x >= this.min.x && id.x <= this.max.x && id.y >= this.min.y
&& id.y <= this.max.y); && id.y <= this.max.y);
} }
public boolean contains(@NotNull final Location location) { public boolean contains(@Nonnull final Location location) {
return StringMan.isEqual(location.getWorld(), this.worldname) && (getRegionAbs() == null return StringMan.isEqual(location.getWorld(), this.worldname) && (getRegionAbs() == null
|| this.region.isIn(location.getX(), location.getZ())); || this.region.isIn(location.getX(), location.getZ()));
} }
@NotNull Set<Plot> getPlotsAbs(final UUID uuid) { @Nonnull Set<Plot> getPlotsAbs(final UUID uuid) {
if (uuid == null) { if (uuid == null) {
return Collections.emptySet(); return Collections.emptySet();
} }
@ -515,7 +519,7 @@ public abstract class PlotArea {
return myPlots; return myPlots;
} }
@NotNull public Set<Plot> getPlots(@NotNull final UUID uuid) { @Nonnull public Set<Plot> getPlots(@Nonnull final UUID uuid) {
return getPlots().stream().filter(plot -> plot.isBasePlot() && plot.isOwner(uuid)) return getPlots().stream().filter(plot -> plot.isBasePlot() && plot.isOwner(uuid))
.collect(ImmutableSet.toImmutableSet()); .collect(ImmutableSet.toImmutableSet());
} }
@ -529,7 +533,7 @@ public abstract class PlotArea {
return this.plots.values(); return this.plots.values();
} }
public int getPlotCount(@NotNull final UUID uuid) { public int getPlotCount(@Nonnull final UUID uuid) {
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
return (int) getPlotsAbs(uuid).stream().filter(plot -> !plot.hasFlag(Flags.DONE)) return (int) getPlotsAbs(uuid).stream().filter(plot -> !plot.hasFlag(Flags.DONE))
.count(); .count();
@ -542,11 +546,11 @@ public abstract class PlotArea {
* *
* @deprecated Use {@link #getPlots(UUID)} * @deprecated Use {@link #getPlots(UUID)}
*/ */
@Deprecated public Set<Plot> getPlots(@NotNull final PlotPlayer player) { @Deprecated public Set<Plot> getPlots(@Nonnull final PlotPlayer player) {
return getPlots(player.getUUID()); return getPlots(player.getUUID());
} }
public boolean hasPlot(@NotNull final UUID uuid) { public boolean hasPlot(@Nonnull final UUID uuid) {
return this.plots.entrySet().stream().anyMatch(entry -> entry.getValue().isOwner(uuid)); return this.plots.entrySet().stream().anyMatch(entry -> entry.getValue().isOwner(uuid));
} }
@ -555,7 +559,7 @@ public abstract class PlotArea {
return player != null ? getPlotCount(player.getUUID()) : 0; return player != null ? getPlotCount(player.getUUID()) : 0;
} }
@Nullable public Plot getPlotAbs(@NotNull final PlotId id) { @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) {
Plot plot = getOwnedPlotAbs(id); Plot plot = getOwnedPlotAbs(id);
if (plot == null) { if (plot == null) {
if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y
@ -567,7 +571,7 @@ public abstract class PlotArea {
return plot; return plot;
} }
@Nullable public Plot getPlot(@NotNull final PlotId id) { @Nullable public Plot getPlot(@Nonnull final PlotId id) {
final Plot plot = getOwnedPlotAbs(id); final Plot plot = getOwnedPlotAbs(id);
if (plot == null) { if (plot == null) {
if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y
@ -588,7 +592,7 @@ public abstract class PlotArea {
return this.plots.size(); return this.plots.size();
} }
@Nullable public PlotCluster getCluster(@NotNull final Location location) { @Nullable public PlotCluster getCluster(@Nonnull final Location location) {
final Plot plot = getPlot(location); final Plot plot = getPlot(location);
if (plot == null) { if (plot == null) {
return null; return null;
@ -596,8 +600,8 @@ public abstract class PlotArea {
return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null; return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null;
} }
@Nullable public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, @Nullable public PlotCluster getFirstIntersectingCluster(@Nonnull final PlotId pos1,
@NotNull final PlotId pos2) { @Nonnull final PlotId pos2) {
if (this.clusters == null) { if (this.clusters == null) {
return null; return null;
} }
@ -609,11 +613,11 @@ public abstract class PlotArea {
return null; return null;
} }
@Nullable PlotCluster getCluster(@NotNull final PlotId id) { @Nullable PlotCluster getCluster(@Nonnull final PlotId id) {
return this.clusters != null ? this.clusters.get(id.x, id.y) : null; return this.clusters != null ? this.clusters.get(id.x, id.y) : null;
} }
@NotNull public PlotManager getPlotManager() { public PlotManager getPlotManager() {
return this.manager; return this.manager;
} }
@ -624,14 +628,14 @@ public abstract class PlotArea {
* *
* @see FlagManager * @see FlagManager
*/ */
public void setMeta(@NotNull final String key, @Nullable final Object value) { public void setMeta(@Nonnull final String key, @Nullable final Object value) {
if (this.meta == null) { if (this.meta == null) {
this.meta = new ConcurrentHashMap<>(); this.meta = new ConcurrentHashMap<>();
} }
this.meta.put(key, value); this.meta.put(key, value);
} }
@NotNull public <T> T getMeta(@Nullable final String key, @NotNull final T def) { @Nullable public <T> T getMeta(@Nullable final String key, @Nullable final T def) {
final Object v = getMeta(key); final Object v = getMeta(key);
return v == null ? def : (T) v; return v == null ? def : (T) v;
} }
@ -641,14 +645,14 @@ public abstract class PlotArea {
* <br> * <br>
* For persistent metadata use the flag system * For persistent metadata use the flag system
*/ */
@Nullable public Object getMeta(@NotNull final String key) { @Nullable public Object getMeta(@Nonnull final String key) {
if (this.meta != null) { if (this.meta != null) {
return this.meta.get(key); return this.meta.get(key);
} }
return null; return null;
} }
@SuppressWarnings("unused") @NotNull public Set<Plot> getBasePlots() { @SuppressWarnings("unused") @Nonnull public Set<Plot> getBasePlots() {
final HashSet<Plot> myPlots = new HashSet<>(getPlots()); final HashSet<Plot> myPlots = new HashSet<>(getPlots());
myPlots.removeIf(plot -> !plot.isBasePlot()); myPlots.removeIf(plot -> !plot.isBasePlot());
return myPlots; return myPlots;
@ -681,15 +685,15 @@ public abstract class PlotArea {
* @deprecated Use {@link #getPlotsMap()} * @deprecated Use {@link #getPlotsMap()}
*/ */
//todo eventually remove //todo eventually remove
@Deprecated @NotNull public Map<PlotId, Plot> getPlotsRaw() { @Deprecated @Nonnull public Map<PlotId, Plot> getPlotsRaw() {
return ImmutableMap.copyOf(plots); return ImmutableMap.copyOf(plots);
} }
@NotNull public Set<Entry<PlotId, Plot>> getPlotEntries() { @Nonnull public Set<Entry<PlotId, Plot>> getPlotEntries() {
return this.plots.entrySet(); return this.plots.entrySet();
} }
public boolean addPlot(@NotNull final Plot plot) { public boolean addPlot(@Nonnull final Plot plot) {
for (PlotPlayer pp : plot.getPlayersInPlot()) { for (PlotPlayer pp : plot.getPlayersInPlot()) {
pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); pp.setMeta(PlotPlayer.META_LAST_PLOT, plot);
} }
@ -727,7 +731,7 @@ public abstract class PlotArea {
return null; return null;
} }
public boolean addPlotIfAbsent(@NotNull final Plot plot) { public boolean addPlotIfAbsent(@Nonnull final 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(PlotPlayer.META_LAST_PLOT, plot); pp.setMeta(PlotPlayer.META_LAST_PLOT, plot);
@ -737,7 +741,7 @@ public abstract class PlotArea {
return false; return false;
} }
public boolean addPlotAbs(@NotNull final Plot plot) { public boolean addPlotAbs(@Nonnull final Plot plot) {
return this.plots.put(plot.getId(), plot) == null; return this.plots.put(plot.getId(), plot) == null;
} }
@ -782,14 +786,14 @@ public abstract class PlotArea {
* *
* @param key Meta data key * @param key Meta data key
*/ */
public void deleteMeta(@NotNull final String key) { public void deleteMeta(@Nonnull final String key) {
if (this.meta != null) { if (this.meta != null) {
this.meta.remove(key); this.meta.remove(key);
} }
} }
public boolean canClaim(@Nullable final PlotPlayer player, @NotNull final PlotId pos1, public boolean canClaim(@Nullable final PlotPlayer player, @Nonnull final PlotId pos1,
@NotNull final PlotId pos2) { @Nonnull final PlotId pos2) {
if (pos1.x == pos2.x && pos1.y == pos2.y) { if (pos1.x == pos2.x && pos1.y == pos2.y) {
if (getOwnedPlot(pos1) != null) { if (getOwnedPlot(pos1) != null) {
return false; return false;
@ -815,11 +819,11 @@ public abstract class PlotArea {
return true; return true;
} }
public boolean removePlot(@NotNull final PlotId id) { public boolean removePlot(@Nonnull final PlotId id) {
return this.plots.remove(id) != null; return this.plots.remove(id) != null;
} }
public boolean mergePlots(@NotNull final List<PlotId> plotIds, final boolean removeRoads) { public boolean mergePlots(@Nonnull final List<PlotId> plotIds, final boolean removeRoads) {
if (plotIds.size() < 2) { if (plotIds.size() < 2) {
return false; return false;
} }
@ -897,7 +901,7 @@ public abstract class PlotArea {
* @param pos2 second corner of selection * @param pos2 second corner of selection
* @return the plots in the selection which are owned * @return the plots in the selection which are owned
*/ */
public Set<Plot> getPlotSelectionOwned(@NotNull final PlotId pos1, @NotNull final PlotId pos2) { public Set<Plot> getPlotSelectionOwned(@Nonnull final PlotId pos1, @Nonnull final PlotId pos2) {
final int size = (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); final int size = (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y);
final Set<Plot> result = new HashSet<>(); final Set<Plot> result = new HashSet<>();
if (size < 16 || size < getPlotCount()) { if (size < 16 || size < getPlotCount()) {

View File

@ -132,8 +132,8 @@ public class PlotCluster {
toReturn = center.getHome(); toReturn = center.getHome();
if (toReturn.getY() == 0) { if (toReturn.getY() == 0) {
PlotManager manager = this.area.getPlotManager(); PlotManager manager = this.area.getPlotManager();
Location location = manager.getSignLoc(center); Location loc = manager.getSignLoc(center);
toReturn.setY(location.getY()); toReturn.setY(loc.getY());
} }
} else { } else {
toReturn = getClusterBottom().add(home.x, home.y, home.z); toReturn = getClusterBottom().add(home.x, home.y, home.z);

View File

@ -1,7 +1,7 @@
package com.github.intellectualsites.plotsquared.plot.object; package com.github.intellectualsites.plotsquared.plot.object;
import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull;
import org.jetbrains.annotations.Nullable; import javax.annotation.Nullable;
public class PlotId { public class PlotId {
/** /**
@ -32,14 +32,14 @@ public class PlotId {
* @return the PlotId representation of the arguement * @return the PlotId representation of the arguement
* @throws IllegalArgumentException if the string does not contain a valid PlotId * @throws IllegalArgumentException if the string does not contain a valid PlotId
*/ */
@NotNull public static PlotId fromString(@NotNull String string) { @Nonnull public static PlotId fromString(@Nonnull String string) {
PlotId plot = fromStringOrNull(string); PlotId plot = fromStringOrNull(string);
if (plot == null) if (plot == null)
throw new IllegalArgumentException("Cannot create PlotID. String invalid."); throw new IllegalArgumentException("Cannot create PlotID. String invalid.");
return plot; return plot;
} }
@Nullable public static PlotId fromStringOrNull(@NotNull String string) { @Nullable public static PlotId fromStringOrNull(@Nonnull String string) {
String[] parts = string.split("[;|,]"); String[] parts = string.split("[;|,]");
if (parts.length < 2) { if (parts.length < 2) {
return null; return null;

View File

@ -39,12 +39,6 @@ public abstract class PlotManager {
public abstract boolean unClaimPlot(Plot plot, Runnable whenDone); public abstract boolean unClaimPlot(Plot plot, Runnable whenDone);
/**
* Retrieves the location of where a sign should be for a plot.
*
* @param plot The plot
* @return The location where a sign should be
*/
public abstract Location getSignLoc(Plot plot); public abstract Location getSignLoc(Plot plot);
/* /*
@ -53,7 +47,8 @@ public abstract class PlotManager {
*/ */
public abstract String[] getPlotComponents(PlotId plotId); public abstract String[] getPlotComponents(PlotId plotId);
public abstract boolean setComponent(PlotId plotId, String component, BlockBucket blocks); public abstract boolean setComponent(PlotId plotId, String component,
BlockBucket blocks);
/* /*
* PLOT MERGING (return false if your generator does not support plot * PLOT MERGING (return false if your generator does not support plot

View File

@ -14,8 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import lombok.NonNull; import lombok.NonNull;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -306,7 +306,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* *
* @return The location * @return The location
*/ */
@NotNull public Location getLocation() { public Location getLocation() {
Location location = getMeta("location"); Location location = getMeta("location");
if (location != null) { if (location != null) {
return location; return location;
@ -335,14 +335,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* *
* @return UUID * @return UUID
*/ */
@Override @NotNull public abstract UUID getUUID(); @Override @Nonnull public abstract UUID getUUID();
public boolean canTeleport(@NotNull final Location location) { public boolean canTeleport(@Nonnull final Location loc) {
Preconditions.checkNotNull(location, "Specified location cannot be null"); Preconditions.checkNotNull(loc, "Specified location cannot be null");
final Location current = getLocationFull(); final Location current = getLocationFull();
teleport(location); teleport(loc);
boolean result = true; boolean result = true;
if (!getLocation().equals(location)) { if (!getLocation().equals(loc)) {
result = false; result = false;
} }
teleport(current); teleport(current);
@ -421,21 +421,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* *
* @param weather the weather visible to the player * @param weather the weather visible to the player
*/ */
public abstract void setWeather(@NotNull PlotWeather weather); public abstract void setWeather(@Nonnull PlotWeather weather);
/** /**
* Get this player's gamemode. * Get this player's gamemode.
* *
* @return the gamemode of the player. * @return the gamemode of the player.
*/ */
@NotNull public abstract PlotGameMode getGameMode(); @Nonnull public abstract PlotGameMode getGameMode();
/** /**
* Set this player's gameMode. * Set this player's gameMode.
* *
* @param gameMode the gamemode to set * @param gameMode the gamemode to set
*/ */
public abstract void setGameMode(@NotNull PlotGameMode gameMode); public abstract void setGameMode(@Nonnull PlotGameMode gameMode);
/** /**
* Set this player's local time (ticks). * Set this player's local time (ticks).
@ -464,7 +464,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* @param location where to play the music * @param location where to play the music
* @param id the record item id * @param id the record item id
*/ */
public abstract void playMusic(@NotNull Location location, @NotNull PlotBlock id); public abstract void playMusic(@Nonnull Location location, @Nonnull PlotBlock id);
/** /**
* Check if this player is banned. * Check if this player is banned.
@ -493,10 +493,10 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
ByteBuffer buffer = ByteBuffer.allocate(13); ByteBuffer buffer = ByteBuffer.allocate(13);
buffer.putShort((short) x); buffer.putShort((short) x);
buffer.putShort((short) z); buffer.putShort((short) z);
Location location = getLocation(); Location loc = getLocation();
buffer.putInt(location.getX()); buffer.putInt(loc.getX());
buffer.put((byte) location.getY()); buffer.put((byte) loc.getY());
buffer.putInt(location.getZ()); buffer.putInt(loc.getZ());
setPersistentMeta("quitLoc", buffer.array()); setPersistentMeta("quitLoc", buffer.array());
} else if (hasPersistentMeta("quitLoc")) { } else if (hasPersistentMeta("quitLoc")) {
removePersistentMeta("quitLoc"); removePersistentMeta("quitLoc");
@ -596,11 +596,11 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
return; return;
} }
final Location location = new Location(plot.getWorldName(), x, y, z); final Location loc = new Location(plot.getWorldName(), x, y, z);
if (plot.isLoaded()) { if (plot.isLoaded()) {
TaskManager.runTask(() -> { TaskManager.runTask(() -> {
if (getMeta("teleportOnLogin", true)) { if (getMeta("teleportOnLogin", true)) {
teleport(location); teleport(loc);
sendMessage( sendMessage(
Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX
+ "," + plotZ + ")"); + "," + plotZ + ")");
@ -612,7 +612,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
TaskManager.runTask(() -> { TaskManager.runTask(() -> {
if (getMeta("teleportOnLogin", true)) { if (getMeta("teleportOnLogin", true)) {
if (plot.isLoaded()) { if (plot.isLoaded()) {
teleport(location); teleport(loc);
sendMessage(Captions.TELEPORTED_TO_PLOT.f() sendMessage(Captions.TELEPORTED_TO_PLOT.f()
+ " (quitLoc-unloaded) (" + plotX + "," + plotZ + " (quitLoc-unloaded) (" + plotX + "," + plotZ
+ ")"); + ")");

View File

@ -5,12 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/** /**
* Generic settings class. * Generic settings class.
@ -85,17 +80,6 @@ public class PlotSettings {
return false; return false;
} }
public boolean setMerged(Direction direction, boolean merged) {
if (Direction.ALL == direction) {
throw new IllegalArgumentException("You cannot use Direction.ALL in this method!");
}
if (this.merged[direction.getIndex()] != merged) {
this.merged[direction.getIndex()] = merged;
return true;
}
return false;
}
public BlockLoc getPosition() { public BlockLoc getPosition() {
if (this.position == null) { if (this.position == null) {
return new BlockLoc(0, 0, 0); return new BlockLoc(0, 0, 0);

View File

@ -30,8 +30,8 @@ public class Schematic {
public boolean setBlock(BlockVector3 position, BaseBlock block) throws WorldEditException { public boolean setBlock(BlockVector3 position, BaseBlock block) throws WorldEditException {
if (clipboard.getRegion().contains(position)) { if (clipboard.getRegion().contains(position)) {
BlockVector3 vector3 = position.subtract(clipboard.getRegion().getMinimumPoint()); BlockVector3 v = position.subtract(clipboard.getRegion().getMinimumPoint());
clipboard.setBlock(vector3, block); clipboard.setBlock(v, block);
return true; return true;
} else { } else {
return false; return false;
@ -39,9 +39,9 @@ public class Schematic {
} }
public void save(File file) throws IOException { public void save(File file) throws IOException {
try (SpongeSchematicWriter schematicWriter = new SpongeSchematicWriter( try (SpongeSchematicWriter ssw = new SpongeSchematicWriter(
new NBTOutputStream(new FileOutputStream(file)))) { new NBTOutputStream(new FileOutputStream(file)))) {
schematicWriter.write(clipboard); ssw.write(clipboard);
} }
} }
} }

View File

@ -4,8 +4,8 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.*;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
@ -60,7 +60,7 @@ public class SinglePlot extends Plot {
return super.isLoaded(); return super.isLoaded();
} }
@NotNull @Override public HashSet<RegionWrapper> getRegions() { @Nonnull @Override public HashSet<RegionWrapper> getRegions() {
return regions; return regions;
} }

View File

@ -9,9 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -26,7 +26,7 @@ public class SinglePlotArea extends GridPlotWorld {
this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
} }
@NotNull @Override @Override
protected PlotManager createManager() { protected PlotManager createManager() {
return new SinglePlotManager(this); return new SinglePlotManager(this);
} }
@ -76,8 +76,8 @@ public class SinglePlotArea extends GridPlotWorld {
new File(dataDest, file.getName()).toPath()); new File(dataDest, file.getName()).toPath());
} }
} }
} catch (IOException exception) { } catch (IOException ignore) {
exception.printStackTrace(); ignore.printStackTrace();
} }
} }
} }
@ -113,38 +113,38 @@ public class SinglePlotArea extends GridPlotWorld {
new ConfigurationNode("void", this.VOID, "Void world", Configuration.BOOLEAN)}; new ConfigurationNode("void", this.VOID, "Void world", Configuration.BOOLEAN)};
} }
@Nullable @Override public Plot getOwnedPlot(@NotNull final Location location) { @Nullable @Override public Plot getOwnedPlot(@Nonnull final Location location) {
PlotId pid = PlotId.fromStringOrNull(location.getWorld()); PlotId pid = PlotId.fromStringOrNull(location.getWorld());
Plot plot = pid == null ? null : this.plots.get(pid); Plot plot = pid == null ? null : this.plots.get(pid);
return plot == null ? null : plot.getBasePlot(false); return plot == null ? null : plot.getBasePlot(false);
} }
@Nullable @Override public Plot getOwnedPlotAbs(@NotNull Location location) { @Nullable @Override public Plot getOwnedPlotAbs(@Nonnull Location location) {
PlotId pid = PlotId.fromStringOrNull(location.getWorld()); PlotId pid = PlotId.fromStringOrNull(location.getWorld());
return pid == null ? null : plots.get(pid); return pid == null ? null : plots.get(pid);
} }
@Nullable @Override public Plot getPlot(@NotNull final Location location) { @Nullable @Override public Plot getPlot(@Nonnull final Location location) {
PlotId pid = PlotId.fromStringOrNull(location.getWorld()); PlotId pid = PlotId.fromStringOrNull(location.getWorld());
return pid == null ? null : getPlot(pid); return pid == null ? null : getPlot(pid);
} }
@Nullable @Override public Plot getPlotAbs(@NotNull final Location location) { @Nullable @Override public Plot getPlotAbs(@Nonnull final Location location) {
final PlotId pid = PlotId.fromStringOrNull(location.getWorld()); final PlotId pid = PlotId.fromStringOrNull(location.getWorld());
return pid == null ? null : getPlotAbs(pid); return pid == null ? null : getPlotAbs(pid);
} }
public boolean addPlot(@NotNull Plot plot) { public boolean addPlot(@Nonnull Plot plot) {
plot = adapt(plot); plot = adapt(plot);
return super.addPlot(plot); return super.addPlot(plot);
} }
@Override public boolean addPlotAbs(@NotNull Plot plot) { @Override public boolean addPlotAbs(@Nonnull Plot plot) {
plot = adapt(plot); plot = adapt(plot);
return super.addPlotAbs(plot); return super.addPlotAbs(plot);
} }
@Override public boolean addPlotIfAbsent(@NotNull Plot plot) { @Override public boolean addPlotIfAbsent(@Nonnull Plot plot) {
plot = adapt(plot); plot = adapt(plot);
return super.addPlotIfAbsent(plot); return super.addPlotIfAbsent(plot);
} }
@ -160,7 +160,7 @@ public class SinglePlotArea extends GridPlotWorld {
return p; return p;
} }
@Nullable public Plot getPlotAbs(@NotNull final PlotId id) { @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) {
Plot plot = getOwnedPlotAbs(id); Plot plot = getOwnedPlotAbs(id);
if (plot == null) { if (plot == null) {
return new SinglePlot(this, id); return new SinglePlot(this, id);
@ -168,7 +168,7 @@ public class SinglePlotArea extends GridPlotWorld {
return plot; return plot;
} }
@Nullable public Plot getPlot(@NotNull PlotId id) { @Nullable public Plot getPlot(@Nonnull PlotId id) {
// TODO // TODO
Plot plot = getOwnedPlotAbs(id); Plot plot = getOwnedPlotAbs(id);
if (plot == null) { if (plot == null) {

View File

@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import org.jetbrains.annotations.Nullable; import javax.annotation.Nullable;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;

View File

@ -1,70 +0,0 @@
package com.github.intellectualsites.plotsquared.plot.util;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class HastebinUtility {
public static final String BIN_URL = "https://hastebin.com/documents", USER_AGENT =
"Mozilla/5.0";
public static final Pattern PATTERN = Pattern.compile("\\{\"key\":\"([\\S\\s]*)\"\\}");
public static String upload(final String string) throws IOException {
final URL url = new URL(BIN_URL);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("User-Agent", USER_AGENT);
connection.setDoOutput(true);
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
outputStream.write(string.getBytes());
outputStream.flush();
}
StringBuilder response;
try (BufferedReader in = new BufferedReader(
new InputStreamReader(connection.getInputStream()))) {
response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
}
Matcher matcher = PATTERN.matcher(response.toString());
if (matcher.matches()) {
return "https://hastebin.com/" + matcher.group(1);
} else {
throw new RuntimeException("Couldn't read response!");
}
}
public static String upload(final File file) throws IOException {
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
int i = 0;
while ((line = reader.readLine()) != null) {
lines.add(line);
}
}
final StringBuilder content = new StringBuilder();
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
content.append(lines.get(i)).append("\n");
}
return upload(content.toString());
}
}

View File

@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream; import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@ -329,7 +329,7 @@ public class MainUtil {
* @param owner * @param owner
* @return The player's name, None, Everyone or Unknown * @return The player's name, None, Everyone or Unknown
*/ */
@NotNull public static String getName(UUID owner) { @Nonnull public static String getName(UUID owner) {
if (owner == null) { if (owner == null) {
return Captions.NONE.getTranslated(); return Captions.NONE.getTranslated();
} }
@ -358,7 +358,7 @@ public class MainUtil {
* @return * @return
* @see Plot#getCorners() * @see Plot#getCorners()
*/ */
@NotNull public static Location[] getCorners(String world, Collection<RegionWrapper> regions) { @Nonnull public static Location[] getCorners(String world, Collection<RegionWrapper> regions) {
Location min = null; Location min = null;
Location max = null; Location max = null;
for (RegionWrapper region : regions) { for (RegionWrapper region : regions) {
@ -560,11 +560,11 @@ public class MainUtil {
* Send a message to the player. * Send a message to the player.
* *
* @param player Player to receive message * @param player Player to receive message
* @param message Message to send * @param msg Message to send
* @return true Can be used in things such as commands (return PlayerFunctions.sendMessage(...)) * @return true Can be used in things such as commands (return PlayerFunctions.sendMessage(...))
*/ */
public static boolean sendMessage(PlotPlayer player, String message) { public static boolean sendMessage(PlotPlayer player, String msg) {
return sendMessage(player, message, true); return sendMessage(player, msg, true);
} }
/** /**
@ -585,7 +585,7 @@ public class MainUtil {
* @param prefix If the message should be prefixed with the configured prefix * @param prefix If the message should be prefixed with the configured prefix
* @return * @return
*/ */
public static boolean sendMessage(CommandCaller player, @NotNull String msg, boolean prefix) { public static boolean sendMessage(CommandCaller player, String msg, boolean prefix) {
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
if (player == null) { if (player == null) {
String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg; String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg;

Some files were not shown because too many files have changed in this diff Show More