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


Java ConnectionHook类代码示例

本文整理汇总了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());
}
 
开发者ID:toddharrison,项目名称:PlayerState,代码行数:18,代码来源:PlayerStatePlugin.java

示例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);
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:12,代码来源:DynmapPlugin.java

示例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);
        }
    });
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:11,代码来源:CanaryPlayerListener.java

示例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
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:19,代码来源:LatchListener.java

示例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);
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:13,代码来源:MixinServerConfigurationManager.java

示例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()));
}
 
开发者ID:UnoModding,项目名称:cynmap,代码行数:5,代码来源:CynmapListener.java


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