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 @Comment({"If schematics used for generation should be searched for in the path.schematics location", 439 " - This setting exists and is `false` by default for backwards compatibility.", 440 " - If false then generation schematics must be located in `schematics`", 441 " - Schematics must still always be under GEN_ROAD_SCHEMATIC/<world> etc."}) 442 public static boolean USE_SCHEMATICS_PATH_FOR_GEN_SCHEMATICS = false; 443 444 } 445 446 447 @Deprecated(forRemoval = true, since = "6.0.0") 448 @Comment("Schematic interface related settings") 449 public static class Web { 450 451 @Comment({"The web interface for schematics", " - All schematics are anonymous and private", 452 " - Downloads can be deleted by the user", 453 " - Supports plot uploads, downloads and saves",}) 454 public static String URL = 455 "https://schem.intellectualsites.com/plots/"; 456 @Comment({"Whether or not the legacy web interface will be used for /plot download and /plot save", 457 "Note that this will be removed in future versions. Updating to Arkitektonika is highly suggested"}) 458 public static boolean LEGACY_WEBINTERFACE = false; 459 460 } 461 462 @Comment("Schematic web interface related settings") 463 public static class Arkitektonika { 464 465 @Comment("The url of the backend server (Arkitektonika)") 466 public static String BACKEND_URL = "https://api.schematic.cloud/"; 467 468 @Comment({"The url used to generate a download link from.", 469 "{key} will be replaced with the generated key"}) 470 public static String DOWNLOAD_URL = "https://api.schematic.cloud/download/{key}"; 471 472 @Comment({"The url used to generate a deletion link from.", 473 "{key} will be replaced with the generated key"}) 474 public static String DELETE_URL = "https://api.schematic.cloud/delete/{key}"; 475 476 } 477 478 @Comment("Used to format the plot creation date placeholder. Modifying the format does not affect the storage time.") 479 public static class Timeformat { 480 481 @Comment("The date used formatted in ISO 8601") 482 public static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss z"; 483 484 @Comment("The time zone used") 485 public static String TIME_ZONE = "GMT"; 486 487 } 488 489 490 @Comment("Miscellaneous settings") 491 public static final class Done { 492 493 @Comment("Require a plot marked as done to download (/plot download)") 494 public static boolean 495 REQUIRED_FOR_DOWNLOAD = false; 496 @Comment("Only plots marked as done can be rated") 497 public static boolean 498 REQUIRED_FOR_RATINGS = false; 499 @Comment("Restrict building when a plot is marked as done") 500 public static boolean 501 RESTRICT_BUILDING = false; 502 @Comment("The limit being how many plots a player can claim") 503 public static boolean 504 COUNTS_TOWARDS_LIMIT = true; 505 506 } 507 508 509 @Comment("Chat related settings") 510 public static final class Chat { 511 512 @Comment("Should the plot chat be logged to console?") 513 public static boolean LOG_PLOTCHAT_TO_CONSOLE = true; 514 515 @Comment({"Whether an action bar message should be send over a chat message for notification purposes such for the ", 516 "notify-enter, notify-leave, greeting or farewell flag."}) 517 public static boolean NOTIFICATION_AS_ACTIONBAR = false; 518 519 @Comment({"The click event actions that should be removed from user input in e.g. plot flags like 'greeting'.", 520 "Actions like 'RUN_COMMAND' may be used maliciously as players could trick staff into clicking on messages", 521 "triggering destructive commands."}) 522 public static List<String> CLICK_EVENT_ACTIONS_TO_REMOVE = Arrays.stream(ClickEvent.Action.values()) 523 .map(Enum::name) 524 .collect(Collectors.toList()); 525 526 } 527 528 529 @Comment("Relating to how many plots someone can claim") 530 public static final class Limit { 531 532 @Comment("Should the limit be global (over multiple worlds)") 533 public static boolean GLOBAL = 534 false; 535 @Comment({"The max range of integer permissions to check for, e.g. 'plots.plot.127' or 'plots.set.flag.mob-cap.127'", 536 "The value covers the permission range to check, you need to assign the permission to players/groups still", 537 "Modifying the value does NOT change the amount of plots players can claim"}) 538 public static int MAX_PLOTS = 127; 539 540 } 541 542 543 @Comment({"Backup related settings", 544 "See https://intellectualsites.gitbook.io/plotsquared/plot-backups for more information."}) 545 public static final class Backup { 546 547 @Comment("Automatically backup plots when destructive commands are performed, e.g. /plot clear") 548 public static boolean AUTOMATIC_BACKUPS = true; 549 @Comment("Maximum amount of backups associated with a plot") 550 public static int 551 BACKUP_LIMIT = 3; 552 @Comment("Whether or not backups should be deleted when the plot is unclaimed") 553 public static boolean DELETE_ON_UNCLAIM = true; 554 555 } 556 557 558 @Comment("Confirmation timeout related settings") 559 public static final class Confirmation { 560 561 @Comment("Timeout before a confirmation prompt expires") 562 public static int 563 CONFIRMATION_TIMEOUT_SECONDS = 20; 564 565 } 566 567 568 @Comment("Teleportation related settings") 569 public static final class Teleport { 570 571 @Comment("Teleport to your plot on death") 572 public static boolean ON_DEATH = false; 573 @Comment("Teleport to your plot on login") 574 public static boolean ON_LOGIN = false; 575 @Comment("Teleport to your plot on claim (/plot claim)") 576 public static boolean ON_CLAIM = true; 577 @Comment("Teleport to your plot on auto (/plot auto)") 578 public static boolean ON_AUTO = true; 579 @Comment({"Add a delay to all teleport commands (in seconds)", 580 "Assign `plots.teleport.delay.bypass` to bypass the cooldown"}) 581 public static int DELAY = 0; 582 @Comment("Teleport outside of the plot before clearing") 583 public static boolean ON_CLEAR = false; 584 @Comment("Teleport outside of the plot before deleting") 585 public static boolean ON_DELETE = false; 586 @Comment("The visit command is ordered by world instead of globally") 587 public static boolean PER_WORLD_VISIT = false; 588 @Comment("Search merged plots for having multiple owners when using the visit command") 589 public static boolean VISIT_MERGED_OWNERS = true; 590 @Comment("Allows to teleport based on block size instead to spawn on the highest block at the home command") 591 public static boolean SIZED_BASED = true; 592 593 } 594 595 596 @Comment("Redstone related settings") 597 public static final class Redstone { 598 599 @Comment("Disable redstone in unoccupied plots") 600 public static boolean DISABLE_UNOCCUPIED = 601 false; 602 @Comment("Disable redstone when all owners/trusted/members are offline") 603 public static boolean DISABLE_OFFLINE = false; 604 @Comment( 605 "Detect and cancel invalid pistons on the edge of plots (e.g. placed with WorldEdit)") 606 public static boolean DETECT_INVALID_EDGE_PISTONS = false; 607 608 } 609 610 611 @Comment("Claim related settings") 612 public static final class Claim { 613 614 @Comment("The max plots claimed in a single `/plot auto <size>` command") 615 public static int 616 MAX_AUTO_AREA = 4; 617 618 } 619 620 621 @Comment("Rating related settings") 622 public static final class Ratings { 623 624 @Comment("Replace the rating system with a like system. Will add /plot like/dislike," 625 + " and remove the rating command") 626 public static boolean USE_LIKES = false; 627 @Comment("Rating categories") 628 public static List<String> CATEGORIES = new ArrayList<>(); 629 @Comment("The blocks to use for the rating GUI if categories are set above") 630 public static String BLOCK_0 = "brown_wool"; 631 public static String BLOCK_1 = "red_wool"; 632 public static String BLOCK_2 = "orange_wool"; 633 public static String BLOCK_3 = "yellow_wool"; 634 public static String BLOCK_4 = "lime_wool"; 635 public static String BLOCK_5 = "cyan_wool"; 636 public static String BLOCK_6 = "blue_wool"; 637 public static String BLOCK_7 = "purple_wool"; 638 public static String BLOCK_8 = "magenta_wool"; 639 640 } 641 642 @Comment("Enable or disable all of or parts of the FastAsyncWorldEdit-PlotSquared hook") 643 public static final class FAWE_Components { 644 645 @Comment("Use FastAsyncWorldEdit for queue handling.") 646 public static boolean FAWE_HOOK = true; 647 public static boolean CUBOIDS = true; 648 public static boolean CLEAR = true; 649 public static boolean COPY_AND_SWAP = true; 650 public static boolean SET_BIOME = true; 651 652 } 653 654 @Comment("Enable or disable parts of the plugin specific to using Paper") 655 public static final class Paper_Components { 656 657 @Comment("Enable Paper's listeners.") 658 public static boolean PAPER_LISTENERS = true; 659 @Comment("Prevent entities from leaving plots") 660 public static boolean ENTITY_PATHING = true; 661 @Comment("Prevent entities from leaving plots, even by pushing or pulling") 662 public static boolean ENTITY_MOVEMENT = false; 663 @Comment( 664 "Cancel entity spawns when the chunk is loaded if the PlotArea's mob spawning is off") 665 public static boolean CANCEL_CHUNK_SPAWN = true; 666 @Comment("Use paper's PlayerLaunchProjectileEvent to cancel projectiles") 667 public static boolean PLAYER_PROJECTILE = true; 668 @Comment("Cancel entity spawns from spawners before they happen (performance buff)") 669 public static boolean SPAWNER_SPAWN = true; 670 @Comment("Cancel entity spawns from tick spawn rates before they happen (performance buff)") 671 public static boolean CREATURE_SPAWN = true; 672 @Comment("Check the tile entity limit on block placement") 673 public static boolean TILE_ENTITY_CHECK = true; 674 @Comment("Use Paper's async tab completion") 675 public static boolean ASYNC_TAB_COMPLETION; 676 677 } 678 679 @Comment("Settings relating to PlotSquared's GlobalBlockQueue") 680 public static final class QUEUE { 681 682 @Comment({"Average time per tick spent completing chunk tasks in ms.", 683 "Queue will adjust the batch size to match this."}) 684 public static int MAX_ITERATION_TIME = 30; 685 @Comment({"Initial number of chunks to process by the queue. This can be increased or", 686 "decreased by the queue based on the actual iteration time compared to above."}) 687 public static int INITIAL_BATCH_SIZE = 5; 688 @Comment("Notify progress of the queue to the player or console.") 689 public static boolean NOTIFY_PROGRESS = true; 690 @Comment("Interval in ms to notify player or console of progress.") 691 public static int NOTIFY_INTERVAL = 5000; 692 @Comment({"Time to wait in ms before beginning to notify player or console of progress.", 693 "Prevent needless notification of progress for short queues."}) 694 public static int NOTIFY_WAIT = 5000; 695 @Comment({"How lighting should be handled by the queue. Modes:", 696 " - 0 - Do not do any lighting (fastest)", 697 " - 1 - Only execute lighting where blocks with light values are placed", 698 " - 2 - Only execute lighting where blocks with light values are placed or removed/replaced", 699 " - 3 - Always execute lighting (slowest)"}) 700 public static int LIGHTING_MODE = 1; 701 @Comment({"If blocks at the edges of queued operations should be set causing updates", 702 " - Slightly slower, but prevents issues such as fences left connected to nothing"}) 703 public static boolean UPDATE_EDGES = true; 704 705 } 706 707 @Comment("Settings related to tab completion") 708 public static final class Tab_Completions { 709 710 @Comment({"The time in seconds how long tab completions should remain in cache.", 711 "0 will disable caching. Lower values may be less performant."}) 712 public static int CACHE_EXPIRATION = 15; 713 714 } 715 716 @Comment("Settings related to plot titles") 717 public static final class Titles { 718 719 @Comment({"The big text that appears when you enter a plot.", 720 "For a single plot set `/plot flag set titles false` to disable it.", "For just you run `/plot toggle titles` to disable it.", 721 "For all plots: Add `titles: false` in the worlds.yml flags block to disable it."}) 722 public static boolean DISPLAY_TITLES = true; 723 @Comment("Plot titles fading in (duration in ticks)") 724 public static int TITLES_FADE_IN = 10; 725 @Comment("Plot titles being shown (duration in ticks)") 726 public static int TITLES_STAY = 50; 727 @Comment("Plot titles fading out (duration in ticks)") 728 public static int TITLES_FADE_OUT = 20; 729 @Comment({"Changes the notification method on plot entry from Title + SubTitle -> ActionBar.", 730 "The message still sent to the player is pulled from the lang key \"titles.title_entered_plot\".", 731 "If you would like to still show the owner of the plot, append the contents of \"titles.title_entered_plot_sub\" onto the " + 732 "former lang key."}) 733 public static boolean TITLES_AS_ACTIONBAR = false; 734 @Comment({"If the default title should be displayed on plots with server-plot flag set.", 735 "Titles will still be sent if the plot-title flag is set."}) 736 public static boolean DISPLAY_DEFAULT_ON_SERVER_PLOT = false; 737 738 } 739 740 @Comment("Settings related to flags") 741 public static final class Flags { 742 743 @Comment("If \"instabreak\" should consider the used tool.") 744 public static boolean INSTABREAK_CONSIDER_TOOL = false; 745 } 746 747 @Comment({"Enable or disable parts of the plugin", 748 "Note: A cache will use some memory if enabled"}) 749 public static final class Enabled_Components { // Group the following values into a new config section 750 751 @Comment("The database stores all the plots") 752 public static boolean DATABASE = true; 753 @Comment("Events are needed to track a lot of things") 754 public static boolean EVENTS = true; 755 @Comment("Commands are used to interact with the plugin") 756 public static boolean COMMANDS = 757 true; 758 @Comment("Whether we should notify you about updates or not.") 759 public static boolean 760 UPDATE_NOTIFICATIONS = true; 761 @Comment("Stores user metadata in a database") 762 public static boolean PERSISTENT_META = true; 763 @Comment("Getting a rating won't need the database") 764 public static boolean RATING_CACHE = 765 true; 766 @Comment("Allow WorldEdit to be restricted to plots") 767 public static boolean 768 WORLDEDIT_RESTRICTIONS = true; 769 @Comment("Allow economy to be used to sell, claim or buy plots.") 770 public static boolean ECONOMY = false; 771 @Comment("Expiry will clear old or simplistic plots") 772 public static boolean PLOT_EXPIRY = 773 false; 774 @Comment("Processes chunks (trimming, or entity/tile limits) ") 775 public static boolean 776 CHUNK_PROCESSOR = false; 777 @Comment("Kill mobs on roads (Chicken, Cow, etc.)") 778 public static boolean KILL_ROAD_MOBS = false; 779 @Comment("Also kill any road mobs that are being ridden, or are leashed") 780 public static boolean 781 KILL_OWNED_ROAD_MOBS = false; 782 @Comment("Also kill any road mobs that are named") 783 public static boolean KILL_NAMED_ROAD_MOBS = false; 784 @Comment("Kill items on roads (Stick, Paper, etc.)") 785 public static boolean KILL_ROAD_ITEMS = false; 786 @Comment("Kill vehicles on roads (Boat, Minecart, etc.)") 787 public static boolean KILL_ROAD_VEHICLES = false; 788 @Comment("Notify a player of any missed plot comments upon plot entry") 789 public static boolean 790 COMMENT_NOTIFIER = true; 791 @Comment("Let players claim entire worlds with PlotSquared") 792 public static boolean WORLDS = 793 false; 794 @Comment("Actively purge invalid database entries") 795 public static boolean DATABASE_PURGER = 796 false; 797 @Comment({"Delete plots when a player is banned.", 798 "Note: This only works with the /minecraft:ban command. Any punishment plugin is not supported."}) 799 public static boolean BAN_DELETER = false; 800 @Comment("Allows PlaceholderAPI placeholders to be used in captions, flags, etc.") 801 public static boolean EXTERNAL_PLACEHOLDERS = true; 802 @Comment("Make road regeneration persistent across restarts") 803 public static boolean 804 PERSISTENT_ROAD_REGEN = true; 805 @Comment({"Enable the `/plot component` preset GUI", 806 "Read more about components here: https://intellectualsites.gitbook.io/plotsquared/customization/plot-components"}) 807 public static boolean COMPONENT_PRESETS = true; 808 @Comment("Enable per user locale") 809 public static boolean PER_USER_LOCALE = false; 810 @Comment({"The default locale. Before changing the language, make sure you downloaded the appropriate file and put it " + 811 "in the 'lang' folder.", 812 "You can find additional translations here: https://intellectualsites.crowdin.com/plotsquared" 813 }) 814 public static String DEFAULT_LOCALE = "en"; 815 @Comment("Use UUID cache to complete usernames") 816 public static boolean EXTENDED_USERNAME_COMPLETION = true; 817 @Comment("Command aliases that will be tab completed") 818 public static List<String> TAB_COMPLETED_ALIASES = Arrays.asList( 819 "plot", 820 "plots", 821 "p", 822 "plotsquared", 823 "plot2", 824 "p2", 825 "ps", 826 "2", 827 "plotme", 828 "plotz", 829 "ap" 830 ); 831 @Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not") 832 public static boolean USE_MVDWAPI = true; 833 @Comment("Prevent cross plot beacon effects") 834 public static boolean DISABLE_BEACON_EFFECT_OVERFLOW = true; 835 836 } 837 838}