001/*
002 * PlotSquared, a land and world management plugin for Minecraft.
003 * Copyright (C) IntellectualSites <https://intellectualsites.com>
004 * Copyright (C) IntellectualSites team and contributors
005 *
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
018 */
019package com.plotsquared.core.configuration;
020
021import com.plotsquared.core.configuration.file.YamlConfiguration;
022import net.kyori.adventure.text.event.ClickEvent;
023
024import java.io.File;
025import java.util.ArrayList;
026import java.util.Arrays;
027import java.util.Collections;
028import java.util.List;
029
030public class Settings extends Config {
031
032    /*
033    START OF CONFIGURATION SECTION:
034    NOTE: Fields are saved in declaration order, classes in reverse order
035     */
036
037    @Comment("This value is not configurable. It shows the platform you are using.") // This is a comment
038    @Final
039    public static String PLATFORM; // These values are set from PlotSquared before loading
040
041    @Comment({"Show additional information in console. It helps us at IntellectualSites to find out more about an issue.",
042            "Leave it off if you don't need it, it can spam your console."})
043    public static boolean DEBUG = true;
044
045    @Comment({"The activity of high-frequency event listener can be deactivated here to improve the server performance. ",
046            "Affected settings: 'redstone' settings here below. Affected flags: 'disable-physics', 'redstone'. ",
047            "Only deactivate this setting if you do not need any of the mentioned settings or flags."})
048    public static boolean HIGH_FREQUENCY_LISTENER = true;
049
050    @Create // This value will be generated automatically
051    public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null;
052    // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks
053
054    public static void save(File file) {
055        save(file, Settings.class);
056    }
057
058    public static void load(File file) {
059        load(file, Settings.class);
060    }
061
062    public static boolean convertLegacy(File file) {
063        if (!file.exists()) {
064            return false;
065        }
066        YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
067
068        // Protection
069        Redstone.DISABLE_OFFLINE = config.getBoolean("protection.redstone.disable-offline");
070        Redstone.DISABLE_UNOCCUPIED = config
071                .getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED);
072
073        // UUID
074        UUID.OFFLINE = config.getBoolean("UUID.offline", UUID.OFFLINE);
075        UUID.FORCE_LOWERCASE = config.getBoolean("UUID.force-lowercase", UUID.FORCE_LOWERCASE);
076
077        // Mob stuff
078        Enabled_Components.KILL_ROAD_MOBS =
079                config.getBoolean("kill_road_mobs", Enabled_Components.KILL_ROAD_MOBS);
080        Enabled_Components.KILL_ROAD_VEHICLES =
081                config.getBoolean("kill_road_vehicles", Enabled_Components.KILL_ROAD_VEHICLES);
082
083        // Clearing + Expiry
084        //FAST_CLEAR = config.getBoolean("clear.fastmode");
085        Enabled_Components.PLOT_EXPIRY =
086                config.getBoolean("clear.auto.enabled", Enabled_Components.PLOT_EXPIRY);
087        if (Enabled_Components.PLOT_EXPIRY) {
088            Enabled_Components.BAN_DELETER = config.getBoolean("clear.on.ban");
089            AUTO_CLEAR = new ConfigBlock<>();
090            AUTO_CLEAR.put("task1", new Auto_Clear());
091            Auto_Clear task = AUTO_CLEAR.get("task1");
092            task.CALIBRATION = new Auto_Clear.CALIBRATION();
093
094            task.DAYS = config.getInt("clear.auto.days", task.DAYS);
095            task.THRESHOLD = config.getInt("clear.auto.threshold", task.THRESHOLD);
096            task.CONFIRMATION = config.getBoolean("clear.auto.confirmation", task.CONFIRMATION);
097            task.CALIBRATION.CHANGES =
098                    config.getInt("clear.auto.calibration.changes", task.CALIBRATION.CHANGES);
099            task.CALIBRATION.FACES =
100                    config.getInt("clear.auto.calibration.faces", task.CALIBRATION.FACES);
101            task.CALIBRATION.DATA =
102                    config.getInt("clear.auto.calibration.data", task.CALIBRATION.DATA);
103            task.CALIBRATION.AIR =
104                    config.getInt("clear.auto.calibration.air", task.CALIBRATION.AIR);
105            task.CALIBRATION.VARIETY =
106                    config.getInt("clear.auto.calibration.variety", task.CALIBRATION.VARIETY);
107            task.CALIBRATION.CHANGES_SD =
108                    config.getInt("clear.auto.calibration.changes_sd", task.CALIBRATION.CHANGES_SD);
109            task.CALIBRATION.FACES_SD =
110                    config.getInt("clear.auto.calibration.faces_sd", task.CALIBRATION.FACES_SD);
111            task.CALIBRATION.DATA_SD =
112                    config.getInt("clear.auto.calibration.data_sd", task.CALIBRATION.DATA_SD);
113            task.CALIBRATION.AIR_SD =
114                    config.getInt("clear.auto.calibration.air_sd", task.CALIBRATION.AIR_SD);
115            task.CALIBRATION.VARIETY_SD =
116                    config.getInt("clear.auto.calibration.variety_sd", task.CALIBRATION.VARIETY_SD);
117        }
118
119        // Done
120        Done.REQUIRED_FOR_RATINGS =
121                config.getBoolean("approval.ratings.check-done", Done.REQUIRED_FOR_RATINGS);
122        Done.COUNTS_TOWARDS_LIMIT =
123                config.getBoolean("approval.done.counts-towards-limit", Done.COUNTS_TOWARDS_LIMIT);
124        Done.RESTRICT_BUILDING =
125                config.getBoolean("approval.done.restrict-building", Done.RESTRICT_BUILDING);
126        Done.REQUIRED_FOR_DOWNLOAD =
127                config.getBoolean("approval.done.required-for-download", Done.REQUIRED_FOR_DOWNLOAD);
128
129        // Schematics
130        Paths.SCHEMATICS = config.getString("schematics.save_path", Paths.SCHEMATICS);
131
132        // Web
133        Web.URL = config.getString("web.url", Web.URL);
134
135        // Caching
136        Enabled_Components.RATING_CACHE =
137                config.getBoolean("cache.ratings", Enabled_Components.RATING_CACHE);
138
139        // Rating system
140        Ratings.CATEGORIES = config.contains("ratings.categories") ?
141                config.getStringList("ratings.categories") :
142                Ratings.CATEGORIES;
143
144        // Update Notifications
145        Enabled_Components.UPDATE_NOTIFICATIONS =
146                config.getBoolean("update-notifications", Enabled_Components.UPDATE_NOTIFICATIONS);
147
148        // Teleportation
149        Teleport.DELAY = config.getInt("teleport.delay", Teleport.DELAY);
150        Teleport.ON_LOGIN = config.getBoolean("teleport.on_login", Teleport.ON_LOGIN);
151        Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
152        Teleport.ON_CLEAR = config.getBoolean("teleport.on_clear", Teleport.ON_CLEAR);
153        Teleport.ON_DELETE = config.getBoolean("teleport.on_delete", Teleport.ON_DELETE);
154
155        // Chunk processor
156        Enabled_Components.CHUNK_PROCESSOR =
157                config.getBoolean("chunk-processor.enabled", Enabled_Components.CHUNK_PROCESSOR);
158        Chunk_Processor.AUTO_TRIM =
159                config.getBoolean("chunk-processor.auto-unload", Chunk_Processor.AUTO_TRIM);
160        Chunk_Processor.MAX_TILES =
161                config.getInt("chunk-processor.max-blockstates", Chunk_Processor.MAX_TILES);
162        Chunk_Processor.MAX_ENTITIES =
163                config.getInt("chunk-processor.max-entities", Chunk_Processor.MAX_ENTITIES);
164        Chunk_Processor.DISABLE_PHYSICS =
165                config.getBoolean("chunk-processor.disable-physics", Chunk_Processor.DISABLE_PHYSICS);
166
167        // Comments
168        Enabled_Components.COMMENT_NOTIFIER = config
169                .getBoolean("comments.notifications.enabled", Enabled_Components.COMMENT_NOTIFIER);
170
171        // Plot limits
172        Claim.MAX_AUTO_AREA = config.getInt("claim.max-auto-area", Claim.MAX_AUTO_AREA);
173        Limit.MAX_PLOTS = config.getInt("max_plots", Limit.MAX_PLOTS);
174        Limit.GLOBAL = config.getBoolean("global_limit", Limit.GLOBAL);
175
176        // Miscellaneous
177        DEBUG = config.getBoolean("debug", DEBUG);
178
179        Enabled_Components.DATABASE_PURGER =
180                config.getBoolean("auto-purge", Enabled_Components.DATABASE_PURGER);
181        return true;
182    }
183
184    @Comment("This is an auto clearing task called `task1`")
185    @BlockName("task1")
186    // The name for the default block
187    public static final class Auto_Clear extends ConfigBlock {
188
189        @Create // This value has to be generated since an instance isn't static
190        public CALIBRATION CALIBRATION = null;
191        public int THRESHOLD = -1;
192        public int REQUIRED_PLOTS = -1;
193        public boolean CONFIRMATION = true;
194        public int DAYS = 90;
195        public int SKIP_ACCOUNT_AGE_DAYS = -1;
196        @Comment("True, if a plot should be deleted if the plot owner is unknown to the server")
197        public boolean DELETE_IF_OWNER_IS_UNKNOWN = false;
198        public List<String> WORLDS = new ArrayList<>(Collections.singletonList("*"));
199
200
201        @Comment("See: https://intellectualsites.gitbook.io/plotsquared/optimization/plot-analysis for a description of each value.")
202        public static final class CALIBRATION {
203
204            public int VARIETY = 0;
205            public int VARIETY_SD = 0;
206            public int CHANGES = 0;
207            public int CHANGES_SD = 1;
208            public int FACES = 0;
209            public int FACES_SD = 0;
210            public int DATA_SD = 0;
211            public int AIR = 0;
212            public int AIR_SD = 0;
213            public int DATA = 0;
214
215        }
216
217    }
218
219
220    @Comment({"Chunk processor related settings",
221            "See https://intellectualsites.gitbook.io/plotsquared/optimization/chunk-processor for more information."})
222    public static class Chunk_Processor {
223
224        @Comment("Auto trim will not save chunks which aren't claimed")
225        public static boolean
226                AUTO_TRIM = false;
227        @Comment("Max tile entities per chunk")
228        public static int MAX_TILES = 4096;
229        @Comment("Max entities per chunk")
230        public static int MAX_ENTITIES = 512;
231        @Comment("Disable block physics")
232        public static boolean DISABLE_PHYSICS = false;
233
234    }
235
236
237    @Comment({"UUID settings",
238            "DO NOT EDIT them unless you know what you are doing."})
239    public static class UUID {
240
241        @Comment("Force using offline UUIDs (it usually detects the right mode)")
242        public static boolean OFFLINE = false;
243        @Comment("Force using lowercase UUIDs")
244        public static boolean FORCE_LOWERCASE = false;
245        @Comment("How many UUIDs that may be stored in the cache")
246        public static int UUID_CACHE_SIZE = 100000;
247        @Comment("Rate limit (per 10 minutes) for background UUID fetching from the Mojang API")
248        public static int BACKGROUND_LIMIT = 200;
249        @Comment("Whether the Mojang API service is enabled for impromptu api calls. If false only the Background task will use" +
250                " http requests to fill the UUID cache (requires restart)")
251        public static boolean IMPROMPTU_SERVICE_MOJANG_API = true;
252        @Comment("Rate limit (per 10 minutes) for random UUID fetching from the Mojang API")
253        public static int IMPROMPTU_LIMIT = 300;
254        @Comment("Timeout (in milliseconds) for non-blocking UUID requests (mostly commands)")
255        public static long NON_BLOCKING_TIMEOUT = 3000L;
256        @Comment("Timeout (in milliseconds) for blocking UUID requests (events)")
257        public static long BLOCKING_TIMEOUT = 10L;
258        @Comment("Whether or not PlotSquared should read from the legacy database")
259        public static boolean LEGACY_DATABASE_SUPPORT = true;
260        @Comment("Whether or not PlotSquared should return Unknown if it fails to fulfill a request")
261        public static boolean UNKNOWN_AS_DEFAULT = true;
262        @Comment("Whether or not automatic background caching should be enabled. It is HIGHLY recommended to keep this turned on."
263                + " This should only be disabled if the server has a very large number of plots (>100k)")
264        public static boolean BACKGROUND_CACHING_ENABLED = true;
265        @Comment("Whether the PaperMC service is enabled")
266        public static boolean SERVICE_PAPER = true;
267        @Comment("Whether the LuckPerms service is enabled")
268        public static boolean SERVICE_LUCKPERMS = true;
269        @Comment("Whether the Bukkit service is enabled")
270        public static boolean SERVICE_BUKKIT = true;
271        @Comment("Whether the EssentialsX service is enabled")
272        public static boolean SERVICE_ESSENTIALSX = true;
273
274    }
275
276
277    @Comment("General settings")
278    public static final class General {
279
280        @Comment("Display scientific numbers (4.2E8)")
281        public static boolean SCIENTIFIC = false;
282        @Comment("Replace wall when merging")
283        public static boolean MERGE_REPLACE_WALL = true;
284        @Comment("Always show explosion Particles, even if explosion flag is set to false")
285        public static boolean ALWAYS_SHOW_EXPLOSIONS = false;
286        @Comment({"Blocks that may not be used in plot components",
287                "Checkout the wiki article regarding plot components before modifying: https://intellectualsites.gitbook.io/plotsquared/customization/plot-components"})
288        public static List<String>
289                INVALID_BLOCKS = Arrays.asList(
290                // Acacia Stuff
291                "acacia_button", "acacia_fence_gate", "acacia_door", "acacia_pressure_plate",
292                "acacia_trapdoor", "acacia_sapling", "acacia_sign", "acacia_wall_sign", "acacia_leaves",
293                // Birch Stuff
294                "birch_button", "birch_fence_gate", "birch_door", "birch_pressure_plate",
295                "birch_trapdoor", "birch_sapling", "birch_sign", "birch_wall_sign", "birch_leaves",
296                // Dark Oak Stuff
297                "dark_oak_button", "dark_oak_fence_gate", "dark_oak_door", "dark_oak_pressure_plate",
298                "dark_oak_trapdoor", "dark_oak_sapling", "dark_oak_sign", "dark_oak_wall_sign",
299                "dark_oak_leaves",
300                // Jungle Stuff
301                "jungle_button", "jungle_fence_gate", "jungle_door", "jungle_pressure_plate",
302                "jungle_trapdoor", "jungle_sapling", "jungle_sign", "jungle_wall_sign", "jungle_leaves",
303                // Oak Stuff
304                "oak_button", "oak_fence_gate", "oak_door", "oak_pressure_plate", "oak_trapdoor",
305                "oak_sapling", "oak_sign", "oak_wall_sign", "oak_leaves",
306                // Spruce Stuff
307                "spruce_button", "spruce_fence_gate", "spruce_door", "spruce_pressure_plate",
308                "spruce_trapdoor", "spruce_sapling", "spruce_sign", "spruce_wall_sign", "spruce_leaves",
309                // Rails
310                "activator_rail", "detector_rail", "rail",
311                // Flowers
312                "allium", "azure_bluet", "blue_orchid", "dandelion", "lilac", "orange_tulip",
313                "oxeye_daisy", "peony", "pink_tulip", "poppy", "potted_allium", "potted_azure_bluet",
314                "potted_birch_sapling", "potted_blue_orchid", "potted_brown_mushroom", "potted_cactus",
315                "potted_fern", "potted_jungle_sapling", "potted_oak_sapling", "potted_orange_tulip",
316                "potted_oxeye_daisy", "potted_pink_tulip", "potted_red_mushroom", "potted_red_tulip",
317                "red_mushroom", "red_tulip", "potted_spruce_sapling", "potted_white_tulip", "rose_bush",
318                "sunflower", "white_tulip", "cornflower", "wither_rose",
319                // Stems
320                "attached_melon_stem", "attached_pumpkin_stem", "melon_stem", "pumpkin_stem",
321                "mushroom_stem",
322                // Plants
323                "beetroots", "brown_mushroom", "cactus", "carrots", "chorus_flower", "chorus_plant",
324                "cocoa", "dead_bush", "fern", "kelp_plant", "large_fern", "lily_pad", "potatoes",
325                "sea_pickle", "seagrass", "sugar_cane", "tall_grass", "tall_seagrass", "vine", "wheat",
326                "bamboo",
327                // Misc
328                "anvil", "barrier", "beacon", "brewing_stand", "bubble_column", "cake", "cobweb",
329                "comparator", "creeper_head", "creeper_wall_header", "damaged_anvil",
330                "daylight_detector", "dragon_egg", "dragon_head", "dragon_wall_head",
331                "enchanting_table", "end_gateway", "end_portal", "end_rod", "ender_chest", "chest",
332                "flower_pot", "grass", "heavy_weighted_pressure_plate", "lever",
333                "light_weighted_pressure_plate", "player_head", "redstone_wire", "repeater",
334                "comparator", "redstone_torch", "torch", "redstone_wall_torch", "wall_torch", "sign",
335                "skeleton_skull", "skeleton_wall_skull", "snow", "stone_pressure_plate",
336                "trapped_chest", "tripwire", "tripwire_hook", "turtle_egg", "wall_sign", "zombie_head",
337                "zombie_wall_head", "bell",
338                // Black Stuff
339                "black_bed", "black_banner", "black_carpet", "black_concrete_powder",
340                "black_wall_banner",
341                // Blue Stuff
342                "blue_bed", "blue_banner", "blue_carpet", "blue_concrete_powder", "blue_wall_banner",
343                // Brown Stuff
344                "brown_bed", "brown_banner", "brown_carpet", "brown_concrete_powder",
345                "brown_wall_banner",
346                // Cyan Stuff
347                "cyan_bed", "cyan_banner", "cyan_concrete_powder", "cyan_carpet", "cyan_wall_banner",
348                // Gray Stuff
349                "gray_bed", "gray_banner", "gray_concrete_powder", "gray_carpet", "gray_wall_banner",
350                // Green Stuff
351                "green_bed", "green_banner", "green_concrete_powder", "green_carpet",
352                "green_wall_banner",
353                // Light blue Stuff
354                "light_blue_bed", "light_blue_banner", "light_blue_concrete_powder",
355                "light_blue_carpet", "light_blue_wall_banner",
356                // Light Gray Stuff
357                "light_gray_bed", "light_gray_banner", "light_gray_concrete_powder",
358                "light_gray_carpet", "light_gray_wall_banner",
359                // Lime Stuff
360                "lime_bed", "lime_banner", "lime_concrete_powder", "lime_carpet", "lime_wall_banner",
361                // Magenta Stuff
362                "magenta_bed", "magenta_banner", "magenta_concrete_powder", "magenta_carpet",
363                "magenta_wall_banner",
364                // Orange Stuff
365                "orange_bed", "orange_banner", "orange_concrete_powder", "orange_carpet",
366                "orange_wall_banner",
367                // Pink Stuff
368                "pink_bed", "pink_banner", "pink_concrete_powder", "pink_carpet", "pink_wall_banner",
369                // Purple Stuff
370                "purple_bed", "purple_banner", "purple_concrete_powder", "purple_carpet",
371                "purple_wall_banner",
372                // Red Stuff
373                "red_bed", "red_banner", "red_concrete_powder", "red_carpet", "red_wall_banner",
374                // White Stuff
375                "white_bed", "white_banner", "white_concrete_powder", "white_carpet",
376                "white_wall_banner",
377                // Yellow Stuff
378                "yellow_bed", "yellow_banner", "yellow_concrete_powder", "yellow_carpet",
379                "yellow_wall_banner",
380                // Corals
381                "brain_coral", "brain_coral_fan", "brain_coral_wall_fan", "bubble_coral",
382                "bubble_coral_block", "bubble_coral_fan", "bubble_coral_wall_fan", "dead_brain_coral",
383                "dead_brain_coral_block", "dead_brain_coral_fan", "dead_brain_coral_wall_fan",
384                "dead_bubble_coral", "dead_bubble_coral_fan", "dead_bubble_coral_wall_fan",
385                "dead_fire_coral", "dead_fire_coral_block", "dead_fire_coral_fan",
386                "dead_fire_coral_wall_fan", "dead_horn_coral", "dead_horn_coral_block",
387                "dead_horn_coral_fan", "dead_tube_coral", "dead_tube_coral_wall_fan",
388                "dried_kelp_block", "horn_coral", "horn_coral_block", "horn_coral_fan",
389                "horn_coral_wall_fan", "tube_coral", "tube_coral_block", "tube_coral_fan",
390                "tube_coral_wall_fan"
391        );
392
393    }
394
395
396    @Comment("Update checker settings")
397    public static final class UpdateChecker {
398
399        @Comment("How often to poll for updates (in minutes)")
400        public static int POLL_RATE = 360;
401        @Comment("Only notify console once after an update is found")
402        public static boolean
403                NOTIFY_ONCE = true;
404
405    }
406
407
408    @Comment({"Schematic Settings",
409            "See https://intellectualsites.gitbook.io/plotsquared/schematics/schematic-on-claim for more information."})
410    public static final class Schematics {
411
412        @Comment(
413                "Whether schematic based generation should paste schematic on top of plots, or from Y=1")
414        public static boolean PASTE_ON_TOP = true;
415        @Comment(
416                "Whether schematic based road generation should paste schematic on top of roads, or from Y=1")
417        public static boolean PASTE_ROAD_ON_TOP = true;
418        @Comment({"If schematics that do not match a plot's size should be pasted anyway",
419                " - This will still only paste a schematic with a plot's bounds.",
420                " - If a schematic is too big, it will cut off, and if too small, will not full the plot."})
421        public static boolean PASTE_MISMATCHES = true;
422        @Comment({"If the wall height should be taken into account when calculating the road schematic paste height",
423                " - If true, will use the lower of wall and road height.",
424                " - If true, will ensure correct schematic behaviour (no parts are cut off).",
425                " - Set to false if you experience the road being set one block too low",
426                "   (only for road schematics created pre 6.1.4)."})
427        public static boolean USE_WALL_IN_ROAD_SCHEM_HEIGHT = true;
428
429    }
430
431
432    @Comment("Configure the paths that will be used")
433    public static final class Paths {
434
435        public static String SCHEMATICS = "schematics";
436        public static String TEMPLATES = "templates";
437        @Comment({"If schematics used for generation should be searched for in the path.schematics location",
438                " - This setting exists and is `false` by default for backwards compatibility.",
439                " - If false then generation schematics must be located in `schematics`",
440                " - Schematics must still always be under GEN_ROAD_SCHEMATIC/<world> etc."})
441        public static boolean USE_SCHEMATICS_PATH_FOR_GEN_SCHEMATICS = false;
442
443    }
444
445
446    @Deprecated(forRemoval = true, since = "6.0.0")
447    @Comment("Schematic interface related settings")
448    public static class Web {
449
450        @Comment({"The web interface for schematics", " - All schematics are anonymous and private",
451                " - Downloads can be deleted by the user",
452                " - Supports plot uploads, downloads and saves",})
453        public static String URL =
454                "https://schem.intellectualsites.com/plots/";
455        @Comment({"Whether or not the legacy web interface will be used for /plot download and /plot save",
456                "Note that this will be removed in future versions. Updating to Arkitektonika is highly suggested"})
457        public static boolean LEGACY_WEBINTERFACE = false;
458
459    }
460
461    @Comment("Schematic web interface related settings")
462    public static class Arkitektonika {
463
464        @Comment("The url of the backend server (Arkitektonika)")
465        public static String BACKEND_URL = "https://api.schematic.cloud/";
466
467        @Comment({"The url used to generate a download link from.",
468                "{key} will be replaced with the generated key"})
469        public static String DOWNLOAD_URL = "https://api.schematic.cloud/download/{key}";
470
471        @Comment({"The url used to generate a deletion link from.",
472                "{key} will be replaced with the generated key"})
473        public static String DELETE_URL = "https://api.schematic.cloud/delete/{key}";
474
475    }
476
477    @Comment("Used to format the plot creation date placeholder. Modifying the format does not affect the storage time.")
478    public static class Timeformat {
479
480        @Comment("The date used formatted in ISO 8601")
481        public static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss z";
482
483        @Comment("The time zone used")
484        public static String TIME_ZONE = "GMT";
485
486    }
487
488
489    @Comment("Miscellaneous settings")
490    public static final class Done {
491
492        @Comment("Require a plot marked as done to download (/plot download)")
493        public static boolean
494                REQUIRED_FOR_DOWNLOAD = false;
495        @Comment("Only plots marked as done can be rated")
496        public static boolean
497                REQUIRED_FOR_RATINGS = false;
498        @Comment("Restrict building when a plot is marked as done")
499        public static boolean
500                RESTRICT_BUILDING = false;
501        @Comment("The limit being how many plots a player can claim")
502        public static boolean
503                COUNTS_TOWARDS_LIMIT = true;
504
505    }
506
507
508    @Comment("Chat related settings")
509    public static final class Chat {
510
511        @Comment("Should the plot chat be logged to console?")
512        public static boolean LOG_PLOTCHAT_TO_CONSOLE = true;
513
514        @Comment({"Whether an action bar message should be send over a chat message for notification purposes such for the ",
515                "notify-enter, notify-leave, greeting or farewell flag."})
516        public static boolean NOTIFICATION_AS_ACTIONBAR = false;
517
518        @Comment({"The click event actions that should be removed from user input in e.g. plot flags like 'greeting'.",
519                "Actions like 'RUN_COMMAND' may be used maliciously as players could trick staff into clicking on messages",
520                "triggering destructive commands."})
521        public static List<String> CLICK_EVENT_ACTIONS_TO_REMOVE = new ArrayList<>(ClickEvent.Action.NAMES.keys());
522
523    }
524
525
526    @Comment("Relating to how many plots someone can claim")
527    public static final class Limit {
528
529        @Comment("Should the limit be global (over multiple worlds)")
530        public static boolean GLOBAL =
531                false;
532        @Comment({"The max range of integer permissions to check for, e.g. 'plots.plot.127' or 'plots.set.flag.mob-cap.127'",
533                "The value covers the permission range to check, you need to assign the permission to players/groups still",
534                "Modifying the value does NOT change the amount of plots players can claim"})
535        public static int MAX_PLOTS = 127;
536
537    }
538
539
540    @Comment({"Backup related settings",
541            "See https://intellectualsites.gitbook.io/plotsquared/plot-backups for more information."})
542    public static final class Backup {
543
544        @Comment("Automatically backup plots when destructive commands are performed, e.g. /plot clear")
545        public static boolean AUTOMATIC_BACKUPS = true;
546        @Comment("Maximum amount of backups associated with a plot")
547        public static int
548                BACKUP_LIMIT = 3;
549        @Comment("Whether or not backups should be deleted when the plot is unclaimed")
550        public static boolean DELETE_ON_UNCLAIM = true;
551
552    }
553
554
555    @Comment("Confirmation timeout related settings")
556    public static final class Confirmation {
557
558        @Comment("Timeout before a confirmation prompt expires")
559        public static int
560                CONFIRMATION_TIMEOUT_SECONDS = 20;
561
562    }
563
564
565    @Comment("Teleportation related settings")
566    public static final class Teleport {
567
568        @Comment("Teleport to your plot on death")
569        public static boolean ON_DEATH = false;
570        @Comment("Teleport to your plot on login")
571        public static boolean ON_LOGIN = false;
572        @Comment("Teleport to your plot on claim (/plot claim)")
573        public static boolean ON_CLAIM = true;
574        @Comment("Teleport to your plot on auto (/plot auto)")
575        public static boolean ON_AUTO = true;
576        @Comment({"Add a delay to all teleport commands (in seconds)",
577                "Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
578        public static int DELAY = 0;
579        @Comment("Teleport outside of the plot before clearing")
580        public static boolean ON_CLEAR = false;
581        @Comment("Teleport outside of the plot before deleting")
582        public static boolean ON_DELETE = false;
583        @Comment("The visit command is ordered by world instead of globally")
584        public static boolean PER_WORLD_VISIT = false;
585        @Comment("Search merged plots for having multiple owners when using the visit command")
586        public static boolean VISIT_MERGED_OWNERS = true;
587        @Comment("Allows to teleport based on block size instead to spawn on the highest block at the home command")
588        public static boolean SIZED_BASED = true;
589
590    }
591
592
593    @Comment("Redstone related settings")
594    public static final class Redstone {
595
596        @Comment("Disable redstone in unoccupied plots")
597        public static boolean DISABLE_UNOCCUPIED =
598                false;
599        @Comment("Disable redstone when all owners/trusted/members are offline")
600        public static boolean DISABLE_OFFLINE = false;
601        @Comment(
602                "Detect and cancel invalid pistons on the edge of plots (e.g. placed with WorldEdit)")
603        public static boolean DETECT_INVALID_EDGE_PISTONS = false;
604
605    }
606
607
608    @Comment("Claim related settings")
609    public static final class Claim {
610
611        @Comment("The max plots claimed in a single `/plot auto <size>` command")
612        public static int
613                MAX_AUTO_AREA = 4;
614
615    }
616
617
618    @Comment("Rating related settings")
619    public static final class Ratings {
620
621        @Comment("Replace the rating system with a like system. Will add /plot like/dislike,"
622                + " and remove the rating command")
623        public static boolean USE_LIKES = false;
624        @Comment("Rating categories")
625        public static List<String> CATEGORIES = new ArrayList<>();
626        @Comment("The blocks to use for the rating GUI if categories are set above")
627        public static String BLOCK_0 = "brown_wool";
628        public static String BLOCK_1 = "red_wool";
629        public static String BLOCK_2 = "orange_wool";
630        public static String BLOCK_3 = "yellow_wool";
631        public static String BLOCK_4 = "lime_wool";
632        public static String BLOCK_5 = "cyan_wool";
633        public static String BLOCK_6 = "blue_wool";
634        public static String BLOCK_7 = "purple_wool";
635        public static String BLOCK_8 = "magenta_wool";
636
637    }
638
639    @Comment("Enable or disable all of or parts of the FastAsyncWorldEdit-PlotSquared hook")
640    public static final class FAWE_Components {
641
642        @Comment("Use FastAsyncWorldEdit for queue handling.")
643        public static boolean FAWE_HOOK = true;
644        public static boolean CUBOIDS = true;
645        public static boolean CLEAR = true;
646        public static boolean COPY_AND_SWAP = true;
647        public static boolean SET_BIOME = true;
648
649    }
650
651    @Comment("Enable or disable parts of the plugin specific to using Paper")
652    public static final class Paper_Components {
653
654        @Comment("Enable Paper's listeners.")
655        public static boolean PAPER_LISTENERS = true;
656        @Comment("Prevent entities from leaving plots")
657        public static boolean ENTITY_PATHING = true;
658        @Comment("Prevent entities from leaving plots, even by pushing or pulling")
659        public static boolean ENTITY_MOVEMENT = false;
660        @Comment(
661                "Cancel entity spawns when the chunk is loaded if the PlotArea's mob spawning is off")
662        public static boolean CANCEL_CHUNK_SPAWN = true;
663        @Comment("Use paper's PlayerLaunchProjectileEvent to cancel projectiles")
664        public static boolean PLAYER_PROJECTILE = true;
665        @Comment("Cancel entity spawns from spawners before they happen (performance buff)")
666        public static boolean SPAWNER_SPAWN = true;
667        @Comment("Cancel entity spawns from tick spawn rates before they happen (performance buff)")
668        public static boolean CREATURE_SPAWN = true;
669        @Comment("Check the tile entity limit on block placement")
670        public static boolean TILE_ENTITY_CHECK = true;
671        @Comment("Use Paper's async tab completion")
672        public static boolean ASYNC_TAB_COMPLETION;
673
674    }
675
676    @Comment("Settings relating to PlotSquared's GlobalBlockQueue")
677    public static final class QUEUE {
678
679        @Comment({"Average time per tick spent completing chunk tasks in ms.",
680                "Queue will adjust the batch size to match this."})
681        public static int MAX_ITERATION_TIME = 30;
682        @Comment({"Initial number of chunks to process by the queue. This can be increased or",
683                "decreased by the queue based on the actual iteration time compared to above."})
684        public static int INITIAL_BATCH_SIZE = 5;
685        @Comment("Notify progress of the queue to the player or console.")
686        public static boolean NOTIFY_PROGRESS = true;
687        @Comment("Interval in ms to notify player or console of progress.")
688        public static int NOTIFY_INTERVAL = 5000;
689        @Comment({"Time to wait in ms before beginning to notify player or console of progress.",
690                "Prevent needless notification of progress for short queues."})
691        public static int NOTIFY_WAIT = 5000;
692        @Comment({"How lighting should be handled by the queue. Modes:",
693                "  - 0 - Do not do any lighting (fastest)",
694                "  - 1 - Only execute lighting where blocks with light values are placed",
695                "  - 2 - Only execute lighting where blocks with light values are placed or removed/replaced",
696                "  - 3 - Always execute lighting (slowest)"})
697        public static int LIGHTING_MODE = 1;
698        @Comment({"If blocks at the edges of queued operations should be set causing updates",
699                " - Slightly slower, but prevents issues such as fences left connected to nothing"})
700        public static boolean UPDATE_EDGES = true;
701
702    }
703
704    @Comment("Settings related to tab completion")
705    public static final class Tab_Completions {
706
707        @Comment({"The time in seconds how long tab completions should remain in cache.",
708                "0 will disable caching. Lower values may be less performant."})
709        public static int CACHE_EXPIRATION = 15;
710
711    }
712
713    @Comment("Settings related to plot titles")
714    public static final class Titles {
715
716        @Comment({"The big text that appears when you enter a plot.",
717                "For a single plot set `/plot flag set titles false` to disable it.", "For just you run `/plot toggle titles` to disable it.",
718                "For all plots: Add `titles: false` in the worlds.yml flags block to disable it."})
719        public static boolean DISPLAY_TITLES = true;
720        @Comment("Plot titles fading in (duration in ticks)")
721        public static int TITLES_FADE_IN = 10;
722        @Comment("Plot titles being shown (duration in ticks)")
723        public static int TITLES_STAY = 50;
724        @Comment("Plot titles fading out (duration in ticks)")
725        public static int TITLES_FADE_OUT = 20;
726        @Comment({"Changes the notification method on plot entry from Title + SubTitle -> ActionBar.",
727                "The message still sent to the player is pulled from the lang key \"titles.title_entered_plot\".",
728                "If you would like to still show the owner of the plot, append the contents of \"titles.title_entered_plot_sub\" onto the " +
729                        "former lang key."})
730        public static boolean TITLES_AS_ACTIONBAR = false;
731        @Comment({"If the default title should be displayed on plots with server-plot flag set.",
732                "Titles will still be sent if the plot-title flag is set."})
733        public static boolean DISPLAY_DEFAULT_ON_SERVER_PLOT = false;
734
735    }
736
737    @Comment("Settings related to flags")
738    public static final class Flags {
739
740        @Comment("If \"instabreak\" should consider the used tool.")
741        public static boolean INSTABREAK_CONSIDER_TOOL = false;
742    }
743
744    @Comment({"Enable or disable parts of the plugin",
745            "Note: A cache will use some memory if enabled"})
746    public static final class Enabled_Components { // Group the following values into a new config section
747
748        @Comment("The database stores all the plots")
749        public static boolean DATABASE = true;
750        @Comment("Events are needed to track a lot of things")
751        public static boolean EVENTS = true;
752        @Comment("Commands are used to interact with the plugin")
753        public static boolean COMMANDS =
754                true;
755        @Comment("Whether we should notify you about updates or not.")
756        public static boolean
757                UPDATE_NOTIFICATIONS = true;
758        @Comment("Stores user metadata in a database")
759        public static boolean PERSISTENT_META = true;
760        @Comment("Getting a rating won't need the database")
761        public static boolean RATING_CACHE =
762                true;
763        @Comment("Allow WorldEdit to be restricted to plots")
764        public static boolean
765                WORLDEDIT_RESTRICTIONS = true;
766        @Comment("Allow economy to be used to sell, claim or buy plots.")
767        public static boolean ECONOMY = false;
768        @Comment("Expiry will clear old or simplistic plots")
769        public static boolean PLOT_EXPIRY =
770                false;
771        @Comment("Processes chunks (trimming, or entity/tile limits) ")
772        public static boolean
773                CHUNK_PROCESSOR = false;
774        @Comment("Kill mobs on roads (Chicken, Cow, etc.)")
775        public static boolean KILL_ROAD_MOBS = false;
776        @Comment("Also kill any road mobs that are being ridden, or are leashed")
777        public static boolean
778                KILL_OWNED_ROAD_MOBS = false;
779        @Comment("Also kill any road mobs that are named")
780        public static boolean KILL_NAMED_ROAD_MOBS = false;
781        @Comment("Kill items on roads (Stick, Paper, etc.)")
782        public static boolean KILL_ROAD_ITEMS = false;
783        @Comment("Kill vehicles on roads (Boat, Minecart, etc.)")
784        public static boolean KILL_ROAD_VEHICLES = false;
785        @Comment("Notify a player of any missed plot comments upon plot entry")
786        public static boolean
787                COMMENT_NOTIFIER = true;
788        @Comment("Let players claim entire worlds with PlotSquared")
789        public static boolean WORLDS =
790                false;
791        @Comment("Actively purge invalid database entries")
792        public static boolean DATABASE_PURGER =
793                false;
794        @Comment({"Delete plots when a player is banned.",
795                "Note: This only works with the /minecraft:ban command. Any punishment plugin is not supported."})
796        public static boolean BAN_DELETER = false;
797        @Comment("Allows PlaceholderAPI placeholders to be used in captions, flags, etc.")
798        public static boolean EXTERNAL_PLACEHOLDERS = true;
799        @Comment("Make road regeneration persistent across restarts")
800        public static boolean
801                PERSISTENT_ROAD_REGEN = true;
802        @Comment({"Enable the `/plot component` preset GUI",
803                "Read more about components here: https://intellectualsites.gitbook.io/plotsquared/customization/plot-components"})
804        public static boolean COMPONENT_PRESETS = true;
805        @Comment("Enable per user locale")
806        public static boolean PER_USER_LOCALE = false;
807        @Comment({"The default locale. Before changing the language, make sure you downloaded the appropriate file and put it " +
808                "in the 'lang' folder.",
809                "You can find additional translations here: https://intellectualsites.crowdin.com/plotsquared"
810        })
811        public static String DEFAULT_LOCALE = "en";
812        @Comment("Use UUID cache to complete usernames")
813        public static boolean EXTENDED_USERNAME_COMPLETION = true;
814        @Comment("Command aliases that will be tab completed")
815        public static List<String> TAB_COMPLETED_ALIASES = Arrays.asList(
816                "plot",
817                "plots",
818                "p",
819                "plotsquared",
820                "plot2",
821                "p2",
822                "ps",
823                "2",
824                "plotme",
825                "plotz",
826                "ap"
827        );
828        @Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not")
829        public static boolean USE_MVDWAPI = true;
830        @Comment("Prevent cross plot beacon effects")
831        public static boolean DISABLE_BEACON_EFFECT_OVERFLOW = true;
832
833    }
834
835}