About playersevent? create our event?

Hello, i code for 2 weeks, and i have seen the events for players (joins, die, …) doesn’t exist.

i know we can create our event, but i don"t understand how…

i’m french and english is not my maternal language…

how can i do for a class is reconized like an event?


Have you checked the SpongeDocs? The pages you’re looking for might also be already translated in the French translation.

The event is missing in the API or it isn’t implemented yet? Iirc both should be the case.


i have understand how create a class, but now how declarate the event at the player login

import org.spongepowered.api.event.impl.AbstractEvent;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Cancellable;

public class PlayerJoinEvent extends AbstractEvent{

   private Player player;

   private String joinmessage;

   public Player getPlayer() {
      return player;

   public String getJoinMessage() {
      return joinmessage;

how can i do?

Are you wanting to create an instance of the event from your plugin? If so, then use SpongeEventFactory to create an instance, then pass it to game.getEventManager().post(event).

where do i have to put game.getEventManager?
(i think it’s in the Listener)

and how the event know when it has to activate it?

i don’t understand…

I’m not sure exactly what you’re asking. Are you wanting to run some code when the player joins, or are you wanting to cause other plugins’ “player join” code to run?

no, i found, i’m just stupid…

You misspelled “learning” :wink:

1 Like

yes, but the answer is just behind my eyes (french expression) and i didn’t find it