Portals cannot load on startup
kanyunhk opened this issue ยท 9 comments
Upon upgrading to the latest version of Multiverse Portals (v4.0.0 @ 2019-06-26) yesterday, running on Spigot 1.14.4, my portals.yml contents got cleared.
I was upgrading from an older version of the plugin and the portal prices (currency) was still stored as the numeric item ID, after upgrading it, the portals are successfully loaded but after it is loaded, the currency node is changed to something like !!org.bukkit.Materal 'MATERIAL_ENUM'
. When I restart the server with the updated config (updated by the plugin), the following Exception is thrown, and then my portals.yml got cleared.
[11:52:10] [Server thread/ERROR]: Cannot load plugins/Multiverse-Portals/portals.yml
org.bukkit.configuration.InvalidConfigurationException: could not determine a constructor for the tag tag:yaml.org,2002:org.bukkit.Material
in 'string', line 703, column 17:
currency: !!org.bukkit.Material 'GOLD_INGOT'
^
>
> at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:56) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:128) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:183) [spigot.jar:git-Spigot-1981d55-860b354]
> at com.onarandombox.MultiversePortals.MultiversePortals.loadPortals(MultiversePortals.java:212) [Multiverse-Portals.jar:?]
> at com.onarandombox.MultiversePortals.MultiversePortals.onEnable(MultiversePortals.java:140) [Multiverse-Portals.jar:?]
> at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) [spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:352) [spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:417) [spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugin(CraftServer.java:461) [spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugins(CraftServer.java:375) [spigot.jar:git-Spigot-1981d55-860b354]
> at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:449) [spigot.jar:git-Spigot-1981d55-860b354]
> at net.minecraft.server.v1_14_R1.DedicatedServer.init(DedicatedServer.java:258) [spigot.jar:git-Spigot-1981d55-860b354]
> at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:774) [spigot.jar:git-Spigot-1981d55-860b354]
> at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
Caused by: org.yaml.snakeyaml.constructor.ConstructorException: could not determine a constructor for the tag tag:yaml.org,2002:org.bukkit.Material
in 'string', line 703, column 17:
currency: !!org.bukkit.Material 'GOLD_INGOT'
^
>
> at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructUndefined.construct(SafeConstructor.java:541) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:204) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:193) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:453) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:184) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:434) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:521) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:28) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:204) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:193) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:453) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:184) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:434) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:521) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:28) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:204) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:193) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:453) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:184) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:434) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:521) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:28) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:204) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:193) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:453) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:184) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:434) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:521) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:28) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:204) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:193) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:159) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:146) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:524) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.yaml.snakeyaml.Yaml.load(Yaml.java:437) ~[spigot.jar:git-Spigot-1981d55-860b354]
> at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:54) ~[spigot.jar:git-Spigot-1981d55-860b354]
> ... 14 more
[11:52:10] [Server thread/INFO]: [MVPLogging] 0 - Portals(s) loaded
Please help investigate this issue and fix it, thanks for your time!
I do not remember the exact version but it was for 1.13.2 and should be MV3 from Jenkins. But anyways, I started fresh and it's still happening.
Steps to reproduce:
- Create a portal
- Set the currency
- Restart the server
- The Portal Config is empty and it prints the exact same Exception I mentioned.
Let me know if you have any questions about my server environment. Thanks!
I assume you mean Multiverse-3.0.0 rather than MV3 (which was in development but is now discontinued and unfinished). How are you setting your currency? You need to use item IDs if you're using an item.
I set the currency using the command /mvpm currency stone
, by item IDs I assume you mean the text ID instead of number ID right?
PS: Step 3 can be replaced by running /mv reload.
Basically the problem is before I upgrade, the item currency is stored as (e.g. stone) 'STONE'
, but after the upgrade it automatically changed it to !!org.bukkit.Material 'STONE'
when the plugin is loading and it gives me the exception and my portal config went empty.
Using the set portal property command to change currency also stores the !!org.bukkit.Material 'STONE'
in the currency node.
By item ID I mean the numeric ID for the item. You can refer to this list for an item ID database. You'd need to set the currency to 1
.
I just tried it, it does not work. My test case is I set the price to 90, so that it will require 90 stones to use the portal. I have only 64 stones in my inventory, I walk into it and it still let me through and gives me a message You have been charged for using test.
. In between charged
and for
, there are extra spaces.
I also discovered that the config file did not store the item that I set as the currency.
I have gone ahead and fixed the problem, tested and it works.
Change this line from config.set(this.portalConfigString + ".entryfee.currency", currency);
to
config.set(this.portalConfigString + ".entryfee.currency", currency.name());
Which version did you upgrade from? If it was really that old you may have to just regenerate the configuration files. Especially if it was before MV2; however, if you have a backup of your old data, you could use a script to update - https://gist.github.com/FernFerret/f43a6c1eeded0bf7f795 If you don't have a backup then you'll definitely have to regenerate.