- Update code style to format annotations nicely

- Reformat code
This commit is contained in:
dordsor21 2018-12-26 17:21:06 +00:00
parent 8cb2bdc846
commit ba47a21971
82 changed files with 584 additions and 478 deletions

View File

@ -33,8 +33,8 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extension.platform.Capability;
import lombok.Getter;
import lombok.NonNull;
import org.bukkit.Location;
import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -114,10 +114,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
System.out.println("[P2] Testing platform capabilities");
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS);
} catch (final Throwable throwable) {
throw new IllegalStateException("Failed to force load WorldEdit."
+ " Road schematics will fail to generate", throwable);
throw new IllegalStateException(
"Failed to force load WorldEdit." + " Road schematics will fail to generate",
throwable);
}
}
private final LegacyMappings legacyMappings = new BukkitLegacyMappings();
private final BlockRegistry<Material> blockRegistry =
new BukkitBlockRegistry(Material.values());
@ -160,16 +162,19 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (Bukkit.getVersion().contains("git-Spigot")) {
// Uses System.out.println because the logger isn't initialized yet
System.out.println("[P2] ========================== USE PAPER ==========================");
System.out
.println("[P2] ========================== USE PAPER ==========================");
System.out.println("[P2] Paper offers a more complete API for us to work with");
System.out.println("[P2] and we may come to rely on it in the future.");
System.out.println("[P2] It is also recommended out of a performance standpoint as");
System.out.println("[P2] it contains many improvements missing from Spigot and Bukkit.");
System.out
.println("[P2] it contains many improvements missing from Spigot and Bukkit.");
System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads");
System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/");
System.out.println("[P2] NOTE: This is only a recommendation");
System.out.println("[P2] both Spigot and CraftBukkit are still supported.");
System.out.println("[P2] ===============================================================");
System.out
.println("[P2] ===============================================================");
}
new PlotSquared(this, "Bukkit");
@ -325,67 +330,81 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
TaskManager.runTaskRepeat(() -> PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea plotArea) {
final World world = Bukkit.getWorld(plotArea.worldname);
try {
if (world == null) {
return;
}
List<Entity> entities = world.getEntities();
Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) {
Entity entity = iterator.next();
switch (entity.getType()) {
case EGG:
case COMPLEX_PART:
case FISHING_HOOK:
case ENDER_SIGNAL:
case LINGERING_POTION:
case AREA_EFFECT_CLOUD:
case EXPERIENCE_ORB:
case LEASH_HITCH:
case FIREWORK:
case WEATHER:
case LIGHTNING:
case WITHER_SKULL:
case UNKNOWN:
case PLAYER:
// non moving / unmovable
continue;
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case SNOWBALL:
case SHULKER_BULLET:
case SPECTRAL_ARROW:
case TIPPED_ARROW:
case ENDER_PEARL:
case ARROW:
case LLAMA_SPIT:
// managed elsewhere | projectile
continue;
case ITEM_FRAME:
case PAINTING:
// Not vehicles
continue;
case ARMOR_STAND:
// Temporarily classify as vehicle
case MINECART:
case MINECART_CHEST:
case MINECART_COMMAND:
case MINECART_FURNACE:
case MINECART_HOPPER:
case MINECART_MOB_SPAWNER:
case ENDER_CRYSTAL:
case MINECART_TNT:
case BOAT:
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.github.intellectualsites.plotsquared.plot.object.Location
location =
BukkitUtil.getLocation(entity.getLocation());
Plot plot = location.getPlot();
if (plot == null) {
if (location.isPlotArea()) {
TaskManager
.runTaskRepeat(() -> PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override public void run(PlotArea plotArea) {
final World world = Bukkit.getWorld(plotArea.worldname);
try {
if (world == null) {
return;
}
List<Entity> entities = world.getEntities();
Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) {
Entity entity = iterator.next();
switch (entity.getType()) {
case EGG:
case COMPLEX_PART:
case FISHING_HOOK:
case ENDER_SIGNAL:
case LINGERING_POTION:
case AREA_EFFECT_CLOUD:
case EXPERIENCE_ORB:
case LEASH_HITCH:
case FIREWORK:
case WEATHER:
case LIGHTNING:
case WITHER_SKULL:
case UNKNOWN:
case PLAYER:
// non moving / unmovable
continue;
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case SNOWBALL:
case SHULKER_BULLET:
case SPECTRAL_ARROW:
case TIPPED_ARROW:
case ENDER_PEARL:
case ARROW:
case LLAMA_SPIT:
// managed elsewhere | projectile
continue;
case ITEM_FRAME:
case PAINTING:
// Not vehicles
continue;
case ARMOR_STAND:
// Temporarily classify as vehicle
case MINECART:
case MINECART_CHEST:
case MINECART_COMMAND:
case MINECART_FURNACE:
case MINECART_HOPPER:
case MINECART_MOB_SPAWNER:
case ENDER_CRYSTAL:
case MINECART_TNT:
case BOAT:
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.github.intellectualsites.plotsquared.plot.object.Location
location = BukkitUtil.getLocation(entity.getLocation());
Plot plot = location.getPlot();
if (plot == null) {
if (location.isPlotArea()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
}
continue;
}
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta.isEmpty()) {
continue;
}
Plot origin = (Plot) meta.get(0).value();
if (!plot.equals(origin.getBasePlot(false))) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
@ -393,97 +412,93 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
entity.remove();
}
continue;
}
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta.isEmpty()) {
} else {
continue;
}
Plot origin = (Plot) meta.get(0).value();
if (!plot.equals(origin.getBasePlot(false))) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
case SMALL_FIREBALL:
case FIREBALL:
case DRAGON_FIREBALL:
case DROPPED_ITEM:
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
entity.remove();
}
// dropped item
continue;
} else {
case PRIMED_TNT:
case FALLING_BLOCK:
// managed elsewhere
continue;
}
case SMALL_FIREBALL:
case FIREBALL:
case DRAGON_FIREBALL:
case DROPPED_ITEM:
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
entity.remove();
}
// dropped item
continue;
case PRIMED_TNT:
case FALLING_BLOCK:
// managed elsewhere
continue;
case LLAMA:
case DONKEY:
case MULE:
case ZOMBIE_HORSE:
case SKELETON_HORSE:
case HUSK:
case ELDER_GUARDIAN:
case WITHER_SKELETON:
case STRAY:
case ZOMBIE_VILLAGER:
case EVOKER:
case EVOKER_FANGS:
case VEX:
case VINDICATOR:
case POLAR_BEAR:
case BAT:
case BLAZE:
case CAVE_SPIDER:
case CHICKEN:
case COW:
case CREEPER:
case ENDERMAN:
case ENDERMITE:
case ENDER_DRAGON:
case GHAST:
case GIANT:
case GUARDIAN:
case HORSE:
case IRON_GOLEM:
case MAGMA_CUBE:
case MUSHROOM_COW:
case OCELOT:
case PIG:
case PIG_ZOMBIE:
case RABBIT:
case SHEEP:
case SILVERFISH:
case SKELETON:
case SLIME:
case SNOWMAN:
case SPIDER:
case SQUID:
case VILLAGER:
case WITCH:
case WITHER:
case WOLF:
case ZOMBIE:
default: {
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
Location location = entity.getLocation();
if (BukkitUtil.getLocation(location).isPlotRoad()) {
if (entity instanceof LivingEntity) {
LivingEntity livingEntity =
(LivingEntity) entity;
if (!livingEntity.isLeashed() || !entity
.hasMetadata("keep")) {
case LLAMA:
case DONKEY:
case MULE:
case ZOMBIE_HORSE:
case SKELETON_HORSE:
case HUSK:
case ELDER_GUARDIAN:
case WITHER_SKELETON:
case STRAY:
case ZOMBIE_VILLAGER:
case EVOKER:
case EVOKER_FANGS:
case VEX:
case VINDICATOR:
case POLAR_BEAR:
case BAT:
case BLAZE:
case CAVE_SPIDER:
case CHICKEN:
case COW:
case CREEPER:
case ENDERMAN:
case ENDERMITE:
case ENDER_DRAGON:
case GHAST:
case GIANT:
case GUARDIAN:
case HORSE:
case IRON_GOLEM:
case MAGMA_CUBE:
case MUSHROOM_COW:
case OCELOT:
case PIG:
case PIG_ZOMBIE:
case RABBIT:
case SHEEP:
case SILVERFISH:
case SKELETON:
case SLIME:
case SNOWMAN:
case SPIDER:
case SQUID:
case VILLAGER:
case WITCH:
case WITHER:
case WOLF:
case ZOMBIE:
default: {
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
Location location = entity.getLocation();
if (BukkitUtil.getLocation(location).isPlotRoad()) {
if (entity instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entity;
if (!livingEntity.isLeashed() || !entity
.hasMetadata("keep")) {
Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity
.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
continue;
}
}
} else {
Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity
.getMetadata("keep").isEmpty()) {
if (entity
.hasMetadata("ps-tmp-teleport")) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
@ -491,84 +506,68 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
continue;
}
}
} else {
Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity
.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
continue;
}
}
}
continue;
}
continue;
}
case SHULKER: {
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
LivingEntity livingEntity = (LivingEntity) entity;
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta != null && !meta.isEmpty()) {
if (livingEntity.isLeashed())
continue;
case SHULKER: {
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
LivingEntity livingEntity = (LivingEntity) entity;
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta != null && !meta.isEmpty()) {
if (livingEntity.isLeashed())
continue;
List<MetadataValue> keep =
entity.getMetadata("keep");
if (keep != null && !keep.isEmpty())
continue;
List<MetadataValue> keep = entity.getMetadata("keep");
if (keep != null && !keep.isEmpty())
continue;
PlotId originalPlotId =
(PlotId) meta.get(0).value();
if (originalPlotId != null) {
PlotId originalPlotId = (PlotId) meta.get(0).value();
if (originalPlotId != null) {
com.github.intellectualsites.plotsquared.plot.object.Location
pLoc =
BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId =
PlotId.of(area.getPlotAbs(pLoc));
if (!originalPlotId.equals(currentPlotId) && (
currentPlotId == null || !area
.getPlot(originalPlotId)
.equals(area.getPlot(currentPlotId)))) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
}
}
}
} else {
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
com.github.intellectualsites.plotsquared.plot.object.Location
pLoc = BukkitUtil
.getLocation(entity.getLocation());
pLoc = BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId =
PlotId.of(area.getPlotAbs(pLoc));
if (!originalPlotId.equals(currentPlotId)
&& (currentPlotId == null || !area
.getPlot(originalPlotId)
.equals(area.getPlot(currentPlotId)))) {
if (entity
.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
if (currentPlotId != null) {
entity.setMetadata("plot",
new FixedMetadataValue(
(Plugin) PlotSquared.get().IMP,
currentPlotId));
}
}
}
} else {
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
com.github.intellectualsites.plotsquared.plot.object.Location
pLoc =
BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId =
PlotId.of(area.getPlotAbs(pLoc));
if (currentPlotId != null) {
entity.setMetadata("plot",
new FixedMetadataValue(
(Plugin) PlotSquared.get().IMP,
currentPlotId));
}
}
}
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}), 20);
}), 20);
}
@Override @Nullable
@ -766,7 +765,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (this.metricsStarted) {
return;
}
System.setProperty("bstats.relocatecheck", "false"); // We do not want to relocate the package...
System.setProperty("bstats.relocatecheck",
"false"); // We do not want to relocate the package...
new org.bstats.bukkit.Metrics(this); // bstats
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
this.metricsStarted = true;

View File

@ -27,8 +27,10 @@ import java.nio.file.Files;
import java.util.*;
import java.util.Map.Entry;
@CommandDeclaration(command = "uuidconvert", permission = "plots.admin", description = "Debug UUID conversion", usage = "/plot uuidconvert <lower|offline|online>", requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG)
public class DebugUUID extends SubCommand {
@CommandDeclaration(command = "uuidconvert", permission = "plots.admin",
description = "Debug UUID conversion", usage = "/plot uuidconvert <lower|offline|online>",
requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) public class DebugUUID
extends SubCommand {
public DebugUUID() {
super(Argument.String);

View File

@ -206,8 +206,8 @@ public class BukkitChunkManager extends ChunkManager {
RegionWrapper currentPlotClear =
new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
AugmentedUtils.bypass(ignoreAugment,
() -> queue.regenChunkSafe(chunk.x, chunk.z));
AugmentedUtils
.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z));
continue;
}
boolean checkX1 = false;
@ -270,39 +270,38 @@ public class BukkitChunkManager extends ChunkManager {
map.saveRegion(worldObj, xxt2, xxt, zzt2, zzt); //
}
map.saveEntitiesOut(chunkObj, currentPlotClear);
AugmentedUtils.bypass(ignoreAugment, () -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
@Override public void run(ScopedLocalBlockQueue value) {
com.github.intellectualsites.plotsquared.plot.object.Location
min = value.getMin();
int bx = min.getX();
int bz = min.getZ();
for (int x1 = 0; x1 < 16; x1++) {
for (int z1 = 0; z1 < 16; z1++) {
PlotLoc loc = new PlotLoc(bx + x1, bz + z1);
PlotBlock[] ids = map.allBlocks.get(loc);
if (ids != null) {
for (int y = 0;
y < Math.min(128, ids.length); y++) {
PlotBlock id = ids[y];
if (id != null) {
value.setBlock(x1, y, z1, id);
} else {
value.setBlock(x1, y, z1,
PlotBlock.get("air"));
AugmentedUtils.bypass(ignoreAugment,
() -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
@Override public void run(ScopedLocalBlockQueue value) {
com.github.intellectualsites.plotsquared.plot.object.Location min =
value.getMin();
int bx = min.getX();
int bz = min.getZ();
for (int x1 = 0; x1 < 16; x1++) {
for (int z1 = 0; z1 < 16; z1++) {
PlotLoc loc = new PlotLoc(bx + x1, bz + z1);
PlotBlock[] ids = map.allBlocks.get(loc);
if (ids != null) {
for (int y = 0; y < Math.min(128, ids.length); y++) {
PlotBlock id = ids[y];
if (id != null) {
value.setBlock(x1, y, z1, id);
} else {
value.setBlock(x1, y, z1, PlotBlock.get("air"));
}
}
}
for (int y = Math.min(128, ids.length);
y < ids.length; y++) {
PlotBlock id = ids[y];
if (id != null) {
value.setBlock(x1, y, z1, id);
for (int y = Math.min(128, ids.length);
y < ids.length; y++) {
PlotBlock id = ids[y];
if (id != null) {
value.setBlock(x1, y, z1, id);
}
}
}
}
}
}
}
}, world, chunk));
}, world, chunk));
map.restoreBlocks(worldObj, 0, 0);
map.restoreEntities(worldObj, 0, 0);
}
@ -347,8 +346,8 @@ public class BukkitChunkManager extends ChunkManager {
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
final boolean safe) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(
() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe));
TaskManager
.runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe));
} else {
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
}

View File

@ -676,7 +676,8 @@ public final class BukkitLegacyMappings extends LegacyMappings {
for (final Material material : Material.values()) {
final String materialName = material.name().toLowerCase(Locale.ENGLISH);
if (OLD_STRING_TO_STRING_PLOT_BLOCK.get(materialName) == null) {
final LegacyBlock missingBlock = new LegacyBlock(material.getId(), materialName, materialName);
final LegacyBlock missingBlock =
new LegacyBlock(material.getId(), materialName, materialName);
missing.add(missingBlock);
}
}
@ -692,8 +693,9 @@ public final class BukkitLegacyMappings extends LegacyMappings {
.put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()),
legacyBlock.toStringPlotBlock());
} */
LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK.put(new IdDataPair(legacyBlock.getNumericalId(),
legacyBlock.getDataValue()), legacyBlock.toStringPlotBlock());
LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK
.put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()),
legacyBlock.toStringPlotBlock());
NEW_STRING_TO_LEGACY_PLOT_BLOCK
.put(legacyBlock.getLegacyName(), legacyBlock.toStringPlotBlock());
OLD_STRING_TO_STRING_PLOT_BLOCK

File diff suppressed because one or more lines are too long

View File

@ -16,8 +16,10 @@ import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
@CommandDeclaration(command = "add", description = "Allow a user to build in a plot while you are online", usage = "/plot add <player>", category = CommandCategory.SETTINGS, permission = "plots.add", requiredType = RequiredType.NONE)
public class Add extends Command {
@CommandDeclaration(command = "add",
description = "Allow a user to build in a plot while you are online",
usage = "/plot add <player>", category = CommandCategory.SETTINGS, permission = "plots.add",
requiredType = RequiredType.NONE) public class Add extends Command {
public Add() {
super(MainCommand.getInstance(), true);

View File

@ -12,10 +12,11 @@ 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.NONE)
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.NONE) public class Alias
extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {

View File

@ -15,8 +15,11 @@ 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) {

View File

@ -11,7 +11,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import javax.annotation.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) {

View File

@ -8,10 +8,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
@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) {
int biome = WorldUtil.IMP.getBiomeFromString(value);

View File

@ -15,8 +15,9 @@ import com.google.common.base.Optional;
import java.util.Set;
@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);

View File

@ -10,8 +10,10 @@ import java.io.IOException;
import java.net.URL;
import java.util.Scanner;
@CommandDeclaration(command = "changelog", permission = "plots.admin.command.changelog", description = "View the changelog", usage = "/plot changelog", requiredType = RequiredType.NONE, aliases = {
"cl"}, category = CommandCategory.ADMINISTRATION) public class Changelog extends SubCommand {
@CommandDeclaration(command = "changelog", permission = "plots.admin.command.changelog",
description = "View the changelog", usage = "/plot changelog", requiredType = RequiredType.NONE,
aliases = {"cl"}, category = CommandCategory.ADMINISTRATION) public class Changelog
extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
try {

View File

@ -3,8 +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 = "chat", description = "Toggle plot chat on or off", usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT, requiredType = RequiredType.NONE)
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.NONE) public class Chat extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
MainCommand.getInstance().toggle.chat(this, player, new String[0], null, null);

View File

@ -10,7 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
@CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, 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.NONE, permission = "plots.claim", usage = "/plot claim")
public class Claim extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {

View File

@ -14,8 +14,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
@CommandDeclaration(command = "clear", description = "Clear the plot you stand on", 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",
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>

View File

@ -15,8 +15,10 @@ 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) {

View File

@ -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.NONE, permission = "plots.comment")
@CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot",
category = CommandCategory.CHAT, requiredType = RequiredType.NONE, permission = "plots.comment")
public class Comment extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {

View File

@ -15,8 +15,9 @@ import java.util.*;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@CommandDeclaration(command = "condense", permission = "plots.admin", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE)
public class Condense extends SubCommand {
@CommandDeclaration(command = "condense", permission = "plots.admin",
description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand {
public static boolean TASK = false;

View File

@ -9,8 +9,9 @@ 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);

View File

@ -9,8 +9,10 @@ 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.NONE)
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.NONE) public class Continue extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
Plot plot = player.getCurrentPlot();

View File

@ -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 loc = player.getLocation();

View File

@ -9,9 +9,11 @@ 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.NONE, 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.NONE,
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 loc = player.getLocation();

View File

@ -22,9 +22,11 @@ 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) {

View File

@ -7,7 +7,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 = "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) {

View File

@ -8,8 +8,10 @@ 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<>();

View File

@ -17,7 +17,8 @@ import java.util.UUID;
@CommandDeclaration(command = "debugclaimtest", description =
"If you accidentally delete your database, this command will attempt to restore all plots based on the data from plot signs. "
+ "Execution time may vary", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE, permission = "plots.debugclaimtest")
+ "Execution time may vary", category = CommandCategory.DEBUG,
requiredType = RequiredType.CONSOLE, permission = "plots.debugclaimtest")
public class DebugClaimTest extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {

View File

@ -24,8 +24,9 @@ import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.*;
@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;

View File

@ -16,7 +16,9 @@ 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() {

View File

@ -17,8 +17,9 @@ import com.google.common.base.Charsets;
import java.io.File;
import java.util.UUID;
@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);
}

View File

@ -5,8 +5,10 @@ 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();

View File

@ -13,8 +13,10 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.io.File;
import java.io.IOException;
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", description = "Upload settings.yml, worlds.yml, commands.yml and latest.log to www.hastebin.com", permission = "plots.debugpaste", category = CommandCategory.DEBUG)
public class DebugPaste extends SubCommand {
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
description = "Upload settings.yml, worlds.yml, commands.yml and latest.log to www.hastebin.com",
permission = "plots.debugpaste", category = CommandCategory.DEBUG) public class DebugPaste
extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
TaskManager.runTaskAsync(new Runnable() {

View File

@ -4,12 +4,16 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
@CommandDeclaration(command = "debugroadregen", usage = "/plot debugroadregen", requiredType = RequiredType.NONE, description = "Regenerate all roads based on the road schematic", category = CommandCategory.DEBUG, permission = "plots.debugroadregen")
@CommandDeclaration(command = "debugroadregen", usage = "/plot debugroadregen",
requiredType = RequiredType.NONE,
description = "Regenerate all roads based on the road schematic",
category = CommandCategory.DEBUG, permission = "plots.debugroadregen")
public class DebugRoadRegen extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
@ -20,7 +24,7 @@ public class DebugRoadRegen extends SubCommand {
}
Plot plot = player.getCurrentPlot();
if (plot == null) {
C.NOT_IN_PLOT.send(player);
C.NOT_IN_PLOT.send(player);
} else {
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
manager.createRoadEast(plotArea, plot);

View File

@ -9,7 +9,10 @@ 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) {

View File

@ -7,10 +7,10 @@ import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*;
@CommandDeclaration(command = "delete", permission = "plots.delete", description = "Delete the plot you stand on", usage = "/plot delete", aliases = {
"dispose",
"del"}, 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"}, 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>

View File

@ -14,9 +14,10 @@ import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
@CommandDeclaration(command = "deny", aliases = {"d",
"ban"}, description = "Deny a user from a plot", usage = "/plot deny <player>", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE)
public class Deny extends SubCommand {
@CommandDeclaration(command = "deny", aliases = {"d", "ban"},
description = "Deny a user from a plot", usage = "/plot deny <player>",
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Deny
extends SubCommand {
public Deny() {
super(Argument.PlayerName);

View File

@ -8,10 +8,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.NONE)
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.NONE) public class Desc extends SetCommand {
@Override public boolean set(PlotPlayer player, Plot plot, String desc) {
if (desc.isEmpty()) {

View File

@ -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 loc = player.getLocation();

View File

@ -13,9 +13,10 @@ import com.sk89q.jnbt.CompoundTag;
import java.net.URL;
@CommandDeclaration(usage = "/plot download [schematic|bo3|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|bo3|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();

View File

@ -14,9 +14,10 @@ import com.google.common.base.Optional;
import java.util.*;
@CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf",
"setflag"}, 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 {
@CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf", "setflag"},
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, Flag flag, String key, String value) {
key = key.toLowerCase();

View File

@ -15,8 +15,9 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.util.UUID;
@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);

View File

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

View File

@ -15,8 +15,10 @@ import com.google.common.base.Optional;
import java.util.ArrayList;
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.NONE)
public class Inbox extends SubCommand {
@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.NONE) public class Inbox
extends SubCommand {
public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
if (oldComments == null || oldComments.isEmpty()) {

View File

@ -9,8 +9,9 @@ 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>", category = CommandCategory.INFO)
public class Info extends SubCommand {
@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info",
usage = "/plot info <id>", category = CommandCategory.INFO) public class Info
extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
Plot plot;

View File

@ -17,9 +17,9 @@ 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.NONE)
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.NONE) public class Kick extends SubCommand {
public Kick() {
super(Argument.PlayerName);

View File

@ -12,8 +12,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import java.util.UUID;
@CommandDeclaration(command = "leave", description = "Leave a plot", permission = "plots.leave", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
public class Leave extends Command {
@CommandDeclaration(command = "leave", description = "Leave a plot", permission = "plots.leave",
category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE) public class Leave
extends Command {
public Leave() {
super(MainCommand.getInstance(), true);
}

View File

@ -13,8 +13,9 @@ import com.google.common.base.Optional;
import java.util.*;
import java.util.Map.Entry;
@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) {

View File

@ -15,9 +15,9 @@ 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();

View File

@ -14,8 +14,9 @@ import java.util.Arrays;
/**
* 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;

View File

@ -8,7 +8,10 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import java.util.UUID;
@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"};

View File

@ -9,9 +9,10 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
/**
* @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.NONE)
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.NONE) public class Middle
extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] arguments) {
Location location = player.getLocation();

View File

@ -10,9 +10,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(usage = "/plot move <X;Z>", command = "move", description = "Move a plot", aliases = {
"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
public class Move extends SubCommand {
@CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot",
aliases = {"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE) public class Move extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location loc = player.getLocation();

View File

@ -6,8 +6,10 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
@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 {
@Override public boolean onCommand(PlotPlayer player, String[] args) {
Location loc = player.getLocation();

View File

@ -9,8 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", usage = "/plot near", category = CommandCategory.INFO)
public class Near extends Command {
@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players",
usage = "/plot near", category = CommandCategory.INFO) public class Near extends Command {
public Near() {
super(MainCommand.getInstance(), true);
}

View File

@ -10,10 +10,10 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
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) {
Set<Plot> plots = plot.getConnectedPlots();

View File

@ -8,8 +8,9 @@ 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() {

View File

@ -18,8 +18,11 @@ 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) {

View File

@ -13,8 +13,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import java.util.*;
import java.util.Map.Entry;
@CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, requiredType = RequiredType.NONE)
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.NONE) public class Rate extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length == 1) {

View File

@ -14,9 +14,11 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import java.util.Set;
@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;

View File

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

View File

@ -14,8 +14,9 @@ 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 {

View File

@ -17,9 +17,10 @@ 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);

View File

@ -14,9 +14,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();
@ -52,8 +52,7 @@ public class Save extends SubCommand {
PlotId id = plot.getId();
String world1 = plot.getArea().toString().replaceAll(";", "-")
.replaceAll("[^A-Za-z0-9]", "");
final String file =
time + '_' + world1 + '_' + id.x + '_' + id.y + '_' + size;
final String file = time + '_' + world1 + '_' + id.x + '_' + id.y + '_' + size;
UUID uuid = player.getUUID();
SchematicHandler.manager.upload(value, uuid, file, new RunnableVal<URL>() {
@Override public void run(URL url) {

View File

@ -13,8 +13,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 <arg...>")
@CommandDeclaration(command = "schematic", permission = "plots.schematic",
description = "Schematic command", aliases = {"sch", "schem"},
category = CommandCategory.SCHEMATIC, usage = "/plot schematic <arg...>")
public class SchematicCmd extends SubCommand {
private boolean running = false;

View File

@ -16,9 +16,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@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"};

View File

@ -8,8 +8,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 = "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.NONE)
@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.NONE)
public class SetHome extends SetCommand {
@Override public boolean set(PlotPlayer player, Plot plot, String value) {

View File

@ -17,8 +17,9 @@ import javax.annotation.Nullable;
import java.util.*;
import java.util.Map.Entry;
@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 {
public void displayGenerators(PlotPlayer player) {
StringBuilder message = new StringBuilder();
@ -305,8 +306,7 @@ import java.util.Map.Entry;
private static final class StepPickGenerator extends SetupStep {
@Getter
private String generator;
@Getter private String generator;
public StepPickGenerator() {
super("generator");
@ -319,11 +319,17 @@ import java.util.Map.Entry;
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
final PlotMessage plotMessage = new PlotMessage(" - ").color("$8");
if (entry.getKey().equals(PlotSquared.imp().getPluginName())) {
plotMessage.text(entry.getKey()).color("$8").tooltip("Select this generator").color("$2").command("/plot setup generator " + entry.getKey()).text(" (Default Generator)").color("$7");
plotMessage.text(entry.getKey()).color("$8").tooltip("Select this generator")
.color("$2").command("/plot setup generator " + entry.getKey())
.text(" (Default Generator)").color("$7");
} else if (entry.getValue().isFull()) {
plotMessage.text(entry.getKey()).color("$8").tooltip("Select this generator").color("$7").command("/plot setup generator " + entry.getKey()).text(" (Plot Generator)").color("$7");
plotMessage.text(entry.getKey()).color("$8").tooltip("Select this generator")
.color("$7").command("/plot setup generator " + entry.getKey())
.text(" (Plot Generator)").color("$7");
} else {
plotMessage.text(entry.getKey()).color("$8").tooltip("Select this generator").color("$7").command("/plot setup generator " + entry.getKey()).text(" (Unknown Structure)").color("$7");
plotMessage.text(entry.getKey()).color("$8").tooltip("Select this generator")
.color("$7").command("/plot setup generator " + entry.getKey())
.text(" (Unknown Structure)").color("$7");
}
messages.add(plotMessage);
}
@ -344,14 +350,14 @@ import java.util.Map.Entry;
private static final class StepWorldType extends SetupStep {
private static final Map<String, String> WORLD_TYPES = new HashMap<>();
static {
WORLD_TYPES.put("default", "Standard plot generation");
WORLD_TYPES.put("augmented", "Plot generation with vanilla terrain");
WORLD_TYPES.put("partial", "Vanilla clusters of plots");
}
@Getter
private String worldType;
@Getter private String worldType;
public StepWorldType() {
super("type");
@ -361,8 +367,11 @@ import java.util.Map.Entry;
final List<PlotMessage> messages = new ArrayList<>();
messages.add(new PlotMessage("What world type do you want?").color("$6"));
for (final Map.Entry<String, String> worldType : WORLD_TYPES.entrySet()) {
messages.add(new PlotMessage(" - ").color("$8").text(worldType.getKey()).color(worldType.getKey().equals(getDefault()) ? "$2" : "$7")
.tooltip("Select this world type").command("/plot setup type " + worldType.getKey()).text(" (" +worldType.getValue() + ")").color("$7"));
messages.add(new PlotMessage(" - ").color("$8").text(worldType.getKey())
.color(worldType.getKey().equals(getDefault()) ? "$2" : "$7")
.tooltip("Select this world type")
.command("/plot setup type " + worldType.getKey())
.text(" (" + worldType.getValue() + ")").color("$7"));
}
return messages;
}
@ -380,18 +389,17 @@ import java.util.Map.Entry;
}
}
@ToString
@EqualsAndHashCode(of = "uuid")
@AllArgsConstructor
@ToString @EqualsAndHashCode(of = "uuid") @AllArgsConstructor
private static class SetupContext {
private final UUID uuid;
@Getter
private String step;
@Getter private String step;
}
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
private abstract static class SetupStep {
@ -402,16 +410,20 @@ import java.util.Map.Entry;
public abstract boolean parseInut(String input);
public final PlotMessage getUsage() {
return new PlotMessage("Usage: ").color("$1").text("/plot setup " + this.stepName + " <value>").color("$2")
.suggest("/plot setup " + this.stepName + (this.getDefault() != null ? this.getDefault() : ""));
return new PlotMessage("Usage: ").color("$1")
.text("/plot setup " + this.stepName + " <value>").color("$2").suggest(
"/plot setup " + this.stepName + (this.getDefault() != null ?
this.getDefault() :
""));
}
@Nullable public abstract String getDefault();
public void sendToPlayer(@NonNull final PlotPlayer plotPlayer) {
new PlotMessage("Setup Step: ").color("$6").text(this.stepName).color("$7").send(plotPlayer);
new PlotMessage("Setup Step: ").color("$6").text(this.stepName).color("$7")
.send(plotPlayer);
this.getUsage().send(plotPlayer);
this.showDescriptionMessage().forEach(plotMessage -> plotMessage.send(plotPlayer));
this.showDescriptionMessage().forEach(plotMessage -> plotMessage.send(plotPlayer));
if (this.getDefault() != null) {
new PlotMessage("Default: ").color("$6").text(this.getDefault()).color("$7");
}

View File

@ -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.NONE)
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots",
aliases = {"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
public class Swap extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {

View File

@ -10,8 +10,10 @@ 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);

View File

@ -21,8 +21,10 @@ 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 {

View File

@ -9,15 +9,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", description = "Toggle per user settings", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS)
public class Toggle extends Command {
@CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use",
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 admin chat spying")
@CommandDeclaration(command = "chatspy", aliases = {"spy"},
permission = "plots.admin.command.chat", description = "Toggle admin chat spying")
public void chatspy(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
@ -28,8 +28,8 @@ public class Toggle extends Command {
}
}
@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,7 +40,8 @@ public class Toggle extends Command {
}
}
@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) {
@ -51,7 +52,8 @@ public class Toggle extends Command {
}
}
@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) {
@ -62,7 +64,8 @@ public class Toggle extends Command {
}
}
@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) {

View File

@ -23,8 +23,10 @@ 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;

View File

@ -16,9 +16,10 @@ import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
@CommandDeclaration(command = "trust", aliases = {
"t"}, requiredType = RequiredType.NONE, usage = "/plot trust <player>", description = "Allow a user to build in a plot while you are offline", category = CommandCategory.SETTINGS)
public class Trust extends Command {
@CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.NONE,
usage = "/plot trust <player>",
description = "Allow a user to build in a plot while you are offline",
category = CommandCategory.SETTINGS) public class Trust extends Command {
public Trust() {
super(MainCommand.getInstance(), true);

View File

@ -7,9 +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.*;
@CommandDeclaration(command = "unlink", aliases = {"u",
"unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS, confirmation = true)
public class Unlink extends SubCommand {
@CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"},
description = "Unlink a mega-plot", usage = "/plot unlink", requiredType = RequiredType.NONE,
category = CommandCategory.SETTINGS, confirmation = true) public class Unlink
extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) {

View File

@ -13,10 +13,10 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.util.*;
@CommandDeclaration(command = "visit", permission = "plots.visit", description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]", aliases = {
"v", "tp", "teleport", "goto", "home",
"h"}, requiredType = RequiredType.NONE, 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"}, requiredType = RequiredType.NONE,
category = CommandCategory.TELEPORT) public class Visit extends Command {
public Visit() {
super(MainCommand.getInstance(), true);

View File

@ -3,9 +3,10 @@ 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", 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", 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);

View File

@ -864,7 +864,8 @@ public enum C {
+ "Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. "
+ "You need to re-generate the schematics.",
"LegacyConfig"), LEGACY_CONFIG_CONVERSION_FAILED(
"Failed to convert the legacy configuration file. See stack trace for information.", "LegacyConfig"),
"Failed to convert the legacy configuration file. See stack trace for information.",
"LegacyConfig"),
CUSTOM_STRING("-", "-");
@ -1063,4 +1064,5 @@ public enum C {
} else {
caller.sendMessage(msg);
}
}}
}
}

View File

@ -113,7 +113,7 @@ public class Configuration {
if (value == null) {
throw new UnknownBlockException(block);
} else if (!value.best.isAir() && !WorldUtil.IMP.isBlockSolid(value.best)) {
throw new UnsafeBlockException(value.best);
throw new UnsafeBlockException(value.best);
}
blockBucket.addBlock(value.best, chance);
}
@ -146,7 +146,7 @@ public class Configuration {
if (value == null || value.match > 1) {
return false;
} else if (!value.best.isAir() && !WorldUtil.IMP.isBlockSolid(value.best)) {
throw new UnsafeBlockException(value.best);
throw new UnsafeBlockException(value.best);
}
}
} catch (final Throwable exception) {
@ -204,10 +204,10 @@ public class Configuration {
public abstract boolean validateValue(String string);
}
public static final class UnsafeBlockException extends IllegalArgumentException {
@Getter
private final PlotBlock unsafeBlock;
@Getter private final PlotBlock unsafeBlock;
public UnsafeBlockException(@NonNull final PlotBlock unsafeBlock) {
super(String.format("%s is not a valid block", unsafeBlock));

View File

@ -301,7 +301,8 @@ 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;
}
@ -317,8 +318,8 @@ public class Settings extends Config {
}
@Comment({"Enable or disable part of the plugin",
"Note: A cache will use some memory if enabled"})
@Comment(
{"Enable or disable part 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;

View File

@ -1,7 +1,10 @@
package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
/**

View File

@ -15,15 +15,9 @@ import java.util.Map;
/**
* Converts legacy configurations into the new (BlockBucket) format
*/
@SuppressWarnings("unused")
public final class LegacyConverter {
@SuppressWarnings("unused") public final class LegacyConverter {
public static final String CONFIGURATION_VERSION = "post_flattening";
private enum ConfigurationType {
BLOCK, BLOCK_LIST
}
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
static {
@ -46,7 +40,8 @@ public final class LegacyConverter {
return BlockBucket.withSingle(plotBlock);
}
private void setString(@NonNull final ConfigurationSection section, @NonNull final String string, @NonNull final BlockBucket blocks) {
private void setString(@NonNull final ConfigurationSection section,
@NonNull final String string, @NonNull final BlockBucket blocks) {
if (!section.contains(string)) {
throw new IllegalArgumentException(String.format("No such key: %s", string));
}
@ -88,19 +83,20 @@ public final class LegacyConverter {
return entries;
}
private void convertBlock(@NonNull final ConfigurationSection section, @NonNull final String key,
@NonNull final String block) {
private void convertBlock(@NonNull final ConfigurationSection section,
@NonNull final String key, @NonNull final String block) {
final BlockBucket bucket = this.blockToBucket(block);
this.setString(section, key, bucket);
PlotSquared.log(C.LEGACY_CONFIG_REPLACED.f(block, bucket.toString()));
}
private void convertBlockList(@NonNull final ConfigurationSection section, @NonNull final String key,
@NonNull final List<String> blockList) {
private void convertBlockList(@NonNull final ConfigurationSection section,
@NonNull final String key, @NonNull final List<String> blockList) {
final PlotBlock[] blocks = this.splitBlockList(blockList);
final BlockBucket bucket = this.blockListToBucket(blocks);
this.setString(section, key, bucket);
PlotSquared.log(C.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
PlotSquared
.log(C.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
}
private String plotBlockArrayString(@NonNull final PlotBlock[] blocks) {
@ -120,13 +116,19 @@ public final class LegacyConverter {
for (final String world : worlds) {
final ConfigurationSection worldSection = configuration.getConfigurationSection(world);
for (final Map.Entry<String, ConfigurationType> entry : TYPE_MAP.entrySet()) {
if (entry.getValue() == ConfigurationType.BLOCK) {
this.convertBlock(worldSection, entry.getKey(), worldSection.getString(entry.getKey()));
} else {
this.convertBlockList(worldSection, entry.getKey(), worldSection.getStringList(entry.getKey()));
}
if (entry.getValue() == ConfigurationType.BLOCK) {
this.convertBlock(worldSection, entry.getKey(),
worldSection.getString(entry.getKey()));
} else {
this.convertBlockList(worldSection, entry.getKey(),
worldSection.getStringList(entry.getKey()));
}
}
}
}
private enum ConfigurationType {
BLOCK, BLOCK_LIST
}
}

View File

@ -119,25 +119,24 @@ public class MainUtil {
String boundary = Long.toHexString(System.currentTimeMillis());
URLConnection con = new URL(website).openConnection();
con.setDoOutput(true);
con.setRequestProperty("Content-Type",
"multipart/form-data; boundary=" + boundary);
con.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
try (OutputStream output = con.getOutputStream();
PrintWriter writer = new PrintWriter(
new OutputStreamWriter(output, StandardCharsets.UTF_8), true)) {
String CRLF = "\r\n";
writer.append("--" + boundary).append(CRLF);
writer.append("Content-Disposition: form-data; name=\"param\"")
writer.append("Content-Disposition: form-data; name=\"param\"").append(CRLF);
writer.append(
"Content-Type: text/plain; charset=" + StandardCharsets.UTF_8.displayName())
.append(CRLF);
writer.append("Content-Type: text/plain; charset=" + StandardCharsets.UTF_8
.displayName()).append(CRLF);
String param = "value";
writer.append(CRLF).append(param).append(CRLF).flush();
writer.append("--" + boundary).append(CRLF);
writer.append(
"Content-Disposition: form-data; name=\"schematicFile\"; filename=\""
+ filename + '"').append(CRLF);
writer.append(
"Content-Type: " + URLConnection.guessContentTypeFromName(filename))
writer
.append("Content-Type: " + URLConnection.guessContentTypeFromName(filename))
.append(CRLF);
writer.append("Content-Transfer-Encoding: binary").append(CRLF);
writer.append(CRLF).flush();
@ -150,7 +149,8 @@ public class MainUtil {
writer.append(CRLF).flush();
writer.append("--" + boundary + "--").append(CRLF).flush();
}
try (Reader response = new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8)) {
try (Reader response = new InputStreamReader(con.getInputStream(),
StandardCharsets.UTF_8)) {
final char[] buffer = new char[256];
final StringBuilder result = new StringBuilder();
while (true) {

View File

@ -259,7 +259,7 @@
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation"
value="do not insert"/>
value="insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration"
value="do not insert"/>
@ -312,7 +312,7 @@
value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation"
value="false"/>
value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch"
value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer"