[Solved] ClientConnectionEvent.Disconnect Issue

So I can’t get this code to work as intended. I’ve seen bug reports of this event been submitted and solved on the Sponge Commons repository, but I’m still having issues with this. I figured I post this here before I bothered the Git side of Sponge.

public static void onPlayerLogOut(ClientConnectionEvent.Disconnect event){
	Player player = (Player)event.getTargetEntity();

	Sponge.getServer().getBroadcastChannel().send(Text.of(TextColors.AQUA,player.getName()," left the server!"));

Your event listener is static, static methods can’t be registered as event handlers.

1 Like

Out of curiosity, why not?

See this issue:

Ah! I didn’t realize I had made it static. Thank you!