Modify Setting and Storage class names.

This commit is contained in:
MattBDev 2016-06-10 13:00:34 -04:00
parent 8fe381d098
commit 482f4d6815
50 changed files with 432 additions and 403 deletions

View File

@ -71,12 +71,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.sk89q.worldedit.WorldEdit;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
@ -93,6 +87,13 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public static WorldEdit worldEdit;
@ -135,7 +136,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
public void log(String message) {
try {
message = C.color(message);
if (!Settings.CHAT.CONSOLE_COLOR) {
if (!Settings.Chat.CONSOLE_COLOR) {
message = ChatColor.stripColor(message);
}
this.getServer().getConsoleSender().sendMessage(message);
@ -241,7 +242,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case MINECART_MOB_SPAWNER:
case MINECART_TNT:
case BOAT: {
if (!Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) {
if (!Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
continue;
}
com.intellectualcrafters.plot.object.Location location = BukkitUtil.getLocation(entity.getLocation());
@ -308,7 +309,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case ZOMBIE:
case SHULKER:
default:
if (!Settings.ENABLED_COMPONENTS.KILL_ROAD_MOBS) {
if (!Settings.Enabled_Components.KILL_ROAD_MOBS) {
continue;
}
Location location = entity.getLocation();
@ -660,7 +661,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override
public ChatManager<?> initChatManager() {
if (Settings.CHAT.INTERACTIVE) {
if (Settings.Chat.INTERACTIVE) {
return new BukkitChatManager();
} else {
return new BukkitPlainChatManager();

View File

@ -64,7 +64,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
} else if (checkUUID2) {
column = "ownerId";
}
boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER;
boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER;
int missing = 0;
while (resultSet.next()) {
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));

View File

@ -144,7 +144,7 @@ public class LikePlotMeConverter {
sendMessage(" - " + dbPrefix + "Plots");
final Set<String> worlds = getPlotMeWorlds(plotConfig);
if (Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER) {
if (Settings.Enabled_Components.PLOTME_CONVERTER) {
sendMessage("Updating bukkit.yml");
updateWorldYml("bukkit.yml");
updateWorldYml("plugins/Multiverse-Core/worlds.yml");
@ -166,7 +166,7 @@ public class LikePlotMeConverter {
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
plotCount += entry.getValue().size();
}
if (!Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER) {
if (!Settings.Enabled_Components.PLOTME_CONVERTER) {
return false;
}

View File

@ -67,7 +67,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
return null;
}
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
boolean merge = !this.plugin.equals("plotme") && Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER;
boolean merge = !this.plugin.equals("plotme") && Settings.Enabled_Components.PLOTME_CONVERTER;
while (resultSet.next()) {
int key = resultSet.getInt("plot_id");
PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ"));

View File

@ -1,5 +1,7 @@
package com.plotsquared.bukkit.listeners;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
@ -8,8 +10,6 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
import com.intellectualcrafters.plot.util.TaskManager;
import java.lang.reflect.Method;
import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
@ -28,8 +28,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.lang.reflect.Method;
import java.util.HashSet;
public class ChunkListener implements Listener {
@ -39,7 +39,7 @@ public class ChunkListener implements Listener {
public ChunkListener() {
if (Settings.CHUNK_PROCESSOR.AUTO_TRIM) {
if (Settings.Chunk_Processor.AUTO_TRIM) {
try {
RefClass classChunk = getRefClass("{nms}.Chunk");
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
@ -47,10 +47,10 @@ public class ChunkListener implements Listener {
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
} catch (Throwable ignored) {
PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc");
Settings.CHUNK_PROCESSOR.AUTO_TRIM = false;
Settings.Chunk_Processor.AUTO_TRIM = false;
}
}
if (!Settings.CHUNK_PROCESSOR.AUTO_TRIM) {
if (!Settings.Chunk_Processor.AUTO_TRIM) {
return;
}
for (World world : Bukkit.getWorlds()) {
@ -139,7 +139,7 @@ public class ChunkListener implements Listener {
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (Settings.CHUNK_PROCESSOR.AUTO_TRIM) {
if (Settings.Chunk_Processor.AUTO_TRIM) {
Chunk chunk = event.getChunk();
String world = chunk.getWorld().getName();
if (PS.get().hasPlotArea(world)) {
@ -171,7 +171,7 @@ public class ChunkListener implements Listener {
return;
}
Entity[] entities = chunk.getEntities();
if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
event.getEntity().remove();
event.setCancelled(true);
this.lastChunk = chunk;
@ -182,7 +182,7 @@ public class ChunkListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent event) {
if (Settings.CHUNK_PROCESSOR.DISABLE_PHYSICS) {
if (Settings.Chunk_Processor.DISABLE_PHYSICS) {
event.setCancelled(true);
}
}
@ -200,7 +200,7 @@ public class ChunkListener implements Listener {
return;
}
Entity[] entities = chunk.getEntities();
if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
event.getEntity().remove();
event.setCancelled(true);
this.lastChunk = chunk;
@ -254,7 +254,7 @@ public class ChunkListener implements Listener {
}
Entity[] entities = chunk.getEntities();
BlockState[] tiles = chunk.getTileEntities();
if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
for (Entity ent : entities) {
if (!(ent instanceof Player)) {
ent.remove();
@ -262,7 +262,7 @@ public class ChunkListener implements Listener {
}
PS.debug("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
}
if (tiles.length > Settings.CHUNK_PROCESSOR.MAX_TILES) {
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) {
PS.debug("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
cleanChunk(chunk);

View File

@ -200,7 +200,7 @@ public class PlayerEvents extends PlotListener implements Listener {
event.setNewCurrent(0);
return;
}
if (Settings.REDSTONE.DISABLE_OFFLINE) {
if (Settings.Redstone.DISABLE_OFFLINE) {
if (UUIDHandler.getPlayer(plot.owner) == null) {
boolean disable = true;
for (UUID trusted : plot.getTrusted()) {
@ -215,7 +215,7 @@ public class PlayerEvents extends PlotListener implements Listener {
}
}
}
if (Settings.REDSTONE.DISABLE_UNOCCUPIED) {
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
if (plot.equals(entry.getValue().getCurrentPlot())) {
return;
@ -350,7 +350,7 @@ public class PlayerEvents extends PlotListener implements Listener {
if (cmd == null) {
if (split[0].equals("plotme") || split[0].equals("ap")) {
Player player = event.getPlayer();
if (Settings.PLOTME.ALIAS) {
if (Settings.PlotMe.ALIAS) {
player.performCommand("plots " + StringMan.join(Arrays.copyOfRange(split, 1, split.length), " "));
} else {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
@ -647,7 +647,7 @@ public class PlayerEvents extends PlotListener implements Listener {
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true);
} else if (Settings.DONE.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
@ -741,7 +741,7 @@ public class PlayerEvents extends PlotListener implements Listener {
}
}
}
if (Settings.ENABLED_COMPONENTS.PERMISSION_CACHE) {
if (Settings.Enabled_Components.PERMISSION_CACHE) {
pp.deleteMeta("perm");
}
}
@ -1883,7 +1883,7 @@ public class PlayerEvents extends PlotListener implements Listener {
entity.remove();
return;
}
if (Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) {
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot));
}
}
@ -2302,7 +2302,7 @@ public class PlayerEvents extends PlotListener implements Listener {
event.setCancelled(true);
return;
}
} else if (Settings.DONE.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);

View File

@ -10,9 +10,7 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.config.Storage;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.Database;
import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager;
import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils;
@ -52,6 +50,7 @@ import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.intellectualcrafters.plot.util.expiry.ExpiryTask;
import com.plotsquared.listener.WESubscriber;
import com.sk89q.worldedit.WorldEdit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -156,21 +155,21 @@ public class PS {
}
this.TASK = this.IMP.getTaskManager();
setupConfigs();
this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), Settings.PATHS.TRANSLATIONS + File.separator + "PlotSquared.use_THIS.yml");
this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + "PlotSquared.use_THIS.yml");
C.load(this.translationFile);
// Database
if (Settings.ENABLED_COMPONENTS.DATABASE) {
if (Settings.Enabled_Components.DATABASE) {
setupDatabase();
}
// Comments
CommentManager.registerDefaultInboxes();
// Kill entities
if (Settings.ENABLED_COMPONENTS.KILL_ROAD_MOBS || Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) {
if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
this.IMP.runEntityTask();
}
// WorldEdit
if (Settings.ENABLED_COMPONENTS.WORLDEDIT_RESTRICTIONS) {
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try {
if (this.IMP.initWorldEdit()) {
this.worldedit = WorldEdit.getInstance();
@ -183,10 +182,10 @@ public class PS {
}
}
// Commands
if (Settings.ENABLED_COMPONENTS.COMMANDS) {
if (Settings.Enabled_Components.COMMANDS) {
this.IMP.registerCommands();
}
if (Settings.ENABLED_COMPONENTS.EVENTS) {
if (Settings.Enabled_Components.EVENTS) {
this.IMP.registerPlayerEvents();
this.IMP.registerInventoryEvents();
this.IMP.registerPlotPlusEvents();
@ -194,17 +193,17 @@ public class PS {
}
// Required
this.IMP.registerWorldEvents();
if (Settings.ENABLED_COMPONENTS.METRICS) {
if (Settings.Enabled_Components.METRICS) {
this.IMP.startMetrics();
} else {
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS);
}
if (Settings.ENABLED_COMPONENTS.CHUNK_PROCESSOR) {
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
this.IMP.registerChunkProcessor();
}
// create UUIDWrapper
UUIDHandler.implementation = this.IMP.initUUIDHandler();
if (Settings.ENABLED_COMPONENTS.UUID_CACHE) {
if (Settings.Enabled_Components.UUID_CACHE) {
startUuidCatching();
} else {
// Start these separately
@ -233,7 +232,7 @@ public class PS {
// Chat
ChatManager.manager = this.IMP.initChatManager();
// Economy
if (Settings.ENABLED_COMPONENTS.ECONOMY) {
if (Settings.Enabled_Components.ECONOMY) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
@ -243,7 +242,7 @@ public class PS {
}
// Check for updates
if (Settings.ENABLED_COMPONENTS.UPDATER) {
if (Settings.Enabled_Components.UPDATER) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@ -293,13 +292,13 @@ public class PS {
}
// Copy files
copyFile("automerge.js", Settings.PATHS.SCRIPTS);
copyFile("town.template", Settings.PATHS.TEMPLATES);
copyFile("skyblock.template", Settings.PATHS.TEMPLATES);
copyFile("german.yml", Settings.PATHS.TRANSLATIONS);
copyFile("s_chinese_unescaped.yml", Settings.PATHS.TRANSLATIONS);
copyFile("s_chinese.yml", Settings.PATHS.TRANSLATIONS);
copyFile("italian.yml", Settings.PATHS.TRANSLATIONS);
copyFile("automerge.js", Settings.Paths.SCRIPTS);
copyFile("town.template", Settings.Paths.TEMPLATES);
copyFile("skyblock.template", Settings.Paths.TEMPLATES);
copyFile("german.yml", Settings.Paths.TRANSLATIONS);
copyFile("s_chinese_unescaped.yml", Settings.Paths.TRANSLATIONS);
copyFile("s_chinese.yml", Settings.Paths.TRANSLATIONS);
copyFile("italian.yml", Settings.Paths.TRANSLATIONS);
showDebug();
} catch (Throwable e) {
e.printStackTrace();
@ -384,10 +383,10 @@ public class PS {
}
private void startExpiryTasks() {
if (Settings.ENABLED_COMPONENTS.PLOT_EXPIRY) {
if (Settings.Enabled_Components.PLOT_EXPIRY) {
ExpireManager.IMP = new ExpireManager();
ExpireManager.IMP.runAutomatedTask();
for (Settings.AUTO_CLEAR settings : Settings.AUTO_CLEAR.getInstances()) {
for (Settings.Auto_Clear settings : Settings.AUTO_CLEAR.getInstances()) {
ExpiryTask task = new ExpiryTask(settings);
ExpireManager.IMP.addTask(task);
}
@ -395,13 +394,13 @@ public class PS {
}
private void startPlotMeConversion() {
if (Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER || Settings.PLOTME.CACHE_UUDS) {
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
if (PS.this.IMP.initPlotMeConverter()) {
PS.log("&c=== IMPORTANT ===");
PS.log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
PS.log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PlotMe!");
PS.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
PS.log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the "
@ -1816,11 +1815,11 @@ public class PS {
public void setupDatabase() {
try {
if (DBFunc.dbManager == null) {
if (Storage.MYSQL.USE) {
this.database = new MySQL(Storage.MYSQL.HOST, Storage.MYSQL.PORT, Storage.MYSQL.DATABASE, Storage.MYSQL.USER, Storage.MYSQL.PASSWORD);
} else if (Storage.SQLITE.USE) {
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLITE.DB + ".db");
this.database = new SQLite(file);
if (Storage.MySQL.USE) {
this.database = new com.intellectualcrafters.plot.database.MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE, Storage.MySQL.USER, Storage.MySQL.PASSWORD);
} else if (Storage.SQLite.USE) {
File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db");
this.database = new com.intellectualcrafters.plot.database.SQLite(file);
} else {
PS.log(C.PREFIX + "&cNo storage type is set!");
this.IMP.disable();
@ -1832,9 +1831,9 @@ public class PS {
this.clusters_tmp = DBFunc.getClusters();
} catch (ClassNotFoundException | SQLException e) {
PS.log(C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
if (Storage.MYSQL.USE) {
if (Storage.MySQL.USE) {
PS.log("$4MYSQL");
} else if (Storage.SQLITE.USE) {
} else if (Storage.SQLite.USE) {
PS.log("$4SQLITE");
}
PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ===");
@ -1906,7 +1905,7 @@ public class PS {
PS.log("Failed to save settings.yml");
}
try {
this.styleFile = MainUtil.getFile(IMP.getDirectory(), Settings.PATHS.TRANSLATIONS +File.separator + "style.yml" );
this.styleFile = MainUtil.getFile(IMP.getDirectory(), Settings.Paths.TRANSLATIONS +File.separator + "style.yml" );
if (!this.styleFile.exists()) {
if (!this.styleFile.getParentFile().exists()) {
this.styleFile.getParentFile().mkdirs();
@ -1963,7 +1962,7 @@ public class PS {
*/
private void showDebug() {
if (Settings.DEBUG) {
Map<String, Object> components = Settings.getFields(Settings.ENABLED_COMPONENTS.class);
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
for (Entry<String, Object> component : components.entrySet()) {
PS.log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", component.getKey(), component.getValue()));
}

View File

@ -86,11 +86,11 @@ public class Auto extends SubCommand {
// return false;
}
}
if (size_x * size_z > Settings.CLAIM.MAX_AUTO_AREA) {
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.CLAIM.MAX_AUTO_AREA + "");
if (size_x * size_z > Settings.Claim.MAX_AUTO_AREA) {
MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.Claim.MAX_AUTO_AREA + "");
return false;
}
int currentPlots = Settings.LIMIT.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname);
int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname);
int diff = currentPlots - player.getAllowedPlots();
if (diff + size_x * size_z > 0) {
if (diff < 0) {

View File

@ -30,7 +30,7 @@ public class Claim extends SubCommand {
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
}
int currentPlots = Settings.LIMIT.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld());
int grants = 0;
if (currentPlots >= player.getAllowedPlots()) {
if (player.hasPersistentMeta("grantedPlots")) {

View File

@ -36,7 +36,7 @@ public class Clear extends Command {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.clear"), C.NO_PLOT_PERMS);
checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER);
checkTrue((!Flags.DONE.isSet(plot) || Permissions.hasPermission(player, "plots.continue")) && (!Settings.DONE.COUNTS_TOWARDS_LIMIT || player.getAllowedPlots() >= player.getPlotCount() + plot.getConnectedPlots().size()), C.DONE_ALREADY_DONE);
checkTrue((!Flags.DONE.isSet(plot) || Permissions.hasPermission(player, "plots.continue")) && (!Settings.Done.COUNTS_TOWARDS_LIMIT || player.getAllowedPlots() >= player.getPlotCount() + plot.getConnectedPlots().size()), C.DONE_ALREADY_DONE);
confirm.run(this, new Runnable() {
@Override
public void run() {

View File

@ -127,12 +127,12 @@ public class Cluster extends SubCommand {
// Check allowed cluster size
cluster = new PlotCluster(area, pos1, pos2, player.getUUID());
int current;
if (Settings.LIMIT.GLOBAL) {
if (Settings.Limit.GLOBAL) {
current = player.getPlayerClusterCount();
} else {
current = player.getPlayerClusterCount(player.getLocation().getWorld());
}
int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.LIMIT.MAX_PLOTS);
int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.Limit.MAX_PLOTS);
if (current + cluster.getArea() > allowed) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea()));
return false;
@ -257,13 +257,13 @@ public class Cluster extends SubCommand {
}
// Check allowed cluster size
int current;
if (Settings.LIMIT.GLOBAL) {
if (Settings.Limit.GLOBAL) {
current = player.getPlayerClusterCount();
} else {
current = player.getPlayerClusterCount(player.getLocation().getWorld());
}
current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y);
int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.LIMIT.MAX_PLOTS);
int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.Limit.MAX_PLOTS);
if (current + cluster.getArea() > allowed) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea()));
return false;

View File

@ -32,7 +32,7 @@ public class Continue extends SubCommand {
return false;
}
int size = plot.getConnectedPlots().size();
if (Settings.DONE.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) {
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command.continue");
return false;
}

View File

@ -12,7 +12,6 @@ import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.expiry.PlotAnalysis;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId;
@ -25,7 +24,6 @@ import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.SchematicHandler;
@ -35,6 +33,8 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.intellectualcrafters.plot.util.expiry.PlotAnalysis;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import com.plotsquared.listener.WEManager;
@ -68,11 +68,11 @@ public class DebugExec extends SubCommand {
public DebugExec() {
try {
if (PS.get() != null) {
File file = new File(PS.get().IMP.getDirectory(), Settings.PATHS.SCRIPTS + File.separator + "start.js");
File file = new File(PS.get().IMP.getDirectory(), Settings.Paths.SCRIPTS + File.separator + "start.js");
if (file.exists()) {
init();
String script = StringMan.join(Files
.readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS), "start.js"),
.readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), "start.js"),
StandardCharsets.UTF_8),
System.getProperty("line.separator"));
this.scope.put("THIS", this);
@ -283,7 +283,8 @@ public class DebugExec extends SubCommand {
case "addcmd":
try {
final String cmd = StringMan.join(Files
.readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS), args[1]),
.readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
args[1]),
StandardCharsets.UTF_8),
System.getProperty("line.separator"));
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, RequiredType.NONE, CommandCategory.DEBUG) {
@ -310,7 +311,8 @@ public class DebugExec extends SubCommand {
case "run":
try {
script = StringMan.join(Files
.readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS), args[1]),
.readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS),
args[1]),
StandardCharsets.UTF_8),
System.getProperty("line.separator"));
if (args.length > 2) {
@ -326,7 +328,7 @@ public class DebugExec extends SubCommand {
}
break;
case "list-scripts":
String path = PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS;
String path = PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS;
File folder = new File(path);
File[] filesArray = folder.listFiles();

View File

@ -43,7 +43,7 @@ public class Done extends SubCommand {
}
plot.addRunning();
MainUtil.sendMessage(player, C.GENERATING_LINK);
final Settings.AUTO_CLEAR doneRequirements = Settings.AUTO_CLEAR.get("done");
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
if (ExpireManager.IMP == null || doneRequirements == null) {
finish(plot, player, true);
plot.removeRunning();

View File

@ -41,7 +41,7 @@ public class Download extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false;
}
if ((Settings.DONE.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions
.hasPermission(player, "plots.admin.command.download")) {
MainUtil.sendMessage(player, C.DONE_NOT_DONE);
return false;

View File

@ -31,7 +31,7 @@ public class Load extends SubCommand {
@Override
public boolean onCommand(final PlotPlayer player, String[] args) {
if (!Settings.ENABLED_COMPONENTS.METRICS) {
if (!Settings.Enabled_Components.METRICS) {
MainUtil.sendMessage(player,
"&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
return false;
@ -75,7 +75,7 @@ public class Load extends SubCommand {
}
final URL url;
try {
url = new URL(Settings.WEB.URL + "saves/" + player.getUUID() + '/' + schematic + ".schematic");
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic + ".schematic");
} catch (MalformedURLException e) {
e.printStackTrace();
MainUtil.sendMessage(player, C.LOAD_FAILED);

View File

@ -77,7 +77,7 @@ public class Merge extends SubCommand {
return false;
}
final int size = plot.getConnectedPlots().size();
final int maxSize = Permissions.hasPermissionRange(player, "plots.merge", Settings.LIMIT.MAX_PLOTS);
final int maxSize = Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS);
if (size - 1 > maxSize) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.merge." + (size + 1));
return false;

View File

@ -65,7 +65,7 @@ public class Owner extends SetCommand {
return false;
}
int size = plots.size();
int currentPlots = (Settings.LIMIT.GLOBAL ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size;
int currentPlots = (Settings.Limit.GLOBAL ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size;
if (currentPlots > other.getAllowedPlots()) {
sendMessage(player, C.CANT_TRANSFER_MORE_PLOTS);
return false;

View File

@ -62,7 +62,7 @@ public class Rate extends SubCommand {
});
UUID uuid = player.getUUID();
for (Plot p : plots) {
if ((!Settings.DONE.REQUIRED_FOR_RATINGS || p.hasFlag(Flags.DONE)) && p.isBasePlot() && (p.hasRatings() || !p.getRatings()
if ((!Settings.Done.REQUIRED_FOR_RATINGS || p.hasFlag(Flags.DONE)) && p.isBasePlot() && (p.hasRatings() || !p.getRatings()
.containsKey(uuid)) && !p.isAdded(uuid)) {
p.teleportPlayer(player);
MainUtil.sendMessage(player, C.RATE_THIS);
@ -85,11 +85,11 @@ public class Rate extends SubCommand {
sendMessage(player, C.RATING_NOT_YOUR_OWN);
return false;
}
if (Settings.DONE.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) {
if (Settings.Done.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) {
sendMessage(player, C.RATING_NOT_DONE);
return false;
}
if (Settings.RATINGS.CATEGORIES != null && !Settings.RATINGS.CATEGORIES.isEmpty()) {
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
final Runnable run = new Runnable() {
@Override
public void run() {
@ -99,13 +99,13 @@ public class Rate extends SubCommand {
}
final MutableInt index = new MutableInt(0);
final MutableInt rating = new MutableInt(0);
String title = Settings.RATINGS.CATEGORIES.get(0);
String title = Settings.Ratings.CATEGORIES.get(0);
PlotInventory inventory = new PlotInventory(player, 1, title) {
@Override
public boolean onClick(int i) {
rating.add((i + 1) * Math.pow(10, index.getValue()));
index.increment();
if (index.getValue() >= Settings.RATINGS.CATEGORIES.size()) {
if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) {
int rV = rating.getValue();
Rating result = EventUtil.manager.callRating(this.player, plot, new Rating(rV));
plot.addRating(this.player.getUUID(), result);
@ -118,7 +118,7 @@ public class Rate extends SubCommand {
}
return false;
}
setTitle(Settings.RATINGS.CATEGORIES.get(index.getValue()));
setTitle(Settings.Ratings.CATEGORIES.get(index.getValue()));
return true;
}
};
@ -135,7 +135,7 @@ public class Rate extends SubCommand {
}
};
if (plot.getSettings().ratings == null) {
if (!Settings.ENABLED_COMPONENTS.RATING_CACHE) {
if (!Settings.Enabled_Components.RATING_CACHE) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@ -180,7 +180,7 @@ public class Rate extends SubCommand {
}
};
if (plot.getSettings().ratings == null) {
if (!Settings.ENABLED_COMPONENTS.RATING_CACHE) {
if (!Settings.Enabled_Components.RATING_CACHE) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {

View File

@ -30,7 +30,7 @@ public class Save extends SubCommand {
@Override
public boolean onCommand(final PlotPlayer player, String[] args) {
if (!Settings.ENABLED_COMPONENTS.METRICS) {
if (!Settings.Enabled_Components.METRICS) {
MainUtil.sendMessage(player,
"&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
return false;

View File

@ -75,7 +75,7 @@ public class SchematicCmd extends SubCommand {
if (location.startsWith("url:")) {
try {
UUID uuid = UUID.fromString(location.substring(4));
URL base = new URL(Settings.WEB.URL);
URL base = new URL(Settings.Web.URL);
URL url = new URL(base, "uploads/" + uuid + ".schematic");
schematic = SchematicHandler.manager.getSchematic(url);
} catch (Exception e) {

View File

@ -39,7 +39,7 @@ public class Template extends SubCommand {
public static boolean extractAllFiles(String world, String template) {
try {
File folder = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.TEMPLATES);
File folder = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
if (!folder.exists()) {
return false;
}
@ -89,7 +89,7 @@ public class Template extends SubCommand {
}
public static void zipAll(String world, Set<FileBytes> files) throws IOException {
File output = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.TEMPLATES);
File output = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES);
output.mkdirs();
try (FileOutputStream fos = new FileOutputStream(output + File.separator + world + ".template");
ZipOutputStream zos = new ZipOutputStream(fos)) {
@ -134,7 +134,7 @@ public class Template extends SubCommand {
MainUtil.sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
return false;
}
File worldFile = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.TEMPLATES + File.separator + "tmp-data.yml");
File worldFile = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml");
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
PS.get().worlds.set("worlds." + world, worldConfig.get(""));
try {

View File

@ -26,6 +26,7 @@ public class Config {
* Get the value for a node<br>
* Probably throws some error if you try to get a non existent key
* @param key
* @param root
* @param <T>
* @return
*/
@ -51,6 +52,7 @@ public class Config {
* Probably throws some error if you supply non existing keys or invalid values
* @param key config node
* @param value value
* @param root
*
*/
public static void set(String key, Object value, Class root) {
@ -91,6 +93,7 @@ public class Config {
/**
* Set all values in the file (load first to avoid overwriting)
* @param file
* @param root
*/
public static void save(File file, Class root) {
try {
@ -108,7 +111,7 @@ public class Config {
}
/**
* Get the static fields in a section
* Get the static fields in a section.
* @param clazz
* @return
*/
@ -150,7 +153,7 @@ public class Config {
private static void save(PrintWriter writer, Class clazz, Object instance, int indent) {
try {
String CTRF = System.lineSeparator();
String lineSeparator = System.lineSeparator();
String spacing = StringMan.repeat(" ", indent);
for (Field field : clazz.getFields()) {
if (field.getAnnotation(Ignore.class) != null) {
@ -159,7 +162,7 @@ public class Config {
Comment comment = field.getAnnotation(Comment.class);
if (comment != null) {
for (String commentLine : comment.value()) {
writer.write(spacing + "# " + commentLine + CTRF);
writer.write(spacing + "# " + commentLine + lineSeparator);
}
}
Create create = field.getAnnotation(Create.class);
@ -177,7 +180,7 @@ public class Config {
}
continue;
} else {
writer.write(spacing + toNodeName(field.getName() + ": ") + toYamlString(field.get(instance), spacing) + CTRF);
writer.write(spacing + toNodeName(field.getName() + ": ") + toYamlString(field.get(instance), spacing) + lineSeparator);
}
}
for (Class<?> current : clazz.getClasses()) {
@ -185,15 +188,15 @@ public class Config {
continue;
}
if (indent == 0) {
writer.write(CTRF);
writer.write(lineSeparator);
}
Comment comment = current.getAnnotation(Comment.class);
if (comment != null) {
for (String commentLine : comment.value()) {
writer.write(spacing + "# " + commentLine + CTRF);
writer.write(spacing + "# " + commentLine + lineSeparator);
}
}
writer.write(spacing + toNodeName(current.getSimpleName()) + ":" + CTRF);
writer.write(spacing + toNodeName(current.getSimpleName()) + ":" + lineSeparator);
BlockName blockNames = current.getAnnotation(BlockName.class);
if (blockNames != null) {
Field instanceField = clazz.getDeclaredField(toFieldName(current.getSimpleName()));
@ -209,7 +212,7 @@ public class Config {
// Save each instance
for (Map.Entry<String, Object> entry: ((Map<String, Object>) value.getRaw()).entrySet()) {
String key = entry.getKey();
writer.write(spacing + " " + toNodeName(key) + ":" + CTRF);
writer.write(spacing + " " + toNodeName(key) + ":" + lineSeparator);
save(writer, current, entry.getValue(), indent + 4);
}
continue;
@ -223,8 +226,9 @@ public class Config {
}
/**
* Get the field for a specific config node
* Get the field for a specific config node.
* @param split the node (split by period)
* @param root
* @return
*/
private static Field getField(String[] split, Class root) {
@ -254,8 +258,9 @@ public class Config {
}
/**
* Get the instance for a specific config node
* Get the instance for a specific config node.
* @param split the node (split by period)
* @param root
* @return The instance or null
*/
private static Object getInstance(String[] split, Class root) {
@ -270,7 +275,7 @@ public class Config {
Class found = null;
Class<?>[] classes = clazz.getDeclaredClasses();
for (Class current : classes) {
if (StringMan.isEqual(current.getSimpleName(), toFieldName(split[0]))) {
if (current.getSimpleName().equalsIgnoreCase(toFieldName(split[0]))) {
found = current;
break;
}
@ -319,7 +324,7 @@ public class Config {
}
/**
* Translate a node to a java field name
* Translate a node to a java field name.
* @param node
* @return
*/
@ -328,7 +333,7 @@ public class Config {
}
/**
* Translate a field to a config node
* Translate a field to a config node.
* @param field
* @return
*/
@ -337,7 +342,7 @@ public class Config {
}
/**
* Set some field to be accesible
* Set some field to be accessible.
* @param field
* @throws NoSuchFieldException
* @throws IllegalAccessException
@ -350,21 +355,21 @@ public class Config {
}
/**
* Indicates that a field should be instantiated / created
* Indicates that a field should be instantiated / created.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Create {}
/**
* Indicates that a field cannot be modified
* Indicates that a field cannot be modified.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Final {}
/**
* Creates a comment
* Creates a comment.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD,ElementType.TYPE})
@ -373,7 +378,7 @@ public class Config {
}
/**
* The names of any default blocks
* The names of any default blocks.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD,ElementType.TYPE})
@ -382,7 +387,7 @@ public class Config {
}
/**
* Any field or class with is not part of the config
* Any field or class with is not part of the config.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD,ElementType.TYPE})

View File

@ -1,9 +1,10 @@
package com.intellectualcrafters.plot.config;
import com.intellectualcrafters.configuration.file.YamlConfiguration;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Settings extends Config {
@ -29,13 +30,132 @@ public class Settings extends Config {
public static boolean TITLES = true;
@Create // This value will be generated automatically
public static ConfigBlock<AUTO_CLEAR> AUTO_CLEAR = null; // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks
public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null; // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks
public static void save(File file) {
save(file, Settings.class);
}
public static void load(File file) {
load(file, Settings.class);
}
public static boolean convertLegacy(File file) {
if (!file.exists()) {
return false;
}
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
// Protection
Redstone.DISABLE_OFFLINE = config.getBoolean("protection.redstone.disable-offline");
Redstone.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED);
// PlotMe
PlotMe.ALIAS = config.getBoolean("plotme-alias", PlotMe.ALIAS);
Enabled_Components.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", Enabled_Components.PLOTME_CONVERTER);
PlotMe.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PlotMe.CACHE_UUDS);
// UUID
UUID.USE_SQLUUIDHANDLER = config.getBoolean("uuid.use_sqluuidhandler", UUID.USE_SQLUUIDHANDLER);
UUID.OFFLINE = config.getBoolean("UUID.offline", UUID.OFFLINE);
UUID.FORCE_LOWERCASE = config.getBoolean("UUID.force-lowercase", UUID.FORCE_LOWERCASE);
// Mob stuff
Enabled_Components.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs", Enabled_Components.KILL_ROAD_MOBS);
Enabled_Components.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", Enabled_Components.KILL_ROAD_VEHICLES);
// Clearing + Expiry
// FAST_CLEAR = config.getBoolean("clear.fastmode");
Enabled_Components.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", Enabled_Components.PLOT_EXPIRY);
if (Enabled_Components.PLOT_EXPIRY) {
Enabled_Components.BAN_DELETER = config.getBoolean("clear.on.ban");
AUTO_CLEAR = new ConfigBlock<>();
AUTO_CLEAR.put("task1", new Auto_Clear());
Auto_Clear task = AUTO_CLEAR.get("task1");
task.CALIBRATION = new Auto_Clear.CALIBRATION();
task.DAYS = config.getInt("clear.auto.days", task.DAYS);
task.THRESHOLD = config.getInt("clear.auto.threshold", task.THRESHOLD);
task.CONFIRMATION = config.getBoolean("clear.auto.confirmation", task.CONFIRMATION);
task.CALIBRATION.CHANGES = config.getInt("clear.auto.calibration.changes", task.CALIBRATION.CHANGES);
task.CALIBRATION.FACES = config.getInt("clear.auto.calibration.faces", task.CALIBRATION.FACES);
task.CALIBRATION.DATA = config.getInt("clear.auto.calibration.data", task.CALIBRATION.DATA);
task.CALIBRATION.AIR = config.getInt("clear.auto.calibration.air", task.CALIBRATION.AIR);
task.CALIBRATION.VARIETY = config.getInt("clear.auto.calibration.variety", task.CALIBRATION.VARIETY);
task.CALIBRATION.CHANGES_SD = config.getInt("clear.auto.calibration.changes_sd", task.CALIBRATION.CHANGES_SD);
task.CALIBRATION.FACES_SD = config.getInt("clear.auto.calibration.faces_sd", task.CALIBRATION.FACES_SD);
task.CALIBRATION.DATA_SD = config.getInt("clear.auto.calibration.data_sd", task.CALIBRATION.DATA_SD);
task.CALIBRATION.AIR_SD = config.getInt("clear.auto.calibration.air_sd", task.CALIBRATION.AIR_SD);
task.CALIBRATION.VARIETY_SD = config.getInt("clear.auto.calibration.variety_sd", task.CALIBRATION.VARIETY_SD);
}
// Done
Done.REQUIRED_FOR_RATINGS = config.getBoolean("approval.ratings.check-done", Done.REQUIRED_FOR_RATINGS);
Done.COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit", Done.COUNTS_TOWARDS_LIMIT);
Done.RESTRICT_BUILDING = config.getBoolean("approval.done.restrict-building", Done.RESTRICT_BUILDING);
Done.REQUIRED_FOR_DOWNLOAD = config.getBoolean("approval.done.required-for-download", Done.REQUIRED_FOR_DOWNLOAD);
// Schematics
Paths.SCHEMATICS = config.getString("schematics.save_path", Paths.SCHEMATICS);
Paths.BO3 = config.getString("bo3.save_path", Paths.BO3);
// Web
Web.URL = config.getString("web.url", Web.URL);
Web.SERVER_IP = config.getString("web.server-ip", Web.SERVER_IP);
// Caching
Enabled_Components.PERMISSION_CACHE = config.getBoolean("cache.permissions", Enabled_Components.PERMISSION_CACHE);
Enabled_Components.RATING_CACHE = config.getBoolean("cache.ratings", Enabled_Components.RATING_CACHE);
// Rating system
Ratings.CATEGORIES = config.contains("ratings.categories") ? config.getStringList("ratings.categories") : Ratings.CATEGORIES;
// Titles
TITLES = config.getBoolean("titles", TITLES);
// Teleportation
Teleport.DELAY = config.getInt("teleport.delay", Teleport.DELAY);
Teleport.ON_LOGIN = config.getBoolean("teleport.on_login", Teleport.ON_LOGIN);
Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
// WorldEdit
// WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
// Chunk processor
Enabled_Components.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", Enabled_Components.CHUNK_PROCESSOR);
Chunk_Processor.AUTO_TRIM = config.getBoolean("chunk-processor.auto-unload", Chunk_Processor.AUTO_TRIM);
Chunk_Processor.MAX_TILES = config.getInt("chunk-processor.max-blockstates", Chunk_Processor.MAX_TILES);
Chunk_Processor.MAX_ENTITIES = config.getInt("chunk-processor.max-entities", Chunk_Processor.MAX_ENTITIES);
Chunk_Processor.DISABLE_PHYSICS = config.getBoolean("chunk-processor.disable-physics", Chunk_Processor.DISABLE_PHYSICS);
// Comments
Enabled_Components.COMMENT_NOTIFIER = config.getBoolean("comments.notifications.enabled", Enabled_Components.COMMENT_NOTIFIER);
// Plot limits
Claim.MAX_AUTO_AREA = config.getInt("claim.max-auto-area", Claim.MAX_AUTO_AREA);
Limit.MAX_PLOTS = config.getInt("max_plots", Limit.MAX_PLOTS);
Limit.GLOBAL = config.getBoolean("global_limit", Limit.GLOBAL);
// Misc
DEBUG = config.getBoolean("debug", DEBUG);
Chat.CONSOLE_COLOR = config.getBoolean("console.color", Chat.CONSOLE_COLOR);
Chat.INTERACTIVE = config.getBoolean("chat.fancy", Chat.INTERACTIVE);
Enabled_Components.METRICS = config.getBoolean("metrics", Enabled_Components.METRICS);
Enabled_Components.UPDATER = config.getBoolean("update-notifications", Enabled_Components.UPDATER);
Enabled_Components.DATABASE_PURGER = config.getBoolean("auto-purge", Enabled_Components.DATABASE_PURGER);
return true;
}
@Comment("This is an auto clearing task called `task1`")
@BlockName("task1") // The name for the default block
public static final class AUTO_CLEAR extends ConfigBlock {
public static final class Auto_Clear extends ConfigBlock {
@Create // This value has to be generated since an instance isn't static
public CALIBRATION CALIBRATION = null;
public int THRESHOLD = 1;
public boolean CONFIRMATION = true;
public int DAYS = 7;
public List<String> WORLDS = new ArrayList<>(Collections.singletonList("*"));
@Comment("See: https://github.com/IntellectualSites/PlotSquared/wiki/Plot-analysis")
public static final class CALIBRATION {
@ -50,14 +170,9 @@ public class Settings extends Config {
public int AIR_SD = 0;
public int DATA = 0;
}
public int THRESHOLD = 1;
public boolean CONFIRMATION = true;
public int DAYS = 7;
public List<String> WORLDS = new ArrayList<>(Arrays.asList("*"));
}
public static class CHUNK_PROCESSOR {
public static class Chunk_Processor {
@Comment("Auto trim will not save chunks which aren't claimed")
public static boolean AUTO_TRIM = false;
@Comment("Max tile entities per chunk")
@ -80,7 +195,7 @@ public class Settings extends Config {
}
@Comment("Configure the paths PlotSquared will use")
public static final class PATHS {
public static final class Paths {
public static String SCHEMATICS = "schematics";
public static String BO3 = "bo3";
public static String SCRIPTS = "scripts";
@ -88,14 +203,14 @@ public class Settings extends Config {
public static String TRANSLATIONS = "translations";
}
public static class WEB {
public static class Web {
@Comment("We are already hosting a web interface for you:")
public static String URL = "http://empcraft.com/plots/";
@Comment("The ip that will show up in the interface")
public static String SERVER_IP = "your.ip.here";
}
public static final class DONE {
public static final class Done {
@Comment("Require a done plot to download")
public static boolean REQUIRED_FOR_DOWNLOAD = false;
@Comment("Only done plots can be rated")
@ -106,7 +221,7 @@ public class Settings extends Config {
public static boolean COUNTS_TOWARDS_LIMIT = true;
}
public static final class CHAT {
public static final class Chat {
@Comment("Sometimes console color doesn't work, you can disable it here")
public static boolean CONSOLE_COLOR = true;
@Comment("Should chat be interactive")
@ -114,7 +229,7 @@ public class Settings extends Config {
}
@Comment("Relating to how many plots someone can claim ")
public static final class LIMIT {
public static final class Limit {
@Comment("Should the limit be global (over multiple worlds)")
public static boolean GLOBAL = false;
@Comment("The range of permissions to check e.g. plots.plot.127")
@ -122,14 +237,14 @@ public class Settings extends Config {
}
@Comment("Switching from PlotMe?")
public static final class PLOTME {
public static final class PlotMe {
@Comment("Cache the uuids from the PlotMe database")
public static boolean CACHE_UUDS = false;
@Comment("Have `/plotme` as a command alias")
public static boolean ALIAS = false;
}
public static final class TELEPORT {
public static final class Teleport {
@Comment("Teleport to your plot on death")
public static boolean ON_DEATH = false;
@Comment("Teleport to your plot on login")
@ -138,24 +253,28 @@ public class Settings extends Config {
public static int DELAY = 0;
}
public static final class REDSTONE {
public static final class Redstone {
@Comment("Disable redstone in unoccupied plots")
public static boolean DISABLE_UNOCCUPIED = false;
@Comment("Disable redstone when all owners/trusted/members are offline")
public static boolean DISABLE_OFFLINE = false;
}
public static final class CLAIM {
/*
END OF CONFIGURATION SECTION:
*/
public static final class Claim {
@Comment("The max plots claimed in a single `/plot auto <size>` command")
public static int MAX_AUTO_AREA = 4;
}
public static final class RATINGS {
public static final class Ratings {
public static List<String> CATEGORIES = new ArrayList<>();
}
@Comment({"Enable or disable part of the plugin","Note: A cache will use some memory if enabled"})
public static final class ENABLED_COMPONENTS { // Group the following values into a new config section
public static final class Enabled_Components { // Group the following values into a new config section
@Comment("The database stores all the plots")
public static boolean DATABASE = true;
@Comment("Events are needed to track a lot of things")
@ -194,123 +313,4 @@ public class Settings extends Config {
@Comment("Delete plots when a player is banned")
public static boolean BAN_DELETER = false;
}
/*
END OF CONFIGURATION SECTION:
*/
public static void save(File file) {
save(file, Settings.class);
}
public static void load(File file) {
load(file, Settings.class);
}
public static boolean convertLegacy(File file) {
if (!file.exists()) {
return false;
}
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
// Protection
REDSTONE.DISABLE_OFFLINE = config.getBoolean("protection.redstone.disable-offline");
REDSTONE.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", REDSTONE.DISABLE_UNOCCUPIED);
// PlotMe
PLOTME.ALIAS = config.getBoolean("plotme-alias", PLOTME.ALIAS);
ENABLED_COMPONENTS.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", ENABLED_COMPONENTS.PLOTME_CONVERTER);
PLOTME.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PLOTME.CACHE_UUDS);
// UUID
UUID.USE_SQLUUIDHANDLER = config.getBoolean("uuid.use_sqluuidhandler", UUID.USE_SQLUUIDHANDLER);
UUID.OFFLINE = config.getBoolean("UUID.offline", UUID.OFFLINE);
UUID.FORCE_LOWERCASE = config.getBoolean("UUID.force-lowercase", UUID.FORCE_LOWERCASE);
// Mob stuff
ENABLED_COMPONENTS.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs", ENABLED_COMPONENTS.KILL_ROAD_MOBS);
ENABLED_COMPONENTS.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", ENABLED_COMPONENTS.KILL_ROAD_VEHICLES);
// Clearing + Expiry
// FAST_CLEAR = config.getBoolean("clear.fastmode");
ENABLED_COMPONENTS.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", ENABLED_COMPONENTS.PLOT_EXPIRY);
if (ENABLED_COMPONENTS.PLOT_EXPIRY) {
ENABLED_COMPONENTS.BAN_DELETER = config.getBoolean("clear.on.ban");
AUTO_CLEAR = new ConfigBlock<>();
AUTO_CLEAR.put("task1", new AUTO_CLEAR());
AUTO_CLEAR task = AUTO_CLEAR.get("task1");
task.CALIBRATION = new AUTO_CLEAR.CALIBRATION();
task.DAYS = config.getInt("clear.auto.days", task.DAYS);
task.THRESHOLD = config.getInt("clear.auto.threshold", task.THRESHOLD);
task.CONFIRMATION = config.getBoolean("clear.auto.confirmation", task.CONFIRMATION);
task.CALIBRATION.CHANGES = config.getInt("clear.auto.calibration.changes", task.CALIBRATION.CHANGES);
task.CALIBRATION.FACES = config.getInt("clear.auto.calibration.faces", task.CALIBRATION.FACES);
task.CALIBRATION.DATA = config.getInt("clear.auto.calibration.data", task.CALIBRATION.DATA);
task.CALIBRATION.AIR = config.getInt("clear.auto.calibration.air", task.CALIBRATION.AIR);
task.CALIBRATION.VARIETY = config.getInt("clear.auto.calibration.variety", task.CALIBRATION.VARIETY);
task.CALIBRATION.CHANGES_SD = config.getInt("clear.auto.calibration.changes_sd", task.CALIBRATION.CHANGES_SD);
task.CALIBRATION.FACES_SD = config.getInt("clear.auto.calibration.faces_sd", task.CALIBRATION.FACES_SD);
task.CALIBRATION.DATA_SD = config.getInt("clear.auto.calibration.data_sd", task.CALIBRATION.DATA_SD);
task.CALIBRATION.AIR_SD = config.getInt("clear.auto.calibration.air_sd", task.CALIBRATION.AIR_SD);
task.CALIBRATION.VARIETY_SD = config.getInt("clear.auto.calibration.variety_sd", task.CALIBRATION.VARIETY_SD);
}
// Done
DONE.REQUIRED_FOR_RATINGS = config.getBoolean("approval.ratings.check-done", DONE.REQUIRED_FOR_RATINGS);
DONE.COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit", DONE.COUNTS_TOWARDS_LIMIT);
DONE.RESTRICT_BUILDING = config.getBoolean("approval.done.restrict-building", DONE.RESTRICT_BUILDING);
DONE.REQUIRED_FOR_DOWNLOAD = config.getBoolean("approval.done.required-for-download", DONE.REQUIRED_FOR_DOWNLOAD);
// Schematics
PATHS.SCHEMATICS = config.getString("schematics.save_path", PATHS.SCHEMATICS);
PATHS.BO3 = config.getString("bo3.save_path", PATHS.BO3);
// Web
WEB.URL = config.getString("web.url", WEB.URL);
WEB.SERVER_IP = config.getString("web.server-ip", WEB.SERVER_IP);
// Caching
ENABLED_COMPONENTS.PERMISSION_CACHE = config.getBoolean("cache.permissions", ENABLED_COMPONENTS.PERMISSION_CACHE);
ENABLED_COMPONENTS.RATING_CACHE = config.getBoolean("cache.ratings", ENABLED_COMPONENTS.RATING_CACHE);
// Rating system
RATINGS.CATEGORIES = config.contains("ratings.categories") ? config.getStringList("ratings.categories") : RATINGS.CATEGORIES;
// Titles
TITLES = config.getBoolean("titles", TITLES);
// Teleportation
TELEPORT.DELAY = config.getInt("teleport.delay", TELEPORT.DELAY);
TELEPORT.ON_LOGIN = config.getBoolean("teleport.on_login", TELEPORT.ON_LOGIN);
TELEPORT.ON_DEATH = config.getBoolean("teleport.on_death", TELEPORT.ON_DEATH);
// WorldEdit
// WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
// Chunk processor
ENABLED_COMPONENTS.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", ENABLED_COMPONENTS.CHUNK_PROCESSOR);
CHUNK_PROCESSOR.AUTO_TRIM = config.getBoolean("chunk-processor.auto-unload", CHUNK_PROCESSOR.AUTO_TRIM);
CHUNK_PROCESSOR.MAX_TILES = config.getInt("chunk-processor.max-blockstates", CHUNK_PROCESSOR.MAX_TILES);
CHUNK_PROCESSOR.MAX_ENTITIES = config.getInt("chunk-processor.max-entities", CHUNK_PROCESSOR.MAX_ENTITIES);
CHUNK_PROCESSOR.DISABLE_PHYSICS = config.getBoolean("chunk-processor.disable-physics", CHUNK_PROCESSOR.DISABLE_PHYSICS);
// Comments
ENABLED_COMPONENTS.COMMENT_NOTIFIER = config.getBoolean("comments.notifications.enabled", ENABLED_COMPONENTS.COMMENT_NOTIFIER);
// Plot limits
CLAIM.MAX_AUTO_AREA = config.getInt("claim.max-auto-area", CLAIM.MAX_AUTO_AREA);
LIMIT.MAX_PLOTS = config.getInt("max_plots", LIMIT.MAX_PLOTS);
LIMIT.GLOBAL = config.getBoolean("global_limit", LIMIT.GLOBAL);
// Misc
DEBUG = config.getBoolean("debug", DEBUG);
CHAT.CONSOLE_COLOR = config.getBoolean("console.color", CHAT.CONSOLE_COLOR);
CHAT.INTERACTIVE = config.getBoolean("chat.fancy", CHAT.INTERACTIVE);
ENABLED_COMPONENTS.METRICS = config.getBoolean("metrics", ENABLED_COMPONENTS.METRICS);
ENABLED_COMPONENTS.UPDATER = config.getBoolean("update-notifications", ENABLED_COMPONENTS.UPDATER);
ENABLED_COMPONENTS.DATABASE_PURGER = config.getBoolean("auto-purge", ENABLED_COMPONENTS.DATABASE_PURGER);
return true;
}
}

View File

@ -4,25 +4,6 @@ import java.io.File;
public class Storage extends Config {
@Comment("MySQL section")
public static final class MYSQL {
@Comment("Should MySQL be used?")
public static boolean USE = false;
public static String HOST = "localhost";
public static String PORT = "3306";
public static String USER = "root";
public static String PASSWORD = "password";
public static String DATABASE = "plot_db";
}
@Comment("SQLite section")
public static final class SQLITE {
@Comment("Should SQLite be used?")
public static boolean USE = true;
@Comment("The file to use")
public static String DB = "storage";
}
public static final String PREFIX = "";
public static void save(File file) {
@ -33,4 +14,23 @@ public class Storage extends Config {
load(file, Storage.class);
}
@Comment("MySQL section")
public static final class MySQL {
@Comment("Should MySQL be used?")
public static boolean USE = false;
public static String HOST = "localhost";
public static String PORT = "3306";
public static String USER = "root";
public static String PASSWORD = "password";
public static String DATABASE = "plot_db";
}
@Comment("SQLite section")
public static final class SQLite {
@Comment("Should SQLite be used?")
public static boolean USE = true;
@Comment("The file to use")
public static String DB = "storage";
}
}

View File

@ -24,8 +24,8 @@ public interface AbstractDB {
/**
* Set Plot owner.
*
* @param plot Plot in which the owner should be set
* @param uuid The uuid of the new owner
* @param plot the plot
* @param uuid the uuid of the new owner
*/
void setOwner(Plot plot, UUID uuid);
@ -33,14 +33,14 @@ public interface AbstractDB {
* Create all settings, and create default helpers, trusted + denied lists.
*
* @param plots Plots for which the default table entries should be created
* @param whenDone
* @param whenDone the task to run when the method is finished executing
*/
void createPlotsAndData(List<Plot> plots, Runnable whenDone);
/**
* Create a plot
* Create a plot.
*
* @param plot That should be created
* @param plot the plot to create
*/
void createPlot(Plot plot);
@ -54,7 +54,7 @@ public interface AbstractDB {
/**
* Delete a plot.
*
* @param plot The plot to delete.
* @param plot the plot to delete
*/
void delete(Plot plot);
@ -64,8 +64,16 @@ public interface AbstractDB {
void deleteTrusted(Plot plot);
/**
* Remove all denied players from the plot.
* @param plot the plot
*/
void deleteDenied(Plot plot);
/**
* Delete all comments from the plot.
* @param plot the plot
*/
void deleteComments(Plot plot);
void deleteRatings(Plot plot);
@ -79,19 +87,19 @@ public interface AbstractDB {
void getPersistentMeta(UUID uuid, RunnableVal<Map<String, byte[]>> result);
/**
* Create plot settings.
* Create the plot settings.
*
* @param id Plot Entry ID
* @param plot Plot Object
* @param id the plot entry id
* @param plot the plot
*/
void createPlotSettings(int id, Plot plot);
/**
* Get the table entry ID.
*
* @param plot Plot Object
* @param plot the plot
*
* @return Integer = Plot Entry Id
* @return {@code Integer} = Plot Entry Id
*/
int getId(Plot plot);
@ -138,7 +146,7 @@ public interface AbstractDB {
/**
* Set plot flags.
* @param plot Plot Object
* @param flags flags to set (flag[])
* @param flags flags to set
*/
void setFlags(Plot plot, HashMap<Flag<?>, Object> flags);
@ -151,7 +159,9 @@ public interface AbstractDB {
void setFlags(PlotCluster cluster, HashMap<Flag<?>, Object> flags);
/**
* Rename a cluster.
* Rename a cluster to the given name.
* @param cluster the cluster to rename
* @param name the new cluster name
*/
void setClusterName(PlotCluster cluster, String name);
@ -174,15 +184,15 @@ public interface AbstractDB {
* Purge a whole world.
*
* @param area World in which the plots should be purged
* @param plotIds
* @param plotIds the {@code PlotId}s of {@code Plot}s to purge
*/
void purge(PlotArea area, Set<PlotId> plotIds);
/**
* Set Plot Home Position.
* Set the plot home position.
*
* @param plot Plot Object
* @param position Plot Home Position
* @param plot the plot
* @param position the position of plot home
*/
void setPosition(Plot plot, String position);
@ -194,8 +204,9 @@ public interface AbstractDB {
void setPosition(PlotCluster cluster, String position);
/**
* @param plot Plot Object
* @param uuid Player that should be removed
* Remove the specified player from the trust list of the specified plot.
* @param plot the plot
* @param uuid the uuid of the player to remove
*/
void removeTrusted(Plot plot, UUID uuid);
@ -206,7 +217,7 @@ public interface AbstractDB {
void removeHelper(PlotCluster cluster, UUID uuid);
/**
* @param plot Plot Object
* @param plot the plot
* @param uuid Player that should be removed
*/
void removeMember(Plot plot, UUID uuid);
@ -244,23 +255,25 @@ public interface AbstractDB {
void setInvited(PlotCluster cluster, UUID uuid);
/**
* @param plot Plot Object
* @param uuid Player uuid
* Remove the specified player from the denied list of the specified plot.
* @param plot the plot
* @param uuid the uuid of the player to remove
*/
void removeDenied(Plot plot, UUID uuid);
/**
* Deny the specified player from the given plot.
* @param plot the plot
* @param uuid the uuid of the player to deny
*/
void setDenied(Plot plot, UUID uuid);
/**
* Get Plots ratings.
* Get the ratings from the specified plot.
*
* @param plot Plot Object
* @param plot the plot
*
* @return Plot Ratings (pre-calculated)
* @return the plot ratings (pre-calculated)
*/
HashMap<UUID, Integer> getRatings(Plot plot);
@ -273,26 +286,26 @@ public interface AbstractDB {
void setRating(Plot plot, UUID rater, int value);
/**
* Remove a plot comment.
* Remove the specified comment from the given plot.
*
* @param plot Plot Object
* @param comment Comment to remove
* @param plot the plot
* @param comment the comment to remove
*/
void removeComment(Plot plot, PlotComment comment);
/**
* Clear an inbox.
* Clear the specified inbox on the given plot.
*
* @param plot
* @param inbox
* @param plot the plot
* @param inbox the inbox to clear
*/
void clearInbox(Plot plot, String inbox);
/**
* Set a plot comment.
* Add the specified comment to the given plot.
*
* @param plot Plot Object
* @param comment Comment to add
* @param plot the plot
* @param comment the comment to add
*/
void setComment(Plot plot, PlotComment comment);
@ -329,6 +342,9 @@ public interface AbstractDB {
*/
boolean deleteTables();
/**
* Close the database. Generally not recommended to be used by add-ons.
*/
void close();
void replaceWorld(String oldWorld, String newWorld, PlotId min, PlotId max);

View File

@ -18,6 +18,7 @@ import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
@ -1321,7 +1322,7 @@ public class SQLManager implements AbstractDB {
@Override
public void deleteRatings(final Plot plot) {
if (Settings.ENABLED_COMPONENTS.RATING_CACHE && plot.getSettings().getRatings().isEmpty()) {
if (Settings.Enabled_Components.RATING_CACHE && plot.getSettings().getRatings().isEmpty()) {
return;
}
addPlotTask(plot, new UniqueStatement("delete_plot_ratings") {
@ -1479,7 +1480,7 @@ public class SQLManager implements AbstractDB {
rs.close();
try (Statement statement = this.connection.createStatement()) {
statement.addBatch("DROP TABLE `" + this.prefix + "plot_comments`");
if (Storage.MYSQL.USE) {
if (Storage.MySQL.USE) {
statement.addBatch("CREATE TABLE IF NOT EXISTS `"
+ this.prefix
+ "plot_comments` ("
@ -1625,7 +1626,7 @@ public class SQLManager implements AbstractDB {
id = resultSet.getInt("id");
String areaid = resultSet.getString("world");
if (!areas.contains(areaid)) {
if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
continue;
} else {
@ -1652,7 +1653,7 @@ public class SQLManager implements AbstractDB {
Plot last = map.put(p.getId(), p);
if (last != null) {
map.put(last.getId(), last);
if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cPLOT " + id + " in `" + this.prefix
@ -1669,7 +1670,7 @@ public class SQLManager implements AbstractDB {
}
deleteRows(toDelete, this.prefix + "plot", "id");
}
if (Settings.ENABLED_COMPONENTS.RATING_CACHE) {
if (Settings.Enabled_Components.RATING_CACHE) {
try (ResultSet r = statement.executeQuery("SELECT `plot_plot_id`, `player`, `rating` FROM `" + this.prefix + "plot_rating`")) {
ArrayList<Integer> toDelete = new ArrayList<>();
while (r.next()) {
@ -1683,7 +1684,7 @@ public class SQLManager implements AbstractDB {
Plot plot = plots.get(id);
if (plot != null) {
plot.getSettings().getRatings().put(user, r.getInt("rating"));
} else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY " + id + " in `plot_rating` does not exist. Create this plot or set `auto-purge: true` in the "
@ -1710,7 +1711,7 @@ public class SQLManager implements AbstractDB {
Plot plot = plots.get(id);
if (plot != null) {
plot.getTrusted().add(user);
} else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY " + id + " in `plot_helpers` does not exist. Create this plot or set `auto-purge: true` in the settings"
@ -1736,7 +1737,7 @@ public class SQLManager implements AbstractDB {
Plot plot = plots.get(id);
if (plot != null) {
plot.getMembers().add(user);
} else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY " + id + " in `plot_trusted` does not exist. Create this plot or set `auto-purge: true` in the settings"
@ -1762,7 +1763,7 @@ public class SQLManager implements AbstractDB {
Plot plot = plots.get(id);
if (plot != null) {
plot.getDenied().add(user);
} else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug("&cENTRY " + id
@ -1851,7 +1852,7 @@ public class SQLManager implements AbstractDB {
this.setFlags(plot, flags);
}
plot.getSettings().flags = flags;
} else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
PS.debug(

View File

@ -30,7 +30,7 @@ public class HybridPlotManager extends ClassicPlotManager {
@Override
public void exportTemplate(PlotArea plotArea) throws IOException {
HashSet<FileBytes> files = new HashSet<>(
Collections.singletonList(new FileBytes(Settings.PATHS.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))));
Collections.singletonList(new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))));
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotArea.worldname + File.separator;
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
try {

View File

@ -59,7 +59,7 @@ public class BO3 {
}
public File getFile() {
return MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.BO3 + File.separator + getWorld() + File.separator + getFilename());
return MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.BO3 + File.separator + getWorld() + File.separator + getFilename());
}
public String getFilename() {

View File

@ -926,7 +926,7 @@ public class Plot {
* This will return null if the plot hasn't been analyzed
* @return analysis of plot
*/
public PlotAnalysis getComplexity(Settings.AUTO_CLEAR settings) {
public PlotAnalysis getComplexity(Settings.Auto_Clear settings) {
return PlotAnalysis.getAnalysis(this, settings);
}
@ -1737,7 +1737,7 @@ public class Plot {
public void run() {
String name = Plot.this.id + "," + Plot.this.area + ',' + MainUtil.getName(Plot.this.owner);
boolean result =
SchematicHandler.manager.save(value, Settings.PATHS.SCHEMATICS + File.separator + name + ".schematic");
SchematicHandler.manager.save(value, Settings.Paths.SCHEMATICS + File.separator + name + ".schematic");
if (whenDone != null) {
whenDone.value = result;
TaskManager.runTask(whenDone);
@ -2549,12 +2549,12 @@ public class Plot {
} else {
location = this.getDefaultHome();
}
if (Settings.TELEPORT.DELAY == 0 || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) {
if (Settings.Teleport.DELAY == 0 || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) {
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
player.teleport(location);
return true;
}
MainUtil.sendMessage(player, C.TELEPORT_IN_SECONDS, Settings.TELEPORT.DELAY + "");
MainUtil.sendMessage(player, C.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
final String name = player.getName();
TaskManager.TELEPORT_QUEUE.add(name);
TaskManager.runTaskLater(new Runnable() {
@ -2570,7 +2570,7 @@ public class Plot {
player.teleport(location);
}
}
}, Settings.TELEPORT.DELAY * 20);
}, Settings.Teleport.DELAY * 20);
return true;
}
return false;

View File

@ -491,7 +491,7 @@ public abstract class PlotArea {
}
public int getPlotCount(UUID uuid) {
if (!Settings.DONE.COUNTS_TOWARDS_LIMIT) {
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
int count = 0;
for (Plot plot : getPlotsAbs(uuid)) {
if (!plot.hasFlag(Flags.DONE)) {

View File

@ -14,18 +14,17 @@ public class PlotBlock {
}
}
public static PlotBlock get(int id, int data) {
return Settings.ENABLED_COMPONENTS.BLOCK_CACHE && data > 0 ? CACHE[(id << 4) + data] : new PlotBlock((short) id, (byte) data);
}
public final short id;
public final byte data;
public PlotBlock(short id, byte data) {
this.id = id;
this.data = data;
}
public static PlotBlock get(int id, int data) {
return Settings.Enabled_Components.BLOCK_CACHE && data > 0 ? CACHE[(id << 4) + data] : new PlotBlock((short) id, (byte) data);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {

View File

@ -1,8 +1,8 @@
package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.commands.Template;
import com.intellectualcrafters.plot.config.Settings;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@ -69,7 +69,7 @@ public abstract class PlotManager {
public void exportTemplate(PlotArea plotArea) throws IOException {
HashSet<FileBytes> files = new HashSet<>(
Collections.singletonList(new FileBytes(Settings.PATHS.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))));
Collections.singletonList(new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea))));
Template.zipAll(plotArea.worldname, files);
}

View File

@ -7,11 +7,11 @@ import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.PlotGameMode;
import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.plotsquared.general.commands.CommandCaller;
import java.util.HashMap;
@ -113,7 +113,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
*/
public Plot getCurrentPlot() {
Plot value = (Plot) getMeta("lastplot");
if (value == null && !Settings.ENABLED_COMPONENTS.EVENTS) {
if (value == null && !Settings.Enabled_Components.EVENTS) {
return getLocation().getPlot();
}
return value;
@ -125,7 +125,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* @return number of allowed plots within the scope (globally, or in the player's current world as defined in the settings.yml)
*/
public int getAllowedPlots() {
return Permissions.hasPermissionRange(this, "plots.plot", Settings.LIMIT.MAX_PLOTS);
return Permissions.hasPermissionRange(this, "plots.plot", Settings.Limit.MAX_PLOTS);
}
/**
@ -137,7 +137,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
* @return number of plots within the scope (globally, or in the player's current world as defined in the settings.yml)
*/
public int getPlotCount() {
if (!Settings.LIMIT.GLOBAL) {
if (!Settings.Limit.GLOBAL) {
return getPlotCount(getLocation().getWorld());
}
final AtomicInteger count = new AtomicInteger(0);
@ -145,7 +145,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override
public void run(PlotArea value) {
if (!Settings.DONE.COUNTS_TOWARDS_LIMIT) {
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
for (Plot plot : value.getPlotsAbs(uuid)) {
if (!plot.hasFlag(Flags.DONE)) {
count.incrementAndGet();
@ -168,7 +168,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
UUID uuid = getUUID();
int count = 0;
for (PlotArea area : PS.get().getPlotAreas(world)) {
if (!Settings.DONE.COUNTS_TOWARDS_LIMIT) {
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
for (Plot plot : area.getPlotsAbs(uuid)) {
if (!plot.getFlag(Flags.DONE).isPresent()) {
count++;
@ -347,7 +347,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
if (plot != null) {
EventUtil.manager.callLeave(this, plot);
}
if (Settings.ENABLED_COMPONENTS.BAN_DELETER && isBanned()) {
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
for (Plot owned : getPlots()) {
owned.deletePlot(null);
PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), getName()));

View File

@ -18,15 +18,15 @@ public class Rating {
public Rating(int value) {
this.initial = value;
this.ratingMap = new HashMap<>();
if (Settings.RATINGS.CATEGORIES != null && Settings.RATINGS.CATEGORIES.size() > 1) {
if (Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
if (value < 10) {
for (String ratingCategory : Settings.RATINGS.CATEGORIES) {
for (String ratingCategory : Settings.Ratings.CATEGORIES) {
this.ratingMap.put(ratingCategory, value);
}
this.changed = true;
return;
}
for (String ratingCategory : Settings.RATINGS.CATEGORIES) {
for (String ratingCategory : Settings.Ratings.CATEGORIES) {
this.ratingMap.put(ratingCategory, value % 10 - 1);
value = value / 10;
}
@ -66,10 +66,10 @@ public class Rating {
if (!this.changed) {
return this.initial;
}
if (Settings.RATINGS.CATEGORIES != null && Settings.RATINGS.CATEGORIES.size() > 1) {
if (Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
int val = 0;
for (int i = 0; i < Settings.RATINGS.CATEGORIES.size(); i++) {
val += (i + 1) * Math.pow(10, this.ratingMap.get(Settings.RATINGS.CATEGORIES.get(i)));
for (int i = 0; i < Settings.Ratings.CATEGORIES.size(); i++) {
val += (i + 1) * Math.pow(10, this.ratingMap.get(Settings.Ratings.CATEGORIES.get(i)));
}
return val;
} else {

View File

@ -289,9 +289,9 @@ public class BO3Handler {
}
public static File getBaseFile(String category) {
File base = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.BO3 + File.separator + category + File.separator + "base.yml");
File base = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.BO3 + File.separator + category + File.separator + "base.yml");
if (!base.exists()) {
PS.get().copyFile("base.yml", Settings.PATHS.BO3 + File.separator + category);
PS.get().copyFile("base.yml", Settings.Paths.BO3 + File.separator + category);
}
return base;
}

View File

@ -21,7 +21,7 @@ public class CommentManager {
public static final HashMap<String, CommentInbox> inboxes = new HashMap<>();
public static void sendTitle(final PlotPlayer player, final Plot plot) {
if (!Settings.ENABLED_COMPONENTS.COMMENT_NOTIFIER || !plot.isOwner(player.getUUID())) {
if (!Settings.Enabled_Components.COMMENT_NOTIFIER || !plot.isOwner(player.getUUID())) {
return;
}
TaskManager.runTaskLaterAsync(new Runnable() {

View File

@ -67,11 +67,11 @@ public abstract class EventUtil {
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED);
}
}
if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.ENABLED_COMPONENTS.UPDATER) {
if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.Enabled_Components.UPDATER) {
MainUtil.sendMessage(player, "&6An update for PlotSquared is available: &7/plot update");
}
final Plot plot = player.getCurrentPlot();
if (Settings.TELEPORT.ON_LOGIN && plot != null) {
if (Settings.Teleport.ON_LOGIN && plot != null) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
@ -84,7 +84,7 @@ public abstract class EventUtil {
public void doRespawnTask(final PlotPlayer player) {
final Plot plot = player.getCurrentPlot();
if (Settings.TELEPORT.ON_DEATH && plot != null) {
if (Settings.Teleport.ON_DEATH && plot != null) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {

View File

@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
@ -123,15 +124,15 @@ public class MainUtil {
final String website;
if (uuid == null) {
uuid = UUID.randomUUID();
website = Settings.WEB.URL + "upload.php?" + uuid;
website = Settings.Web.URL + "upload.php?" + uuid;
filename = "plot." + extension;
} else {
website = Settings.WEB.URL + "save.php?" + uuid;
website = Settings.Web.URL + "save.php?" + uuid;
filename = file + '.' + extension;
}
final URL url;
try {
url = new URL(Settings.WEB.URL + "?key=" + uuid + "&ip=" + Settings.WEB.SERVER_IP + "&type=" + extension);
url = new URL(Settings.Web.URL + "?key=" + uuid + "&ip=" + Settings.Web.SERVER_IP + "&type=" + extension);
} catch (MalformedURLException e) {
e.printStackTrace();
whenDone.run();
@ -663,14 +664,14 @@ public class MainUtil {
HashMap<UUID, Integer> rating;
if (plot.getSettings().ratings != null) {
rating = plot.getSettings().ratings;
} else if (Settings.ENABLED_COMPONENTS.RATING_CACHE) {
} else if (Settings.Enabled_Components.RATING_CACHE) {
rating = new HashMap<>();
} else {
rating = DBFunc.getRatings(plot);
}
int size = 1;
if (!Settings.RATINGS.CATEGORIES.isEmpty()) {
size = Math.max(1, Settings.RATINGS.CATEGORIES.size());
if (!Settings.Ratings.CATEGORIES.isEmpty()) {
size = Math.max(1, Settings.Ratings.CATEGORIES.size());
}
double[] ratings = new double[size];
if (rating == null || rating.isEmpty()) {
@ -678,10 +679,10 @@ public class MainUtil {
}
for (Entry<UUID, Integer> entry : rating.entrySet()) {
int current = entry.getValue();
if (Settings.RATINGS.CATEGORIES.isEmpty()) {
if (Settings.Ratings.CATEGORIES.isEmpty()) {
ratings[0] += current;
} else {
for (int i = 0; i < Settings.RATINGS.CATEGORIES.size(); i++) {
for (int i = 0; i < Settings.Ratings.CATEGORIES.size(); i++) {
ratings[i] += current % 10 - 1;
current /= 10;
}
@ -739,7 +740,7 @@ public class MainUtil {
String members = getPlayerList(plot.getMembers());
String denied = getPlayerList(plot.getDenied());
String expires = C.UNKNOWN.s();
if (Settings.ENABLED_COMPONENTS.PLOT_EXPIRY) {
if (Settings.Enabled_Components.PLOT_EXPIRY) {
if (plot.hasOwner()) {
Optional<?> keep = plot.getFlag(Flags.KEEP);
if (keep.isPresent()) {
@ -803,11 +804,11 @@ public class MainUtil {
@Override
public void run() {
int max = 10;
if (Settings.RATINGS.CATEGORIES != null && !Settings.RATINGS.CATEGORIES.isEmpty()) {
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
max = 8;
}
String info;
if (full && Settings.RATINGS.CATEGORIES != null && Settings.RATINGS.CATEGORIES.size() > 1) {
if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
double[] ratings = MainUtil.getAverageRatings(plot);
for (double v : ratings) {
@ -816,7 +817,7 @@ public class MainUtil {
String rating = "";
String prefix = "";
for (int i = 0; i < ratings.length; i++) {
rating += prefix + Settings.RATINGS.CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]);
rating += prefix + Settings.Ratings.CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]);
prefix = ",";
}
info = newInfo.replaceAll("%rating%", rating);

View File

@ -31,7 +31,7 @@ public class Permissions {
* @return
*/
public static boolean hasPermission(PlotPlayer player, String permission) {
if (!Settings.ENABLED_COMPONENTS.PERMISSION_CACHE) {
if (!Settings.Enabled_Components.PERMISSION_CACHE) {
return hasPermission((CommandCaller) player, permission);
}
HashMap<String, Boolean> map = player.getMeta("perm");
@ -93,7 +93,7 @@ public class Permissions {
/**
* Check the the highest permission a PlotPlayer has within a specified range.<br>
* - Excessively high values will lag<br>
* - The default range that is checked is {@link Settings#LIMIT#MAX_PLOTS}<br>
* - The default range that is checked is {@link Settings.Limit#MAX_PLOTS}<br>
* @param player
* @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
* @param range The range to check

View File

@ -87,7 +87,7 @@ public abstract class SchematicHandler {
}
final String directory;
if (outputDir == null) {
directory = Settings.PATHS.SCHEMATICS;
directory = Settings.Paths.SCHEMATICS;
} else {
directory = outputDir.getAbsolutePath();
}
@ -451,14 +451,14 @@ public abstract class SchematicHandler {
* @return schematic if found, else null
*/
public Schematic getSchematic(String name) {
File parent = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.SCHEMATICS);
File parent = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
if (!parent.exists()) {
if (!parent.mkdir()) {
throw new RuntimeException("Could not create schematic parent directory");
}
}
File file = MainUtil.getFile(PS.get().IMP.getDirectory(),
Settings.PATHS.SCHEMATICS + File.separator + name + (name.endsWith(".schematic") ? "" : ".schematic"));
Settings.Paths.SCHEMATICS + File.separator + name + (name.endsWith(".schematic") ? "" : ".schematic"));
return getSchematic(file);
}
@ -512,7 +512,7 @@ public abstract class SchematicHandler {
public List<String> getSaves(UUID uuid) {
StringBuilder rawJSON = new StringBuilder();
try {
String website = Settings.WEB.URL + "list.php?" + uuid.toString();
String website = Settings.Web.URL + "list.php?" + uuid.toString();
URL url = new URL(website);
URLConnection connection = new URL(url.toString()).openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/5.0");

View File

@ -2,12 +2,13 @@ package com.intellectualcrafters.plot.util.expiry;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.PlotArea;
import java.util.concurrent.TimeUnit;
public class ExpiryTask {
private final Settings.AUTO_CLEAR settings;
private final Settings.Auto_Clear settings;
public ExpiryTask(Settings.AUTO_CLEAR settings) {
public ExpiryTask(Settings.Auto_Clear settings) {
this.settings = settings;
}

View File

@ -32,7 +32,7 @@ public class PlotAnalysis {
public int variety_sd;
private int complexity;
public static PlotAnalysis getAnalysis(Plot plot, Settings.AUTO_CLEAR settings) {
public static PlotAnalysis getAnalysis(Plot plot, Settings.Auto_Clear settings) {
Optional<List<Integer>> flag = plot.getFlag(Flags.ANALYSIS);
if (flag.isPresent()) {
PlotAnalysis analysis = new PlotAnalysis();
@ -207,7 +207,7 @@ public class PlotAnalysis {
PS.debug(" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
PS.debug(" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
Settings.AUTO_CLEAR settings = new Settings.AUTO_CLEAR();
Settings.Auto_Clear settings = new Settings.Auto_Clear();
int[] rankChanges = rank(changes);
int[] sdChanges = getSD(rankChanges, rankRatings);
@ -527,8 +527,8 @@ public class PlotAnalysis {
this.variety_sd);
}
public int getComplexity(Settings.AUTO_CLEAR settings) {
Settings.AUTO_CLEAR.CALIBRATION modifiers = settings.CALIBRATION;
public int getComplexity(Settings.Auto_Clear settings) {
Settings.Auto_Clear.CALIBRATION modifiers = settings.CALIBRATION;
if (this.complexity != 0) {
return this.complexity;
}

View File

@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.CommentManager;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.PlotGameMode;
@ -22,6 +21,7 @@ import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import java.util.HashMap;
import java.util.Map;

View File

@ -14,6 +14,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
import java.lang.reflect.Field;
import java.util.HashSet;
@ -92,7 +93,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
return false;
}
this.BScount++;
if (this.BScount > Settings.CHUNK_PROCESSOR.MAX_TILES) {
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true;
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ());
}
@ -243,7 +244,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
return null;
}
this.Ecount++;
if (this.Ecount > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
this.Eblocked = true;
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ());
}

View File

@ -9,6 +9,7 @@ import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.sk89q.worldedit.blocks.BaseBlock;
import java.util.HashSet;
import java.util.UUID;
@ -48,7 +49,7 @@ public class WEManager {
return regions;
}
for (Plot plot : area.getPlots()) {
if (!plot.isBasePlot() || (Settings.DONE.RESTRICT_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) {
if (!plot.isBasePlot() || (Settings.Done.RESTRICT_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) {
continue;
}
boolean allowMember = player.hasPermission("plots.worldedit.member");

View File

@ -17,6 +17,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.world.World;
import java.util.HashSet;
public class WESubscriber {
@ -61,7 +62,7 @@ public class WESubscriber {
return;
}
}
if (Settings.ENABLED_COMPONENTS.CHUNK_PROCESSOR) {
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
if (PS.get().hasPlotArea(world)) {
event.setExtent(new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(), event.getExtent()));
}

View File

@ -52,12 +52,6 @@ import com.plotsquared.sponge.util.block.SlowQueue;
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.spongepowered.api.Game;
import org.spongepowered.api.Server;
@ -74,7 +68,14 @@ import org.spongepowered.api.world.World;
import org.spongepowered.api.world.gen.GenerationPopulator;
import org.spongepowered.api.world.gen.WorldGenerator;
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@Plugin(id = "plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.",
url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
@ -134,7 +135,7 @@ public class SpongeMain implements IPlotMain {
@Override
public void log(String message) {
message = C.format(message, C.replacements);
if (!Settings.CHAT.CONSOLE_COLOR) {
if (!Settings.Chat.CONSOLE_COLOR) {
message = message.replaceAll('\u00a7' + "[a-z|0-9]", "");
}
if (this.server == null) {

View File

@ -95,7 +95,7 @@ public class MainListener {
if (source == null) {
return;
}
if (Settings.PLOTME.ALIAS) {
if (Settings.PlotMe.ALIAS) {
SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim());
} else {
source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME.s()));