本文整理汇总了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);
}
}
}
示例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);
}
示例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());
}