Configuration parsing errors
SlimeDog opened this issue ยท 23 comments
Type of bug
Error in console
TabList version
version TabList [15:31:15] [Server thread/INFO]: TabList version 5.6.0
[15:31:15] [Server thread/INFO]: An ultimate animated tablist
[15:31:15] [Server thread/INFO]: Author: montlikadani
Software version
version [15:30:54] [Server thread/INFO]: This server is running CraftBukkit version 3369-Spigot-8965a50-2a2caa7 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT)
[15:30:54] [Server thread/INFO]: You are running the latest version
Relevant plugins
Irrelevant, but available on request.
Console error (if applicable)
[15:21:29] [Server thread/INFO]: [TabList] Enabling TabList v5.6.0
[15:21:29] [Server thread/ERROR]: Error occurred while enabling TabList v5.6.0 (Is it up to date?)
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.StringLatin1.charAt(StringLatin1.java:48) ~[?:?]
at java.lang.String.charAt(String.java:1512) ~[?:?]
at hu.montlikadani.tablist.config.CommentedConfig.insertComments(CommentedConfig.java:81) ~[?:?]
at hu.montlikadani.tablist.config.CommentedConfig.save(CommentedConfig.java:62) ~[?:?]
at hu.montlikadani.tablist.config.CommentedConfig.save(CommentedConfig.java:41) ~[?:?]
at hu.montlikadani.tablist.config.constantsLoader.ConfigValues.loadValues(ConfigValues.java:261) ~[?:?]
at hu.montlikadani.tablist.config.Configuration.loadFiles(Configuration.java:48) ~[?:?]
at hu.montlikadani.tablist.TabList.onEnable(TabList.java:86) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:526) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:440) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:262) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:994) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3369-Spigot-8965a50-2a2caa7]
at java.lang.Thread.run(Thread.java:833) [?:?]
TabList configuration files
No change.
Bug description
Just a heads-up.
Spigot 1.18.1-3369 introduced new configuration management.
On server start-up (ie, on plugin enable), the above error occurs. This error did not occur previously.
config.yml
@ https://pastebin.com/enQ6dBmy
which is not much different from the default.
A bad side effect: on error, TabList deletes and rewrites config.yml
, losing any changes. Of course, I have backups, but still.
The same content does not fail on Paper 1.18.1-84, which presumably has the same methods from upstream.
TabList-5.6.0-b261
Not a good solution. It duplicates may comments and adds blank lines (actually two spaces and newline) as it rewrites config.yml
(why does it rewrite it, anyway?).
Original starts
hook:
# Hook to PlaceholderAPI to use custom placeholders.
placeholderapi: true
# Fake players that can be added to the player list.
fake-players:
enabled: false
# Do we count the added fake players to the %online-players% placeholder?
count-fake-players-to-online-players: false
# If enabled, the gray color will not appear to other players when the player's game mode is spectator.
# The gray color will only show for the spectator player.
# Requires ProtocolLib!
remove-gray-color-from-tab-in-spectator: false
# true - does not count vanished players in %online-players% placeholder.
# Requires Essentials, SuperVanish, PremiumVanish or CMI plugin!
ignore-vanished-players-in-online-players: false
# true - count vanished staff in %staff-online% placeholder,
# but they need to have "tablist.onlinestaff" permission set.
# false - does not count vanished staff in the %staff-online% placeholder
# Requires Essentials, SuperVanish, PremiumVanish or CMI plugin!
count-vanished-staffs: true
# Hide player from player list when a player is AFK?
# Requires Essentials or CMI plugin!
hide-player-from-tab-when-afk: false
# Hide all players from the player list?
# This removes all players from the player list, but the player that has the
# group set is retained as it is not changed during removal, so your group
# will be restored if this option is disabled.
# Requires ProtocolLib to fix view distance issue! (https://github.com/montlikadani/TabList/issues/147)
hide-players-from-tablist: false
# Different player list in different world.
per-world-player-list:
enabled: false
...
becomes with the addition of 114 extra lines
hook:
# Hook to PlaceholderAPI to use custom placeholders.
# Hook to PlaceholderAPI to use custom placeholders.
placeholderapi: true
# Fake players that can be added to the player list.
fake-players:
enabled: false
# Do we count the added fake players to the %online-players% placeholder?
# Do we count the added fake players to the %online-players% placeholder?
count-fake-players-to-online-players: false
# If enabled, the gray color will not appear to other players when the player's game mode is spectator.
# The gray color will only show for the spectator player.
# Requires ProtocolLib!
remove-gray-color-from-tab-in-spectator: false
# true - does not count vanished players in %online-players% placeholder.
# Requires Essentials, SuperVanish, PremiumVanish or CMI plugin!
ignore-vanished-players-in-online-players: false
# true - count vanished staff in %staff-online% placeholder,
# but they need to have "tablist.onlinestaff" permission set.
# false - does not count vanished staff in the %staff-online% placeholder
# Requires Essentials, SuperVanish, PremiumVanish or CMI plugin!
count-vanished-staffs: true
# Hide player from player list when a player is AFK?
# Requires Essentials or CMI plugin!
hide-player-from-tab-when-afk: false
# Hide all players from the player list?
# This removes all players from the player list, but the player that has the
# group set is retained as it is not changed during removal, so your group
# will be restored if this option is disabled.
# Requires ProtocolLib to fix view distance issue! (https://github.com/montlikadani/TabList/issues/147)
hide-players-from-tablist: false
# Different player list in different world.
per-world-player-list:
enabled: false
...
Shouldn't this issue be fixed more generally (like in Spigot) rather than in each plugin that encounters it?
Since this is a "fresh" implementation in the upstream (Spigot), it probably is. After a thorough examination and testing, it appears that the saveToString
method does not gather the contents of the file into a single text (String) in the reading order of the file (so from top to bottom). prior to this commit, writing comments to the file worked properly.
I simply printed this saveToString
method out to the console as proof.
This is the current return value on the upstream (Spigot) and with the last commit:
use-as-whitelist: false
list:
- myWorldWithUpper
# Automatically add groups from another plugins to the tablist groups.yml on every reload?
# If a plugin does not support Vault, it will not be added.
# Automatically add groups from another plugins to the tablist groups.yml on every reload?
# If a plugin does not support Vault, it will not be added.
sync-plugins-groups-with-tablist: false
While in 1.17
#
# Fake players that can be added to the player list.
hook:
placeholderapi: true
fake-players:
enabled: false
count-fake-players-to-online-players: false
So this is an upstream problem, especially with the saveToString
method. ? (Edit: unsure)
BTW, this affects only one other configuration file, of 165+ plugins on our test servers. What is different about how configuration files are handled by TabList?
Previously, it was not possible to save the comments in the configuration (with #
character) above a specific option. I implemented a way to save these comments, each time the file is reloaded, the contents of the file will be saved (cached) and deleted, to remove the non-existent settings or invalid entries, then the cached content within the resource will be put again, including the comments into the file. These comments have different indexes for each setting, so they are not lost when reloading. But now that the upstream has again made a configuration change without running a test, it will break.
I manage my configuration files very carefully. I appreciate that you implemented your own methods, but if nothing substantive changes in the configuration -- no new or outdated nodes -- there is no reason to rewrite it.
I would prefer to be warned if something isn't right, so that I can fix it myself. I appreciate that many people do not check for warnings and errors in the console/log, but I do.
You might want to look at https://hub.spigotmc.org/jira/browse/SPIGOT-3247
I reopen and keep opened while this issue fixed in upstream or in the source of TL.
Edit: Did the console error fixed that you reported before?
Did the console error fixed that you reported before?
Yes, the console error was resolved, but the mangled file remains. I have reverted to Spigot 1.18.1-3368 and TabList 5.6.0-b253 (equivalent to the 5.6.0 release) until this issue is resolved.
On Spigot 1.18.1-3372, which reinvigorated some removed variables (but deprecated them), on server start-up (ie., TabList enable) an error is thrown
[17:21:19] [Server thread/INFO]: [TabList] Enabling TabList v5.6.0
[17:21:19] [Server thread/ERROR]: Error occurred while enabling TabList v5.6.0 (Is it up to date?)
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.StringLatin1.charAt(StringLatin1.java:48) ~[?:?]
at java.lang.String.charAt(String.java:1512) ~[?:?]
at hu.montlikadani.tablist.config.CommentedConfig.insertComments(CommentedConfig.java:81) ~[?:?]
at hu.montlikadani.tablist.config.CommentedConfig.save(CommentedConfig.java:62) ~[?:?]
at hu.montlikadani.tablist.config.CommentedConfig.save(CommentedConfig.java:41) ~[?:?]
at hu.montlikadani.tablist.config.constantsLoader.ConfigValues.loadValues(ConfigValues.java:261) ~[?:?]
at hu.montlikadani.tablist.config.Configuration.loadFiles(Configuration.java:48) ~[?:?]
at hu.montlikadani.tablist.TabList.onEnable(TabList.java:86) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:526) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:440) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:262) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:994) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3372-Spigot-8965a50-c59b0ca]
at java.lang.Thread.run(Thread.java:833) [?:?]
Sorry, but this is with the Spigot version that supposedly reverted the missing variables.
Right, the above commit will fixes this issue (tested now and works as before).
Thanks. On Spigot prior to the snakeyaml changes (which I reverted to, until the myriad Spigot snakeyaml issues get sorted), I get on server start-up
[09:56:22] [Server thread/WARN]: java.lang.NoSuchMethodException: org.bukkit.configuration.file.YamlConfigurationOptions.parseComments(boolean)
[09:56:22] [Server thread/WARN]: at java.base/java.lang.Class.getDeclaredMethod(Class.java:2675)
[09:56:22] [Server thread/WARN]: at hu.montlikadani.tablist.config.constantsLoader.ConfigValues.loadValues(ConfigValues.java:41)
[09:56:22] [Server thread/WARN]: at hu.montlikadani.tablist.config.Configuration.loadFiles(Configuration.java:48)
[09:56:22] [Server thread/WARN]: at hu.montlikadani.tablist.TabList.onEnable(TabList.java:86)
[09:56:22] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[09:56:22] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342)
[09:56:22] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480)
[09:56:22] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:526)
[09:56:22] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:440)
[09:56:22] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612)
[09:56:22] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414)
[09:56:22] [Server thread/WARN]: at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:262)
[09:56:22] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:994)
[09:56:22] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304)
[09:56:22] [Server thread/WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
but TabList seems to work. So just a heads up, if that is unexpected.
Unfortunately, there is no evidence that Paper is going to incorporate the Spigot snakeyaml changes. :(
Not yet, as they will wait until the reported issues are fixed. It is summarized in this comment.