PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.67k stars 2.25k forks source link

Spigot's `PrepareGrindstoneEvent` somehow considered deprecated by Paper by mistake. #9035

Closed LoneDev6 closed 1 year ago

LoneDev6 commented 1 year ago

Expected behavior

No deprecation warning in console: [17:35:36 WARN]: [ItemsAdder] "ItemsAdder v3.4.1-r2" has registered a listener for com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent on method "public void dev.lone.itemsadder.Main.testPrepareGrindstoneEvent(org.bukkit.event.inventory.PrepareGrindstoneEvent)", but the event is Deprecated. "Server performance will be affected"; please notify the authors [LoneDev].

Observed/Actual behavior

Somehow Paper thinks that the method org.bukkit.event.inventory.PrepareGrindstoneEvent is the same as com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent.

org.bukkit.event.inventory.PrepareGrindstoneEvent is not deprecated and it's an official event of Spigot. More info here.

com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent is deprecated and it's a Paper event. More info here.

Steps/models to reproduce

Create a test event listener with this code.

    @EventHandler
    public void testPrepareGrindstoneEvent(org.bukkit.event.inventory.PrepareGrindstoneEvent e)
    {
        System.out.println("Test");
    }

Run the plugin and see that you get the fake warning message.

Plugin and Datapack List

[17:36:55 INFO]: Bukkit Plugins: [17:36:55 INFO]: - Essentials, EssentialsChat, ItemsAdder, LoneLibs, Multiverse-Core, ProtocolLib

[17:37:23 INFO]: There are 2 data packs enabled: [vanilla (built-in)], [file/bukkit (world)] [17:37:23 INFO]: There are no more data packs available

Paper version

[17:43:47 INFO]: Checking version, please wait... [17:43:48 INFO]: This server is running Paper version git-Paper-468 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 9087a64) You are running the latest version Previous version: git-Paper-466 (MC: 1.19.4)

Other

I also think that this message is just useless since deprecated events are not affecting performance in any way. People get scared of that error because they think the server performance will be compromised by deprecated events.

I'd love to see Paper implement some sort of option (defaulted to true) in the paper configuration to disable this pointless message from being printed in console.

lynxplay commented 1 year ago

Replicable, the current logic runs up the entire inheritance chain, printing any warning. Why that is done, I am unsure of as we explicitly keep deprecated classes in the inheritance I presume for backwards compatible reasons.

https://github.com/PaperMC/Paper/blob/23b0ef524af83cdfc7d392bf558cba69b1e53757/patches/server/0013-Paper-Plugins.patch#L3224-L3243 as a reference to said logic. However this is pretty much a 1 to 1 clone of upstreams logic: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java#271-290

LoneDev6 commented 1 year ago

I think a good solution would be to implement my idea:

I also think that this message is just useless since deprecated events are not affecting performance in any way. People get scared of that error because they think the server performance will be compromised by deprecated events.

I'd love to see Paper implement some sort of option (defaulted to true) in the paper configuration to disable this pointless message from being printed in console.