Java Code Examples for org.bukkit.event.player.PlayerLoginEvent#Result

The following examples show how to use org.bukkit.event.player.PlayerLoginEvent#Result . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerOnlineListener.java    From Plan with GNU Lesser General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLogin(PlayerLoginEvent event) {
    try {
        PlayerLoginEvent.Result result = event.getResult();
        UUID playerUUID = event.getPlayer().getUniqueId();
        boolean operator = event.getPlayer().isOp();
        boolean banned = result == PlayerLoginEvent.Result.KICK_BANNED;
        dbSystem.getDatabase().executeTransaction(new BanStatusTransaction(playerUUID, () -> banned));
        dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator));
    } catch (Exception e) {
        errorLogger.log(L.ERROR, e, ErrorContext.builder().related(event, event.getResult()).build());
    }
}
 
Example 2
Source File: UserLoginEvent.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public UserLoginEvent(Player player, LoginResponse response, PlayerLoginEvent.Result result, @Nullable BaseComponent kickMessage) {
    this.response = checkNotNull(response);
    this.player = checkNotNull(player);
    this.result = checkNotNull(result);
    this.kickMessage = kickMessage;
}
 
Example 3
Source File: UserLoginEvent.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public PlayerLoginEvent.Result getResult() {
    return result;
}
 
Example 4
Source File: UserLoginEvent.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public void disallow(PlayerLoginEvent.Result result, BaseComponent message) {
    this.result = result;
    this.kickMessage = message;
}