Search in sources :

Example 1 with SoliniaPlayerJoinEvent

use of com.solinia.solinia.Events.SoliniaPlayerJoinEvent in project solinia3-core by mixxit.

the class Solinia3CorePlayerListener method onPlayerJoin.

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    SoliniaPlayerJoinEvent soliniaevent;
    try {
        ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt(event.getPlayer());
        soliniaevent = new SoliniaPlayerJoinEvent(event, solplayer);
        solplayer.updateDisplayName();
        solplayer.updateMaxHp();
        Bukkit.getPluginManager().callEvent(soliniaevent);
        // patch
        if (solplayer.getClassObj() != null)
            solplayer.setChosenClass(true);
        else
            solplayer.setChosenClass(false);
        // patch
        if (solplayer.getRace() != null)
            solplayer.setChosenRace(true);
        else
            solplayer.setChosenRace(false);
        StateManager.getInstance().getChannelManager().sendToDiscordMC(solplayer, StateManager.getInstance().getChannelManager().getDefaultDiscordChannel(), event.getPlayer().getName() + "(" + solplayer.getFullName() + ") has joined the game");
    } catch (CoreStateInitException e) {
        event.getPlayer().kickPlayer("Server initialising");
    }
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) SoliniaPlayerJoinEvent(com.solinia.solinia.Events.SoliniaPlayerJoinEvent) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) EventHandler(org.bukkit.event.EventHandler)

Aggregations

SoliniaPlayerJoinEvent (com.solinia.solinia.Events.SoliniaPlayerJoinEvent)1 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)1 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)1 EventHandler (org.bukkit.event.EventHandler)1