Registering teams and adding players

Hey Sponge, I’m Vuiz. This is my first topic post here!

The purpose of my plugin is to use teams to give players with certain permissions prefixes. HealthName has prefixes/suffixes using teams.

GameServerStartedEvent does run (logging fixed thanks to @dualspiral) but no teams are registered in game (when using /scoreboard teams list, none are registered). In turn when joining the players cannot be assigned to a team as they do not exist.

ClientConnectionEvent.Join does run as my debug message “Active” shows when joining the server.

Sponge Build: spongeapi-3.1.0
Forge Build: 11.15.1.1722
Java Version: 1.8

Forge Logs: http://pasted.co/905f9ade (exceeded Pastebin limit)

Minecraft Logs: http://pastebin.com/JqA89xay

Plugin Source: http://pastebin.com/fBsTHhwf

EDIT: I would’ve used spoilers but kept getting Internal Server Error (500) errors.

The annotation on the event method should be Sponge’s @Listener, not Google’s @Subscribe - which is why the event doesn’t run your method. See https://docs.spongepowered.org/master/en-GB/plugin/event/listeners.html

(Also, you should probably be using Sponge API 4 now, but that doesn’t affect this particular question.)

I started by using @Listener and just changed back to it now, still having the same problem (no teams registered)

@Subscribe must still work in 3.1.0 as it works for the join event. I have not changed to API 4 due to the version of Forge that I will be using the plugin on being 1722.

@Subscribe was replaced in 2.0 I believe. Should be using @Listener for all events

Weird, it was working for the ClientConnectionEvent.Join event for me. Anyway, I’ve changed both events to @Listener but it still does not run GameServerStartedEvent.

I can see that the event IS getting sent to your plugin:

[11:06:30] [Server thread/TRACE] [slimey/slimey]: Sending event FMLServerStartedEvent to mod slimey
[11:06:30] [Server thread/TRACE] [slimey/slimey]: Sent event FMLServerStartedEvent to mod

However, I bet that it’s because you’re injecting the wrong logger, so it might not actually be printing to the console. You’ve used java.util.Logger, you should be importing org.slf4j.Logger instead. See if that helps.

1 Like

I remember reading somewhere that GameServerStartedEvent hasn’t been implemented yet because of some issue…maybe. I can’t remember exactly but if everything else works fine then that’s a pretty clear indication

That fixed the logging issue, thanks. But the teams are still not being registered.

The logging in that method is working now thanks to @dualspiral so it does fire.

Added an IllegalArgumentException try… catch statement to the team registration under the onServerStart method, no error is produced.

The setScoreboard() method is missing. Every player has the global scoreboard as default. If you create a new custom scoreboard (line 26), you have to assign this scoreboard to the players.

1 Like