Implement PostLoginEvent, closes #191

This commit is contained in:
md_5 2013-03-14 21:11:16 +11:00
parent ac426f0c3f
commit 4811e7be4f
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package net.md_5.bungee.api.event;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Event;
/**
* Event called as soon as a connection has an {@link ProxiedPlayer} and is
* ready to be connected to a server.
*/
@Data
@ToString(callSuper = false)
@EqualsAndHashCode(callSuper = false)
public class PostLoginEvent extends Event
{
/**
* The player involved with this event.
*/
private final ProxiedPlayer player;
}

View File

@ -28,6 +28,7 @@ import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.netty.CipherCodec;
import net.md_5.bungee.netty.HandlerBoss;
@ -208,6 +209,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
Preconditions.checkState( thisState == State.LOGIN, "Not expecting LOGIN" );
UserConnection userCon = new UserConnection( (BungeeCord) bungee, ch, this, handshake, forgeLogin, loginMessages );
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );
ch.pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );
ServerInfo server = bungee.getReconnectHandler().getServer( userCon );