java类org.bukkit.event.player.PlayerPreLoginEvent的实例源码

LoginListener.java 文件源码 项目:SpigotSource 阅读 26 收藏 0 点赞 0 评论 0
public void fireEvents() throws Exception {
            String playerName = i.getName();
            java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
            java.util.UUID uniqueId = i.getId();
            final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;

            AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
            server.getPluginManager().callEvent(asyncEvent);

            if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
                final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
                if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
                    event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
                }
                Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
                    @Override
                    protected PlayerPreLoginEvent.Result evaluate() {
                        server.getPluginManager().callEvent(event);
                        return event.getResult();
                    }};

                LoginListener.this.server.processQueue.add(waitable);
                if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
                    disconnect(event.getKickMessage());
                    return;
                }
            } else {
                if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
                    disconnect(asyncEvent.getKickMessage());
                    return;
                }
            }
            // CraftBukkit end
            LoginListener.c.info("UUID of player " + LoginListener.this.i.getName() + " is " + LoginListener.this.i.getId());
            LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
}
ThreadPlayerLookupUUID.java 文件源码 项目:Uranium 阅读 21 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:ThermosRebased 阅读 23 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:Thermos 阅读 27 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:KCauldron 阅读 24 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:CauldronGit 阅读 23 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:Cauldron-Old 阅读 25 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:Cauldron-Reloaded 阅读 20 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:FFoKC 阅读 24 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
ThreadPlayerLookupUUID.java 文件源码 项目:CraftBukkit 阅读 25 收藏 0 点赞 0 评论 0
public void run() {
    GameProfile gameprofile = LoginListener.a(this.a);

    try {
        String s = (new BigInteger(MinecraftEncryption.a(LoginListener.b(this.a), LoginListener.c(this.a).K().getPublic(), LoginListener.d(this.a)))).toString(16);

        LoginListener.a(this.a, LoginListener.c(this.a).av().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s));
        if (LoginListener.a(this.a) != null) {
            // CraftBukkit start - fire PlayerPreLoginEvent
            if (!this.a.networkManager.isConnected()) {
                return;
            }

            String playerName = LoginListener.a(this.a).getName();
            java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
            java.util.UUID uniqueId = LoginListener.a(this.a).getId();
            final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server;

            AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
            server.getPluginManager().callEvent(asyncEvent);

            if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
                final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
                if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
                    event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
                }
                Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
                    @Override
                    protected PlayerPreLoginEvent.Result evaluate() {
                        server.getPluginManager().callEvent(event);
                        return event.getResult();
                    }};

                LoginListener.c(this.a).processQueue.add(waitable);
                if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
                    this.a.disconnect(event.getKickMessage());
                    return;
                }
            } else {
                if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
                    this.a.disconnect(asyncEvent.getKickMessage());
                    return;
                }
            }
            // CraftBukkit end

            LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId());
            LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
        } else if (LoginListener.c(this.a).N()) {
            LoginListener.e().warn("Failed to verify username but will let them in anyway!");
            LoginListener.a(this.a, this.a.a(gameprofile));
            LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
        } else {
            this.a.disconnect("Failed to verify username!");
            LoginListener.e().error("Username \'" + LoginListener.a(this.a).getName() + "\' tried to join with an invalid session");
        }
    } catch (AuthenticationUnavailableException authenticationunavailableexception) {
        if (LoginListener.c(this.a).N()) {
            LoginListener.e().warn("Authentication servers are down but will let them in anyway!");
            LoginListener.a(this.a, this.a.a(gameprofile));
            LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
        } else {
            this.a.disconnect("Authentication servers are down. Please try again later, sorry!");
            LoginListener.e().error("Couldn\'t verify username because servers are unavailable");
        }
        // CraftBukkit start - catch all exceptions
    } catch (Exception exception) {
        this.a.disconnect("Failed to verify username!");
        LoginListener.c(this.a).server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + LoginListener.a(this.a).getName(), exception);
        // CraftBukkit end
    }
}
ThreadPlayerLookupUUID.java 文件源码 项目:Tweakkit-Server 阅读 24 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.a.networkManager.isConnected()) {
        return;
    }

    String playerName = LoginListener.a(this.a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = LoginListener.a(this.a).getId();
    final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }
        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
            @Override
            protected PlayerPreLoginEvent.Result evaluate() {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }};

        LoginListener.c(this.a).processQueue.add(waitable);
        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
            this.a.disconnect(event.getKickMessage());
            return;
        }
    } else {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
            this.a.disconnect(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId());
    LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
}
PlayerAuthenticationTask.java 文件源码 项目:ProtocolSupport 阅读 21 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws InterruptedException, ExecutionException  {
    if (!listener.networkManager.isConnected()) {
        return;
    }

    String playerName = listener.profile.getName();
    InetSocketAddress saddress = listener.networkManager.getAddress();

    InetAddress address = saddress.getAddress();

    PlayerPropertiesResolveEvent propResolve = new PlayerPropertiesResolveEvent(
        ConnectionImpl.getFromChannel(listener.networkManager.getChannel()),
        playerName, listener.profile.getProperties().values()
    );
    Bukkit.getPluginManager().callEvent(propResolve);
    listener.profile.clearProperties();
    for (ProfileProperty property : propResolve.getProperties().values()) {
        listener.profile.addProperty(property);
    }
    UUID uniqueId = listener.profile.getUUID();

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    Bukkit.getPluginManager().callEvent(asyncEvent);

    PlayerPreLoginEvent syncEvent = new PlayerPreLoginEvent(playerName, address, uniqueId);
    if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
        syncEvent.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
    }

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
        if (ServerPlatform.get().getMiscUtils().callSyncTask(() -> {
            Bukkit.getPluginManager().callEvent(syncEvent);
            return syncEvent.getResult();
        }).get() != PlayerPreLoginEvent.Result.ALLOWED) {
            listener.disconnect(syncEvent.getKickMessage());
            return;
        }
    }

    if (syncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
        listener.disconnect(syncEvent.getKickMessage());
        return;
    }

    listener.setReadyToAccept();
}
ThreadPlayerLookupUUID.java 文件源码 项目:Cauldron 阅读 24 收藏 0 点赞 0 评论 0
private void fireLoginEvents() throws Exception
{
    // CraftBukkit start - fire PlayerPreLoginEvent
    if (!this.field_151292_a.field_147333_a.isChannelOpen())
    {
        return;
    }

    String playerName = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName();
    java.net.InetAddress address = ((java.net.InetSocketAddress) this.field_151292_a.field_147333_a.getSocketAddress()).getAddress();
    java.util.UUID uniqueId = NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId();
    final org.bukkit.craftbukkit.CraftServer server = this.mcServer.server;

    AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
    server.getPluginManager().callEvent(asyncEvent);

    if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
    {
        final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);

        if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
        }

        Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
        {
            @Override
            protected PlayerPreLoginEvent.Result evaluate()
            {
                server.getPluginManager().callEvent(event);
                return event.getResult();
            }
        };

        NetHandlerLoginServer.getMinecraftServer(this.field_151292_a).processQueue.add(waitable);

        if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(event.getKickMessage());
            return;
        }
    }
    else
    {
        if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
        {
            this.field_151292_a.func_147322_a(asyncEvent.getKickMessage());
            return;
        }
    }
    // CraftBukkit end

    NetHandlerLoginServer.getLogger().info("UUID of player " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + " is " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getId());;
    NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
PoreAsyncPlayerPreLoginEvent.java 文件源码 项目:Pore 阅读 18 收藏 0 点赞 0 评论 0
@Override
@SuppressWarnings("deprecation")
public PlayerPreLoginEvent.Result getResult() {
    throw new NotImplementedException("TODO"); // TODO
}
PoreAsyncPlayerPreLoginEvent.java 文件源码 项目:Pore 阅读 24 收藏 0 点赞 0 评论 0
@Override
@SuppressWarnings("deprecation")
public void setResult(PlayerPreLoginEvent.Result result) {
    throw new NotImplementedException("TODO"); // TODO
}
PoreAsyncPlayerPreLoginEvent.java 文件源码 项目:Pore 阅读 22 收藏 0 点赞 0 评论 0
@Override
@SuppressWarnings("deprecation")
public void disallow(PlayerPreLoginEvent.Result result, String message) {
    throw new NotImplementedException("TODO"); // TODO
}
PlayerPreLoginEvent.java 文件源码 项目:BedrockAPI 阅读 19 收藏 0 点赞 0 评论 0
@Deprecated public PlayerPreLoginEvent(String name, InetAddress ipAddress) {
}
PlayerPreLoginEvent.java 文件源码 项目:BedrockAPI 阅读 20 收藏 0 点赞 0 评论 0
public PlayerPreLoginEvent(String name, InetAddress ipAddress, UUID uniqueId) {
}
PlayerPreLoginEvent.java 文件源码 项目:BedrockAPI 阅读 20 收藏 0 点赞 0 评论 0
public PlayerPreLoginEvent.Result getResult() {
    return null;
}
PlayerPreLoginEvent.java 文件源码 项目:BedrockAPI 阅读 19 收藏 0 点赞 0 评论 0
public void setResult(PlayerPreLoginEvent.Result result) {
}
PlayerPreLoginEvent.java 文件源码 项目:BedrockAPI 阅读 20 收藏 0 点赞 0 评论 0
public void disallow(PlayerPreLoginEvent.Result result, String message) {
}


问题


面经


文章

微信
公众号

扫码关注公众号