mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-02 13:33:47 +01:00
Reformat code
This commit is contained in:
parent
800dcecfe6
commit
00c435e29b
@ -81,7 +81,8 @@ public abstract class Command {
|
||||
&& types[2] == String[].class && types[3] == RunnableVal3.class
|
||||
&& types[4] == RunnableVal2.class) {
|
||||
Command tmp = new Command(this, true) {
|
||||
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
|
||||
@Override
|
||||
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
try {
|
||||
@ -264,14 +265,13 @@ public abstract class Command {
|
||||
if (totalPages != 0) { // Back
|
||||
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
|
||||
.color("$3").text("->").color("$3").text(Captions.CLICKABLE.getTranslated())
|
||||
.color("$2")
|
||||
.send(player);
|
||||
.color("$2").send(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player Caller
|
||||
* @param args Arguments
|
||||
* @param args Arguments
|
||||
* @param confirm Instance, Success, Failure
|
||||
* @return CompletableFuture true if the command executed fully, false in
|
||||
* any other case
|
||||
|
@ -83,7 +83,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
|
||||
Map<?, ?> input;
|
||||
try {
|
||||
input = (Map<?, ?>) yaml.load(contents);
|
||||
input = yaml.load(contents);
|
||||
} catch (YAMLException e) {
|
||||
throw new InvalidConfigurationException(e);
|
||||
} catch (ClassCastException ignored) {
|
||||
|
@ -186,7 +186,7 @@ public class JSONObject {
|
||||
* @param object An object that has fields that should be used to make a JSONObject.
|
||||
* @param names An array of strings, the names of the fields to be obtained from the object.
|
||||
*/
|
||||
public JSONObject(Object object, String names[]) {
|
||||
public JSONObject(Object object, String[] names) {
|
||||
this();
|
||||
Class c = object.getClass();
|
||||
for (String name : names) {
|
||||
|
@ -219,7 +219,7 @@ public interface IPlotMain extends ILogger {
|
||||
* Gets the generator wrapper for a world (world) and generator (name).
|
||||
*
|
||||
* @param world the world to get the generator from
|
||||
* @param name the name of the generator
|
||||
* @param name the name of the generator
|
||||
* @return the generator being used for the provided world
|
||||
*/
|
||||
GeneratorWrapper<?> getGenerator(String world, String name);
|
||||
|
@ -155,7 +155,7 @@ import java.util.zip.ZipInputStream;
|
||||
//
|
||||
// Register configuration serializable classes
|
||||
//
|
||||
// ConfigurationSerialization.registerClass(BlockState.class, "BlockState");
|
||||
// ConfigurationSerialization.registerClass(BlockState.class, "BlockState");
|
||||
ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket");
|
||||
|
||||
try {
|
||||
@ -247,7 +247,8 @@ import java.util.zip.ZipInputStream;
|
||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||
try {
|
||||
if (this.IMP.initWorldEdit()) {
|
||||
PlotSquared.log(Captions.PREFIX + "&6" + IMP.getPluginName() + " hooked into WorldEdit.");
|
||||
PlotSquared.log(Captions.PREFIX + "&6" + IMP.getPluginName()
|
||||
+ " hooked into WorldEdit.");
|
||||
this.worldedit = WorldEdit.getInstance();
|
||||
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
|
||||
if (Settings.Enabled_Components.COMMANDS) {
|
||||
@ -284,7 +285,7 @@ import java.util.zip.ZipInputStream;
|
||||
}
|
||||
if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) {
|
||||
debug("`" + world + "` was not properly loaded - " + IMP.getPluginName()
|
||||
+ " will now try to load it properly: ");
|
||||
+ " will now try to load it properly: ");
|
||||
debug(
|
||||
" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
||||
debug(
|
||||
@ -347,7 +348,8 @@ import java.util.zip.ZipInputStream;
|
||||
* @see IPlotMain#log(String)
|
||||
*/
|
||||
public static void log(Object message) {
|
||||
if (message == null || (message instanceof Caption ? ((Caption) message).getTranslated().isEmpty() :
|
||||
if (message == null || (message instanceof Caption ?
|
||||
((Caption) message).getTranslated().isEmpty() :
|
||||
message.toString().isEmpty())) {
|
||||
return;
|
||||
}
|
||||
@ -1832,7 +1834,8 @@ import java.util.zip.ZipInputStream;
|
||||
if (this.version != null) {
|
||||
this.style.set("Version", this.version.toString());
|
||||
}
|
||||
this.style.set("Information", "Left Row: PlotSquared color codes ($), right row: Minecraft color codes (&)");
|
||||
this.style.set("Information",
|
||||
"Left Row: PlotSquared color codes ($), right row: Minecraft color codes (&)");
|
||||
Map<String, Object> object = new HashMap<>(16);
|
||||
object.put("color.1", "6");
|
||||
object.put("color.2", "7");
|
||||
|
@ -37,6 +37,7 @@ public class PlotVersion {
|
||||
return "4." + build;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
if (hash == 0 && build == 0) {
|
||||
return "PlotSquared-NoVer-SNAPSHOT";
|
||||
|
@ -17,10 +17,8 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "add",
|
||||
description = "Allow a user to build in a plot while the plot owner is online.",
|
||||
usage = "/plot add <player|*>", category = CommandCategory.SETTINGS, permission = "plots.add",
|
||||
requiredType = RequiredType.PLAYER) public class Add extends Command {
|
||||
@CommandDeclaration(command = "add", description = "Allow a user to build in a plot while the plot owner is online.", usage = "/plot add <player|*>", category = CommandCategory.SETTINGS, permission = "plots.add", requiredType = RequiredType.PLAYER)
|
||||
public class Add extends Command {
|
||||
|
||||
public Add() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
|
@ -12,11 +12,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
|
||||
@CommandDeclaration(command = "setalias", permission = "plots.alias",
|
||||
description = "Set the plot name", usage = "/plot alias <set|remove> <alias>",
|
||||
aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"},
|
||||
category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Alias
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "setalias", permission = "plots.alias", description = "Set the plot name", usage = "/plot alias <set|remove> <alias>", aliases = {
|
||||
"alias", "sa", "name", "rename", "setname", "seta",
|
||||
"nameplot"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
|
||||
public class Alias extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
|
||||
|
@ -33,11 +33,8 @@ import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "area", permission = "plots.area",
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
description = "Create a new PlotArea", aliases = "world",
|
||||
usage = "/plot area <create|info|list|tp|regen>", confirmation = true) public class Area
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, description = "Create a new PlotArea", aliases = "world", usage = "/plot area <create|info|list|tp|regen>", confirmation = true)
|
||||
public class Area extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
if (args.length == 0) {
|
||||
@ -135,14 +132,14 @@ import java.util.Set;
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
Captions.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world),
|
||||
TeleportCause.COMMAND);
|
||||
if (area.TERRAIN != 3) {
|
||||
ChunkManager.largeRegionTask(world, region,
|
||||
new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
AugmentedUtils
|
||||
.generate(world, value.getX(), value.getZ(),
|
||||
null);
|
||||
AugmentedUtils.generate(world, value.getX(),
|
||||
value.getZ(), null);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
@ -258,7 +255,8 @@ import java.util.Set;
|
||||
String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
Captions.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world),
|
||||
TeleportCause.COMMAND);
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
"An error occurred while creating the world: "
|
||||
@ -285,13 +283,15 @@ import java.util.Set;
|
||||
}
|
||||
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||
if (!player.getLocation().getWorld().equals(pa.worldname)) {
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), TeleportCause.COMMAND);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname),
|
||||
TeleportCause.COMMAND);
|
||||
}
|
||||
} else {
|
||||
object.terrain = 0;
|
||||
object.type = 0;
|
||||
SetupUtils.manager.setupWorld(object);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), TeleportCause.COMMAND);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname),
|
||||
TeleportCause.COMMAND);
|
||||
}
|
||||
player.setMeta("area_create_area", pa);
|
||||
MainUtil.sendMessage(player,
|
||||
@ -432,10 +432,11 @@ import java.util.Set;
|
||||
"$4Stop the server and delete: " + area.worldname + "/region");
|
||||
return false;
|
||||
}
|
||||
ChunkManager
|
||||
.largeRegionTask(area.worldname, area.getRegion(), new RunnableVal<BlockVector2>() {
|
||||
ChunkManager.largeRegionTask(area.worldname, area.getRegion(),
|
||||
new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
AugmentedUtils.generate(area.worldname, value.getX(), value.getZ(), null);
|
||||
AugmentedUtils
|
||||
.generate(area.worldname, value.getX(), value.getZ(), null);
|
||||
}
|
||||
}, () -> player.sendMessage("Regen complete"));
|
||||
return true;
|
||||
@ -463,9 +464,10 @@ import java.util.Set;
|
||||
center = WorldUtil.IMP.getSpawn(area.worldname);
|
||||
} else {
|
||||
CuboidRegion region = area.getRegion();
|
||||
center =
|
||||
new Location(area.worldname, region.getMinimumPoint().getX() + (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2,
|
||||
0, region.getMinimumPoint().getZ() + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2);
|
||||
center = new Location(area.worldname, region.getMinimumPoint().getX()
|
||||
+ (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2,
|
||||
0, region.getMinimumPoint().getZ()
|
||||
+ (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2);
|
||||
center.setY(1 + WorldUtil.IMP
|
||||
.getHighestBlock(area.worldname, center.getX(), center.getZ()));
|
||||
}
|
||||
|
@ -23,9 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "auto", permission = "plots.auto",
|
||||
category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE,
|
||||
description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]")
|
||||
@CommandDeclaration(command = "auto", permission = "plots.auto", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]")
|
||||
public class Auto extends SubCommand {
|
||||
|
||||
@Deprecated public static PlotId getNextPlotId(PlotId id, int step) {
|
||||
@ -177,7 +175,7 @@ public class Auto extends SubCommand {
|
||||
try {
|
||||
String[] split = args[0].split(",|;");
|
||||
if (split[1] == null) {
|
||||
MainUtil.sendMessage(player,"Correct use /plot auto [length,width]");
|
||||
MainUtil.sendMessage(player, "Correct use /plot auto [length,width]");
|
||||
size_x = 1;
|
||||
size_z = 1;
|
||||
} else {
|
||||
@ -220,12 +218,12 @@ public class Auto extends SubCommand {
|
||||
sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
return true;
|
||||
}
|
||||
if (!Permissions.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
&& !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
CaptionUtility.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -9,16 +9,17 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
|
||||
@CommandDeclaration(command = "setbiome", permission = "plots.set.biome",
|
||||
description = "Set the plot biome", usage = "/plot biome [biome]",
|
||||
aliases = {"biome", "sb", "setb", "b"}, category = CommandCategory.APPEARANCE,
|
||||
requiredType = RequiredType.NONE) public class Biome extends SetCommand {
|
||||
@CommandDeclaration(command = "setbiome", permission = "plots.set.biome", description = "Set the plot biome", usage = "/plot biome [biome]", aliases = {
|
||||
"biome", "sb", "setb",
|
||||
"b"}, category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE)
|
||||
public class Biome extends SetCommand {
|
||||
|
||||
@Override public boolean set(final PlotPlayer player, final Plot plot, final String value) {
|
||||
BiomeType biome = null;
|
||||
try {
|
||||
biome = BiomeTypes.get(value.toLowerCase());
|
||||
} catch (final Exception ignore) {}
|
||||
} catch (final Exception ignore) {
|
||||
}
|
||||
if (biome == null) {
|
||||
String biomes = StringMan
|
||||
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
||||
|
@ -15,9 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "buy", description = "Buy the plot you are standing on",
|
||||
usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE) public class Buy extends Command {
|
||||
@CommandDeclaration(command = "buy", description = "Buy the plot you are standing on", usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
|
||||
public class Buy extends Command {
|
||||
|
||||
public Buy() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
|
@ -3,9 +3,8 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "chat", description = "Toggle plot chat on or off",
|
||||
usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT,
|
||||
requiredType = RequiredType.PLAYER) public class Chat extends SubCommand {
|
||||
@CommandDeclaration(command = "chat", description = "Toggle plot chat on or off", usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER)
|
||||
public class Chat extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
MainCommand.getInstance().toggle.chat(this, player, new String[0], null, null);
|
||||
|
@ -17,9 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
@CommandDeclaration(command = "claim", aliases = "c",
|
||||
description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER, permission = "plots.claim", usage = "/plot claim")
|
||||
@CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER, permission = "plots.claim", usage = "/plot claim")
|
||||
public class Claim extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
@ -38,8 +36,7 @@ public class Claim extends SubCommand {
|
||||
int grants = 0;
|
||||
if (currentPlots >= player.getAllowedPlots()) {
|
||||
if (player.hasPersistentMeta("grantedPlots")) {
|
||||
grants =
|
||||
Ints.fromByteArray(player.getPersistentMeta("grantedPlots"));
|
||||
grants = Ints.fromByteArray(player.getPersistentMeta("grantedPlots"));
|
||||
if (grants <= 0) {
|
||||
player.removePersistentMeta("grantedPlots");
|
||||
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||
@ -58,9 +55,8 @@ public class Claim extends SubCommand {
|
||||
return sendMessage(player, Captions.SCHEMATIC_INVALID,
|
||||
"non-existent: " + schematic);
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
&& !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||
return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
@ -86,8 +82,7 @@ public class Claim extends SubCommand {
|
||||
if (grants == 1) {
|
||||
player.removePersistentMeta("grantedPlots");
|
||||
} else {
|
||||
player.setPersistentMeta("grantedPlots",
|
||||
Ints.toByteArray(grants - 1));
|
||||
player.setPersistentMeta("grantedPlots", Ints.toByteArray(grants - 1));
|
||||
}
|
||||
sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
||||
}
|
||||
|
@ -16,9 +16,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "clear", description = "Clear the plot you stand on", requiredType = RequiredType.NONE,
|
||||
permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear",
|
||||
aliases = "reset", confirmation = true) public class Clear extends Command {
|
||||
@CommandDeclaration(command = "clear", description = "Clear the plot you stand on", requiredType = RequiredType.NONE, permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear", aliases = "reset", confirmation = true)
|
||||
public class Clear extends Command {
|
||||
|
||||
// Note: To clear a specific plot use /plot <plot> clear
|
||||
// The syntax also works with any command: /plot <plot> <command>
|
||||
|
@ -22,10 +22,8 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "cluster", aliases = "clusters",
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
permission = "plots.cluster", description = "Manage a plot cluster") public class Cluster
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "cluster", aliases = "clusters", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, permission = "plots.cluster", description = "Manage a plot cluster")
|
||||
public class Cluster extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
|
||||
|
@ -16,8 +16,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot",
|
||||
category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER, permission = "plots.comment")
|
||||
@CommandDeclaration(command = "comment", aliases = {
|
||||
"msg"}, description = "Comment on a plot", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER, permission = "plots.comment")
|
||||
public class Comment extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
|
@ -19,10 +19,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@CommandDeclaration(command = "condense", permission = "plots.admin",
|
||||
usage = "/plot condense <area> <start|stop|info> [radius]",
|
||||
description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand {
|
||||
@CommandDeclaration(command = "condense", permission = "plots.admin", usage = "/plot condense <area> <start|stop|info> [radius]", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE)
|
||||
public class Condense extends SubCommand {
|
||||
|
||||
public static boolean TASK = false;
|
||||
|
||||
|
@ -9,9 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
@CommandDeclaration(command = "confirm", permission = "plots.use",
|
||||
description = "Confirm an action", category = CommandCategory.INFO) public class Confirm
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "confirm", permission = "plots.use", description = "Confirm an action", category = CommandCategory.INFO)
|
||||
public class Confirm extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
CmdInstance command = CmdConfirm.getPending(player);
|
||||
|
@ -9,10 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
|
||||
@CommandDeclaration(command = "continue",
|
||||
description = "Continue a plot that was previously marked as done",
|
||||
permission = "plots.continue", category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER) public class Continue extends SubCommand {
|
||||
@CommandDeclaration(command = "continue", description = "Continue a plot that was previously marked as done", permission = "plots.continue", category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
|
||||
public class Continue extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
Plot plot = player.getCurrentPlot();
|
||||
|
@ -8,9 +8,9 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
|
||||
@CommandDeclaration(command = "copy", permission = "plots.copy", aliases = {"copypaste"},
|
||||
category = CommandCategory.CLAIMING, description = "Copy a plot", usage = "/plot copy <X;Z>",
|
||||
requiredType = RequiredType.NONE) public class Copy extends SubCommand {
|
||||
@CommandDeclaration(command = "copy", permission = "plots.copy", aliases = {
|
||||
"copypaste"}, category = CommandCategory.CLAIMING, description = "Copy a plot", usage = "/plot copy <X;Z>", requiredType = RequiredType.NONE)
|
||||
public class Copy extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location location = player.getLocation();
|
||||
|
@ -9,11 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "createroadschematic", aliases = {"crs"},
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.createroadschematic",
|
||||
description = "Add a road schematic to your world using the roads around your current plot",
|
||||
usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand {
|
||||
@CommandDeclaration(command = "createroadschematic", aliases = {
|
||||
"crs"}, category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.PLAYER, permission = "plots.createroadschematic", description = "Add a road schematic to your world using the roads around your current plot", usage = "/plot createroadschematic")
|
||||
public class CreateRoadSchematic extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
Location location = player.getLocation();
|
||||
|
@ -22,11 +22,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@CommandDeclaration(command = "database", aliases = {"convert"},
|
||||
category = CommandCategory.ADMINISTRATION, permission = "plots.database",
|
||||
description = "Convert/Backup Storage", requiredType = RequiredType.CONSOLE,
|
||||
usage = "/plot database [area] <sqlite|mysql|import>") public class Database
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "database", aliases = {
|
||||
"convert"}, category = CommandCategory.ADMINISTRATION, permission = "plots.database", description = "Convert/Backup Storage", requiredType = RequiredType.CONSOLE, usage = "/plot database [area] <sqlite|mysql|import>")
|
||||
public class Database extends SubCommand {
|
||||
|
||||
public static void insertPlots(final SQLManager manager, final List<Plot> plots,
|
||||
final PlotPlayer player) {
|
||||
|
@ -9,8 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@CommandDeclaration(command = "debug", category = CommandCategory.DEBUG,
|
||||
description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin")
|
||||
@CommandDeclaration(command = "debug", category = CommandCategory.DEBUG, description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin")
|
||||
public class Debug extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
@ -19,7 +18,6 @@ public class Debug extends SubCommand {
|
||||
MainUtil.sendMessage(player,
|
||||
"Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , ");
|
||||
}
|
||||
;
|
||||
}
|
||||
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
|
@ -8,10 +8,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "debugallowunsafe",
|
||||
description = "Allow unsafe actions until toggled off", usage = "/plot debugallowunsafe",
|
||||
category = CommandCategory.DEBUG, requiredType = RequiredType.NONE,
|
||||
permission = "plots.debugallowunsafe") public class DebugAllowUnsafe extends SubCommand {
|
||||
@CommandDeclaration(command = "debugallowunsafe", description = "Allow unsafe actions until toggled off", usage = "/plot debugallowunsafe", category = CommandCategory.DEBUG, requiredType = RequiredType.NONE, permission = "plots.debugallowunsafe")
|
||||
public class DebugAllowUnsafe extends SubCommand {
|
||||
|
||||
public static final List<UUID> unsafeAllowed = new ArrayList<>();
|
||||
|
||||
|
@ -56,7 +56,8 @@ public class DebugClaimTest extends SubCommand {
|
||||
PlotManager manager = area.getPlotManager();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(min, max);
|
||||
MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: " + ids.size() + " plot ids to check!");
|
||||
MainUtil.sendMessage(player,
|
||||
"&3Sign Block&8->&3Plot&8: " + ids.size() + " plot ids to check!");
|
||||
for (PlotId id : ids) {
|
||||
Plot plot = area.getPlotAbs(id);
|
||||
if (plot.hasOwner()) {
|
||||
@ -74,7 +75,8 @@ public class DebugClaimTest extends SubCommand {
|
||||
BiMap<StringWrapper, UUID> map = UUIDHandler.getUuidMap();
|
||||
UUID uuid = map.get(new StringWrapper(line));
|
||||
if (uuid == null) {
|
||||
for (Map.Entry<StringWrapper, UUID> stringWrapperUUIDEntry : map.entrySet()) {
|
||||
for (Map.Entry<StringWrapper, UUID> stringWrapperUUIDEntry : map
|
||||
.entrySet()) {
|
||||
if (stringWrapperUUIDEntry.getKey().value.toLowerCase()
|
||||
.startsWith(line.toLowerCase())) {
|
||||
uuid = stringWrapperUUIDEntry.getValue();
|
||||
@ -86,11 +88,13 @@ public class DebugClaimTest extends SubCommand {
|
||||
uuid = UUIDHandler.getUUID(line, null);
|
||||
}
|
||||
if (uuid != null) {
|
||||
MainUtil.sendMessage(player, " - &aFound plot: " + plot.getId() + " : " + line);
|
||||
MainUtil.sendMessage(player,
|
||||
" - &aFound plot: " + plot.getId() + " : " + line);
|
||||
plot.setOwner(uuid);
|
||||
MainUtil.sendMessage(player, " - &8Updated plot: " + plot.getId());
|
||||
} else {
|
||||
MainUtil.sendMessage(player, " - &cInvalid PlayerName: " + plot.getId() + " : " + line);
|
||||
MainUtil.sendMessage(player,
|
||||
" - &cInvalid PlayerName: " + plot.getId() + " : " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,9 +55,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "debugexec", permission = "plots.admin",
|
||||
description = "Mutli-purpose debug command", aliases = {"exec", "$"},
|
||||
category = CommandCategory.DEBUG) public class DebugExec extends SubCommand {
|
||||
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = {
|
||||
"exec", "$"}, category = CommandCategory.DEBUG) public class DebugExec extends SubCommand {
|
||||
private ScriptEngine engine;
|
||||
private Bindings scope;
|
||||
|
||||
@ -306,8 +305,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
System.getProperty("line.separator"));
|
||||
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
|
||||
RequiredType.NONE, CommandCategory.DEBUG) {
|
||||
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
@Override public CompletableFuture<Boolean> execute(PlotPlayer player,
|
||||
String[] args, RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
try {
|
||||
DebugExec.this.scope.put("PlotPlayer", player);
|
||||
|
@ -16,9 +16,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@CommandDeclaration(command = "debugfixflags", usage = "/plot debugfixflags <world>",
|
||||
permission = "plots.debugfixflags", description = "Attempt to fix all flags for a world",
|
||||
requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG)
|
||||
@CommandDeclaration(command = "debugfixflags", usage = "/plot debugfixflags <world>", permission = "plots.debugfixflags", description = "Attempt to fix all flags for a world", requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG)
|
||||
public class DebugFixFlags extends SubCommand {
|
||||
|
||||
public DebugFixFlags() {
|
||||
|
@ -18,9 +18,8 @@ import java.io.File;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "debugimportworlds", permission = "plots.admin",
|
||||
description = "Import worlds by player name", requiredType = RequiredType.CONSOLE,
|
||||
category = CommandCategory.TELEPORT) public class DebugImportWorlds extends Command {
|
||||
@CommandDeclaration(command = "debugimportworlds", permission = "plots.admin", description = "Import worlds by player name", requiredType = RequiredType.CONSOLE, category = CommandCategory.TELEPORT)
|
||||
public class DebugImportWorlds extends Command {
|
||||
public DebugImportWorlds() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
}
|
||||
|
@ -5,10 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "debugloadtest", permission = "plots.debugloadtest",
|
||||
description = "This debug command will force the reload of all plots in the DB",
|
||||
usage = "/plot debugloadtest", category = CommandCategory.DEBUG,
|
||||
requiredType = RequiredType.CONSOLE) public class DebugLoadTest extends SubCommand {
|
||||
@CommandDeclaration(command = "debugloadtest", permission = "plots.debugloadtest", description = "This debug command will force the reload of all plots in the DB", usage = "/plot debugloadtest", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE)
|
||||
public class DebugLoadTest extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
PlotSquared.get().plots_tmp = DBFunc.getPlots();
|
||||
|
@ -25,9 +25,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
|
||||
description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
|
||||
permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE)
|
||||
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE)
|
||||
public class DebugPaste extends SubCommand {
|
||||
|
||||
private static String readFile(@NonNull final File file) throws IOException {
|
||||
@ -56,7 +54,8 @@ public class DebugPaste extends SubCommand {
|
||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
|
||||
.append(!Settings.UUID.OFFLINE).append('\n');
|
||||
b.append("Plugins:");
|
||||
for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared.get().IMP.getPluginIds()) {
|
||||
for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared
|
||||
.get().IMP.getPluginIds()) {
|
||||
Map.Entry<String, String> nameVersion = pluginInfo.getKey();
|
||||
String name = nameVersion.getKey();
|
||||
String version = nameVersion.getValue();
|
||||
@ -67,12 +66,17 @@ public class DebugPaste extends SubCommand {
|
||||
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
|
||||
b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n');
|
||||
b.append("Uptime: ").append(
|
||||
TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes")
|
||||
.append('\n');
|
||||
b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n');
|
||||
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n');
|
||||
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n');
|
||||
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB")
|
||||
.append('\n');
|
||||
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB")
|
||||
.append('\n');
|
||||
b.append("Java Name: ").append(rb.getVmName()).append('\n');
|
||||
b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n");
|
||||
b.append("Java Version: '").append(System.getProperty("java.version"))
|
||||
.append("'\n");
|
||||
b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n");
|
||||
b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n");
|
||||
b.append("OS Version: ").append(System.getProperty("os.version")).append('\n');
|
||||
@ -119,12 +123,13 @@ public class DebugPaste extends SubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
final File MultiverseWorlds =
|
||||
new File(PlotSquared.get().IMP.getDirectory(), "../Multiverse-Core/worlds.yml");
|
||||
incendoPaster
|
||||
.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", readFile(MultiverseWorlds)));
|
||||
final File MultiverseWorlds = new File(PlotSquared.get().IMP.getDirectory(),
|
||||
"../Multiverse-Core/worlds.yml");
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml",
|
||||
readFile(MultiverseWorlds)));
|
||||
} catch (final IOException ignored) {
|
||||
MainUtil.sendMessage(player, "&cSkipping Multiverse worlds.yml because the plugin is not in use");
|
||||
MainUtil.sendMessage(player,
|
||||
"&cSkipping Multiverse worlds.yml because the plugin is not in use");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -13,10 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@CommandDeclaration(command = "debugroadregen", usage = DebugRoadRegen.USAGE,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Regenerate roads in the plot or region the user is, based on the road schematic",
|
||||
category = CommandCategory.DEBUG, permission = "plots.debugroadregen")
|
||||
@CommandDeclaration(command = "debugroadregen", usage = DebugRoadRegen.USAGE, requiredType = RequiredType.NONE, description = "Regenerate roads in the plot or region the user is, based on the road schematic", category = CommandCategory.DEBUG, permission = "plots.debugroadregen")
|
||||
public class DebugRoadRegen extends SubCommand {
|
||||
public static final String USAGE = "/plot debugroadregen <plot|region [height]>";
|
||||
|
||||
@ -67,13 +64,11 @@ public class DebugRoadRegen extends SubCommand {
|
||||
height = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)");
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
DebugRoadRegen.USAGE);
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE);
|
||||
return false;
|
||||
}
|
||||
} else if (args.length != 0) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
DebugRoadRegen.USAGE);
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@CommandDeclaration(command = "debugsavetest", permission = "plots.debugsavetest",
|
||||
category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE,
|
||||
usage = "/plot debugsavetest",
|
||||
description = "This command will force the recreation of all plots in the DB")
|
||||
@CommandDeclaration(command = "debugsavetest", permission = "plots.debugsavetest", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE, usage = "/plot debugsavetest", description = "This command will force the recreation of all plots in the DB")
|
||||
public class DebugSaveTest extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
|
@ -15,10 +15,10 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
|
||||
@CommandDeclaration(command = "delete", permission = "plots.delete",
|
||||
description = "Delete the plot you stand on", usage = "/plot delete",
|
||||
aliases = {"dispose", "del", "unclaim"}, category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE, confirmation = true) public class Delete extends SubCommand {
|
||||
@CommandDeclaration(command = "delete", permission = "plots.delete", description = "Delete the plot you stand on", usage = "/plot delete", aliases = {
|
||||
"dispose", "del",
|
||||
"unclaim"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true)
|
||||
public class Delete extends SubCommand {
|
||||
|
||||
// Note: To delete a specific plot use /plot <plot> delete
|
||||
// The syntax also works with any command: /plot <plot> <command>
|
||||
|
@ -18,10 +18,9 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "deny", aliases = {"d", "ban"},
|
||||
description = "Deny a user from entering a plot", usage = "/plot deny <player|*>",
|
||||
category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Deny
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "deny", aliases = {"d",
|
||||
"ban"}, description = "Deny a user from entering a plot", usage = "/plot deny <player|*>", category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
|
||||
public class Deny extends SubCommand {
|
||||
|
||||
public Deny() {
|
||||
super(Argument.PlayerName);
|
||||
|
@ -7,10 +7,10 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "setdescription", permission = "plots.set.desc",
|
||||
description = "Set the plot description", usage = "/plot desc <description>",
|
||||
aliases = {"desc", "setdesc", "setd", "description"}, category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER) public class Desc extends SetCommand {
|
||||
@CommandDeclaration(command = "setdescription", permission = "plots.set.desc", description = "Set the plot description", usage = "/plot desc <description>", aliases = {
|
||||
"desc", "setdesc", "setd",
|
||||
"description"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
|
||||
public class Desc extends SetCommand {
|
||||
|
||||
@Override public boolean set(PlotPlayer player, Plot plot, String desc) {
|
||||
if (desc.isEmpty()) {
|
||||
|
@ -3,10 +3,8 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "dislike", permission = "plots.dislike",
|
||||
description = "Dislike the plot", usage = "/plot dislike [next|purge]",
|
||||
category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) public class Dislike
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "dislike", permission = "plots.dislike", description = "Dislike the plot", usage = "/plot dislike [next|purge]", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER)
|
||||
public class Dislike extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
return Like.handleLike(player, args, false);
|
||||
|
@ -14,9 +14,9 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
|
||||
|
||||
@CommandDeclaration(command = "done", aliases = {"submit"}, description = "Mark a plot as done",
|
||||
permission = "plots.done", category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE) public class Done extends SubCommand {
|
||||
@CommandDeclaration(command = "done", aliases = {
|
||||
"submit"}, description = "Mark a plot as done", permission = "plots.done", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE)
|
||||
public class Done extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location location = player.getLocation();
|
||||
|
@ -17,10 +17,9 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@CommandDeclaration(usage = "/plot download [schematic|world]", command = "download",
|
||||
aliases = {"dl"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE,
|
||||
description = "Download your plot", permission = "plots.download") public class Download
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(usage = "/plot download [schematic|world]", command = "download", aliases = {
|
||||
"dl"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Download your plot", permission = "plots.download")
|
||||
public class Download extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
String world = player.getLocation().getWorld();
|
||||
@ -35,8 +34,8 @@ import java.net.URL;
|
||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot)))
|
||||
&& !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
||||
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
||||
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
|
||||
return false;
|
||||
}
|
||||
|
@ -30,30 +30,29 @@ import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
@CommandDeclaration(command = "flag", aliases = {"f",
|
||||
"flag"}, usage = "/plot flag <set|remove|add|list|info> <flag> <value>",
|
||||
description = "Set plot flags",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.flag")
|
||||
"flag"}, usage = "/plot flag <set|remove|add|list|info> <flag> <value>", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag")
|
||||
public class FlagCmd extends SubCommand {
|
||||
|
||||
private boolean checkPermValue(PlotPlayer player, PlotFlag<?, ?> flag, String key, String value) {
|
||||
private boolean checkPermValue(PlotPlayer player, PlotFlag<?, ?> flag, String key,
|
||||
String value) {
|
||||
key = key.toLowerCase();
|
||||
value = value.toLowerCase();
|
||||
String perm = CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), value.toLowerCase());
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase());
|
||||
if (flag instanceof IntegerFlag && MathMan.isInteger(value)) {
|
||||
try {
|
||||
int numeric = Integer.parseInt(value);
|
||||
perm = perm.substring(0, perm.length() - value.length() - 1);
|
||||
if (numeric > 0) {
|
||||
int checkRange =
|
||||
PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ? numeric : Settings.Limit.MAX_PLOTS;
|
||||
int checkRange = PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ?
|
||||
numeric :
|
||||
Settings.Limit.MAX_PLOTS;
|
||||
final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric;
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase()));
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), value.toLowerCase()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -87,13 +86,13 @@ public class FlagCmd extends SubCommand {
|
||||
PlotFlag<? extends List<?>, ?> parsedFlag = listFlag.parse(value);
|
||||
for (final Object entry : parsedFlag.getValue()) {
|
||||
final String permission = CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
entry.toString().toLowerCase());
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), entry.toString().toLowerCase());
|
||||
final boolean result = Permissions.hasPermission(player, permission);
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase()));
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), value.toLowerCase()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -134,8 +133,10 @@ public class FlagCmd extends SubCommand {
|
||||
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER);
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) {
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER);
|
||||
return false;
|
||||
}
|
||||
PlotFlag flag = null;
|
||||
@ -145,7 +146,8 @@ public class FlagCmd extends SubCommand {
|
||||
boolean suggested = false;
|
||||
try {
|
||||
StringComparison<PlotFlag<?, ?>> stringComparison =
|
||||
new StringComparison<>(args[1], GlobalFlagContainer.getInstance().getFlagMap().values());
|
||||
new StringComparison<>(args[1],
|
||||
GlobalFlagContainer.getInstance().getFlagMap().values());
|
||||
String best = stringComparison.getBestMatch();
|
||||
if (best != null) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG_SUGGESTED, best);
|
||||
@ -164,11 +166,13 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
case "set": {
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG);
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (args.length < 3) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag set <flag> <value>");
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot flag set <flag> <value>");
|
||||
return false;
|
||||
}
|
||||
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||
@ -188,25 +192,30 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
case "remove": {
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_REMOVE)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_REMOVE);
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_FLAG_REMOVE);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot flag remove <flag> [values]");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[1].toLowerCase()))) {
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[1].toLowerCase()))) {
|
||||
if (args.length != 3) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[1].toLowerCase()));
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[1].toLowerCase()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (args.length == 3 && flag instanceof ListFlag) {
|
||||
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||
final ListFlag<?, ?> listFlag = (ListFlag<?, ?>) flag;
|
||||
final List<?> list = plot.getFlag((Class<? extends ListFlag<?, ?>>) listFlag.getClass());
|
||||
final List<?> list =
|
||||
plot.getFlag((Class<? extends ListFlag<?, ?>>) listFlag.getClass());
|
||||
final PlotFlag<? extends List<?>, ?> parsedFlag;
|
||||
try {
|
||||
parsedFlag = listFlag.parse(value);
|
||||
@ -250,11 +259,13 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
case "add":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_ADD)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD);
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD);
|
||||
return false;
|
||||
}
|
||||
if (args.length < 3) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot flag add <flag> <values>");
|
||||
return false;
|
||||
}
|
||||
for (String entry : args[2].split(",")) {
|
||||
@ -279,7 +290,8 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
case "list":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_LIST)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST);
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST);
|
||||
return false;
|
||||
}
|
||||
if (args.length > 1) {
|
||||
@ -287,20 +299,24 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final Map<String, ArrayList<String>> flags = new HashMap<>();
|
||||
for (PlotFlag<?, ?> plotFlag : GlobalFlagContainer.getInstance().getRecognizedPlotFlags()) {
|
||||
for (PlotFlag<?, ?> plotFlag : GlobalFlagContainer.getInstance()
|
||||
.getRecognizedPlotFlags()) {
|
||||
final String category = plotFlag.getFlagCategory().getTranslated();
|
||||
final Collection<String> flagList = flags.computeIfAbsent(category, k -> new ArrayList<>());
|
||||
final Collection<String> flagList =
|
||||
flags.computeIfAbsent(category, k -> new ArrayList<>());
|
||||
flagList.add(plotFlag.getName());
|
||||
}
|
||||
|
||||
final Iterator<Map.Entry<String, ArrayList<String>>> iterator = flags.entrySet().iterator();
|
||||
final Iterator<Map.Entry<String, ArrayList<String>>> iterator =
|
||||
flags.entrySet().iterator();
|
||||
final StringJoiner message = new StringJoiner("\n");
|
||||
while (iterator.hasNext()) {
|
||||
final Map.Entry<String, ArrayList<String>> flagsEntry = iterator.next();
|
||||
final List<String> flagNames = flagsEntry.getValue();
|
||||
Collections.sort(flagNames);
|
||||
message.add(String.format(Captions.FLAG_LIST_ENTRY.formatted(), flagsEntry.getKey(),
|
||||
StringMan.join(flagNames, ", ")));
|
||||
message.add(String
|
||||
.format(Captions.FLAG_LIST_ENTRY.formatted(), flagsEntry.getKey(),
|
||||
StringMan.join(flagNames, ", ")));
|
||||
}
|
||||
MainUtil.sendMessage(player, message.toString());
|
||||
return true;
|
||||
|
@ -157,8 +157,7 @@ import java.util.Map;
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||
new HelpMenu(player).setCategory(CommandCategory.SETTINGS).setCommands(this.getCommands())
|
||||
.generateMaxPages()
|
||||
.generatePage(0, getParent().toString()).render();
|
||||
.generateMaxPages().generatePage(0, getParent().toString()).render();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -229,8 +228,7 @@ import java.util.Map;
|
||||
.send(player, e.getFlag().getName(), e.getValue(), e.getErrorMessage());
|
||||
return;
|
||||
}
|
||||
boolean result = player.getLocation().getPlotAbs()
|
||||
.setFlag(flag.merge(parsed.getValue()));
|
||||
boolean result = player.getLocation().getPlotAbs().setFlag(flag.merge(parsed.getValue()));
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
|
||||
return;
|
||||
@ -247,18 +245,20 @@ import java.util.Map;
|
||||
return;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
||||
return;
|
||||
}
|
||||
final PlotFlag<?, ?> flag = getFlag(player, args[0]);
|
||||
if (flag == null) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[0].toLowerCase()))) {
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[0].toLowerCase()))) {
|
||||
if (args.length != 2) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[0].toLowerCase()));
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[0].toLowerCase()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -266,7 +266,8 @@ import java.util.Map;
|
||||
if (args.length == 2 && flag instanceof ListFlag) {
|
||||
String value = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " ");
|
||||
final ListFlag<?, ?> listFlag = (ListFlag<?, ?>) flag;
|
||||
final List<?> list = plot.getFlag((Class<? extends ListFlag<?, ?>>) listFlag.getClass());
|
||||
final List<?> list =
|
||||
plot.getFlag((Class<? extends ListFlag<?, ?>>) listFlag.getClass());
|
||||
final PlotFlag<? extends List<?>, ?> parsedFlag;
|
||||
try {
|
||||
parsedFlag = listFlag.parse(value);
|
||||
@ -325,20 +326,22 @@ import java.util.Map;
|
||||
final Map<String, ArrayList<String>> flags = new HashMap<>();
|
||||
for (PlotFlag<?, ?> plotFlag : GlobalFlagContainer.getInstance().getRecognizedPlotFlags()) {
|
||||
final String category = plotFlag.getFlagCategory().getTranslated();
|
||||
final Collection<String> flagList = flags.computeIfAbsent(category, k -> new ArrayList<>());
|
||||
final Collection<String> flagList =
|
||||
flags.computeIfAbsent(category, k -> new ArrayList<>());
|
||||
flagList.add(plotFlag.getName());
|
||||
}
|
||||
|
||||
for (final Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) {
|
||||
Collections.sort(entry.getValue());
|
||||
PlotMessage plotMessage = new PlotMessage(entry.getKey() + ": ").color(Captions.FLAG_INFO_COLOR_KEY.getTranslated());
|
||||
PlotMessage plotMessage = new PlotMessage(entry.getKey() + ": ")
|
||||
.color(Captions.FLAG_INFO_COLOR_KEY.getTranslated());
|
||||
final Iterator<String> flagIterator = entry.getValue().iterator();
|
||||
while (flagIterator.hasNext()) {
|
||||
final String flag = flagIterator.next();
|
||||
plotMessage = plotMessage.text(flag).command("/plot flag info " + flag)
|
||||
.color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated())
|
||||
.tooltip(new PlotMessage(Captions.FLAG_LIST_SEE_INFO.getTranslated())
|
||||
.color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()));
|
||||
.color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).tooltip(
|
||||
new PlotMessage(Captions.FLAG_LIST_SEE_INFO.getTranslated())
|
||||
.color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()));
|
||||
if (flagIterator.hasNext()) {
|
||||
plotMessage = plotMessage.text(", ")
|
||||
.color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated());
|
||||
|
@ -17,9 +17,8 @@ import com.google.common.primitives.Ints;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING,
|
||||
usage = "/plot grant <check|add> [player]", permission = "plots.grant",
|
||||
requiredType = RequiredType.NONE) public class Grant extends Command {
|
||||
@CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, usage = "/plot grant <check|add> [player]", permission = "plots.grant", requiredType = RequiredType.NONE)
|
||||
public class Grant extends Command {
|
||||
|
||||
public Grant() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
|
@ -14,8 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "help", description = "Get this help menu", aliases = "?",
|
||||
category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use")
|
||||
@CommandDeclaration(command = "help", description = "Get this help menu", aliases = "?", category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use")
|
||||
public class Help extends Command {
|
||||
public Help(Command parent) {
|
||||
super(parent, true);
|
||||
@ -56,7 +55,8 @@ public class Help extends Command {
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
|
||||
public CompletableFuture<Boolean> displayHelp(final CommandCaller player, final String catRaw, final int page) {
|
||||
public CompletableFuture<Boolean> displayHelp(final CommandCaller player, final String catRaw,
|
||||
final int page) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
String cat = catRaw;
|
||||
|
||||
@ -81,12 +81,11 @@ public class Help extends Command {
|
||||
for (CommandCategory c : CommandCategory.values()) {
|
||||
builder.append("\n").append(StringMan
|
||||
.replaceAll(Captions.HELP_INFO_ITEM.getTranslated(), "%category%",
|
||||
c.toString().toLowerCase(),
|
||||
"%category_desc%", c.toString()));
|
||||
c.toString().toLowerCase(), "%category_desc%", c.toString()));
|
||||
}
|
||||
builder.append("\n")
|
||||
.append(Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all")
|
||||
.replaceAll("%category_desc%", "Display all commands"));
|
||||
builder.append("\n").append(
|
||||
Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all")
|
||||
.replaceAll("%category_desc%", "Display all commands"));
|
||||
builder.append("\n").append(Captions.HELP_FOOTER.getTranslated());
|
||||
MainUtil.sendMessage(player, builder.toString(), false);
|
||||
return true;
|
||||
|
@ -13,8 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@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)
|
||||
@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)
|
||||
public class Inbox extends SubCommand {
|
||||
|
||||
public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
|
||||
@ -40,8 +39,7 @@ public class Inbox extends SubCommand {
|
||||
StringBuilder string = new StringBuilder();
|
||||
string.append(StringMan
|
||||
.replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.getTranslated(), "%amount%",
|
||||
comments.length, "%cur",
|
||||
page + 1, "%max", totalPages + 1, "%word", "all") + '\n');
|
||||
comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all") + '\n');
|
||||
|
||||
// This might work xD
|
||||
for (int x = page * 12; x < max; x++) {
|
||||
|
@ -15,8 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info",
|
||||
usage = "/plot info <id> [-f, to force info]", category = CommandCategory.INFO)
|
||||
@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info", usage = "/plot info <id> [-f, to force info]", category = CommandCategory.INFO)
|
||||
public class Info extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
|
@ -17,9 +17,8 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot",
|
||||
permission = "plots.kick", usage = "/plot kick <player|*>", category = CommandCategory.TELEPORT,
|
||||
requiredType = RequiredType.PLAYER) public class Kick extends SubCommand {
|
||||
@CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot", permission = "plots.kick", usage = "/plot kick <player|*>", category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER)
|
||||
public class Kick extends SubCommand {
|
||||
|
||||
public Kick() {
|
||||
super(Argument.PlayerName);
|
||||
|
@ -13,10 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "leave",
|
||||
description = "Removes self from being trusted or a member of the plot",
|
||||
permission = "plots.leave", usage = "/plot leave", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER) public class Leave extends Command {
|
||||
@CommandDeclaration(command = "leave", description = "Removes self from being trusted or a member of the plot", permission = "plots.leave", usage = "/plot leave", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER)
|
||||
public class Leave extends Command {
|
||||
public Leave() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
}
|
||||
|
@ -21,9 +21,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot",
|
||||
usage = "/plot like [next|purge]", category = CommandCategory.INFO,
|
||||
requiredType = RequiredType.PLAYER) public class Like extends SubCommand {
|
||||
@CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot", usage = "/plot like [next|purge]", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER)
|
||||
public class Like extends SubCommand {
|
||||
|
||||
protected static boolean handleLike(final PlotPlayer player, String[] args,
|
||||
final boolean like) {
|
||||
@ -41,8 +40,8 @@ import java.util.UUID;
|
||||
return v2 > v1 ? 1 : -1;
|
||||
});
|
||||
for (final Plot plot : plots) {
|
||||
if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot))
|
||||
&& plot.isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
|
||||
if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) && plot
|
||||
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
|
||||
plot.teleportPlayer(player, TeleportCause.COMMAND);
|
||||
MainUtil.sendMessage(player, Captions.RATE_THIS);
|
||||
return true;
|
||||
|
@ -28,9 +28,8 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "list", aliases = {"l", "find", "search"}, description = "List plots",
|
||||
permission = "plots.list", category = CommandCategory.INFO,
|
||||
usage = "/plot list <forsale|mine|shared|world|top|all|unowned|unknown|player|world|done|fuzzy <search...>> [#]")
|
||||
@CommandDeclaration(command = "list", aliases = {"l", "find",
|
||||
"search"}, description = "List plots", permission = "plots.list", category = CommandCategory.INFO, usage = "/plot list <forsale|mine|shared|world|top|all|unowned|unknown|player|world|done|fuzzy <search...>> [#]")
|
||||
public class ListCmd extends SubCommand {
|
||||
|
||||
private String[] getArgumentList(PlotPlayer player) {
|
||||
@ -137,11 +136,10 @@ public class ListCmd extends SubCommand {
|
||||
Captions.PERMISSION_LIST_WORLD);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
||||
@ -162,11 +160,10 @@ public class ListCmd extends SubCommand {
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
return false;
|
||||
}
|
||||
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
|
||||
@ -308,9 +305,8 @@ public class ListCmd extends SubCommand {
|
||||
Captions.PERMISSION_LIST_WORLD);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) {
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]));
|
||||
return false;
|
||||
|
@ -19,9 +19,8 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
@CommandDeclaration(command = "load", aliases = "restore", category = CommandCategory.SCHEMATIC,
|
||||
requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load",
|
||||
usage = "/plot load") public class Load extends SubCommand {
|
||||
@CommandDeclaration(command = "load", aliases = "restore", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load", usage = "/plot load")
|
||||
public class Load extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
String world = player.getLocation().getWorld();
|
||||
|
@ -23,9 +23,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
/**
|
||||
* PlotSquared command class.
|
||||
*/
|
||||
@CommandDeclaration(command = "plot",
|
||||
aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"})
|
||||
public class MainCommand extends Command {
|
||||
@CommandDeclaration(command = "plot", aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps",
|
||||
"2", "plotme", "plotz", "ap"}) public class MainCommand extends Command {
|
||||
|
||||
private static MainCommand instance;
|
||||
public Help help;
|
||||
@ -208,7 +207,8 @@ public class MainCommand extends Command {
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
Plot newPlot = Plot.fromString(area, args[0]);
|
||||
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)
|
||||
|| Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_SUDO_AREA))
|
||||
&& !newPlot.isDenied(player.getUUID())) {
|
||||
Location newLoc = newPlot.getCenter();
|
||||
if (player.canTeleport(newLoc)) {
|
||||
|
@ -20,10 +20,7 @@ import java.util.UUID;
|
||||
|
||||
import static com.github.intellectualsites.plotsquared.plot.object.Direction.getFromIndex;
|
||||
|
||||
@CommandDeclaration(command = "merge", aliases = "m",
|
||||
description = "Merge the plot you are standing on with another plot",
|
||||
permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
||||
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true)
|
||||
@CommandDeclaration(command = "merge", aliases = "m", description = "Merge the plot you are standing on with another plot", permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true)
|
||||
public class Merge extends SubCommand {
|
||||
|
||||
public static final String[] values = new String[] {"north", "east", "south", "west", "auto"};
|
||||
@ -160,8 +157,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
Plot adjacent = plot.getRelative(direction);
|
||||
if (adjacent == null || !adjacent.hasOwner() || adjacent
|
||||
.getMerged((direction.getIndex() + 2) % 4)
|
||||
|| adjacent.isOwner(uuid)) {
|
||||
.getMerged((direction.getIndex() + 2) % 4) || adjacent.isOwner(uuid)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
|
||||
return false;
|
||||
}
|
||||
|
@ -10,10 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
/**
|
||||
* @author manuelgu, altered by Citymonstret
|
||||
*/
|
||||
@CommandDeclaration(command = "middle", aliases = {"center", "centre"},
|
||||
description = "Teleports you to the center of the plot", usage = "/plot middle",
|
||||
category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) public class Middle
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "middle", aliases = {"center",
|
||||
"centre"}, description = "Teleports you to the center of the plot", usage = "/plot middle", category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER)
|
||||
public class Middle extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] arguments) {
|
||||
Location location = player.getLocation();
|
||||
|
@ -10,9 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
|
||||
@CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot",
|
||||
permission = "plots.move", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER) public class Move extends SubCommand {
|
||||
@CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot", permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER)
|
||||
public class Move extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
Location location = player.getLocation();
|
||||
|
@ -13,10 +13,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
@CommandDeclaration(command = "music", permission = "plots.music",
|
||||
description = "Play music in your plot", usage = "/plot music",
|
||||
category = CommandCategory.APPEARANCE, requiredType = RequiredType.PLAYER) public class Music
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "music", permission = "plots.music", description = "Play music in your plot", usage = "/plot music", category = CommandCategory.APPEARANCE, requiredType = RequiredType.PLAYER)
|
||||
public class Music extends SubCommand {
|
||||
|
||||
private static final Collection<String> DISCS = Arrays
|
||||
.asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp",
|
||||
|
@ -11,8 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players",
|
||||
usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER)
|
||||
@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER)
|
||||
public class Near extends Command {
|
||||
public Near() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
|
@ -14,10 +14,10 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "setowner", permission = "plots.set.owner",
|
||||
description = "Set the plot owner", usage = "/plot setowner <player>",
|
||||
aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand {
|
||||
@CommandDeclaration(command = "setowner", permission = "plots.set.owner", description = "Set the plot owner", usage = "/plot setowner <player>", aliases = {
|
||||
"owner", "so",
|
||||
"seto"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true)
|
||||
public class Owner extends SetCommand {
|
||||
|
||||
@Override public boolean set(final PlotPlayer player, final Plot plot, String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
|
@ -8,9 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.util.HttpUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
@CommandDeclaration(command = "plugin", permission = "plots.use",
|
||||
description = "Show plugin information", usage = "/plot plugin", aliases = "version",
|
||||
category = CommandCategory.INFO) public class PluginCmd extends SubCommand {
|
||||
@CommandDeclaration(command = "plugin", permission = "plots.use", description = "Show plugin information", usage = "/plot plugin", aliases = "version", category = CommandCategory.INFO)
|
||||
public class PluginCmd extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
TaskManager.IMP.taskAsync(new Runnable() {
|
||||
|
@ -18,11 +18,8 @@ import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(
|
||||
usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false]",
|
||||
command = "purge", permission = "plots.admin", description = "Purge all plots for a world",
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE,
|
||||
confirmation = true) public class Purge extends SubCommand {
|
||||
@CommandDeclaration(usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false]", command = "purge", permission = "plots.admin", description = "Purge all plots for a world", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, confirmation = true)
|
||||
public class Purge extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
if (args.length == 0) {
|
||||
|
@ -24,9 +24,8 @@ import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot",
|
||||
usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO,
|
||||
requiredType = RequiredType.PLAYER) public class Rate extends SubCommand {
|
||||
@CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER)
|
||||
public class Rate extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
if (args.length == 1) {
|
||||
|
@ -10,11 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "regenallroads",
|
||||
description = "Regenerate all roads in the map using the set road schematic",
|
||||
aliases = {"rgar"}, usage = "/plot regenallroads <world> [height]",
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE,
|
||||
permission = "plots.regenallroads") public class RegenAllRoads extends SubCommand {
|
||||
@CommandDeclaration(command = "regenallroads", description = "Regenerate all roads in the map using the set road schematic", aliases = {
|
||||
"rgar"}, usage = "/plot regenallroads <world> [height]", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, permission = "plots.regenallroads")
|
||||
public class RegenAllRoads extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
int height = 0;
|
||||
|
@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight",
|
||||
category = CommandCategory.DEBUG, requiredType = RequiredType.PLAYER) public class Relight extends Command {
|
||||
@CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", category = CommandCategory.DEBUG, requiredType = RequiredType.PLAYER)
|
||||
public class Relight extends Command {
|
||||
public Relight() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
}
|
||||
|
@ -12,9 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@CommandDeclaration(command = "reload", aliases = "rl", permission = "plots.admin.command.reload",
|
||||
description = "Reload translations and world settings", usage = "/plot reload",
|
||||
category = CommandCategory.ADMINISTRATION) public class Reload extends SubCommand {
|
||||
@CommandDeclaration(command = "reload", aliases = "rl", permission = "plots.admin.command.reload", description = "Reload translations and world settings", usage = "/plot reload", category = CommandCategory.ADMINISTRATION)
|
||||
public class Reload extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
try {
|
||||
|
@ -17,10 +17,9 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"},
|
||||
description = "Remove a player from a plot", usage = "/plot remove <player|*>",
|
||||
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE,
|
||||
permission = "plots.remove") public class Remove extends SubCommand {
|
||||
@CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban",
|
||||
"ud"}, description = "Remove a player from a plot", usage = "/plot remove <player|*>", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.remove")
|
||||
public class Remove extends SubCommand {
|
||||
|
||||
public Remove() {
|
||||
super(Argument.PlayerName);
|
||||
|
@ -18,9 +18,9 @@ import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "save", aliases = {"backup"}, description = "Save your plot",
|
||||
category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE,
|
||||
permission = "plots.save") public class Save extends SubCommand {
|
||||
@CommandDeclaration(command = "save", aliases = {
|
||||
"backup"}, description = "Save your plot", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, permission = "plots.save")
|
||||
public class Save extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
String world = player.getLocation().getWorld();
|
||||
|
@ -23,9 +23,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "schematic", permission = "plots.schematic",
|
||||
description = "Schematic command", aliases = {"sch", "schem"},
|
||||
category = CommandCategory.SCHEMATIC, usage = "/plot schematic <save|saveall|paste>")
|
||||
@CommandDeclaration(command = "schematic", permission = "plots.schematic", description = "Schematic command", aliases = {
|
||||
"sch",
|
||||
"schem"}, category = CommandCategory.SCHEMATIC, usage = "/plot schematic <save|saveall|paste>")
|
||||
public class SchematicCmd extends SubCommand {
|
||||
|
||||
private boolean running = false;
|
||||
@ -136,7 +136,8 @@ public class SchematicCmd extends SubCommand {
|
||||
return false;
|
||||
} else {
|
||||
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED);
|
||||
MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots...");
|
||||
MainUtil.sendMessage(player,
|
||||
"&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots...");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -22,10 +22,9 @@ import java.util.HashSet;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@CommandDeclaration(command = "set", description = "Set a plot value", aliases = {"s"},
|
||||
usage = "/plot set <biome|alias|home|flag> <value...>", permission = "plots.set",
|
||||
category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE) public class Set
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "set", description = "Set a plot value", aliases = {
|
||||
"s"}, usage = "/plot set <biome|alias|home|flag> <value...>", permission = "plots.set", category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE)
|
||||
public class Set extends SubCommand {
|
||||
|
||||
public static final String[] values = new String[] {"biome", "alias", "home", "flag"};
|
||||
public static final String[] aliases = new String[] {"b", "w", "wf", "f", "a", "h", "fl"};
|
||||
@ -51,7 +50,8 @@ import java.util.stream.IntStream;
|
||||
for (String component : components) {
|
||||
if (component.equalsIgnoreCase(args[0])) {
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component))) {
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(),
|
||||
component))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(),
|
||||
component));
|
||||
@ -86,12 +86,11 @@ import java.util.stream.IntStream;
|
||||
new ArrayList<>(Arrays.asList("biome", "alias", "home", "flag"));
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot != null) {
|
||||
newValues.addAll(
|
||||
Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
|
||||
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
|
||||
}
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan
|
||||
.join(newValues, Captions.BLOCK_LIST_SEPARATOR.formatted()));
|
||||
MainUtil.sendMessage(player,
|
||||
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan
|
||||
.join(newValues, Captions.BLOCK_LIST_SEPARATOR.formatted()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -114,8 +113,8 @@ import java.util.stream.IntStream;
|
||||
return false;
|
||||
}
|
||||
// components
|
||||
HashSet<String> components = new HashSet<>(
|
||||
Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
|
||||
HashSet<String> components =
|
||||
new HashSet<>(Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
|
||||
if (components.contains(args[0].toLowerCase())) {
|
||||
return this.component.onCommand(player, Arrays.copyOfRange(args, 0, args.length));
|
||||
}
|
||||
|
@ -18,21 +18,19 @@ public abstract class SetCommand extends SubCommand {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions
|
||||
.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player,
|
||||
CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -8,9 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "sethome", permission = "plots.set.home",
|
||||
description = "Set the plot home to your current position", usage = "/plot sethome [none]",
|
||||
aliases = {"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
|
||||
@CommandDeclaration(command = "sethome", permission = "plots.set.home", description = "Set the plot home to your current position", usage = "/plot sethome [none]", aliases = {
|
||||
"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER)
|
||||
public class SetHome extends SetCommand {
|
||||
|
||||
@Override public boolean set(PlotPlayer player, Plot plot, String value) {
|
||||
|
@ -34,9 +34,14 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "setup", permission = "plots.admin.command.setup",
|
||||
description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = {"create"},
|
||||
category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand {
|
||||
@CommandDeclaration(command = "setup", permission = "plots.admin.command.setup", description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = {
|
||||
"create"}, category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand {
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
public void displayGenerators(PlotPlayer player) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
@ -336,11 +341,7 @@ import java.util.UUID;
|
||||
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 {
|
||||
|
||||
@Getter private String generator;
|
||||
@ -414,7 +415,7 @@ import java.util.UUID;
|
||||
}
|
||||
|
||||
@Override public boolean parseInput(String input) {
|
||||
if (!WORLD_TYPES.keySet().contains(input.toLowerCase())) {
|
||||
if (!WORLD_TYPES.containsKey(input.toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
this.worldType = input.toLowerCase();
|
||||
|
@ -8,8 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
|
||||
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots",
|
||||
aliases = {"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER)
|
||||
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots", aliases = {
|
||||
"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER)
|
||||
public class Swap extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
|
@ -10,10 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
@CommandDeclaration(command = "target", usage = "/plot target <<plot>|nearest>",
|
||||
description = "Target a plot with your compass", permission = "plots.target",
|
||||
requiredType = RequiredType.PLAYER, category = CommandCategory.INFO) public class Target
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "target", usage = "/plot target <<plot>|nearest>", description = "Target a plot with your compass", permission = "plots.target", requiredType = RequiredType.PLAYER, category = CommandCategory.INFO)
|
||||
public class Target extends SubCommand {
|
||||
|
||||
public Target() {
|
||||
super(Argument.PlotID);
|
||||
|
@ -29,10 +29,8 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@CommandDeclaration(command = "template", permission = "plots.admin",
|
||||
description = "Create or use a world template",
|
||||
usage = "/plot template [import|export] <world> <template>",
|
||||
category = CommandCategory.ADMINISTRATION) public class Template extends SubCommand {
|
||||
@CommandDeclaration(command = "template", permission = "plots.admin", description = "Create or use a world template", usage = "/plot template [import|export] <world> <template>", category = CommandCategory.ADMINISTRATION)
|
||||
public class Template extends SubCommand {
|
||||
|
||||
public static boolean extractAllFiles(String world, String template) {
|
||||
try {
|
||||
|
@ -8,16 +8,15 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use",
|
||||
usage = "/plot toggle <chat|chatspy|clear-confirmation|time|titles|worldedit>",
|
||||
description = "Toggle per user settings", requiredType = RequiredType.NONE,
|
||||
category = CommandCategory.SETTINGS) public class Toggle extends Command {
|
||||
@CommandDeclaration(command = "toggle", aliases = {
|
||||
"attribute"}, permission = "plots.use", usage = "/plot toggle <chat|chatspy|clear-confirmation|time|titles|worldedit>", description = "Toggle per user settings", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS)
|
||||
public class Toggle extends Command {
|
||||
public Toggle() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "chatspy", aliases = {"spy"},
|
||||
permission = "plots.admin.command.chat", description = "Toggle plot chat spy")
|
||||
@CommandDeclaration(command = "chatspy", aliases = {
|
||||
"spy"}, permission = "plots.admin.command.chat", description = "Toggle plot chat spy")
|
||||
public void chatspy(Command command, PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -28,8 +27,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "worldedit", aliases = {"we", "wea"},
|
||||
permission = "plots.worldedit.bypass", description = "Toggle worldedit area restrictions")
|
||||
@CommandDeclaration(command = "worldedit", aliases = {"we",
|
||||
"wea"}, permission = "plots.worldedit.bypass", description = "Toggle worldedit area restrictions")
|
||||
public void worldedit(Command command, PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -40,8 +39,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "chat", permission = "plots.toggle.chat",
|
||||
description = "Toggle plot chat")
|
||||
@CommandDeclaration(command = "chat", permission = "plots.toggle.chat", description = "Toggle plot chat")
|
||||
public void chat(Command command, PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -52,8 +50,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "clear-confirmation",
|
||||
permission = "plots.admin.command.autoclear", description = "Toggle autoclear confirmation")
|
||||
@CommandDeclaration(command = "clear-confirmation", permission = "plots.admin.command.autoclear", description = "Toggle autoclear confirmation")
|
||||
public void clearConfirmation(Command command, PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -64,8 +61,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "titles", permission = "plots.toggle.titles",
|
||||
description = "Toggle plot title messages")
|
||||
@CommandDeclaration(command = "titles", permission = "plots.toggle.titles", description = "Toggle plot title messages")
|
||||
public void titles(Command command, PlotPlayer player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -76,8 +72,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "time", permission = "plots.toggle.time",
|
||||
description = "Toggle plot time settings")
|
||||
@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) {
|
||||
|
@ -30,10 +30,8 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "trim", permission = "plots.admin",
|
||||
description = "Delete unmodified portions of your plotworld",
|
||||
usage = "/plot trim <world> [regenerate]", requiredType = RequiredType.CONSOLE,
|
||||
category = CommandCategory.ADMINISTRATION) public class Trim extends SubCommand {
|
||||
@CommandDeclaration(command = "trim", permission = "plots.admin", description = "Delete unmodified portions of your plotworld", usage = "/plot trim <world> [regenerate]", requiredType = RequiredType.CONSOLE, category = CommandCategory.ADMINISTRATION)
|
||||
public class Trim extends SubCommand {
|
||||
|
||||
public static ArrayList<Plot> expired = null;
|
||||
private static volatile boolean TASK = false;
|
||||
@ -177,18 +175,20 @@ import java.util.Set;
|
||||
}
|
||||
int bx = cbx << 4;
|
||||
int bz = cbz << 4;
|
||||
CuboidRegion region = RegionUtil.createRegion(bx, bx + 511, bz, bz + 511);
|
||||
CuboidRegion region =
|
||||
RegionUtil.createRegion(bx, bx + 511, bz, bz + 511);
|
||||
for (Plot plot : PlotSquared.get().getPlots(world)) {
|
||||
Location bot = plot.getBottomAbs();
|
||||
Location top = plot.getExtendedTopAbs();
|
||||
CuboidRegion plotReg =
|
||||
RegionUtil.createRegion(bot.getX(), top.getX(), bot.getZ(),
|
||||
top.getZ());
|
||||
CuboidRegion plotReg = RegionUtil
|
||||
.createRegion(bot.getX(), top.getX(), bot.getZ(), top.getZ());
|
||||
if (!RegionUtil.intersects(region, plotReg)) {
|
||||
continue;
|
||||
}
|
||||
for (int x = plotReg.getMinimumPoint().getX() >> 4; x <= plotReg.getMaximumPoint().getX() >> 4; x++) {
|
||||
for (int z = plotReg.getMinimumPoint().getZ() >> 4; z <= plotReg.getMaximumPoint().getZ() >> 4; z++) {
|
||||
for (int x = plotReg.getMinimumPoint().getX() >> 4;
|
||||
x <= plotReg.getMaximumPoint().getX() >> 4; x++) {
|
||||
for (int z = plotReg.getMinimumPoint().getZ() >> 4;
|
||||
z <= plotReg.getMaximumPoint().getZ() >> 4; z++) {
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
chunks.remove(loc);
|
||||
}
|
||||
|
@ -17,10 +17,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.PLAYER,
|
||||
usage = "/plot trust <player|*>",
|
||||
description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.",
|
||||
category = CommandCategory.SETTINGS) public class Trust extends Command {
|
||||
@CommandDeclaration(command = "trust", aliases = {
|
||||
"t"}, requiredType = RequiredType.PLAYER, usage = "/plot trust <player|*>", description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.", category = CommandCategory.SETTINGS)
|
||||
public class Trust extends Command {
|
||||
|
||||
public Trust() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
|
@ -11,9 +11,8 @@ 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"},
|
||||
description = "Unlink a mega-plot", usage = "/plot unlink [createroads]",
|
||||
requiredType = RequiredType.PLAYER, category = CommandCategory.SETTINGS, confirmation = true)
|
||||
@CommandDeclaration(command = "unlink", aliases = {"u",
|
||||
"unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", requiredType = RequiredType.PLAYER, category = CommandCategory.SETTINGS, confirmation = true)
|
||||
public class Unlink extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
|
@ -24,10 +24,10 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "visit", permission = "plots.visit",
|
||||
description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]",
|
||||
aliases = {"v", "tp", "teleport", "goto", "home", "h", "warp"}, requiredType = RequiredType.PLAYER,
|
||||
category = CommandCategory.TELEPORT) public class Visit extends Command {
|
||||
@CommandDeclaration(command = "visit", permission = "plots.visit", description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]", aliases = {
|
||||
"v", "tp", "teleport", "goto", "home", "h",
|
||||
"warp"}, requiredType = RequiredType.PLAYER, category = CommandCategory.TELEPORT)
|
||||
public class Visit extends Command {
|
||||
|
||||
public Visit() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
@ -139,8 +139,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
} else {
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER) &&
|
||||
!plot.getFlag(UntrustedVisitFlag.class)) {
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OTHER) && !plot
|
||||
.getFlag(UntrustedVisitFlag.class)) {
|
||||
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
@ -3,11 +3,9 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass",
|
||||
description = "Force bypass of WorldEdit restrictions", aliases = {"wea"}, usage = "/plot weanywhere",
|
||||
requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION)
|
||||
@Deprecated
|
||||
public class WE_Anywhere extends SubCommand {
|
||||
@CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass", description = "Force bypass of WorldEdit restrictions", aliases = {
|
||||
"wea"}, usage = "/plot weanywhere", requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION)
|
||||
@Deprecated public class WE_Anywhere extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] arguments) {
|
||||
MainCommand.getInstance().toggle.worldedit(this, player, new String[0], null, null);
|
||||
|
@ -19,8 +19,7 @@ public class Settings extends Config {
|
||||
public static String ISSUES = "https://github.com/IntellectualSites/PlotSquared/issues";
|
||||
@Final public static String SUGGESTION =
|
||||
"https://github.com/IntellectualSites/PlotSquaredSuggestions";
|
||||
@Final public static String WIKI =
|
||||
"https://github.com/IntellectualSites/PlotSquared/wiki";
|
||||
@Final public static String WIKI = "https://github.com/IntellectualSites/PlotSquared/wiki";
|
||||
@Final public static String DATE; // These values are set from P2 before loading
|
||||
@Final public static String BUILD; // These values are set from P2 before loading
|
||||
@Final public static String COMMIT; // These values are set from P2 before loading
|
||||
@ -28,8 +27,9 @@ public class Settings extends Config {
|
||||
|
||||
@Comment("Show additional information in console") public static boolean DEBUG = false;
|
||||
@Comment({"The big annoying text that appears when you enter a plot",
|
||||
"For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`", "For all plots: Add `titles: false` in the worlds.yml flags block"})
|
||||
public static boolean TITLES = true;
|
||||
"For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`",
|
||||
"For all plots: Add `titles: false` in the worlds.yml flags block"}) public static boolean
|
||||
TITLES = true;
|
||||
|
||||
@Create // This value will be generated automatically
|
||||
public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null;
|
||||
@ -229,8 +229,7 @@ public class Settings extends Config {
|
||||
|
||||
|
||||
@Comment("Schematic Settings") public static final class Schematics {
|
||||
@Comment(
|
||||
"Whether schematic based generation should paste schematic on top of plots, or from Y=1")
|
||||
@Comment("Whether schematic based generation should paste schematic on top of plots, or from Y=1")
|
||||
public static boolean PASTE_ON_TOP = true;
|
||||
}
|
||||
|
||||
@ -256,11 +255,12 @@ public class Settings extends Config {
|
||||
|
||||
|
||||
public static final class Done {
|
||||
@Comment("Require a plot marked as done to download") public static boolean REQUIRED_FOR_DOWNLOAD =
|
||||
false;
|
||||
@Comment("Only plots marked as done can be rated") public static boolean REQUIRED_FOR_RATINGS = false;
|
||||
@Comment("Restrict building when a plot is marked as done") public static boolean RESTRICT_BUILDING =
|
||||
false;
|
||||
@Comment("Require a plot marked as done to download") public static boolean
|
||||
REQUIRED_FOR_DOWNLOAD = false;
|
||||
@Comment("Only plots marked as done can be rated") public static boolean
|
||||
REQUIRED_FOR_RATINGS = false;
|
||||
@Comment("Restrict building when a plot is marked as done") public static boolean
|
||||
RESTRICT_BUILDING = false;
|
||||
@Comment("The limit being how many plots a player can claim") public static boolean
|
||||
COUNTS_TOWARDS_LIMIT = true;
|
||||
}
|
||||
@ -276,9 +276,10 @@ public class Settings extends Config {
|
||||
@Comment("Relating to how many plots someone can claim ") public static final class Limit {
|
||||
@Comment("Should the limit be global (over multiple worlds)") public static boolean GLOBAL =
|
||||
false;
|
||||
@Comment({"The max. range of permissions to check e.g. plots.plot.127", "The value covers the range to check only, you need to assign the permission to players/groups still",
|
||||
"Modifying the value does NOT change the amount of plots players can claim"}) public static int
|
||||
MAX_PLOTS = 127;
|
||||
@Comment({"The max. range of permissions to check e.g. plots.plot.127",
|
||||
"The value covers the range to check only, you need to assign the permission to players/groups still",
|
||||
"Modifying the value does NOT change the amount of plots players can claim"})
|
||||
public static int MAX_PLOTS = 127;
|
||||
}
|
||||
|
||||
|
||||
@ -292,7 +293,9 @@ public class Settings extends Config {
|
||||
@Comment("Teleport to your plot on death") public static boolean ON_DEATH = false;
|
||||
@Comment("Teleport to your plot on login") public static boolean ON_LOGIN = false;
|
||||
@Comment("Teleport to your plot on claim") public static boolean ON_CLAIM = true;
|
||||
@Comment({"Add a delay to all teleport commands", "Assign `plots.teleport.delay.bypass` to bypass the cooldown."}) public static int DELAY = 0;
|
||||
@Comment({"Add a delay to all teleport commands",
|
||||
"Assign `plots.teleport.delay.bypass` to bypass the cooldown."}) public static int
|
||||
DELAY = 0;
|
||||
@Comment("The visit command is ordered by world instead of globally") public static boolean
|
||||
PER_WORLD_VISIT = false;
|
||||
}
|
||||
@ -303,8 +306,7 @@ public class Settings extends Config {
|
||||
false;
|
||||
@Comment("Disable redstone when all owners/trusted/members are offline")
|
||||
public static boolean DISABLE_OFFLINE = false;
|
||||
@Comment(
|
||||
"Detect and cancel invalid pistons on the edge of plots (e.g. placed with WorldEdit)")
|
||||
@Comment("Detect and cancel invalid pistons on the edge of plots (e.g. placed with WorldEdit)")
|
||||
public static boolean DETECT_INVALID_EDGE_PISTONS = false;
|
||||
}
|
||||
|
||||
@ -322,8 +324,8 @@ public class Settings extends Config {
|
||||
}
|
||||
|
||||
|
||||
@Comment(
|
||||
{"Enable or disable parts of the plugin", "Note: A cache will use some memory if enabled"})
|
||||
@Comment({"Enable or disable parts of the plugin",
|
||||
"Note: A cache will use some memory if enabled"})
|
||||
public static final class Enabled_Components { // Group the following values into a new config section
|
||||
@Comment("The database stores all the plots") public static boolean DATABASE = true;
|
||||
@Comment("Events are needed to track a lot of things") public static boolean EVENTS = true;
|
||||
@ -331,7 +333,8 @@ public class Settings extends Config {
|
||||
true;
|
||||
@Comment("The UUID cacher is used to resolve player names") public static boolean
|
||||
UUID_CACHE = true;
|
||||
@Comment("The plugin auto updater will notify you if updates are available.") public static boolean UPDATER = true;
|
||||
@Comment("The plugin auto updater will notify you if updates are available.")
|
||||
public static boolean UPDATER = true;
|
||||
@Comment("Stores user metadata in a database") public static boolean PERSISTENT_META = true;
|
||||
@Comment("Optimizes permission checks") public static boolean PERMISSION_CACHE = true;
|
||||
@Comment("Optimizes block changing code") public static boolean BLOCK_CACHE = true;
|
||||
@ -340,8 +343,7 @@ public class Settings extends Config {
|
||||
@Comment("Allow WorldEdit to be restricted to plots") public static boolean
|
||||
WORLDEDIT_RESTRICTIONS = true;
|
||||
@Comment("Allow economy to be used") public static boolean ECONOMY = true;
|
||||
@Comment("@deprecated - use bstats config.yml") public static boolean
|
||||
METRICS = true;
|
||||
@Comment("@deprecated - use bstats config.yml") public static boolean METRICS = true;
|
||||
@Comment("Expiry will clear old or simplistic plots") public static boolean PLOT_EXPIRY =
|
||||
false;
|
||||
@Comment("Processes chunks (trimming, or entity/tile limits) ") public static boolean
|
||||
@ -356,7 +358,8 @@ public class Settings extends Config {
|
||||
@Comment("Actively purge invalid database entries") public static boolean DATABASE_PURGER =
|
||||
false;
|
||||
@Comment("Delete plots when a player is banned") public static boolean BAN_DELETER = false;
|
||||
@Comment({"Prevent possibly unsafe blocks from being used in plot components", "Can be bypassed with `/plot debugallowunsafe`"})
|
||||
public static boolean PREVENT_UNSAFE = true;
|
||||
@Comment({"Prevent possibly unsafe blocks from being used in plot components",
|
||||
"Can be bypassed with `/plot debugallowunsafe`"}) public static boolean PREVENT_UNSAFE =
|
||||
true;
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public interface AbstractDB {
|
||||
|
||||
/**
|
||||
* @param cluster PlotCluster Object
|
||||
* @param uuid Player that should be removed
|
||||
* @param uuid Player that should be removed
|
||||
*/
|
||||
void setHelper(PlotCluster cluster, UUID uuid);
|
||||
|
||||
@ -283,7 +283,7 @@ public interface AbstractDB {
|
||||
/**
|
||||
* Removes the specified comment from the given plot.
|
||||
*
|
||||
* @param plot the plot
|
||||
* @param plot the plot
|
||||
* @param comment the comment to remove
|
||||
*/
|
||||
void removeComment(Plot plot, PlotComment comment);
|
||||
@ -291,7 +291,7 @@ public interface AbstractDB {
|
||||
/**
|
||||
* Clears the specified inbox on the given plot.
|
||||
*
|
||||
* @param plot the plot
|
||||
* @param plot the plot
|
||||
* @param inbox the inbox to clear
|
||||
*/
|
||||
void clearInbox(Plot plot, String inbox);
|
||||
@ -299,7 +299,7 @@ public interface AbstractDB {
|
||||
/**
|
||||
* Adds the specified comment to the given plot.
|
||||
*
|
||||
* @param plot the plot
|
||||
* @param plot the plot
|
||||
* @param comment the comment to add
|
||||
*/
|
||||
void setComment(Plot plot, PlotComment comment);
|
||||
|
@ -84,6 +84,7 @@ public class DBFunc {
|
||||
|
||||
|
||||
//TODO Consider Removal
|
||||
|
||||
/**
|
||||
* Check if a {@link ResultSet} contains a column.
|
||||
*
|
||||
|
@ -23,7 +23,8 @@ public class BlockStateListFlag extends ListFlag<Set<BlockType>> {
|
||||
}
|
||||
|
||||
@Override public Set<BlockType> parseValue(final String value) {
|
||||
return Arrays.stream(BlockUtil.parse(value)).filter(Objects::nonNull).map(BlockState::getBlockType).collect(Collectors.toSet());
|
||||
return Arrays.stream(BlockUtil.parse(value)).filter(Objects::nonNull)
|
||||
.map(BlockState::getBlockType).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override public String getValueDescription() {
|
||||
|
@ -68,8 +68,8 @@ public abstract class Flag<V> implements StringComparison.StringComparable {
|
||||
|
||||
public String getCategoryCaption() {
|
||||
return this.typeCaption == null ?
|
||||
getClass().getSimpleName() :
|
||||
this.typeCaption.getTranslated();
|
||||
getClass().getSimpleName() :
|
||||
this.typeCaption.getTranslated();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ import java.util.Map;
|
||||
this(parentContainer, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public static <V, T extends PlotFlag<V, ?>> T castUnsafe(final PlotFlag<?, ?> flag) {
|
||||
return (T) flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the parent container (if the container has a parent)
|
||||
*
|
||||
@ -131,8 +136,8 @@ import java.util.Map;
|
||||
* {@link GlobalFlagContainer global flag container}.
|
||||
*
|
||||
* @param flagClass Flag class to query for
|
||||
* @param <V> Flag value type
|
||||
* @param <T> Flag type
|
||||
* @param <V> Flag value type
|
||||
* @param <T> Flag type
|
||||
* @return Flag instance
|
||||
*/
|
||||
public <V, T extends PlotFlag<V, ?>> T getFlag(final Class<? extends T> flagClass) {
|
||||
@ -151,11 +156,12 @@ import java.util.Map;
|
||||
* Check for flag existence in this flag container instance.
|
||||
*
|
||||
* @param flagClass Flag class to query for
|
||||
* @param <V> Flag value type
|
||||
* @param <T> Flag type
|
||||
* @param <V> Flag value type
|
||||
* @param <T> Flag type
|
||||
* @return The flag instance, if it exists in this container, else null.
|
||||
*/
|
||||
@Nullable public <V, T extends PlotFlag<V, ?>> T queryLocal(final Class<? extends T> flagClass) {
|
||||
@Nullable public <V, T extends PlotFlag<V, ?>> T queryLocal(
|
||||
final Class<? extends T> flagClass) {
|
||||
final PlotFlag<?, ?> localFlag = this.flagMap.get(flagClass);
|
||||
if (localFlag == null) {
|
||||
return null;
|
||||
@ -164,26 +170,6 @@ import java.util.Map;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public static <V, T extends PlotFlag<V, ?>> T castUnsafe(final PlotFlag<?, ?> flag) {
|
||||
return (T) flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for update events in {@link FlagContainer flag containers}.
|
||||
*/
|
||||
@FunctionalInterface public interface PlotFlagUpdateHandler {
|
||||
|
||||
/**
|
||||
* Act on the flag update event
|
||||
* @param plotFlag Plot flag
|
||||
* @param type Update type
|
||||
*/
|
||||
void handle(PlotFlag<?, ?> plotFlag, PlotFlagUpdateType type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update event types used in {@link PlotFlagUpdateHandler}.
|
||||
*/
|
||||
@ -198,4 +184,20 @@ import java.util.Map;
|
||||
FLAG_REMOVED
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handler for update events in {@link FlagContainer flag containers}.
|
||||
*/
|
||||
@FunctionalInterface public interface PlotFlagUpdateHandler {
|
||||
|
||||
/**
|
||||
* Act on the flag update event
|
||||
*
|
||||
* @param plotFlag Plot flag
|
||||
* @param type Update type
|
||||
*/
|
||||
void handle(PlotFlag<?, ?> plotFlag, PlotFlagUpdateType type);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ public class FlagParseException extends Exception {
|
||||
private final String value;
|
||||
private final String errorMessage;
|
||||
|
||||
public FlagParseException(final PlotFlag<?, ?> flag, final String value, final Caption errorMessage,
|
||||
final Object ... args) {
|
||||
public FlagParseException(final PlotFlag<?, ?> flag, final String value,
|
||||
final Caption errorMessage, final Object... args) {
|
||||
super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
|
||||
flag.getName(), value));
|
||||
this.flag = flag;
|
||||
this.value = value;
|
||||
this.errorMessage = CaptionUtility.format(errorMessage, args);
|
||||
this.errorMessage = CaptionUtility.format(errorMessage, args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,15 +27,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
protected PlotFlag(@NotNull final T value, @NotNull final Caption flagCategory,
|
||||
@NotNull final Caption flagDescription) {
|
||||
this.value = Preconditions.checkNotNull(value, "flag value may not be null");
|
||||
this.flagCategory = Preconditions.checkNotNull(flagCategory, "flag category may not be null");
|
||||
this.flagDescription = Preconditions.checkNotNull(flagDescription, "flag description may not be null");
|
||||
this.flagCategory =
|
||||
Preconditions.checkNotNull(flagCategory, "flag category may not be null");
|
||||
this.flagDescription =
|
||||
Preconditions.checkNotNull(flagDescription, "flag description may not be null");
|
||||
// Parse flag name
|
||||
final StringBuilder flagName = new StringBuilder();
|
||||
final char[] chars = this.getClass().getSimpleName().replace("Flag", "").toCharArray();
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (i == 0) {
|
||||
flagName.append(Character.toLowerCase(chars[i]));
|
||||
} else if(Character.isUpperCase(chars[i])) {
|
||||
} else if (Character.isUpperCase(chars[i])) {
|
||||
flagName.append('-').append(Character.toLowerCase(chars[i]));
|
||||
} else {
|
||||
flagName.append(chars[i]);
|
||||
|
@ -11,10 +11,12 @@ import java.util.List;
|
||||
|
||||
public class BlockedCmdsFlag extends ListFlag<String, BlockedCmdsFlag> {
|
||||
|
||||
public static final BlockedCmdsFlag BLOCKED_CMDS_FLAG_NONE = new BlockedCmdsFlag(Collections.emptyList());
|
||||
public static final BlockedCmdsFlag BLOCKED_CMDS_FLAG_NONE =
|
||||
new BlockedCmdsFlag(Collections.emptyList());
|
||||
|
||||
protected BlockedCmdsFlag(List<String> valueList) {
|
||||
super(valueList, Captions.FLAG_CATEGORY_STRING_LIST, Captions.FLAG_DESCRIPTION_BLOCKED_CMDS);
|
||||
super(valueList, Captions.FLAG_CATEGORY_STRING_LIST,
|
||||
Captions.FLAG_DESCRIPTION_BLOCKED_CMDS);
|
||||
}
|
||||
|
||||
@Override public BlockedCmdsFlag parse(@NotNull String input) throws FlagParseException {
|
||||
|
@ -10,22 +10,52 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, DenyTeleportFlag> {
|
||||
|
||||
public static final DenyTeleportFlag DENY_TELEPORT_FLAG_NONE = new DenyTeleportFlag(DeniedGroup.NONE);
|
||||
public static final DenyTeleportFlag DENY_TELEPORT_FLAG_NONE =
|
||||
new DenyTeleportFlag(DeniedGroup.NONE);
|
||||
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
protected DenyTeleportFlag(@NotNull DeniedGroup value) {
|
||||
super(value, Captions.FLAG_CATEGORY_ENUM, Captions.FLAG_DESCRIPTION_DENY_TELEPORT);
|
||||
}
|
||||
|
||||
public static boolean allowsTeleport(PlotPlayer player, Plot plot) {
|
||||
final DeniedGroup value = plot.getFlag(DenyTeleportFlag.class);
|
||||
if (value == DeniedGroup.NONE) {
|
||||
return true;
|
||||
}
|
||||
final boolean result;
|
||||
switch (value) {
|
||||
case TRUSTED:
|
||||
result = !plot.getTrusted().contains(player.getUUID());
|
||||
break;
|
||||
case MEMBERS:
|
||||
result = !plot.getMembers().contains(player.getUUID());
|
||||
break;
|
||||
case NONMEMBERS:
|
||||
result = plot.isAdded(player.getUUID());
|
||||
break;
|
||||
case NONTRUSTED:
|
||||
result =
|
||||
plot.getTrusted().contains(player.getUUID()) || plot.isOwner(player.getUUID());
|
||||
break;
|
||||
case NONOWNERS:
|
||||
result = plot.isOwner(player.getUUID());
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
return result || player.hasPermission("plots.admin.entry.denied");
|
||||
}
|
||||
|
||||
@Override public DenyTeleportFlag parse(@NotNull String input) throws FlagParseException {
|
||||
final DeniedGroup group = DeniedGroup.fromString(input);
|
||||
if (group == null) {
|
||||
throw new FlagParseException(this, input, Captions.FLAG_ERROR_ENUM, "members, nonmembers,"
|
||||
+ " trusted, nontrusted, nonowners");
|
||||
throw new FlagParseException(this, input, Captions.FLAG_ERROR_ENUM,
|
||||
"members, nonmembers," + " trusted, nontrusted, nonowners");
|
||||
}
|
||||
return flagOf(group);
|
||||
}
|
||||
@ -49,42 +79,8 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
|
||||
return new DenyTeleportFlag(value);
|
||||
}
|
||||
|
||||
public static boolean allowsTeleport(PlotPlayer player, Plot plot) {
|
||||
final DeniedGroup value = plot.getFlag(DenyTeleportFlag.class);
|
||||
if (value == DeniedGroup.NONE) {
|
||||
return true;
|
||||
}
|
||||
final boolean result;
|
||||
switch (value) {
|
||||
case TRUSTED:
|
||||
result = !plot.getTrusted().contains(player.getUUID());
|
||||
break;
|
||||
case MEMBERS:
|
||||
result = !plot.getMembers().contains(player.getUUID());
|
||||
break;
|
||||
case NONMEMBERS:
|
||||
result = plot.isAdded(player.getUUID());
|
||||
break;
|
||||
case NONTRUSTED:
|
||||
result = plot.getTrusted().contains(player.getUUID()) || plot
|
||||
.isOwner(player.getUUID());
|
||||
break;
|
||||
case NONOWNERS:
|
||||
result = plot.isOwner(player.getUUID());
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
return result || player.hasPermission("plots.admin.entry.denied");
|
||||
}
|
||||
|
||||
public enum DeniedGroup {
|
||||
NONE,
|
||||
MEMBERS,
|
||||
TRUSTED,
|
||||
NONMEMBERS,
|
||||
NONTRUSTED,
|
||||
NONOWNERS;
|
||||
NONE, MEMBERS, TRUSTED, NONMEMBERS, NONTRUSTED, NONOWNERS;
|
||||
|
||||
@Nullable public static DeniedGroup fromString(@NotNull final String string) {
|
||||
for (final DeniedGroup group : values()) {
|
||||
|
@ -11,12 +11,16 @@ public class DoneFlag extends PlotFlag<String, DoneFlag> implements InternalFlag
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
public DoneFlag(@NotNull String value) {
|
||||
super(value, Captions.NONE, Captions.NONE);
|
||||
}
|
||||
|
||||
public static boolean isDone(final Plot plot) {
|
||||
return !plot.getFlag(DoneFlag.class).isEmpty();
|
||||
}
|
||||
|
||||
@Override public DoneFlag parse(@NotNull String input) {
|
||||
return flagOf(input);
|
||||
}
|
||||
@ -37,8 +41,4 @@ public class DoneFlag extends PlotFlag<String, DoneFlag> implements InternalFlag
|
||||
return new DoneFlag(value);
|
||||
}
|
||||
|
||||
public static boolean isDone(final Plot plot) {
|
||||
return !plot.getFlag(DoneFlag.class).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,20 +10,22 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class GamemodeFlag extends PlotFlag<GameMode, GamemodeFlag> {
|
||||
|
||||
public static final GameMode DEFAULT = new GameMode("default");
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_CREATIVE = new GamemodeFlag(GameModes.CREATIVE);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_ADVENTURE =
|
||||
new GamemodeFlag(GameModes.ADVENTURE);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_SPECTATOR =
|
||||
new GamemodeFlag(GameModes.SPECTATOR);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_SURVIVAL = new GamemodeFlag(GameModes.SURVIVAL);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_DEFAULT = new GamemodeFlag(DEFAULT);
|
||||
|
||||
static {
|
||||
GameModes.register(DEFAULT);
|
||||
}
|
||||
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_CREATIVE = new GamemodeFlag(GameModes.CREATIVE);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_ADVENTURE = new GamemodeFlag(GameModes.ADVENTURE);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_SPECTATOR = new GamemodeFlag(GameModes.SPECTATOR);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_SURVIVAL = new GamemodeFlag(GameModes.SURVIVAL);
|
||||
public static final GamemodeFlag GAMEMODE_FLAG_DEFAULT = new GamemodeFlag(DEFAULT);
|
||||
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
protected GamemodeFlag(@NotNull GameMode value) {
|
||||
super(value, Captions.FLAG_CATEGORY_GAMEMODE, Captions.FLAG_DESCRIPTION_GAMEMODE);
|
||||
|
@ -9,16 +9,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class GuestGamemodeFlag extends PlotFlag<GameMode, GuestGamemodeFlag> {
|
||||
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_CREATIVE = new GuestGamemodeFlag(GameModes.CREATIVE);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_ADVENTURE = new GuestGamemodeFlag(GameModes.ADVENTURE);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_SPECTATOR = new GuestGamemodeFlag(GameModes.SPECTATOR);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_SURVIVAL = new GuestGamemodeFlag(GameModes.SURVIVAL);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_DEFAULT = new GuestGamemodeFlag(GamemodeFlag.DEFAULT);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_CREATIVE =
|
||||
new GuestGamemodeFlag(GameModes.CREATIVE);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_ADVENTURE =
|
||||
new GuestGamemodeFlag(GameModes.ADVENTURE);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_SPECTATOR =
|
||||
new GuestGamemodeFlag(GameModes.SPECTATOR);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_SURVIVAL =
|
||||
new GuestGamemodeFlag(GameModes.SURVIVAL);
|
||||
public static final GuestGamemodeFlag GUEST_GAMEMODE_FLAG_DEFAULT =
|
||||
new GuestGamemodeFlag(GamemodeFlag.DEFAULT);
|
||||
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
protected GuestGamemodeFlag(@NotNull GameMode value) {
|
||||
super(value, Captions.FLAG_CATEGORY_GAMEMODE, Captions.FLAG_DESCRIPTION_GUEST_GAMEMODE);
|
||||
|
@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HealFlag extends TimedFlag<Integer, HealFlag> {
|
||||
public static final HealFlag HEAL_NOTHING = new HealFlag(new Timed<>(0, 0));
|
||||
|
||||
protected HealFlag(@NotNull Timed<Integer> value) {
|
||||
super(value, 1, Captions.FLAG_DESCRIPTION_HEAL);
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.flags.types.NonNegativeInte
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HostileCapFlag extends NonNegativeIntegerFlag<HostileCapFlag> {
|
||||
public static final HostileCapFlag HOSTILE_CAP_UNLIMITED = new HostileCapFlag(Integer.MAX_VALUE);
|
||||
public static final HostileCapFlag HOSTILE_CAP_UNLIMITED =
|
||||
new HostileCapFlag(Integer.MAX_VALUE);
|
||||
|
||||
protected HostileCapFlag(int value) {
|
||||
super(value, Captions.FLAG_DESCRIPTION_HOSTILE_CAP);
|
||||
|
@ -14,7 +14,7 @@ public class KeepFlag extends PlotFlag<Object, KeepFlag> {
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
protected KeepFlag(@NotNull Object value) {
|
||||
super(value, Captions.FLAG_CATEGORY_MIXED, Captions.FLAG_DESCRIPTION_KEEP);
|
||||
|
@ -15,7 +15,7 @@ public class MusicFlag extends PlotFlag<ItemType, MusicFlag> {
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
protected MusicFlag(ItemType value) {
|
||||
super(value, Captions.FLAG_CATEGORY_MUSIC, Captions.FLAG_DESCRIPTION_MUSIC);
|
||||
|
@ -7,14 +7,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PlotWeatherFlag extends PlotFlag<PlotWeather, PlotWeatherFlag> {
|
||||
|
||||
public static final PlotWeatherFlag PLOT_WEATHER_FLAG_RAIN = new PlotWeatherFlag(PlotWeather.RAIN);
|
||||
public static final PlotWeatherFlag PLOT_WEATHER_FLAG_CLEAR = new PlotWeatherFlag(PlotWeather.CLEAR);
|
||||
public static final PlotWeatherFlag PLOT_WEATHER_FLAG_OFF = new PlotWeatherFlag(PlotWeather.RESET);
|
||||
public static final PlotWeatherFlag PLOT_WEATHER_FLAG_RAIN =
|
||||
new PlotWeatherFlag(PlotWeather.RAIN);
|
||||
public static final PlotWeatherFlag PLOT_WEATHER_FLAG_CLEAR =
|
||||
new PlotWeatherFlag(PlotWeather.CLEAR);
|
||||
public static final PlotWeatherFlag PLOT_WEATHER_FLAG_OFF =
|
||||
new PlotWeatherFlag(PlotWeather.RESET);
|
||||
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
*
|
||||
* @param value Flag value
|
||||
* @param value Flag value
|
||||
*/
|
||||
protected PlotWeatherFlag(@NotNull PlotWeather value) {
|
||||
super(value, Captions.FLAG_CATEGORY_WEATHER, Captions.FLAG_DESCRIPTION_WEATHER);
|
||||
|
@ -5,7 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.flags.types.NonNegativeInte
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class VehicleCapFlag extends NonNegativeIntegerFlag<VehicleCapFlag> {
|
||||
public static final VehicleCapFlag VEHICLE_CAP_UNLIMITED = new VehicleCapFlag(Integer.MAX_VALUE);
|
||||
public static final VehicleCapFlag VEHICLE_CAP_UNLIMITED =
|
||||
new VehicleCapFlag(Integer.MAX_VALUE);
|
||||
|
||||
protected VehicleCapFlag(int value) {
|
||||
super(value, Captions.FLAG_DESCRIPTION_VEHICLE_CAP);
|
||||
|
@ -6,8 +6,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class VillagerInteractFlag extends BooleanFlag<VillagerInteractFlag> {
|
||||
|
||||
public static final VillagerInteractFlag VILLAGER_INTERACT_TRUE = new VillagerInteractFlag(true);
|
||||
public static final VillagerInteractFlag VILLAGER_INTERACT_FALSE = new VillagerInteractFlag(false);
|
||||
public static final VillagerInteractFlag VILLAGER_INTERACT_TRUE =
|
||||
new VillagerInteractFlag(true);
|
||||
public static final VillagerInteractFlag VILLAGER_INTERACT_FALSE =
|
||||
new VillagerInteractFlag(false);
|
||||
|
||||
private VillagerInteractFlag(boolean value) {
|
||||
super(value, Captions.FLAG_DESCRIPTION_VILLAGER_INTERACT);
|
||||
|
@ -11,7 +11,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BlockTypeListFlag<F extends ListFlag<BlockType, F>> extends ListFlag<BlockType, F> {
|
||||
public abstract class BlockTypeListFlag<F extends ListFlag<BlockType, F>>
|
||||
extends ListFlag<BlockType, F> {
|
||||
|
||||
protected BlockTypeListFlag(List<BlockType> blockTypeList, Caption description) {
|
||||
super(blockTypeList, Captions.FLAG_CATEGORY_BLOCK_LIST, description);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user