Merge remote-tracking branch 'origin/breaking' into breaking

This commit is contained in:
Sauilitired 2018-12-26 19:16:42 +01:00
commit f1cf541606
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
83 changed files with 587 additions and 504 deletions

View File

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

View File

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

View File

@ -206,8 +206,8 @@ public class BukkitChunkManager extends ChunkManager {
RegionWrapper currentPlotClear = RegionWrapper currentPlotClear =
new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) { if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
AugmentedUtils.bypass(ignoreAugment, AugmentedUtils
() -> queue.regenChunkSafe(chunk.x, chunk.z)); .bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z));
continue; continue;
} }
boolean checkX1 = false; boolean checkX1 = false;
@ -270,39 +270,38 @@ public class BukkitChunkManager extends ChunkManager {
map.saveRegion(worldObj, xxt2, xxt, zzt2, zzt); // map.saveRegion(worldObj, xxt2, xxt, zzt2, zzt); //
} }
map.saveEntitiesOut(chunkObj, currentPlotClear); map.saveEntitiesOut(chunkObj, currentPlotClear);
AugmentedUtils.bypass(ignoreAugment, () -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() { AugmentedUtils.bypass(ignoreAugment,
@Override public void run(ScopedLocalBlockQueue value) { () -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
com.github.intellectualsites.plotsquared.plot.object.Location @Override public void run(ScopedLocalBlockQueue value) {
min = value.getMin(); com.github.intellectualsites.plotsquared.plot.object.Location min =
int bx = min.getX(); value.getMin();
int bz = min.getZ(); int bx = min.getX();
for (int x1 = 0; x1 < 16; x1++) { int bz = min.getZ();
for (int z1 = 0; z1 < 16; z1++) { for (int x1 = 0; x1 < 16; x1++) {
PlotLoc loc = new PlotLoc(bx + x1, bz + z1); for (int z1 = 0; z1 < 16; z1++) {
PlotBlock[] ids = map.allBlocks.get(loc); PlotLoc loc = new PlotLoc(bx + x1, bz + z1);
if (ids != null) { PlotBlock[] ids = map.allBlocks.get(loc);
for (int y = 0; if (ids != null) {
y < Math.min(128, ids.length); y++) { for (int y = 0; y < Math.min(128, ids.length); y++) {
PlotBlock id = ids[y]; PlotBlock id = ids[y];
if (id != null) { if (id != null) {
value.setBlock(x1, y, z1, id); value.setBlock(x1, y, z1, id);
} else { } else {
value.setBlock(x1, y, z1, value.setBlock(x1, y, z1, PlotBlock.get("air"));
PlotBlock.get("air")); }
} }
} for (int y = Math.min(128, ids.length);
for (int y = Math.min(128, ids.length); y < ids.length; y++) {
y < ids.length; y++) { PlotBlock id = ids[y];
PlotBlock id = ids[y]; if (id != null) {
if (id != null) { value.setBlock(x1, y, z1, id);
value.setBlock(x1, y, z1, id); }
} }
} }
} }
} }
} }
} }, world, chunk));
}, world, chunk));
map.restoreBlocks(worldObj, 0, 0); map.restoreBlocks(worldObj, 0, 0);
map.restoreEntities(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, public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
final boolean safe) { final boolean safe) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask( TaskManager
() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe)); .runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe));
} else { } else {
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe); 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()) { for (final Material material : Material.values()) {
final String materialName = material.name().toLowerCase(Locale.ENGLISH); final String materialName = material.name().toLowerCase(Locale.ENGLISH);
if (OLD_STRING_TO_STRING_PLOT_BLOCK.get(materialName) == null) { 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); missing.add(missingBlock);
} }
} }
@ -692,8 +693,9 @@ public final class BukkitLegacyMappings extends LegacyMappings {
.put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()), .put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()),
legacyBlock.toStringPlotBlock()); legacyBlock.toStringPlotBlock());
} */ } */
LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK.put(new IdDataPair(legacyBlock.getNumericalId(), LEGACY_ID_AND_DATA_TO_STRING_PLOT_BLOCK
legacyBlock.getDataValue()), legacyBlock.toStringPlotBlock()); .put(new IdDataPair(legacyBlock.getNumericalId(), legacyBlock.getDataValue()),
legacyBlock.toStringPlotBlock());
NEW_STRING_TO_LEGACY_PLOT_BLOCK NEW_STRING_TO_LEGACY_PLOT_BLOCK
.put(legacyBlock.getLegacyName(), legacyBlock.toStringPlotBlock()); .put(legacyBlock.getLegacyName(), legacyBlock.toStringPlotBlock());
OLD_STRING_TO_STRING_PLOT_BLOCK 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.Set;
import java.util.UUID; 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) @CommandDeclaration(command = "add",
public class Add extends Command { 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() { public Add() {
super(MainCommand.getInstance(), true); 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.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; 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 = { @CommandDeclaration(command = "setalias", permission = "plots.alias",
"alias", "sa", "name", "rename", "setname", "seta", description = "Set the plot name", usage = "/plot alias <set|remove> <alias>",
"nameplot"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"},
public class Alias extends SubCommand { category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Alias
extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @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.Objects;
import java.util.Set; 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) @CommandDeclaration(command = "area", permission = "plots.area",
public class Area extends SubCommand { 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) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length == 0) { if (args.length == 0) {

View File

@ -11,7 +11,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Set; 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 { public class Auto extends SubCommand {
@Deprecated public static PlotId getNextPlotId(PlotId id, int step) { @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.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; 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 = { @CommandDeclaration(command = "setbiome", permission = "plots.set.biome",
"biome", "sb", "setb", description = "Set the plot biome", usage = "/plot biome [biome]",
"b"}, category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE) aliases = {"biome", "sb", "setb", "b"}, category = CommandCategory.APPEARANCE,
public class Biome extends SetCommand { requiredType = RequiredType.NONE) public class Biome extends SetCommand {
@Override public boolean set(final PlotPlayer player, final Plot plot, final String value) { @Override public boolean set(final PlotPlayer player, final Plot plot, final String value) {
int biome = WorldUtil.IMP.getBiomeFromString(value); int biome = WorldUtil.IMP.getBiomeFromString(value);

View File

@ -15,8 +15,9 @@ import com.google.common.base.Optional;
import java.util.Set; 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) @CommandDeclaration(command = "buy", description = "Buy the plot you are standing on",
public class Buy extends Command { usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE) public class Buy extends Command {
public Buy() { public Buy() {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);

View File

@ -10,8 +10,10 @@ import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.Scanner; import java.util.Scanner;
@CommandDeclaration(command = "changelog", permission = "plots.admin.command.changelog", description = "View the changelog", usage = "/plot changelog", requiredType = RequiredType.NONE, aliases = { @CommandDeclaration(command = "changelog", permission = "plots.admin.command.changelog",
"cl"}, category = CommandCategory.ADMINISTRATION) public class Changelog extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
try { 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.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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) @CommandDeclaration(command = "chat", description = "Toggle plot chat on or off",
public class Chat extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
MainCommand.getInstance().toggle.chat(this, player, new String[0], null, null); 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.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager; 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 { public class Claim extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @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.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; 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) @CommandDeclaration(command = "clear", description = "Clear the plot you stand on",
public class Clear extends Command { 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 // Note: To clear a specific plot use /plot <plot> clear
// The syntax also works with any command: /plot <plot> <command> // 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.Set;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "cluster", aliases = "clusters", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, permission = "plots.cluster", description = "Manage a plot cluster") @CommandDeclaration(command = "cluster", aliases = "clusters",
public class Cluster extends SubCommand { 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) { @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.Arrays;
import java.util.Map.Entry; import java.util.Map.Entry;
@CommandDeclaration(command = "comment", aliases = { @CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot",
"msg"}, description = "Comment on a plot", category = CommandCategory.CHAT, requiredType = RequiredType.NONE, permission = "plots.comment") category = CommandCategory.CHAT, requiredType = RequiredType.NONE, permission = "plots.comment")
public class Comment extends SubCommand { public class Comment extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {

View File

@ -15,8 +15,9 @@ import java.util.*;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@CommandDeclaration(command = "condense", permission = "plots.admin", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE) @CommandDeclaration(command = "condense", permission = "plots.admin",
public class Condense extends SubCommand { description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand {
public static boolean TASK = false; 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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
@CommandDeclaration(command = "confirm", permission = "plots.use", description = "Confirm an action", category = CommandCategory.INFO) @CommandDeclaration(command = "confirm", permission = "plots.use",
public class Confirm extends SubCommand { description = "Confirm an action", category = CommandCategory.INFO) public class Confirm
extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
CmdInstance command = CmdConfirm.getPending(player); 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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; 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) @CommandDeclaration(command = "continue",
public class Continue extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
Plot plot = player.getCurrentPlot(); 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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@CommandDeclaration(command = "copy", permission = "plots.copy", aliases = { @CommandDeclaration(command = "copy", permission = "plots.copy", aliases = {"copypaste"},
"copypaste"}, category = CommandCategory.CLAIMING, description = "Copy a plot", usage = "/plot copy <X;Z>", requiredType = RequiredType.NONE) category = CommandCategory.CLAIMING, description = "Copy a plot", usage = "/plot copy <X;Z>",
public class Copy extends SubCommand { requiredType = RequiredType.NONE) public class Copy extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location loc = player.getLocation(); 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.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@CommandDeclaration(command = "createroadschematic", aliases = { @CommandDeclaration(command = "createroadschematic", aliases = {"crs"},
"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") category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
public class CreateRoadSchematic extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
Location loc = player.getLocation(); Location loc = player.getLocation();

View File

@ -22,9 +22,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
@CommandDeclaration(command = "database", aliases = { @CommandDeclaration(command = "database", aliases = {"convert"},
"convert"}, category = CommandCategory.ADMINISTRATION, permission = "plots.database", description = "Convert/Backup Storage", requiredType = RequiredType.CONSOLE, usage = "/plot database [area] <sqlite|mysql|import>") category = CommandCategory.ADMINISTRATION, permission = "plots.database",
public class Database extends SubCommand { 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, public static void insertPlots(final SQLManager manager, final List<Plot> plots,
final PlotPlayer player) { 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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan; 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 { public class Debug extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @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.List;
import java.util.UUID; 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") @CommandDeclaration(command = "debugallowunsafe",
public class DebugAllowUnsafe extends SubCommand { 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<>(); public static final List<UUID> unsafeAllowed = new ArrayList<>();

View File

@ -17,7 +17,8 @@ import java.util.UUID;
@CommandDeclaration(command = "debugclaimtest", description = @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. " "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 { public class DebugClaimTest extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @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.sql.Timestamp;
import java.util.*; import java.util.*;
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = { @CommandDeclaration(command = "debugexec", permission = "plots.admin",
"exec", "$"}, category = CommandCategory.DEBUG) public class DebugExec extends SubCommand { description = "Mutli-purpose debug command", aliases = {"exec", "$"},
category = CommandCategory.DEBUG) public class DebugExec extends SubCommand {
private ScriptEngine engine; private ScriptEngine engine;
private Bindings scope; private Bindings scope;

View File

@ -16,7 +16,9 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; 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 class DebugFixFlags extends SubCommand {
public DebugFixFlags() { public DebugFixFlags() {

View File

@ -17,8 +17,9 @@ import com.google.common.base.Charsets;
import java.io.File; import java.io.File;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "debugimportworlds", permission = "plots.admin", description = "Import worlds by player name", requiredType = RequiredType.CONSOLE, category = CommandCategory.TELEPORT) @CommandDeclaration(command = "debugimportworlds", permission = "plots.admin",
public class DebugImportWorlds extends Command { description = "Import worlds by player name", requiredType = RequiredType.CONSOLE,
category = CommandCategory.TELEPORT) public class DebugImportWorlds extends Command {
public DebugImportWorlds() { public DebugImportWorlds() {
super(MainCommand.getInstance(), true); 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.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; 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) @CommandDeclaration(command = "debugloadtest", permission = "plots.debugloadtest",
public class DebugLoadTest extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
PlotSquared.get().plots_tmp = DBFunc.getPlots(); 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.File;
import java.io.IOException; 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) @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
public class DebugPaste extends SubCommand { 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) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
TaskManager.runTaskAsync(new Runnable() { 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.config.C;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; 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 { public class DebugRoadRegen extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
@ -20,24 +24,7 @@ public class DebugRoadRegen extends SubCommand {
} }
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); C.NOT_IN_PLOT.send(player);
int extend = 0;
if (args.length == 1) {
if (MathMan.isInteger(args[0])) {
try {
extend = Integer.parseInt(args[0]);
} catch (NumberFormatException ignored) {
C.NOT_VALID_NUMBER.send(player, "(0, <EXTEND HEIGHT>)");
return false;
}
}
}
boolean result = HybridUtils.manager.regenerateRoad(plotArea, chunk, extend);
MainUtil.sendMessage(player,
"&6Regenerating chunk: " + chunk.x + ',' + chunk.z + "\n&6 - Result: " + (result ?
"&aSuccess" :
"&cFailed"));
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
} else { } else {
HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager(); HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager();
manager.createRoadEast(plotArea, plot); manager.createRoadEast(plotArea, plot);

View File

@ -9,7 +9,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import java.util.ArrayList; 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 { public class DebugSaveTest extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @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.*; import com.github.intellectualsites.plotsquared.plot.util.*;
@CommandDeclaration(command = "delete", permission = "plots.delete", description = "Delete the plot you stand on", usage = "/plot delete", aliases = { @CommandDeclaration(command = "delete", permission = "plots.delete",
"dispose", description = "Delete the plot you stand on", usage = "/plot delete",
"del"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true) aliases = {"dispose", "del"}, category = CommandCategory.CLAIMING,
public class Delete extends SubCommand { requiredType = RequiredType.NONE, confirmation = true) public class Delete extends SubCommand {
// Note: To delete a specific plot use /plot <plot> delete // Note: To delete a specific plot use /plot <plot> delete
// The syntax also works with any command: /plot <plot> <command> // The syntax also works with any command: /plot <plot> <command>

View File

@ -14,9 +14,10 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "deny", aliases = {"d", @CommandDeclaration(command = "deny", aliases = {"d", "ban"},
"ban"}, description = "Deny a user from a plot", usage = "/plot deny <player>", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) description = "Deny a user from a plot", usage = "/plot deny <player>",
public class Deny extends SubCommand { category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Deny
extends SubCommand {
public Deny() { public Deny() {
super(Argument.PlayerName); 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.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; 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 = { @CommandDeclaration(command = "setdescription", permission = "plots.set.desc",
"desc", "setdesc", "setd", description = "Set the plot description", usage = "/plot desc <description>",
"description"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) aliases = {"desc", "setdesc", "setd", "description"}, category = CommandCategory.SETTINGS,
public class Desc extends SetCommand { requiredType = RequiredType.NONE) public class Desc extends SetCommand {
@Override public boolean set(PlotPlayer player, Plot plot, String desc) { @Override public boolean set(PlotPlayer player, Plot plot, String desc) {
if (desc.isEmpty()) { 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.ExpireManager;
import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
@CommandDeclaration(command = "done", aliases = { @CommandDeclaration(command = "done", aliases = {"submit"}, description = "Mark a plot as done",
"submit"}, description = "Mark a plot as done", permission = "plots.done", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) permission = "plots.done", category = CommandCategory.SETTINGS,
public class Done extends SubCommand { requiredType = RequiredType.NONE) public class Done extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location loc = player.getLocation(); Location loc = player.getLocation();

View File

@ -13,9 +13,10 @@ import com.sk89q.jnbt.CompoundTag;
import java.net.URL; import java.net.URL;
@CommandDeclaration(usage = "/plot download [schematic|bo3|world]", command = "download", aliases = { @CommandDeclaration(usage = "/plot download [schematic|bo3|world]", command = "download",
"dl"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Download your plot", permission = "plots.download") aliases = {"dl"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE,
public class Download extends SubCommand { description = "Download your plot", permission = "plots.download") public class Download
extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld(); String world = player.getLocation().getWorld();

View File

@ -14,9 +14,10 @@ import com.google.common.base.Optional;
import java.util.*; import java.util.*;
@CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf", @CommandDeclaration(command = "setflag", aliases = {"f", "flag", "setf", "setflag"},
"setflag"}, usage = "/plot flag <set|remove|add|list|info> <flag> <value>", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") usage = "/plot flag <set|remove|add|list|info> <flag> <value>", description = "Set plot flags",
public class FlagCmd extends SubCommand { category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE,
permission = "plots.flag") public class FlagCmd extends SubCommand {
private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) {
key = key.toLowerCase(); key = key.toLowerCase();

View File

@ -15,8 +15,9 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, usage = "/plot grant <check|add> [player]", permission = "plots.grant", requiredType = RequiredType.NONE) @CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING,
public class Grant extends Command { usage = "/plot grant <check|add> [player]", permission = "plots.grant",
requiredType = RequiredType.NONE) public class Grant extends Command {
public Grant() { public Grant() {
super(MainCommand.getInstance(), true); 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.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu; import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu;
@CommandDeclaration(command = "help", description = "Get this help menu", aliases = {"he", @CommandDeclaration(command = "help", description = "Get this help menu", aliases = {"he", "?"},
"?"}, category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use")
public class Help extends Command { public class Help extends Command {
public Help(Command parent) { public Help(Command parent) {
super(parent, true); super(parent, true);

View File

@ -15,8 +15,10 @@ import com.google.common.base.Optional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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) @CommandDeclaration(command = "inbox", description = "Review the comments for a plot",
public class Inbox extends SubCommand { 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) { public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
if (oldComments == null || oldComments.isEmpty()) { if (oldComments == null || oldComments.isEmpty()) {

View File

@ -9,8 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info", usage = "/plot info <id>", category = CommandCategory.INFO) @CommandDeclaration(command = "info", aliases = "i", description = "Display plot info",
public class Info extends SubCommand { usage = "/plot info <id>", category = CommandCategory.INFO) public class Info
extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Plot plot; Plot plot;

View File

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

View File

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

View File

@ -13,8 +13,9 @@ import com.google.common.base.Optional;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@CommandDeclaration(command = "list", aliases = {"l", "find", @CommandDeclaration(command = "list", aliases = {"l", "find", "search"}, description = "List plots",
"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...>> [#]") 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 { public class ListCmd extends SubCommand {
private String[] getArgumentList(PlotPlayer player) { private String[] getArgumentList(PlotPlayer player) {

View File

@ -15,9 +15,9 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
@CommandDeclaration(command = "load", aliases = { @CommandDeclaration(command = "load", aliases = {"restore"}, category = CommandCategory.SCHEMATIC,
"restore"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load", usage = "/plot load") requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load",
public class Load extends SubCommand { usage = "/plot load") public class Load extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld(); String world = player.getLocation().getWorld();

View File

@ -14,8 +14,9 @@ import java.util.Arrays;
/** /**
* PlotSquared command class. * PlotSquared command class.
*/ */
@CommandDeclaration(command = "plot", aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", @CommandDeclaration(command = "plot",
"2", "plotme", "plotz", "ap"}) public class MainCommand extends Command { aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"})
public class MainCommand extends Command {
private static MainCommand instance; private static MainCommand instance;
public Help help; public Help help;

View File

@ -8,7 +8,10 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import java.util.UUID; 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 class Merge extends SubCommand {
public static final String[] values = new String[] {"north", "east", "south", "west", "auto"}; 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 * @author manuelgu, altered by Citymonstret
*/ */
@CommandDeclaration(command = "middle", aliases = {"center", @CommandDeclaration(command = "middle", aliases = {"center", "centre"},
"centre"}, description = "Teleports you to the center of the plot", usage = "/plot middle", category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE) description = "Teleports you to the center of the plot", usage = "/plot middle",
public class Middle extends SubCommand { category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE) public class Middle
extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] arguments) { @Override public boolean onCommand(PlotPlayer player, String[] arguments) {
Location location = player.getLocation(); 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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot", aliases = { @CommandDeclaration(usage = "/plot move <X;Z>", command = "move", description = "Move a plot",
"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE) aliases = {"debugmove"}, permission = "plots.move", category = CommandCategory.CLAIMING,
public class Move extends SubCommand { requiredType = RequiredType.NONE) public class Move extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
Location loc = player.getLocation(); Location loc = player.getLocation();

View File

@ -9,8 +9,10 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; 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) @CommandDeclaration(command = "music", permission = "plots.music",
public class Music extends SubCommand { 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", private static final Collection<String> DISCS = Arrays.asList("music_disc_13", "music_disc_cat",
"music_disc_blocks", "music_disc_chirp", "music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_blocks", "music_disc_chirp", "music_disc_far", "music_disc_mall", "music_disc_mellohi",

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

View File

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

View File

@ -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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager; 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) @CommandDeclaration(command = "plugin", permission = "plots.use",
public class PluginCmd extends SubCommand { 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) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
TaskManager.IMP.taskAsync(new Runnable() { TaskManager.IMP.taskAsync(new Runnable() {

View File

@ -18,8 +18,11 @@ import java.util.HashSet;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; 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) @CommandDeclaration(
public class Purge extends SubCommand { 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) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length == 0) { if (args.length == 0) {

View File

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

View File

@ -14,9 +14,11 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import java.util.Set; import java.util.Set;
@CommandDeclaration(command = "regenallroads", description = "Regenerate all roads in the map using the set road schematic", aliases = { @CommandDeclaration(command = "regenallroads",
"rgar"}, usage = "/plot regenallroads <world> [height]", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, permission = "plots.regenallroads") description = "Regenerate all roads in the map using the set road schematic",
public class RegenAllRoads extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
int height = 0; int height = 0;

View File

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

View File

@ -14,8 +14,9 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; 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) @CommandDeclaration(command = "reload", aliases = "rl", permission = "plots.admin.command.reload",
public class Reload extends SubCommand { 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) { @Override public boolean onCommand(PlotPlayer player, String[] args) {
try { try {

View File

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

View File

@ -14,9 +14,9 @@ import java.net.URL;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "save", aliases = { @CommandDeclaration(command = "save", aliases = {"backup"}, description = "Save your plot",
"backup"}, description = "Save your plot", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, permission = "plots.save") category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE,
public class Save extends SubCommand { permission = "plots.save") public class Save extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
String world = player.getLocation().getWorld(); String world = player.getLocation().getWorld();
@ -52,8 +52,7 @@ public class Save extends SubCommand {
PlotId id = plot.getId(); PlotId id = plot.getId();
String world1 = plot.getArea().toString().replaceAll(";", "-") String world1 = plot.getArea().toString().replaceAll(";", "-")
.replaceAll("[^A-Za-z0-9]", ""); .replaceAll("[^A-Za-z0-9]", "");
final String file = final String file = time + '_' + world1 + '_' + id.x + '_' + id.y + '_' + size;
time + '_' + world1 + '_' + id.x + '_' + id.y + '_' + size;
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
SchematicHandler.manager.upload(value, uuid, file, new RunnableVal<URL>() { SchematicHandler.manager.upload(value, uuid, file, new RunnableVal<URL>() {
@Override public void run(URL url) { @Override public void run(URL url) {

View File

@ -13,8 +13,9 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "schematic", permission = "plots.schematic", description = "Schematic command", aliases = { @CommandDeclaration(command = "schematic", permission = "plots.schematic",
"sch", "schem"}, category = CommandCategory.SCHEMATIC, usage = "/plot schematic <arg...>") description = "Schematic command", aliases = {"sch", "schem"},
category = CommandCategory.SCHEMATIC, usage = "/plot schematic <arg...>")
public class SchematicCmd extends SubCommand { public class SchematicCmd extends SubCommand {
private boolean running = false; private boolean running = false;

View File

@ -16,9 +16,10 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@CommandDeclaration(command = "set", description = "Set a plot value", aliases = { @CommandDeclaration(command = "set", description = "Set a plot value", aliases = {"s"},
"s"}, usage = "/plot set <biome|alias|home|flag> <value...>", permission = "plots.set", category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE) usage = "/plot set <biome|alias|home|flag> <value...>", permission = "plots.set",
public class Set extends SubCommand { 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[] values = new String[] {"biome", "alias", "home", "flag"};
public static final String[] aliases = new String[] {"b", "w", "wf", "f", "a", "h", "fl"}; 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.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; 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 = { @CommandDeclaration(command = "sethome", permission = "plots.set.home",
"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) 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 { public class SetHome extends SetCommand {
@Override public boolean set(PlotPlayer player, Plot plot, String value) { @Override public boolean set(PlotPlayer player, Plot plot, String value) {

View File

@ -17,8 +17,9 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@CommandDeclaration(command = "setup", permission = "plots.admin.command.setup", description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = { @CommandDeclaration(command = "setup", permission = "plots.admin.command.setup",
"create"}, category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand { description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = {"create"},
category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand {
public void displayGenerators(PlotPlayer player) { public void displayGenerators(PlotPlayer player) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
@ -305,8 +306,7 @@ import java.util.Map.Entry;
private static final class StepPickGenerator extends SetupStep { private static final class StepPickGenerator extends SetupStep {
@Getter @Getter private String generator;
private String generator;
public StepPickGenerator() { public StepPickGenerator() {
super("generator"); super("generator");
@ -319,11 +319,17 @@ import java.util.Map.Entry;
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) { for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
final PlotMessage plotMessage = new PlotMessage(" - ").color("$8"); final PlotMessage plotMessage = new PlotMessage(" - ").color("$8");
if (entry.getKey().equals(PlotSquared.imp().getPluginName())) { 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()) { } 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 { } 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); messages.add(plotMessage);
} }
@ -344,14 +350,14 @@ import java.util.Map.Entry;
private static final class StepWorldType extends SetupStep { private static final class StepWorldType extends SetupStep {
private static final Map<String, String> WORLD_TYPES = new HashMap<>(); private static final Map<String, String> WORLD_TYPES = new HashMap<>();
static { static {
WORLD_TYPES.put("default", "Standard plot generation"); WORLD_TYPES.put("default", "Standard plot generation");
WORLD_TYPES.put("augmented", "Plot generation with vanilla terrain"); WORLD_TYPES.put("augmented", "Plot generation with vanilla terrain");
WORLD_TYPES.put("partial", "Vanilla clusters of plots"); WORLD_TYPES.put("partial", "Vanilla clusters of plots");
} }
@Getter @Getter private String worldType;
private String worldType;
public StepWorldType() { public StepWorldType() {
super("type"); super("type");
@ -361,8 +367,11 @@ import java.util.Map.Entry;
final List<PlotMessage> messages = new ArrayList<>(); final List<PlotMessage> messages = new ArrayList<>();
messages.add(new PlotMessage("What world type do you want?").color("$6")); messages.add(new PlotMessage("What world type do you want?").color("$6"));
for (final Map.Entry<String, String> worldType : WORLD_TYPES.entrySet()) { 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") messages.add(new PlotMessage(" - ").color("$8").text(worldType.getKey())
.tooltip("Select this world type").command("/plot setup type " + worldType.getKey()).text(" (" +worldType.getValue() + ")").color("$7")); .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; return messages;
} }
@ -380,18 +389,17 @@ import java.util.Map.Entry;
} }
} }
@ToString
@EqualsAndHashCode(of = "uuid") @ToString @EqualsAndHashCode(of = "uuid") @AllArgsConstructor
@AllArgsConstructor
private static class SetupContext { private static class SetupContext {
private final UUID uuid; private final UUID uuid;
@Getter @Getter private String step;
private String step;
} }
@RequiredArgsConstructor(access = AccessLevel.PROTECTED) @RequiredArgsConstructor(access = AccessLevel.PROTECTED)
private abstract static class SetupStep { private abstract static class SetupStep {
@ -402,16 +410,20 @@ import java.util.Map.Entry;
public abstract boolean parseInut(String input); public abstract boolean parseInut(String input);
public final PlotMessage getUsage() { public final PlotMessage getUsage() {
return new PlotMessage("Usage: ").color("$1").text("/plot setup " + this.stepName + " <value>").color("$2") return new PlotMessage("Usage: ").color("$1")
.suggest("/plot setup " + this.stepName + (this.getDefault() != null ? this.getDefault() : "")); .text("/plot setup " + this.stepName + " <value>").color("$2").suggest(
"/plot setup " + this.stepName + (this.getDefault() != null ?
this.getDefault() :
""));
} }
@Nullable public abstract String getDefault(); @Nullable public abstract String getDefault();
public void sendToPlayer(@NonNull final PlotPlayer plotPlayer) { 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.getUsage().send(plotPlayer);
this.showDescriptionMessage().forEach(plotMessage -> plotMessage.send(plotPlayer)); this.showDescriptionMessage().forEach(plotMessage -> plotMessage.send(plotPlayer));
if (this.getDefault() != null) { if (this.getDefault() != null) {
new PlotMessage("Default: ").color("$6").text(this.getDefault()).color("$7"); 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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.Permissions;
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots", aliases = { @CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots",
"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE) aliases = {"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
public class Swap extends SubCommand { public class Swap extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {

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.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan; 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) @CommandDeclaration(command = "target", usage = "/plot target <<plot>|nearest>",
public class Target extends SubCommand { description = "Target a plot with your compass", permission = "plots.target",
requiredType = RequiredType.PLAYER, category = CommandCategory.INFO) public class Target
extends SubCommand {
public Target() { public Target() {
super(Argument.PlotID); super(Argument.PlotID);

View File

@ -21,8 +21,10 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; 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) @CommandDeclaration(command = "template", permission = "plots.admin",
public class Template extends SubCommand { 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) { public static boolean extractAllFiles(String world, String template) {
try { 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.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@CommandDeclaration(command = "toggle", aliases = { @CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use",
"attribute"}, permission = "plots.use", description = "Toggle per user settings", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS) description = "Toggle per user settings", requiredType = RequiredType.NONE,
public class Toggle extends Command { category = CommandCategory.SETTINGS) public class Toggle extends Command {
public Toggle() { public Toggle() {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@CommandDeclaration(command = "chatspy", aliases = { @CommandDeclaration(command = "chatspy", aliases = {"spy"},
"spy"}, permission = "plots.admin.command.chat", description = "Toggle admin chat spying") permission = "plots.admin.command.chat", description = "Toggle admin chat spying")
public void chatspy(Command command, PlotPlayer player, String[] args, public void chatspy(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -28,8 +28,8 @@ public class Toggle extends Command {
} }
} }
@CommandDeclaration(command = "worldedit", aliases = {"we", @CommandDeclaration(command = "worldedit", aliases = {"we", "wea"},
"wea"}, permission = "plots.worldedit.bypass", description = "Toggle worldedit area restrictions") permission = "plots.worldedit.bypass", description = "Toggle worldedit area restrictions")
public void worldedit(Command command, PlotPlayer player, String[] args, public void worldedit(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { 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, public void chat(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { 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, public void clearConfirmation(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { 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, public void titles(Command command, PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {

View File

@ -23,8 +23,10 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; 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) @CommandDeclaration(command = "trim", permission = "plots.admin",
public class Trim extends SubCommand { 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; public static ArrayList<Plot> expired = null;
private static volatile boolean TASK = false; private static volatile boolean TASK = false;

View File

@ -16,9 +16,10 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "trust", aliases = { @CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.NONE,
"t"}, requiredType = RequiredType.NONE, usage = "/plot trust <player>", description = "Allow a user to build in a plot while you are offline", category = CommandCategory.SETTINGS) usage = "/plot trust <player>",
public class Trust extends Command { description = "Allow a user to build in a plot while you are offline",
category = CommandCategory.SETTINGS) public class Trust extends Command {
public Trust() { public Trust() {
super(MainCommand.getInstance(), true); 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.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.*;
@CommandDeclaration(command = "unlink", aliases = {"u", @CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"},
"unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS, confirmation = true) description = "Unlink a mega-plot", usage = "/plot unlink", requiredType = RequiredType.NONE,
public class Unlink extends SubCommand { category = CommandCategory.SETTINGS, confirmation = true) public class Unlink
extends SubCommand {
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @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.*; import java.util.*;
@CommandDeclaration(command = "visit", permission = "plots.visit", description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]", aliases = { @CommandDeclaration(command = "visit", permission = "plots.visit",
"v", "tp", "teleport", "goto", "home", description = "Visit someones plot", usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]",
"h"}, requiredType = RequiredType.NONE, category = CommandCategory.TELEPORT) public class Visit aliases = {"v", "tp", "teleport", "goto", "home", "h"}, requiredType = RequiredType.NONE,
extends Command { category = CommandCategory.TELEPORT) public class Visit extends Command {
public Visit() { public Visit() {
super(MainCommand.getInstance(), true); 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.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
@CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass", description = "Force bypass of WorldEdit", aliases = { @CommandDeclaration(command = "weanywhere", permission = "plots.worldedit.bypass",
"wea"}, usage = "/plot weanywhere", requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) description = "Force bypass of WorldEdit", aliases = {"wea"}, usage = "/plot weanywhere",
@Deprecated public class WE_Anywhere extends SubCommand { requiredType = RequiredType.NONE, category = CommandCategory.ADMINISTRATION) @Deprecated
public class WE_Anywhere extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] arguments) { @Override public boolean onCommand(PlotPlayer player, String[] arguments) {
MainCommand.getInstance().toggle.worldedit(this, player, new String[0], null, null); 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. " + "Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. "
+ "You need to re-generate the schematics.", + "You need to re-generate the schematics.",
"LegacyConfig"), LEGACY_CONFIG_CONVERSION_FAILED( "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("-", "-"); CUSTOM_STRING("-", "-");
@ -1063,4 +1064,5 @@ public enum C {
} else { } else {
caller.sendMessage(msg); caller.sendMessage(msg);
} }
}} }
}

View File

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

View File

@ -301,7 +301,8 @@ public class Settings extends Config {
false; false;
@Comment("Disable redstone when all owners/trusted/members are offline") @Comment("Disable redstone when all owners/trusted/members are offline")
public static boolean DISABLE_OFFLINE = false; 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; 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", @Comment(
"Note: A cache will use some memory if enabled"}) {"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 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("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; @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; package com.github.intellectualsites.plotsquared.plot.generator;
import com.github.intellectualsites.plotsquared.plot.PlotSquared; 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; 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 * Converts legacy configurations into the new (BlockBucket) format
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused") public final class LegacyConverter {
public final class LegacyConverter {
public static final String CONFIGURATION_VERSION = "post_flattening"; public static final String CONFIGURATION_VERSION = "post_flattening";
private enum ConfigurationType {
BLOCK, BLOCK_LIST
}
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>(); private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
static { static {
@ -46,7 +40,8 @@ public final class LegacyConverter {
return BlockBucket.withSingle(plotBlock); 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)) { if (!section.contains(string)) {
throw new IllegalArgumentException(String.format("No such key: %s", string)); throw new IllegalArgumentException(String.format("No such key: %s", string));
} }
@ -88,19 +83,20 @@ public final class LegacyConverter {
return entries; return entries;
} }
private void convertBlock(@NonNull final ConfigurationSection section, @NonNull final String key, private void convertBlock(@NonNull final ConfigurationSection section,
@NonNull final String block) { @NonNull final String key, @NonNull final String block) {
final BlockBucket bucket = this.blockToBucket(block); final BlockBucket bucket = this.blockToBucket(block);
this.setString(section, key, bucket); this.setString(section, key, bucket);
PlotSquared.log(C.LEGACY_CONFIG_REPLACED.f(block, bucket.toString())); PlotSquared.log(C.LEGACY_CONFIG_REPLACED.f(block, bucket.toString()));
} }
private void convertBlockList(@NonNull final ConfigurationSection section, @NonNull final String key, private void convertBlockList(@NonNull final ConfigurationSection section,
@NonNull final List<String> blockList) { @NonNull final String key, @NonNull final List<String> blockList) {
final PlotBlock[] blocks = this.splitBlockList(blockList); final PlotBlock[] blocks = this.splitBlockList(blockList);
final BlockBucket bucket = this.blockListToBucket(blocks); final BlockBucket bucket = this.blockListToBucket(blocks);
this.setString(section, key, bucket); 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) { private String plotBlockArrayString(@NonNull final PlotBlock[] blocks) {
@ -120,13 +116,19 @@ public final class LegacyConverter {
for (final String world : worlds) { for (final String world : worlds) {
final ConfigurationSection worldSection = configuration.getConfigurationSection(world); final ConfigurationSection worldSection = configuration.getConfigurationSection(world);
for (final Map.Entry<String, ConfigurationType> entry : TYPE_MAP.entrySet()) { for (final Map.Entry<String, ConfigurationType> entry : TYPE_MAP.entrySet()) {
if (entry.getValue() == ConfigurationType.BLOCK) { if (entry.getValue() == ConfigurationType.BLOCK) {
this.convertBlock(worldSection, entry.getKey(), worldSection.getString(entry.getKey())); this.convertBlock(worldSection, entry.getKey(),
} else { worldSection.getString(entry.getKey()));
this.convertBlockList(worldSection, entry.getKey(), worldSection.getStringList(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()); String boundary = Long.toHexString(System.currentTimeMillis());
URLConnection con = new URL(website).openConnection(); URLConnection con = new URL(website).openConnection();
con.setDoOutput(true); con.setDoOutput(true);
con.setRequestProperty("Content-Type", con.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
"multipart/form-data; boundary=" + boundary);
try (OutputStream output = con.getOutputStream(); try (OutputStream output = con.getOutputStream();
PrintWriter writer = new PrintWriter( PrintWriter writer = new PrintWriter(
new OutputStreamWriter(output, StandardCharsets.UTF_8), true)) { new OutputStreamWriter(output, StandardCharsets.UTF_8), true)) {
String CRLF = "\r\n"; String CRLF = "\r\n";
writer.append("--" + boundary).append(CRLF); 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); .append(CRLF);
writer.append("Content-Type: text/plain; charset=" + StandardCharsets.UTF_8
.displayName()).append(CRLF);
String param = "value"; String param = "value";
writer.append(CRLF).append(param).append(CRLF).flush(); writer.append(CRLF).append(param).append(CRLF).flush();
writer.append("--" + boundary).append(CRLF); writer.append("--" + boundary).append(CRLF);
writer.append( writer.append(
"Content-Disposition: form-data; name=\"schematicFile\"; filename=\"" "Content-Disposition: form-data; name=\"schematicFile\"; filename=\""
+ filename + '"').append(CRLF); + filename + '"').append(CRLF);
writer.append( writer
"Content-Type: " + URLConnection.guessContentTypeFromName(filename)) .append("Content-Type: " + URLConnection.guessContentTypeFromName(filename))
.append(CRLF); .append(CRLF);
writer.append("Content-Transfer-Encoding: binary").append(CRLF); writer.append("Content-Transfer-Encoding: binary").append(CRLF);
writer.append(CRLF).flush(); writer.append(CRLF).flush();
@ -150,7 +149,8 @@ public class MainUtil {
writer.append(CRLF).flush(); writer.append(CRLF).flush();
writer.append("--" + boundary + "--").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 char[] buffer = new char[256];
final StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
while (true) { while (true) {

View File

@ -291,15 +291,9 @@ public abstract class SchematicHandler {
} }
try { try {
ClipboardFormat format = ClipboardFormats.findByFile(file); ClipboardFormat format = ClipboardFormats.findByFile(file);
if (format == BuiltInClipboardFormat.SPONGE_SCHEMATIC) { if (format != null) {
SpongeSchematicReader ssr = new SpongeSchematicReader( ClipboardReader reader = format.getReader(new FileInputStream(file));
new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))); BlockArrayClipboard clip = (BlockArrayClipboard) reader.read();
BlockArrayClipboard clip = (BlockArrayClipboard) ssr.read();
return new Schematic(clip);
} else if (format == BuiltInClipboardFormat.MCEDIT_SCHEMATIC) {
MCEditSchematicReader msr = new MCEditSchematicReader(
new NBTInputStream(new GZIPInputStream(new FileInputStream(file))));
BlockArrayClipboard clip = (BlockArrayClipboard) msr.read();
return new Schematic(clip); return new Schematic(clip);
} else { } else {
throw new UnsupportedFormatException( throw new UnsupportedFormatException(

View File

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