plan-player-analytics / Plan

Player Analytics plugin for Minecraft Server platforms - View player activity of your server with ease. :calendar:
https://www.spigotmc.org/resources/plan-player-analytics.32536/
GNU Lesser General Public License v3.0
827 stars 167 forks source link

Minestom platform Support #3259

Open NicklasMatzulla opened 8 months ago

NicklasMatzulla commented 8 months ago

I would like to be able to..

Minestom is a Minecraft server implementation which allows to host resource-pairing Minecraft servers. Minestom, unlike Paper and other Spigot forks, is not based on the Minecraft source code and implements only the most necessary Minecraft features.

Minestom is especially well suited for lobby servers, as well as minigames like BedWars or similar. Since Minestom is getting bigger and many servers use it, I think Plan for Minestom should be supported as well.

Is your feature request related to a problem? Please describe.

Since the Minestom API is not based on that of Spigot, and has its own full-featured API, Plan cannot run on Minestom servers. Due to the good programming of Plan, it should be easy (compared to other plugins) to support this platform. I think it is worth the time to offer a new platform, this would only make Plan more popular than it already is.

AuroraLS3 commented 8 months ago

It may be difficult to support since it does not come with a built-in plugin loading support (at least from a quick look)

Never mind they do have some sort of support https://wiki.minestom.net/expansion/extensions

ajh123 commented 2 weeks ago

That extension system has now been removed. Minestom is meant to be used as an API anyway so if someone wants to use a plugin then they need to include it with Gradle / Maven then activate the plugin. See https://github.com/TogAr2/MinestomPvP for an example.

AuroraLS3 commented 2 weeks ago

What a weird system, it's not really a plug-in if you need to recompile the source with added libraries 🤔

ajh123 commented 2 weeks ago

I agree, however it is up to the Minestom user to enable plugin support by adding https://github.com/hollow-cube/minestom-ce-extensions as a dependency, but I'm not sure if it will get constantly updated.

AuroraLS3 commented 2 weeks ago

Events, data or APIs expected by Plan - availability in Minestorm

Event/data Availability
Player UUID Someone implementing the server needs to provide this ⚠️ https://minestom.net/docs/feature/player-uuid
Player join AsyncPlayerConfigurationEvent
Player register date No implementation, use System.currentTimeMillis similar to Proxy servers
Player nickname [getDisplayName](https://javadoc.minestom.net/net/minestom/server/entity/Player.html#getDisplayName())()
Player leave PlayerDisconnectEvent
Player world change AddEntityToInstanceEvent
Player kick No event, would need to parse [kickMessage](https://javadoc.minestom.net/net/minestom/server/network/packet/server/login/LoginDisconnectPacket.html#kickMessage())() and figure things out. Kick data is so minor that I'd just leave it out entirely.
Death PlayerDeathEvent
Entity Death EntityDeathEvent
Player gamemode change https://javadoc.minestom.net/net/minestom/server/event/player/PlayerGameModeChangeEvent.html
Chat message event PlayerChatEvent
Player movement PlayerMoveEvent
Player online count Instance#getPlayers()
TPS Game ticks are executed per instance as far as I'm aware so it may be difficult to calculate this. This thing is undocumented https://javadoc.minestom.net/net/minestom/server/event/server/ServerTickMonitorEvent.html
Chunk count InstanceRegisterEvent and InstanceUnregisterEvent in addition to Instance#getChunks
Entity count AddEntityToInstanceEvent and RemoveEntityFromInstanceEvent
Player ping [getLatency](https://javadoc.minestom.net/net/minestom/server/entity/Player.html#getLatency())()
Java performance metrics
Join address (Minecraft hello packet) [getServerAddress](https://javadoc.minestom.net/net/minestom/server/network/player/PlayerConnection.html#getServerAddress())()
Player #hasPermission https://minestom.net/docs/feature/permissions
Player #sendMessage Adventure based api, could reuse fabric parts
Commands Brigadier based api, could reuse fabric parts
Allowlist No implementation
Plugin lifecycle No implementation - Extra implementation work on top of platform abstractions to allow reloads if Plan fails to enable.
Server shutdown Unknown, may need to use JVM shutdown hook to finish transactions
Task system https://minestom.net/docs/feature/schedulers https://javadoc.minestom.net/net/minestom/server/timer/Scheduler.html, can use same task system implementation as fabric for async events
Plugin version history No concept of plugin versions
Logging SLF4J, can use same logging implementation for Platform layer as Sponge
AuroraLS3 commented 2 weeks ago

If anyone (or many people) want to take a wack at this feel free to. Fabric implementation was added to Plan by work of 3 developers so you don't even need to implement all of it, just some of it. I'd appreciate if it built into a separate jar similar to how fabric module does it - that way it would be possible to just publish it through jitpack and call it a day.

It's a bit concerning to hear about removed apis though. I probably won't take on mainenance burden of Minestorm support if it is implemented (So if anyone is using it at that point and it breaks I will expect them to fix it and PR a fix.)

ajh123 commented 2 weeks ago

For logging Minstom uses SLF4J

For Player online count you can use Instance#getPlayers() which returns a Collection of all the players on that instance (world). To get the entire player count you need to iterate through all the instances (use InstanceManager#getInstances()), access to the InstanceManager is granted with MinecraftServer#getInstanceManager()

AuroraLS3 commented 2 weeks ago

Added those to the table.

ajh123 commented 2 weeks ago

Those API (extension system) removals were done by a community driven "maintenance" of Minestom known as Minestom CE (which came to life due to Minestom development slowing down). Then Minestom CE was merged back into Minestom.

Minestom CE redesigned Minestom to be an API rather than a runnable server so they refactored it a lot. Now that's done, hopefully they will stay the same.