Deprecated EventHandler methods on Paper starting with 1.18.1
SlimeDog opened this issue · 7 comments
Paper 1.18.1-161 and ff
ExtraHardMode
On server start-up
[15:35:36] [Server thread/WARN]: @EventHandler method com.extrahardmode.features.AntiGrinder#onEntityDeath returns non-void type boolean. This is an unsupported behavior which will be removed in a future version of Paper.This should be reported to the developers of ExtraHardMode v3.15.0-e9c12af, (RoboMWM,Diemex,Big_Scary)
[15:35:36] [Server thread/WARN]: @EventHandler method com.extrahardmode.features.AntiGrinder#onEntitySpawn returns non-void type boolean. This is an unsupported behavior which will be removed in a future version of Paper.This should be reported to the developers of ExtraHardMode v3.15.0-e9c12af, (RoboMWM,Diemex,Big_Scary)
Have asked in the Paper discord about this error, reply:
an EventHandler must return void
or, rather, should. non-void returns may be broken in the future and are not supported.
yeah just this whole class https://github.com/MLG-Fortress/ExtraHardMode/blob/e4f17b107651b0765f9a75a39399637c36ffd38c/src/main/java/com/extrahardmode/features/AntiGrinder.java#L157
just set it cancelled, remove all the returns— they don't do anything
unless you're doing something like calling the handler yourself (which you probably shouldn't)
Looking at the ExtraHardMode sources, onEntityDeath() and onEntitySpawn() are declared void in all cases except in src/main/java/com/extrahardmode/features/AntiGrinder.java, where they are declared boolean and return true or false. It doesn't look like the return values are used anywhere, so the fix would be straightforward, as outlined above.
I tried the fix locally, and it seems to work fine. Note that the assertFalse
and assertTrue
tests in src/test/com/extrahardmode/features/TestAntiGrinder.java
will have to be changed as well. I did not feel comfortable making those changes -- I don't know how testing works -- so I did not post a PR.
There is a new PR that covers this issue, both the code and the tests: #316
closed by #316
ah I see why this wasn't auto-closed, it wasn't linked by the PR author.