本文整理汇总了Java中net.canarymod.hook.player.ConnectionHook类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionHook类的具体用法?Java ConnectionHook怎么用?Java ConnectionHook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionHook类属于net.canarymod.hook.player包,在下文中一共展示了ConnectionHook类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnection
import net.canarymod.hook.player.ConnectionHook; //导入依赖的package包/类
@HookHandler
public void onConnection(final ConnectionHook hook)
throws DatabaseReadException, DatabaseWriteException {
final Player player = hook.getPlayer();
final World world = player.getWorld();
final Location toLoc = player.getLocation();
new WorldEnterHook(player, world, null, toLoc).call();
if (hook.isFirstConnection()) {
if (config.exactSpawn()) {
player.teleportTo(Canary.getServer().getDefaultWorld().getSpawnLocation());
}
}
connectingPlayers.add(player.getUUIDString());
}
示例2: onPlayerJoin
import net.canarymod.hook.player.ConnectionHook; //导入依赖的package包/类
@HookHandler(priority=Priority.PASSIVE, ignoreCanceled=true)
public void onPlayerJoin(ConnectionHook evt) {
final DynmapPlayer dp = new BukkitPlayer(evt.getPlayer());
// Give other handlers a change to prep player (nicknames and such from Essentials)
server.scheduleServerTask(new Runnable() {
@Override
public void run() {
core.listenerManager.processPlayerEvent(EventType.PLAYER_JOIN, dp);
}
}, 2);
}
示例3: onPlayerJoin
import net.canarymod.hook.player.ConnectionHook; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onPlayerJoin(final ConnectionHook hook) {
server.getPluginManager().callEvent(new PlayerJoinEvent(new CanaryPlayer(hook.getPlayer()), hook.getMessage()) {
@Override
public void setJoinMessage(String joinMessage) {
super.setJoinMessage(joinMessage);
hook.setMessage(joinMessage);
}
});
}
示例4: onConnection
import net.canarymod.hook.player.ConnectionHook; //导入依赖的package包/类
/**
* Checks connecting users againts their pair latch account and bans those
* who are latched out.
*
* @param hook A CanaryMod hook launched every time a player connects
* to the server. It allows access to player's info.
*/
@HookHandler
public void onConnection(ConnectionHook hook) {
Player player = hook.getPlayer();
latch.updateStatus(player);
if (latch.isLatchOut(player)) {
String name = player.getName();
plugin.getLogman().info(name + " banned by CanaryLatch.");
latch.latchBan(player);
}
// set a message for ban user
}
示例5: fireConnectionHook
import net.canarymod.hook.player.ConnectionHook; //导入依赖的package包/类
@Redirect(method = "initializeConnectionToPlayer",
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/ServerConfigurationManager;"
+ "sendChatMsg(Lnet/minecraft/util/IChatComponent;)V"))
public void fireConnectionHook(ServerConfigurationManager manager, IChatComponent component, NetworkManager netManager, EntityPlayerMP playerIn) {
ConnectionHook hook = (ConnectionHook)
new ConnectionHook(
(Player) playerIn, component.getUnformattedTextForChat(), false // TODO: check first time
).call();
if (!hook.isHidden()) {
manager.sendChatMsg(component);
}
}
示例6: onPlayerJoin
import net.canarymod.hook.player.ConnectionHook; //导入依赖的package包/类
@HookHandler
public void onPlayerJoin(ConnectionHook hook) {
plugin.getCore().listenerManager.processPlayerEvent(EventType.PLAYER_JOIN, new CanaryPlayer(hook.getPlayer()));
}