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