buape / ActivityRoles

Automatically give and remove Discord roles from players based on their play time within your Minecraft server.
https://modrinth.com/plugin/activityroles
GNU General Public License v3.0
2 stars 1 forks source link

[1.20.1] Plugin not working for the latest version #16

Closed Dyljyn closed 1 year ago

Dyljyn commented 1 year ago

Context

Server: Spigot 1.20.1 DiscordSRV: 1.26.2 ActivityRoles: 1.3.0

Error

20.06 01:12:57 [Server] Server thread/WARN [ActivityRoles] Task #2 for ActivityRoles v1.3.0 generated an exception
20.06 01:12:57 [Server] INFO java.lang.NoSuchMethodError: 'long org.bukkit.OfflinePlayer.getLastSeen()'
20.06 01:12:57 [Server] INFO at com.shadowdev.activityroles.tools.ActivityCheck.meetsSeenRequirement(ActivityCheck.java:66) ~[?:?]
20.06 01:12:57 [Server] INFO at com.shadowdev.activityroles.tools.ActivityCheck.lambda$checkPlayer$1(ActivityCheck.java:163) ~[?:?]
20.06 01:12:57 [Server] INFO at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
20.06 01:12:57 [Server] INFO at com.shadowdev.activityroles.tools.ActivityCheck.checkPlayer(ActivityCheck.java:152) ~[?:?]
20.06 01:12:57 [Server] INFO at com.shadowdev.activityroles.tools.ActivityCheck.checkAllPlayers(ActivityCheck.java:184) ~[?:?]
20.06 01:12:57 [Server] INFO at com.shadowdev.activityroles.ActivityRoles.lambda$onEnable$0(ActivityRoles.java:42) ~[?:?]
20.06 01:12:57 [Server] INFO at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1257) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:388) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1198) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1015) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3802-Spigot-bed8c61-ad6d0cf]
20.06 01:12:57 [Server] INFO at java.lang.Thread.run(Thread.java:833) ~[?:?]
Dyljyn commented 1 year ago

Disclaimer: I don't program in Java or know about modding

If I'm correct, the problem is on the following line: https://github.com/buape/ActivityRoles/blob/707632c62457a0c2d4fd6f81d9749d1ab129d6c4/src/main/java/com/shadowdev/activityroles/tools/ActivityCheck.java#LL66C46-L66C46

and the reason being is that the method OfflinePlayer.getLastSeen() has been removed.


This is strange looking at the deprecation message for the method [OfflinePlayer.getLastPlayed()](https://jd.papermc.io/paper/1.20/org/bukkit/OfflinePlayer.html#getLastPlayed()) in the 1.20 version:

Deprecated. The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended use [getLastLogin()](https://jd.papermc.io/paper/1.20/org/bukkit/OfflinePlayer.html#getLastLogin()) or [getLastSeen()](https://jd.papermc.io/paper/1.20/org/bukkit/OfflinePlayer.html#getLastSeen()) depending on your needs.

thewilloftheshadow commented 1 year ago

ActivityRoles does not support Spigot, it requires at least Paper