当前位置: 首页>>代码示例>>Java>>正文


Java Disconnect类代码示例

本文整理汇总了Java中org.spongepowered.api.event.network.ClientConnectionEvent.Disconnect的典型用法代码示例。如果您正苦于以下问题:Java Disconnect类的具体用法?Java Disconnect怎么用?Java Disconnect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Disconnect类属于org.spongepowered.api.event.network.ClientConnectionEvent包,在下文中一共展示了Disconnect类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerQuit

import org.spongepowered.api.event.network.ClientConnectionEvent.Disconnect; //导入依赖的package包/类
@Listener
public void onPlayerQuit(Disconnect playerQuitEvent, @First Player player) {
    Account account = plugin.getDatabase().remove(player);

    protectionManager.unprotect(player);

    if (account != null) {
        plugin.getAttempts().remove(player.getName());
        //account is loaded -> mark the player as logout as it could remain in the cache
        account.setLoggedIn(false);

        if (settings.getGeneral().isUpdateLoginStatus()) {
            Task.builder()
                    .async().execute(() -> plugin.getDatabase().save(account))
                    .submit(plugin);
        }
    }
}
 
开发者ID:games647,项目名称:FlexibleLogin,代码行数:19,代码来源:ConnectionListener.java

示例2: onPlayerQuit

import org.spongepowered.api.event.network.ClientConnectionEvent.Disconnect; //导入依赖的package包/类
@Listener
public void onPlayerQuit(final Disconnect event) {
    // Skip if Player isn't online. Banned, non-whitelisted, etc players trigger Disconnect too
    if (!Oracle.getGame().getServer().getOnlinePlayers().contains(event.getTargetEntity())) {
        return;
    }

    Sponge.getScheduler().createTaskBuilder().async().execute(() -> {
        try {
            JoinUtil.registerPlayerQuit(event.getTargetEntity());
        } catch (Exception e){
            Oracle.getLogger().error(e.getMessage());
        }
    }).submit(plugin);
}
 
开发者ID:prism,项目名称:Oracle,代码行数:16,代码来源:PlayerQuitListener.java

示例3: onPlayerQuit

import org.spongepowered.api.event.network.ClientConnectionEvent.Disconnect; //导入依赖的package包/类
/**
 * Load channels for player upon join.
 *
 * @param event
 */
@Listener
public void onPlayerQuit(final Disconnect event) {
    Darmok.saveChannelSettingsForPlayer(event.getTargetEntity());
    Darmok.unloadChannelSettingsForPlayer(event.getTargetEntity());
}
 
开发者ID:prism,项目名称:Darmok,代码行数:11,代码来源:DisconnectListener.java


注:本文中的org.spongepowered.api.event.network.ClientConnectionEvent.Disconnect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。