Null check plugin input for servers

This commit is contained in:
md_5 2013-10-07 16:55:29 +11:00
parent a9d3d9461f
commit b041d84063
2 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package net.md_5.bungee.api.event;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.ToString;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -21,6 +22,7 @@ public class ServerConnectEvent extends Event implements Cancellable
/**
* Server the player will be connected to.
*/
@NonNull
private ServerInfo target;
/**
* Cancelled state.

View File

@ -171,6 +171,8 @@ public final class UserConnection implements ProxiedPlayer
public void connect(ServerInfo info, final boolean retry)
{
Preconditions.checkNotNull( info, "info" );
ServerConnectEvent event = new ServerConnectEvent( this, info );
if ( bungee.getPluginManager().callEvent( event ).isCancelled() )
{