GriefPrevention / GriefPrevention

The official self-service anti-griefing Bukkit plugin for Minecraft servers since 2011.
https://griefprevention.com
GNU General Public License v3.0
296 stars 240 forks source link

Config.yml resets after making any changes when starting server #1819

Closed bryanfolstad closed 2 years ago

bryanfolstad commented 2 years ago

Observed Behavior

When making changes to settings in the config.yml file it refuses to load the changed settings and resets to the default config. Changing any setting does this.

Expected Behavior

Adjusted settings should allow the config.yml to load and change the settings on the server accordingly.

Reproduction steps

  1. Stop your server
  2. Edit some settings in the config.yml file such as changing Claim Blocks Accrued Per Hour: to Claim Blocks Accrued Per Hour: 500
  3. Save and exit the config.yml file
  4. Start the server
  5. Watch as the console fills with the error posted in the Stack trace/error log.
  6. Stop server
  7. Open config.yml file and notice it has reset everything to default settings.

Stack trace or error log

D:\3 Creative-Flat>java -Xmx4G -Xms4G -jar server.jar nogui
Starting org.bukkit.craftbukkit.Main
System Info: Java 17 (Java HotSpot(TM) 64-Bit Server VM 17.0.1+12-LTS-39) Host: Windows 10 10.0 (amd64)
Loading libraries, please wait...
[10:56:26 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[10:56:27 INFO]: Reloading ResourceManager: Default, bukkit, player head drops v1.1.2.zip, confetti creepers v2.2.2.zip, spawn v2.3.2.zip, tpa v2.3.2.zip, more mob heads v2.9.4.zip
[10:56:27 INFO]: Loaded 7 recipes
[10:56:27 WARN]: Found validation problem in {minecraft:entities/ender_dragon}.pools[0].entries[0]: Unknown loot table called minecraft:entities/reference/extra/ender_dragon
[10:56:27 WARN]: Found validation problem in {minecraft:entities/shulker}.pools[2].entries[0]: Unknown loot table called minecraft:entities/reference/extra/shulker
[10:56:28 INFO]: Starting minecraft server version 1.18.1
[10:56:28 INFO]: Loading properties
[10:56:28 INFO]: This server is running Paper version git-Paper-215 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT) (Git: 7f65b0b)
[10:56:28 INFO]: Using 4 threads for Netty based IO
[10:56:28 INFO]: Server Ping Player Sample Count: 12
[10:56:28 INFO]: Default game type: CREATIVE
[10:56:28 INFO]: Generating keypair
[10:56:28 INFO]: Starting Minecraft server on *:25585
[10:56:29 INFO]: Using default channel type
[10:56:29 INFO]: Paper: Using Java 11 compression from Velocity.
[10:56:29 INFO]: Paper: Using Java cipher from Velocity.
[10:56:29 INFO]: [CoreProtect] Loading CoreProtect v20.4
[10:56:29 INFO]: [AdvancedPortals] Loading AdvancedPortals v0.9.2
[10:56:29 INFO]: [HolographicDisplays] Loading HolographicDisplays v3.0.0-SNAPSHOT
[10:56:29 INFO]: [Essentials] Loading Essentials v2.19.2
[10:56:29 INFO]: [BungeeGuard] Loading BungeeGuard v1.2-SNAPSHOT
[10:56:29 INFO]: [GriefPrevention] Loading GriefPrevention v16.17.1-2b69191
[10:56:29 INFO]: Server permissions file permissions.yml is empty, ignoring it
[10:56:29 WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[10:56:29 WARN]: The server will make no attempt to authenticate usernames. Beware.
[10:56:29 WARN]: Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.
[10:56:29 WARN]: Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.
[10:56:29 WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[10:56:29 INFO]: Preparing level "Creative"
[10:56:29 INFO]: Preparing start region for dimension minecraft:overworld
[10:56:30 INFO]: Time elapsed: 229 ms
[10:56:30 INFO]: Preparing start region for dimension minecraft:the_nether
[10:56:30 INFO]: Time elapsed: 96 ms
[10:56:30 INFO]: Preparing start region for dimension minecraft:the_end
[10:56:30 INFO]: Time elapsed: 70 ms
[10:56:30 INFO]: [CoreProtect] Enabling CoreProtect v20.4
[10:56:30 INFO]: [CoreProtect] CoreProtect has been successfully enabled!
[10:56:30 INFO]: [CoreProtect] Using SQLite for data storage.
[10:56:30 INFO]: --------------------
[10:56:30 INFO]: [CoreProtect] Enjoy CoreProtect? Join our Discord!
[10:56:30 INFO]: [CoreProtect] Discord: www.coreprotect.net/discord/
[10:56:30 INFO]: --------------------
[10:56:30 INFO]: [AdvancedPortals] Enabling AdvancedPortals v0.9.2
[10:56:30 INFO]: [AdvancedPortals] BLOCK_PORTAL_TRAVEL found
[10:56:30 INFO]: [AdvancedPortals] Bungee detected. Enabling proxy features.
[10:56:30 INFO]: Advanced portals have been successfully enabled!
[10:56:30 INFO]: [HolographicDisplays] Enabling HolographicDisplays v3.0.0-SNAPSHOT
[10:56:31 INFO]: [Essentials] Enabling Essentials v2.19.2
[10:56:31 INFO]: [Essentials] Attempting to convert old kits in config.yml to new kits.yml
[10:56:31 INFO]: [Essentials] No kits found to migrate.
[10:56:31 INFO]: [Essentials] Loaded 36926 items from items.json.
[10:56:31 INFO]: [Essentials] Using locale en_US
[10:56:31 INFO]: [Essentials] ServerListPingEvent: Spigot iterator API
[10:56:31 INFO]: [Essentials] Starting Metrics. Opt-out using the global bStats config.
[10:56:31 INFO]: [Essentials] Using superperms-based permissions.
[10:56:31 INFO]: [BungeeGuard] Enabling BungeeGuard v1.2-SNAPSHOT
[10:56:31 INFO]: [BungeeGuard] Using Paper's PlayerHandshakeEvent to listen for connections.
[10:56:31 INFO]: [GriefPrevention] Enabling GriefPrevention v16.17.1-2b69191
[10:56:31 ERROR]: Cannot load plugins\GriefPreventionData\config.yml
org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
 in 'reader', line 9, column 5:
        Mode:
        ^
expected <block end>, but found '<block mapping start>'
 in 'reader', line 27, column 7:
          Default: 100
          ^

        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:104) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:128) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:304) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at me.ryanhamshire.GriefPrevention.GriefPrevention.loadConfig(GriefPrevention.java:392) ~[GriefPrevention.jar:?]        at me.ryanhamshire.GriefPrevention.GriefPrevention.onEnable(GriefPrevention.java:267) ~[GriefPrevention.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:501) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:562) ~[paper-1.18.1.jar:git-Paper-215]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:476) ~[paper-1.18.1.jar:git-Paper-215]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:736) ~[paper-1.18.1.jar:git-Paper-215]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:503) ~[paper-1.18.1.jar:git-Paper-215]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[paper-1.18.1.jar:git-Paper-215]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1211) ~[paper-1.18.1.jar:git-Paper-215]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-215]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
 in 'reader', line 9, column 5:
        Mode:
        ^
expected <block end>, but found '<block mapping start>'
 in 'reader', line 27, column 7:
          Default: 100
          ^

        at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:644) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:166) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:59) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:45) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:140) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:119) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeScalarNode(Composer.java:214) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:184) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:115) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:142) ~[snakeyaml-1.30.jar:?]
        at org.yaml.snakeyaml.Yaml.compose(Yaml.java:575) ~[snakeyaml-1.30.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:102) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        ... 16 more
[10:56:31 INFO]: [GriefPrevention] Finished loading configuration.
[10:56:31 INFO]: [GriefPrevention] 0 total claims loaded.
[10:56:31 INFO]: [GriefPrevention] Customizable messages loaded.
[10:56:31 INFO]: [GriefPrevention] Finished loading data (File Mode).
[10:56:31 INFO]: [GriefPrevention] Boot finished.
[10:56:31 INFO]: Running delayed init tasks
[10:56:32 INFO]: [Essentials] Fetching version information...
[10:56:32 INFO]: Done (3.388s)! For help, type "help"
[10:56:32 INFO]: Timings Reset
>

Server version

> version
[11:51:22 INFO]: Checking version, please wait...
[11:51:22 INFO]: This server is running Paper version git-Paper-215 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT) (Git: 7f65b0b)
You are running the latest version
Previous version: git-Paper-177 (MC: 1.18.1)
>

GriefPrevention version

> version griefprevention
[11:52:32 INFO]: GriefPrevention version 16.17.1-2b69191
>

Configuration

# Default values are perfect for most servers.  If you want to customize and have a question, look for the answer here first: http://dev.bukkit.org/bukkit-plugins/grief-prevention/pages/setup-and-configuration/

GriefPrevention:
  SeaLevelOverrides:
    Creative: -1
    Creative_nether: -1
    Creative_the_end: -1
  Claims:
    Mode:
      Creative_the_end: Creative
      Creative: Creative
      Creative_nether: Creative
    PreventGlobalMonsterEggs: true
    PreventTheft: true
    ProtectCreatures: true
    PreventButtonsSwitches: true
    LockWoodenDoors: false
    LockTrapDoors: false
    LockFenceGates: true
    EnderPearlsRequireAccessTrust: true
    RaidTriggersRequireBuildTrust: true
    ProtectHorses: true
    ProtectDonkeys: true
    ProtectLlamas: true
    InitialBlocks: 1000
    Claim Blocks Accrued Per Hour: 500
      Default: 100
    Max Accrued Claim Blocks: 100000
      Default: 80000
    Accrued Idle Threshold: 0
    AccruedIdlePercent: 0
    AbandonReturnRatio: 1.0
    AutomaticNewPlayerClaimsRadius: 4
    AutomaticNewPlayerClaimsRadiusMinimum: 0
    ExtendIntoGroundDistance: 5
    MinimumWidth: 5
    MinimumArea: 100
    MaximumDepth: 0
    InvestigationTool: STICK
    ModificationTool: GOLDEN_SHOVEL
    Expiration:
      ChestClaimDays: 7
      UnusedClaimDays: 14
      AllClaims:
        DaysInactive: 365
        ExceptWhenOwnerHasTotalClaimBlocks: 10000
        ExceptWhenOwnerHasBonusClaimBlocks: 5000
      AutomaticNatureRestoration:
        SurvivalWorlds: false
    AllowTrappedInAdminClaims: false
    MaximumNumberOfClaimsPerPlayer: 0
    CreationRequiresWorldGuardBuildPermission: true
    VillagerTradingRequiresPermission: true
    CommandsRequiringAccessTrust: /sethome
    DeliverManuals: true
    ManualDeliveryDelaySeconds: 30
    RavagersBreakBlocks: true
    FireSpreadsInClaims: false
    FireDamagesInClaims: false
    LecternReadingRequiresAccessTrust: true
  Spam:
    Enabled: true
    LoginCooldownSeconds: 60
    LoginLogoutNotificationsPerMinute: 5
    ChatSlashCommands: /me;/global;/local
    WhisperSlashCommands: /tell;/pm;/r;/whisper;/msg
    WarningMessage: Please reduce your noise level.  Spammers will be banned.
    BanOffenders: true
    BanMessage: Banned for spam.
    AllowedIpAddresses: 1.2.3.4; 5.6.7.8
    DeathMessageCooldownSeconds: 120
    Logout Message Delay In Seconds: 0
  PvP:
    RulesEnabledInWorld:
      Creative: true
      Creative_nether: true
      Creative_the_end: true
    ProtectFreshSpawns: true
    PunishLogout: true
    CombatTimeoutSeconds: 15
    AllowCombatItemDrop: false
    BlockedSlashCommands: /home;/vanish;/spawn;/tpa
    ProtectPlayersInLandClaims:
      PlayerOwnedClaims: true
      AdministrativeClaims: true
      AdministrativeSubdivisions: true
    AllowLavaDumpingNearOtherPlayers:
      PvPWorlds: true
      NonPvPWorlds: false
    AllowFlintAndSteelNearOtherPlayers:
      PvPWorlds: true
      NonPvPWorlds: false
    ProtectPetsOutsideLandClaims: false
  Economy:
    ClaimBlocksMaxBonus: 0
    ClaimBlocksPurchaseCost: 0.0
    ClaimBlocksSellValue: 0.0
  ProtectItemsDroppedOnDeath:
    PvPWorlds: false
    NonPvPWorlds: true
  BlockLandClaimExplosions: true
  BlockSurfaceCreeperExplosions: true
  BlockSurfaceOtherExplosions: true
  LimitSkyTrees: true
  LimitTreeGrowth: false
  PistonMovement: EVERYWHERE
  PistonExplosionSound: true
  FireSpreads: false
  FireDestroys: false
  AdminsGetWhispers: true
  AdminsGetSignNotifications: true
  SmartBan: true
  Mute New Players Using Banned Words: true
  MaxPlayersPerIpAddress: 3
  Siege:
    Worlds: []
    BreakableBlocks:
    - GRASS_BLOCK
    - DIRT
    - COBBLESTONE
    - OAK_PLANKS
    - SPRUCE_PLANKS
    - BIRCH_PLANKS
    - JUNGLE_PLANKS
    - ACACIA_PLANKS
    - DARK_OAK_PLANKS
    - SAND
    - GRAVEL
    - GLASS
    - GRASS
    - FERN
    - DEAD_BUSH
    - WHITE_WOOL
    - ORANGE_WOOL
    - MAGENTA_WOOL
    - LIGHT_BLUE_WOOL
    - YELLOW_WOOL
    - LIME_WOOL
    - PINK_WOOL
    - GRAY_WOOL
    - LIGHT_GRAY_WOOL
    - CYAN_WOOL
    - PURPLE_WOOL
    - BLUE_WOOL
    - BROWN_WOOL
    - GREEN_WOOL
    - RED_WOOL
    - BLACK_WOOL
    - SNOW
    - GLASS_PANE
    DoorsOpenDelayInSeconds: 300
    CooldownEndInMinutes: 60
  EndermenMoveBlocks: false
  SilverfishBreakBlocks: false
  CreaturesTrampleCrops: false
  RabbitsEatCrops: true
  HardModeZombiesBreakDoors: false
  Database:
    URL: ''
    UserName: ''
    Password: ''
  UseBanCommand: false
  BanCommandPattern: ban %name% %reason%
  Advanced:
    fixNegativeClaimblockAmounts: true
    ClaimExpirationCheckRate: 60
    OfflinePlayer_cache_days: 90
  Abridged Logs:
    Days To Keep: 7
    Included Entry Types:
      Social Activity: true
      Suspicious Activity: true
      Administrative Activity: false
      Debug: false
      Muted Chat Messages: false

Plugin list

> plugins
[11:53:13 INFO]: Plugins (6): AdvancedPortals, BungeeGuard, CoreProtect, Essentials, GriefPrevention, HolographicDisplays
>

Running without GriefPrevention

Running with only GriefPrevention

Running on a fresh, clean server installation

Using unmodified client

We appreciate you taking the time to fill out a bug report!

Jikoo commented 2 years ago

Your YAML is invalid.

Your edits:

GriefPrevention:
  Claims:
    Claim Blocks Accrued Per Hour: 500
      Default: 100
    Max Accrued Claim Blocks: 100000
      Default: 80000

Valid YAML, the defaults:

GriefPrevention:
  Claims:
    Claim Blocks Accrued Per Hour:
      Default: 100
    Max Accrued Claim Blocks:
      Default: 80000

Try passing your yaml through a parser, there are plenty online.

bigpresh commented 2 years ago

Looks like your YAML is invalid - run it through a linter after editing it - e.g. yamllint and it'll tell you what's wrong.

If you're doing as you described, though:

changing Claim Blocks Accrued Per Hour: to Claim Blocks Accrued Per Hour: 500

That's probably the problem - the config will look something like:

    Claim Blocks Accrued Per Hour:
      Default: 100

You need to be editing the 100 after "Default", not adding an extra spurious value at the end of the previous line (if you'd done that, a linter would have explained, just like GriefPrevention is trying to, e.g.:

[davidp@headshrinker:~]$ diff -u XXX/plugins/GriefPreventionData/config.yml ~/tmp/config-example.yml
--- XXX/plugins/GriefPreventionData/config.yml  2022-02-18 22:19:34.631367099 +0000
+++ /home/davidp/tmp/config-example.yml 2022-02-27 18:36:47.295243949 +0000
@@ -23,7 +23,7 @@
     ProtectDonkeys: true
     ProtectLlamas: true
     InitialBlocks: 100
-    Claim Blocks Accrued Per Hour:
+    Claim Blocks Accrued Per Hour: 500
       Default: 100
     Max Accrued Claim Blocks:
       Default: 2000

[davidp@headshrinker:~]$ yamllint ~/tmp/config-example.yml
/home/davidp/tmp/config-example.yml
  1:81      error    line too long (210 > 80 characters)  (line-length)
  3:1       warning  missing document start "---"  (document-start)
  27:14     error    syntax error: mapping values are not allowed here
bryanfolstad commented 2 years ago

Oh wow. Thanks for your help! This has been frustrating.

I had no idea you have to change the Default line instead of the line with the blank value. Thank you! This solved the issue!