iSach / UltraCosmetics

Lightweight, Fun and Easy-to-Use Spigot Cosmetics plugin. (Gadgets, etc)
https://www.spigotmc.org/resources/ultra-cosmetics-halloween-update.10905/
GNU Affero General Public License v3.0
165 stars 155 forks source link

MySQL Data loading task error #592

Closed JAHMCR closed 2 years ago

JAHMCR commented 2 years ago

Check if the issue is fixed in dev builds

What steps will reproduce the issue?

  1. Enable MySQL in config.yml
  2. Start the server
  3. Join the server
  4. Stop the server
  5. Start the server

What was supposed to happen?

No errors in console while loading SQL data

What happened instead?

There is an error in the console when loading SQL data

What version of UltraCosmetics are you using? Do not say 'latest'.

UltraCosmetics 2.6.1 DEV b11

What server distribution (Spigot, Paper, etc.) and what version are you using? Do not say 'latest'.

Paper build 216

What plugins do you have installed?

Plugins (19): CMILib, CoreProtect, Essentials, EssentialsGeoIP, EssentialsSpawn, GriefPrevention, Jobs, mcMMO, Multiverse-Core, PlaceholderAPI, ResourceWorld, Shops, SkinsRestorer, UltraCosmetics, Vault, ViaBackwards, ViaRewind, ViaVersion, WorldEdit

Are there any errors in the console or in logs?

[02:21:37] [Craft Scheduler Thread - 8 - UltraCosmetics/WARN]: Plugin UltraCosmetics v2.6.1-DEV-b11 generated an exception while executing task 1143 java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Boolean (java.lang.Integer and java.lang.Boolean are in module java.base of loader 'bootstrap') at be.isach.ultracosmetics.player.profile.PlayerData.loadFromSQL(PlayerData.java:196) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.mysql.SqlCache.load(SqlCache.java:40) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.player.profile.CosmeticsProfile.lambda$new$1(CosmeticsProfile.java:32) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.18.2.jar:git-Paper-267] at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) [paper-1.18.2.jar:git-Paper-267] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) [paper-1.18.2.jar:git-Paper-267] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?] at java.lang.Thread.run(Unknown Source) [?:?]

Additional information that could be helpful in fixing the problem

Checking the code, I see the issue is in this line of code:

gadgetsEnabled = (boolean) properties.get(ProfileKey.GADGETS_ENABLED.getSqlKey());

To fix the issue you could:

1) Modify the "gadgetsEnabled" column to be BOOLEAN 2) Modify the line to: "gadgetsEnabled = properties.get(ProfileKey.GADGETS_ENABLED.getSqlKey()).equals(1);"

I guess after fixing this, the same issue will happen with this other line:

morphSelfView = (boolean) properties.get(ProfileKey.MORPH_VIEW.getSqlKey());

So you could just do the same as above

NVM just tried to change the column type to be BOOLEAN (TINYINT) but still fails, so you should do the second option

datatags commented 2 years ago

That's interesting, out of curiosity what database backend are you using? (MySQL Server, MariaDB, etc?)

datatags commented 2 years ago

I believe I've fixed it, but I couldn't reproduce the issue so I'm not 100% sure. Please let me know if this build fixes it (same build mentioned in other issue)

JAHMCR commented 2 years ago

Thanks, will test the latest DEV build. I'm using MySQL 8