use of com.voxelgameslib.voxelgameslib.event.events.game.GameLeaveEvent in project VoxelGamesLibv2 by VoxelGamesLib.
the class AbstractGame method leave.
@Override
public void leave(@Nonnull User user) {
players.remove(user);
spectators.remove(user);
allUsers.remove(user);
Optional.ofNullable(playerStates.remove(user.getUuid())).ifPresent(state -> state.apply(user));
broadcastMessage(LangKey.GAME_PLAYER_LEAVE, (Object) user.getDisplayName());
user.getPlayer().teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
user.removeListeningChannel(chatChannel.getIdentifier());
user.addListeningChannel(chatHandler.defaultChannel.getIdentifier());
user.setActiveChannel(chatHandler.defaultChannel.getIdentifier());
Bukkit.getPluginManager().callEvent(new GameLeaveEvent(this, user));
}
Aggregations