Tidying up the code

This commit is contained in:
MattBDev 2019-04-29 10:49:58 -04:00
parent 0b7e63bafb
commit 237b10a2a2
12 changed files with 306 additions and 238 deletions

View File

@ -3,13 +3,15 @@ repositories {
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "http://nexus.hc.to/content/repositories/pub_releases" } maven { url "http://nexus.hc.to/content/repositories/pub_releases" }
maven { url = "https://repo.codemc.org/repository/maven-public" } maven { url = "https://repo.codemc.org/repository/maven-public" }
maven { url 'http://repo.onarandombox.com/content/groups/public'}
mavenLocal() mavenLocal()
} }
dependencies { dependencies {
implementation project(':Core') implementation project(':Core')
compile project(':Core') compile project(':Core')
compile 'org.spigotmc:spigot-api:1.14-pre5-SNAPSHOT' implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT'
implementation 'org.spigotmc:spigot-api:1.14-pre5-SNAPSHOT'
compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT')
compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4') compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4')
compile("net.milkbowl.vault:VaultAPI:1.7") { compile("net.milkbowl.vault:VaultAPI:1.7") {

View File

@ -10,8 +10,36 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotHandler;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
import com.github.intellectualsites.plotsquared.plot.util.EntityUtil;
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.RegExUtil;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode; import org.bukkit.FluidCollisionMode;
@ -22,18 +50,82 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.entity.*; import org.bukkit.entity.Ageable;
import org.bukkit.entity.Animals;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LingeringPotion;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.Villager;
import org.bukkit.entity.WaterMob;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.*; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.*; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
@ -51,11 +143,6 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.lang.reflect.Field;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Pattern;
/** /**
* Player Events involving plots. * Player Events involving plots.
*/ */
@ -151,16 +238,19 @@ import java.util.regex.Pattern;
return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.VEHICLE_CAP); return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.VEHICLE_CAP);
case BAT: case BAT:
case CHICKEN: case CHICKEN:
case CAT:
case COD: case COD:
case COW: case COW:
case DOLPHIN: case DOLPHIN:
case DONKEY: case DONKEY:
case FOX:
case HORSE: case HORSE:
case IRON_GOLEM: case IRON_GOLEM:
case LLAMA: case LLAMA:
case MULE: case MULE:
case MUSHROOM_COW: case MUSHROOM_COW:
case OCELOT: case OCELOT:
case PANDA:
case PARROT: case PARROT:
case PIG: case PIG:
case POLAR_BEAR: case POLAR_BEAR:
@ -171,6 +261,7 @@ import java.util.regex.Pattern;
case SKELETON_HORSE: case SKELETON_HORSE:
case SNOWMAN: case SNOWMAN:
case SQUID: case SQUID:
case TRADER_LLAMA:
case TROPICAL_FISH: case TROPICAL_FISH:
case TURTLE: case TURTLE:
case VILLAGER: case VILLAGER:
@ -208,6 +299,9 @@ import java.util.regex.Pattern;
case WITHER_SKELETON: case WITHER_SKELETON:
case ZOMBIE: case ZOMBIE:
case ZOMBIE_VILLAGER: case ZOMBIE_VILLAGER:
case PILLAGER:
case PHANTOM:
case RAVAGER:
// monster // monster
return EntityUtil return EntityUtil
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP); .checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
@ -524,18 +618,17 @@ import java.util.regex.Pattern;
} }
String[] parts = msg.split(" "); String[] parts = msg.split(" ");
Plot plot = pp.getCurrentPlot(); Plot plot = pp.getCurrentPlot();
if (BukkitMain.getWorldEdit() != null) { // Check WorldEdit // Check WorldEdit
switch (parts[0].toLowerCase()) { switch (parts[0].toLowerCase()) {
case "up": case "up":
case "/up": case "/up":
case "worldedit:up": case "worldedit:up":
case "worldedit:/up": case "worldedit:/up":
if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions
.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
}
} }
if (plot == null) { if (plot == null) {
return; return;

View File

@ -9,6 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.SetupObject; import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -171,9 +173,9 @@ public class BukkitSetupUtils extends SetupUtils {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
Plugin plugin = Bukkit.getPluginManager().getPlugin("Multiverse-Core");
if (object.setupGenerator != null) { if (object.setupGenerator != null) {
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null && Bukkit if (plugin != null && plugin.isEnabled()) {
.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mv create " + world + " normal -g " + object.setupGenerator); "mv create " + world + " normal -g " + object.setupGenerator);
setGenerator(world, object.setupGenerator); setGenerator(world, object.setupGenerator);
@ -181,15 +183,6 @@ public class BukkitSetupUtils extends SetupUtils {
return world; return world;
} }
} }
if (Bukkit.getPluginManager().getPlugin("MultiWorld") != null && Bukkit
.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mw create " + world + " plugin:" + object.setupGenerator);
setGenerator(world, object.setupGenerator);
if (Bukkit.getWorld(world) != null) {
return world;
}
}
WorldCreator wc = new WorldCreator(object.world); WorldCreator wc = new WorldCreator(object.world);
wc.generator(object.setupGenerator); wc.generator(object.setupGenerator);
wc.environment(Environment.NORMAL); wc.environment(Environment.NORMAL);
@ -197,22 +190,13 @@ public class BukkitSetupUtils extends SetupUtils {
Bukkit.createWorld(wc); Bukkit.createWorld(wc);
setGenerator(world, object.setupGenerator); setGenerator(world, object.setupGenerator);
} else { } else {
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null && Bukkit if (plugin != null && plugin.isEnabled()) {
.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mv create " + world + " normal"); "mv create " + world + " normal");
if (Bukkit.getWorld(world) != null) { if (Bukkit.getWorld(world) != null) {
return world; return world;
} }
} }
if (Bukkit.getPluginManager().getPlugin("MultiWorld") != null && Bukkit
.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
Bukkit.getServer()
.dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world);
if (Bukkit.getWorld(world) != null) {
return world;
}
}
World bw = World bw =
Bukkit.createWorld(new WorldCreator(object.world).environment(Environment.NORMAL)); Bukkit.createWorld(new WorldCreator(object.world).environment(Environment.NORMAL));
} }

View File

@ -62,7 +62,6 @@ permissions:
plots.set.flag.vehicle-use.*: true plots.set.flag.vehicle-use.*: true
plots.set.flag.vehicle-place.*: true plots.set.flag.vehicle-place.*: true
plots.set.flag.vehicle-break.*: true plots.set.flag.vehicle-break.*: true
plots.set.flag.player-interact.*: true
plots.set.flag.place.*: true plots.set.flag.place.*: true
plots.set.flag.break.*: true plots.set.flag.break.*: true
plots.set.flag.use.*: true plots.set.flag.use.*: true
@ -75,16 +74,12 @@ permissions:
comments.notifications.enabled: true comments.notifications.enabled: true
plots.inbox.read.public: true plots.inbox.read.public: true
plots.inbox.modify.public: true plots.inbox.modify.public: true
plots.inbox.modify.public: true
plots.inbox.write.public: true plots.inbox.write.public: true
plots.inbox.read.public: true
plots.inbox.read.report: true plots.inbox.read.report: true
plots.inbox.write.report: true plots.inbox.write.report: true
plots.inbox.read.report: true
plots.inbox.read.owner: true plots.inbox.read.owner: true
plots.inbox.modify.owner: true plots.inbox.modify.owner: true
plots.inbox.write.owner: true plots.inbox.write.owner: true
plots.inbox.read.owner: true
plots.comment: true plots.comment: true
plots.inbox: true plots.inbox: true
plots.permpack.wilderness: plots.permpack.wilderness:

View File

@ -3,19 +3,19 @@ repositories {
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' implementation 'org.yaml:snakeyaml:1.23'
compile 'org.yaml:snakeyaml:1.23' //keep inline with Minecraft which uses gson 2.8.0
compile 'com.google.code.gson:gson:2.8.5' implementation 'com.google.code.gson:gson:2.8.0'
compile("org.projectlombok:lombok:1.18.6") implementation("org.projectlombok:lombok:1.18.6")
compileOnly("org.projectlombok:lombok:1.18.6") compileOnly("org.projectlombok:lombok:1.18.6")
testCompileOnly("org.projectlombok:lombok:1.18.6") testCompileOnly("org.projectlombok:lombok:1.18.6")
annotationProcessor("org.projectlombok:lombok:1.18.6") annotationProcessor("org.projectlombok:lombok:1.18.6")
testAnnotationProcessor("org.projectlombok:lombok:1.18.6") testAnnotationProcessor("org.projectlombok:lombok:1.18.6")
compile 'com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT' implementation 'com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT'
compile 'com.squareup.okhttp3:okhttp:3.14.0' implementation 'com.squareup.okhttp3:okhttp:3.14.0'
compile 'com.squareup.okio:okio:2.2.2' implementation 'com.squareup.okio:okio:2.2.2'
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.3.30' implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.30'
} }
sourceCompatibility = 1.8 sourceCompatibility = 1.8
@ -33,7 +33,7 @@ processResources {
} }
} }
jar.archiveName = "PlotSquared-API-${project.parent.version}.jar" jar.setArchiveName("PlotSquared-API-${project.parent.version}.jar")
jar.destinationDir = file '../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/' + project.parent.version jar.destinationDir = file '../mvn/com/github/intellectualsites/plotsquared/PlotSquared-API/' + project.parent.version
task createPom { task createPom {
doLast { doLast {

View File

@ -15,7 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
@CommandDeclaration(command = "setalias", permission = "plots.alias", @CommandDeclaration(command = "setalias", permission = "plots.alias",
description = "Set the plot name", usage = "/plot alias <set|remove> <alias>", description = "Set the plot name", usage = "/plot alias <set|remove> <alias>",
aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"}, aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"},
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Alias category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Alias
extends SubCommand { extends SubCommand {
@Override public boolean onCommand(PlotPlayer player, String[] args) { @Override public boolean onCommand(PlotPlayer player, String[] args) {

View File

@ -17,7 +17,7 @@ import java.util.Arrays;
import java.util.Map.Entry; import java.util.Map.Entry;
@CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot", @CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot",
category = CommandCategory.CHAT, requiredType = RequiredType.NONE, permission = "plots.comment") category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER, 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

@ -40,11 +40,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions;
Captions.PLOTWORLD_INCOMPATIBLE.send(player); Captions.PLOTWORLD_INCOMPATIBLE.send(player);
return false; return false;
} }
if (plot1.copy(plot2, new Runnable() { if (plot1.copy(plot2, () -> MainUtil.sendMessage(player, Captions.COPY_SUCCESS))) {
@Override public void run() {
MainUtil.sendMessage(player, Captions.COPY_SUCCESS);
}
})) {
return true; return true;
} else { } else {
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);

View File

@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
@CommandDeclaration(command = "setdescription", permission = "plots.set.desc", @CommandDeclaration(command = "setdescription", permission = "plots.set.desc",
description = "Set the plot description", usage = "/plot desc <description>", description = "Set the plot description", usage = "/plot desc <description>",
aliases = {"desc", "setdesc", "setd", "description"}, category = CommandCategory.SETTINGS, aliases = {"desc", "setdesc", "setd", "description"}, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE) public class Desc extends SetCommand { requiredType = RequiredType.PLAYER) 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

@ -33,11 +33,11 @@ import java.util.zip.ZipOutputStream;
if (!folder.exists()) { if (!folder.exists()) {
return false; return false;
} }
File input = new File(folder + File.separator + template + ".template");
File output = PlotSquared.get().IMP.getDirectory(); File output = PlotSquared.get().IMP.getDirectory();
if (!output.exists()) { if (!output.exists()) {
output.mkdirs(); output.mkdirs();
} }
File input = new File(folder + File.separator + template + ".template");
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(input))) { try (ZipInputStream zis = new ZipInputStream(new FileInputStream(input))) {
ZipEntry ze = zis.getNextEntry(); ZipEntry ze = zis.getNextEntry();
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
@ -63,9 +63,6 @@ import java.util.zip.ZipOutputStream;
zis.closeEntry(); zis.closeEntry();
} }
return true; return true;
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
@ -162,11 +159,9 @@ import java.util.zip.ZipOutputStream;
setup.step = new ConfigurationNode[0]; setup.step = new ConfigurationNode[0];
setup.world = world; setup.world = world;
SetupUtils.manager.setupWorld(setup); SetupUtils.manager.setupWorld(setup);
GlobalBlockQueue.IMP.addTask(new Runnable() { GlobalBlockQueue.IMP.addTask(() -> {
@Override public void run() { MainUtil.sendMessage(player, "Done!");
MainUtil.sendMessage(player, "Done!"); player.teleport(WorldUtil.IMP.getSpawn(world));
player.teleport(WorldUtil.IMP.getSpawn(world));
}
}); });
return true; return true;
} }
@ -182,17 +177,15 @@ import java.util.zip.ZipOutputStream;
return false; return false;
} }
final PlotManager manager = area.getPlotManager(); final PlotManager manager = area.getPlotManager();
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(() -> {
@Override public void run() { try {
try { manager.exportTemplate(area);
manager.exportTemplate(area); } catch (Exception e) { // Must recover from any exception thrown a third party template manager
} catch (Exception e) { // Must recover from any exception thrown a third party template manager e.printStackTrace();
e.printStackTrace(); MainUtil.sendMessage(player, "Failed: " + e.getMessage());
MainUtil.sendMessage(player, "Failed: " + e.getMessage()); return;
return;
}
MainUtil.sendMessage(player, "Done!");
} }
MainUtil.sendMessage(player, "Done!");
}); });
return true; return true;
default: default:

View File

@ -5,160 +5,165 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
/** /**
* Captions class. * Captions class.
*/ */
public enum Captions { public enum Captions {
//@formatter:off
/* /*
* Static flags * Static flags
*/ */
FLAG_USE("use", "static.flags"), FLAG_BREAK("break", "static.flags"), FLAG_PLACE("place", FLAG_USE("use", "static.flags"),
"static.flags"), FLAG_PVP("pvp", "static.flags"), FLAG_HANGING_PLACE("hanging-place", FLAG_BREAK("break", "static.flags"),
"static.flags"), FLAG_HANGING_BREAK("hanging-break", "static.flags"), FLAG_HANGING_INTERACT( FLAG_PLACE("place", "static.flags"),
"hanging-interact", "static.flags"), FLAG_MISC_INTERACT("misc-interact", FLAG_PVP("pvp", "static.flags"),
"static.flags"), FLAG_MISC_BREAK("misc-break", "static.flags"), FLAG_MISC_PLACE( FLAG_HANGING_PLACE("hanging-place", "static.flags"),
"misc-place", "static.flags"), FLAG_VEHICLE_BREAK("vehicle-break", FLAG_HANGING_BREAK("hanging-break", "static.flags"),
"static.flags"), FLAG_HOSTILE_INTERACT("hostile-interact", FLAG_HANGING_INTERACT("hanging-interact", "static.flags"),
"static.flags"), FLAG_DEVICE_INTERACT("device-interact", FLAG_MISC_INTERACT("misc-interact", "static.flags"),
"static.flags"), FLAG_ANIMAL_INTERACT("animal-interact", "static.flags"), FLAG_VEHICLE_USE( FLAG_MISC_BREAK("misc-break", "static.flags"),
"vehicle-use", "static.flags"), FLAG_VEHICLE_PLACE("vehicle-place", FLAG_MISC_PLACE("misc-place", "static.flags"),
"static.flags"), FLAG_PLAYER_INTERACT("player-interact", FLAG_VEHICLE_BREAK("vehicle-break", "static.flags"),
"static.flags"), FLAG_TAMED_INTERACT("tamed-interact", FLAG_HOSTILE_INTERACT("hostile-interact", "static.flags"),
"static.flags"), FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"), FLAG_MOB_PLACE( FLAG_DEVICE_INTERACT("device-interact", "static.flags"),
"mob-place", "static.flags"), /* FLAG_ANIMAL_INTERACT("animal-interact", "static.flags"), FLAG_VEHICLE_USE("vehicle-use", "static.flags"),
FLAG_VEHICLE_PLACE("vehicle-place", "static.flags"),
FLAG_PLAYER_INTERACT("player-interact", "static.flags"),
FLAG_TAMED_INTERACT("tamed-interact", "static.flags"),
FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"),
FLAG_MOB_PLACE("mob-place", "static.flags"),
/*
* Static permission * Static permission
*/ */
PERMISSION_STAR("*", "static.permissions"), PERMISSION_ADMIN("plots.admin", PERMISSION_STAR("*", "static.permissions"),
"static.permissions"), PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", PERMISSION_ADMIN("plots.admin", "static.permissions"),
"static.permissions"), PERMISSION_PROJECTILE_OTHER("plots.projectile.other", PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS( PERMISSION_PROJECTILE_OTHER("plots.projectile.other", "static.permissions"),
"plots.admin.interact.blockedcommands", "static.permissions"), PERMISSION_WORLDEDIT_BYPASS( PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands", "static.permissions"),
"plots.worldedit.bypass", "static.permissions"), PERMISSION_PLOT_TOGGLE_TITLES( PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass", "static.permissions"),
"plots.toggle.titles", "static.permissions"), PERMISSION_PLOT_TOGGLE_CHAT( PERMISSION_PLOT_TOGGLE_TITLES("plots.toggle.titles", "static.permissions"),
"plots.toggle.chat", "static.permissions"), PERMISSION_ADMIN_UPDATE_NOTIFICATION( PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat", "static.permissions"),
"plots.admin.update.notify", "static.permissions"), PERMISSION_ADMIN_EXIT_DENIED( PERMISSION_ADMIN_UPDATE_NOTIFICATION("plots.admin.update.notify", "static.permissions"),
"plots.admin.exit.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_DENIED( PERMISSION_ADMIN_EXIT_DENIED("plots.admin.exit.denied", "static.permissions"),
"plots.admin.entry.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_FORCEFIELD( PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"),
"plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT( PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"),
"plots.admin.command.chat", "static.permissions"), PERMISSION_MERGE_OTHER( PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"),
"plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEPROAD( PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"),
"plots.merge.keeproad", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED( PERMISSION_MERGE_KEEPROAD("plots.merge.keeproad", "static.permissions"),
"plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL( PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"),
"plots.admin.destroy.groundlevel", "static.permissions"), PERMISSION_ADMIN_DESTROY_OTHER( PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"),
"plots.admin.destroy.other", "static.permissions"), PERMISSION_ADMIN_DESTROY_ROAD( PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"),
"plots.admin.destroy.road", "static.permissions"), PERMISSION_ADMIN_BUILD_ROAD( PERMISSION_ADMIN_DESTROY_ROAD("plots.admin.destroy.road", "static.permissions"),
"plots.admin.build.road", "static.permissions"), PERMISSION_ADMIN_BUILD_UNOWNED( PERMISSION_ADMIN_BUILD_ROAD("plots.admin.build.road", "static.permissions"),
"plots.admin.build.unowned", "static.permissions"), PERMISSION_ADMIN_BUILD_OTHER( PERMISSION_ADMIN_BUILD_UNOWNED("plots.admin.build.unowned", "static.permissions"),
"plots.admin.build.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_ROAD( PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"),
"plots.admin.interact.road", "static.permissions"), PERMISSION_ADMIN_INTERACT_UNOWNED( PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"),
"plots.admin.interact.unowned", "static.permissions"), PERMISSION_ADMIN_INTERACT_OTHER( PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"),
"plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHTLIMIT( PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"),
"plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_UPDATE( PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"),
"plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_COMMAND_RATE( PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"),
"plots.admin.command.rate", "static.permissions"), PERMISSION_ADMIN_COMMAND_TRUST( PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"),
"plots.admin.command.trust", "static.permissions"), PERMISSION_TRUST_EVERYONE( PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"),
"plots.trust.everyone", "static.permissions"), PERMISSION_AREA_CREATE("plots.area.create", PERMISSION_TRUST_EVERYONE("plots.trust.everyone", "static.permissions"),
"static.permissions"), PERMISSION_AREA_INFO("plots.area.info", PERMISSION_AREA_CREATE("plots.area.create", "static.permissions"),
"static.permissions"), PERMISSION_AREA_INFO_FORCE("plots.admin.info.force", PERMISSION_AREA_INFO("plots.area.info","static.permissions"),
"static.permissions"), PERMISSION_AREA_LIST("plots.area.list", PERMISSION_AREA_INFO_FORCE("plots.admin.info.force", "static.permissions"),
"static.permissions"), PERMISSION_AREA_REGEN("plots.area.regen", PERMISSION_AREA_LIST("plots.area.list", "static.permissions"),
"static.permissions"), PERMISSION_AREA_TP("plots.area.tp", PERMISSION_AREA_REGEN("plots.area.regen", "static.permissions"),
"static.permissions"), PERMISSION_AUTO_MEGA("plots.auto.mega", PERMISSION_AREA_TP("plots.area.tp", "static.permissions"),
"static.permissions"), PERMISSION_CLAIM_SCHEMATIC("plots.claim.%s0", PERMISSION_AUTO_MEGA("plots.auto.mega", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_SCHEMATIC("plots.admin.command.schematic", PERMISSION_CLAIM_SCHEMATIC("plots.claim.%s0", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_CLEAR("plots.admin.command.clear", PERMISSION_ADMIN_COMMAND_SCHEMATIC("plots.admin.command.schematic", "static.permissions"),
"static.permissions"), PERMISSION_CONTINUE("plots.continue", PERMISSION_ADMIN_COMMAND_CLEAR("plots.admin.command.clear", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_LIST("plots.cluster.list", PERMISSION_CONTINUE("plots.continue", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_CREATE("plots.cluster.create", PERMISSION_CLUSTER_LIST("plots.cluster.list", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_CREATE_OTHER("plots.cluster.create.other", PERMISSION_CLUSTER_CREATE("plots.cluster.create", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_SIZE("plots.cluster.size", PERMISSION_CLUSTER_CREATE_OTHER("plots.cluster.create.other", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_DELETE("plots.cluster.delete", PERMISSION_CLUSTER_SIZE("plots.cluster.size", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_DELETE_OTHER("plots.cluster.delete.other", PERMISSION_CLUSTER_DELETE("plots.cluster.delete", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_RESIZE("plots.cluster.resize", PERMISSION_CLUSTER_DELETE_OTHER("plots.cluster.delete.other", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_RESIZE_OTHER("plots.cluster.resize.other", PERMISSION_CLUSTER_RESIZE("plots.cluster.resize", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_RESIZE_SHRINK("plots.cluster.resize.shrink", PERMISSION_CLUSTER_RESIZE_OTHER("plots.cluster.resize.other", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_RESIZE_EXPAND("plots.cluster.resize.expand", PERMISSION_CLUSTER_RESIZE_SHRINK("plots.cluster.resize.shrink", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER("plots.cluster", PERMISSION_CLUSTER_RESIZE_EXPAND("plots.cluster.resize.expand", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_INVITE("plots.cluster.invite", PERMISSION_CLUSTER("plots.cluster", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_INVITE_OTHER("plots.cluster.invite.other", PERMISSION_CLUSTER_INVITE("plots.cluster.invite", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_KICK("plots.cluster.kick", PERMISSION_CLUSTER_INVITE_OTHER("plots.cluster.invite.other", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_KICK_OTHER("plots.cluster.kick.other", PERMISSION_CLUSTER_KICK("plots.cluster.kick", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_LEAVE("plots.cluster.leave", PERMISSION_CLUSTER_KICK_OTHER("plots.cluster.kick.other", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_HELPERS("plots.cluster.helpers", PERMISSION_CLUSTER_LEAVE("plots.cluster.leave", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_TP("plots.cluster.tp", PERMISSION_CLUSTER_HELPERS("plots.cluster.helpers", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_TP_OTHER("plots.cluster.tp.other", PERMISSION_CLUSTER_TP("plots.cluster.tp", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_INFO("plots.cluster.info", PERMISSION_CLUSTER_TP_OTHER("plots.cluster.tp.other", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_SETHOME("plots.cluster.sethome", PERMISSION_CLUSTER_INFO("plots.cluster.info", "static.permissions"),
"static.permissions"), PERMISSION_CLUSTER_SETHOME_OTHER("plots.cluster.sethome.other", PERMISSION_CLUSTER_SETHOME("plots.cluster.sethome", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_CONTINUE("plots.admin.command.continue", PERMISSION_CLUSTER_SETHOME_OTHER("plots.cluster.sethome.other", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_DELETE("plots.admin.command.delete", PERMISSION_ADMIN_COMMAND_CONTINUE("plots.admin.command.continue", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_DENY("plots.admin.command.deny", PERMISSION_ADMIN_COMMAND_DELETE("plots.admin.command.delete", "static.permissions"),
"static.permissions"), PERMISSION_DENY_EVERYONE("plots.deny.everyone", PERMISSION_ADMIN_COMMAND_DENY("plots.admin.command.deny", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_DONE("plots.admin.command.done", PERMISSION_DENY_EVERYONE("plots.deny.everyone", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_DOWNLOAD("plots.admin.command.download", PERMISSION_ADMIN_COMMAND_DONE("plots.admin.command.done", "static.permissions"),
"static.permissions"), PERMISSION_DOWNLOAD_WORLD("plots.download.world", PERMISSION_ADMIN_COMMAND_DOWNLOAD("plots.admin.command.download", "static.permissions"),
"static.permissions"), PERMISSION_SET_FLAG_OTHER("plots.set.flag.other", PERMISSION_DOWNLOAD_WORLD("plots.download.world", "static.permissions"),
"static.permissions"), PERMISSION_SET_FLAG("plots.set.flag", PERMISSION_SET_FLAG_OTHER("plots.set.flag.other", "static.permissions"),
"static.permissions"), PERMISSION_SET_FLAG_KEY("plots.set.flag.%s0", PERMISSION_SET_FLAG("plots.set.flag", "static.permissions"),
"static.permissions"), PERMISSION_SET_FLAG_KEY_VALUE("plots.set.flag.%s0.%s1", PERMISSION_SET_FLAG_KEY("plots.set.flag.%s0", "static.permissions"),
"static.permissions"), PERMISSION_FLAG_REMOVE("plots.flag.remove", PERMISSION_SET_FLAG_KEY_VALUE("plots.set.flag.%s0.%s1", "static.permissions"),
"static.permissions"), PERMISSION_FLAG_ADD("plots.flag.add", PERMISSION_FLAG_REMOVE("plots.flag.remove", "static.permissions"),
"static.permissions"), PERMISSION_FLAG_LIST("plots.flag.list", PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"),
"static.permissions"), PERMISSION_GRANT("plots.grant.%s0", PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"),
"static.permissions"), PERMISSION_LIST_FORSALE("plots.list.forsale", PERMISSION_GRANT("plots.grant.%s0", "static.permissions"),
"static.permissions"), PERMISSION_LIST_MINE("plots.list.mine", PERMISSION_LIST_FORSALE("plots.list.forsale", "static.permissions"),
"static.permissions"), PERMISSION_LIST_SHARED("plots.list.shared", PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"),
"static.permissions"), PERMISSION_LIST_WORLD("plots.list.world", PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"),
"static.permissions"), PERMISSION_LIST_WORLD_NAME("plots.list.world.%s0", PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"),
"static.permissions"), PERMISSION_LIST_TOP("plots.list.top", PERMISSION_LIST_WORLD_NAME("plots.list.world.%s0", "static.permissions"),
"static.permissions"), PERMISSION_LIST_ALL("plots.list.all", PERMISSION_LIST_TOP("plots.list.top", "static.permissions"),
"static.permissions"), PERMISSION_LIST_UNOWNED("plots.list.unowned", PERMISSION_LIST_ALL("plots.list.all", "static.permissions"),
"static.permissions"), PERMISSION_LIST_UNKNOWN("plots.list.unknown", PERMISSION_LIST_UNOWNED("plots.list.unowned", "static.permissions"),
"static.permissions"), PERMISSION_LIST_PLAYER("plots.list.player", PERMISSION_LIST_UNKNOWN("plots.list.unknown", "static.permissions"),
"static.permissions"), PERMISSION_LIST_DONE("plots.list.done", PERMISSION_LIST_PLAYER("plots.list.player", "static.permissions"),
"static.permissions"), PERMISSION_LIST_EXPIRED("plots.list.expired", PERMISSION_LIST_DONE("plots.list.done", "static.permissions"),
"static.permissions"), PERMISSION_LIST_FUZZY("plots.list.fuzzy", PERMISSION_LIST_EXPIRED("plots.list.expired", "static.permissions"),
"static.permissions"), PERMISSION_LIST_AREA("plots.list.area", PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", PERMISSION_LIST_AREA("plots.list.area", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_SETOWNER("plots.admin.command.setowner", PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"),
"static.permissions"), PERMISSION_COMMENT("plots.comment", PERMISSION_ADMIN_COMMAND_SETOWNER("plots.admin.command.setowner", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", PERMISSION_COMMENT("plots.comment", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE( PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"),
"plots.admin.command.schematic.paste", "static.permissions"), PERMISSION_SCHEMATIC_PASTE( PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE("plots.admin.command.schematic.paste", "static.permissions"),
"plots.schematic.paste", "static.permissions"), PERMISSION_SCHEMATIC_LIST( PERMISSION_SCHEMATIC_PASTE("plots.schematic.paste", "static.permissions"),
"plots.schematic.list", "static.permissions"), PERMISSION_SCHEMATIC_LIST("plots.schematic.list", "static.permissions"),
PERMISSION_SCHEMATIC_SAVE("plots.schematic.save", PERMISSION_SCHEMATIC_SAVE("plots.schematic.save", "static.permissions"),
"static.permissions"), PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE( PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE("plots.admin.command.schematic.save", "static.permissions"),
"plots.admin.command.schematic.save", "static.permissions"),
PERMISSION_SET_COMPONENT("plots.set.%s0", "static.permissions"), PERMISSION_ADMIN_COMMAND( PERMISSION_SET_COMPONENT("plots.set.%s0", "static.permissions"),
PERMISSION_ADMIN_COMMAND(
"plots.admin.command.%s0", "static.permissions"), "plots.admin.command.%s0", "static.permissions"),
PERMISSION_ADMIN_COMMAND_UNLINK("plots.ad2min.command.unlink", "static.permissions"),
PERMISSION_VISIT_UNOWNED("plots.visit.unowned", "static.permissions"),
PERMISSION_VISIT_OWNED("plots.visit.owned", "static.permissions"),
PERMISSION_SHARED("plots.visit.shared", "static.permissions"),
PERMISSION_VISIT_OTHER("plots.visit.other", "static.permissions"),
PERMISSION_HOME("plots.home", "static.permissions"),
PERMISSION_ADMIN_COMMAND_UNLINK("plots.admin.command.unlink", PERMISSION_ALIAS_SET_OBSOLETE("plots.set.alias", "static.permissions"), // Note this is for backwards compatibility
"static.permissions"), PERMISSION_VISIT_UNOWNED("plots.visit.unowned", PERMISSION_ALIAS_SET("plots.alias.set", "static.permissions"),
"static.permissions"), PERMISSION_ALIAS_REMOVE("plots.alias.remove", "static.permissions"),
PERMISSION_VISIT_OWNED("plots.visit.owned", "static.permissions"), PERMISSION_SHARED(
"plots.visit.shared", "static.permissions"),
PERMISSION_VISIT_OTHER("plots.visit.other", "static.permissions"), PERMISSION_HOME("plots.home",
"static.permissions"),
PERMISSION_ALIAS_SET_OBSOLETE("plots.set.alias",
"static.permissions"), // Note this is for backwards compatibility
PERMISSION_ALIAS_SET("plots.alias.set", "static.permissions"), PERMISSION_ALIAS_REMOVE(
"plots.alias.remove", "static.permissions"),
/* /*
* Static console * Static console
@ -894,6 +899,7 @@ public enum Captions {
"LegacyConfig"), "LegacyConfig"),
CUSTOM_STRING("-", "-"); CUSTOM_STRING("-", "-");
//@formatter:on
public static final HashMap<String, String> replacements = new HashMap<>(); public static final HashMap<String, String> replacements = new HashMap<>();
@ -917,7 +923,7 @@ public enum Captions {
/** /**
* Constructor. * Constructor.
* *
* @param def default * @param def default
* @param prefix use prefix * @param prefix use prefix
*/ */
Captions(String def, boolean prefix, String category) { Captions(String def, boolean prefix, String category) {
@ -941,18 +947,16 @@ public enum Captions {
return m; return m;
} }
Map<String, String> map = new LinkedHashMap<>(); Map<String, String> map = new LinkedHashMap<>();
if (args.length > 0) { for (int i = args.length - 1; i >= 0; i--) {
for (int i = args.length - 1; i >= 0; i--) { String arg = "" + args[i];
String arg = "" + args[i]; if (arg.isEmpty()) {
if (arg == null || arg.isEmpty()) { map.put("%s" + i, "");
map.put("%s" + i, ""); } else {
} else { arg = Captions.color(arg);
arg = Captions.color(arg); map.put("%s" + i, arg);
map.put("%s" + i, arg); }
} if (i == 0) {
if (i == 0) { map.put("%s", arg);
map.put("%s", arg);
}
} }
} }
m = StringMan.replaceFromMap(m, map); m = StringMan.replaceFromMap(m, map);
@ -982,13 +986,13 @@ public enum Captions {
EnumSet<Captions> allEnums = EnumSet.allOf(Captions.class); EnumSet<Captions> allEnums = EnumSet.allOf(Captions.class);
HashSet<String> allNames = new HashSet<>(); HashSet<String> allNames = new HashSet<>();
HashSet<String> categories = new HashSet<>(); HashSet<String> categories = new HashSet<>();
HashSet<String> toRemove = new HashSet<>();
for (Captions caption : allEnums) { for (Captions caption : allEnums) {
allNames.add(caption.name()); allNames.add(caption.name());
categories.add(caption.category.toLowerCase()); categories.add(caption.category.toLowerCase());
} }
HashSet<Captions> captions = new HashSet<>(); HashSet<Captions> captions = new HashSet<>();
boolean changed = false; boolean changed = false;
HashSet<String> toRemove = new HashSet<>();
for (String key : keys) { for (String key : keys) {
if (!yml.isString(key)) { if (!yml.isString(key)) {
if (!categories.contains(key)) { if (!categories.contains(key)) {

View File

@ -62,13 +62,14 @@ subprojects {
} }
dependencies { dependencies {
compile(group: 'com.sk89q.worldedit', name: 'worldedit-core', version: '7.0.0-SNAPSHOT') { implementation('com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT') {
exclude(module: 'bukkit-classloader-check') exclude(module: 'bukkit-classloader-check')
exclude(module: 'mockito-core') exclude(module: 'mockito-core')
exclude(module: 'dummypermscompat') exclude(module: 'dummypermscompat')
} }
//Minecraft uses Guava 21 as of 1.13. //Minecraft uses Guava 21 as of 1.13.
compile 'com.google.guava:guava:21.0' compile 'com.google.guava:guava:21.0'
compileOnly 'org.jetbrains:annotations:17.0.0'
compile("org.projectlombok:lombok:1.18.6") compile("org.projectlombok:lombok:1.18.6")
compileOnly("org.projectlombok:lombok:1.18.6") compileOnly("org.projectlombok:lombok:1.18.6")
testCompileOnly("org.projectlombok:lombok:1.18.6") testCompileOnly("org.projectlombok:lombok:1.18.6")