• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java S00PacketDisconnect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onProcessHandshake

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
@Inject(method = "processHandshake", at = @At(value = "HEAD"), cancellable = true)
private void onProcessHandshake(C00Handshake packetIn, CallbackInfo ci) {
    if (packetIn.getRequestedState().equals(EnumConnectionState.LOGIN)) {
        final String[] split = packetIn.ip.split("\00");

        if (split.length >= 3) {
            packetIn.ip = split[0];
            ((IMixinNetworkManager_Bungee) this.networkManager).setRemoteAddress(new InetSocketAddress(split[1],
                            ((InetSocketAddress) this.networkManager.getRemoteAddress()).getPort()));
            ((IMixinNetworkManager_Bungee) this.networkManager).setSpoofedUUID(UUIDTypeAdapter.fromString(split[2]));

            if (split.length == 4) {
                ((IMixinNetworkManager_Bungee) this.networkManager).setSpoofedProfile(GSON.fromJson(split[3], Property[].class));
            }
        } else {
            final ChatComponentText chatcomponenttext =
                    new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
            this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
            this.networkManager.closeChannel(chatcomponenttext);
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:23,代码来源:MixinNetHandlerHandshakeTCP_Bungee.java


示例2: closeConnection

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
public void closeConnection(String reason)
{
    try
    {
        logger.info("Disconnecting " + this.getConnectionInfo() + ": " + reason);
        ChatComponentText chatcomponenttext = new ChatComponentText(reason);
        this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
        this.networkManager.closeChannel(chatcomponenttext);
    }
    catch (Exception exception)
    {
        logger.error((String)"Error whilst disconnecting player", (Throwable)exception);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:NetHandlerLoginServer.java


示例3: processHandshake

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 47)
            {
                ChatComponentText chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
                this.networkManager.closeChannel(chatcomponenttext);
            }
            else if (packetIn.getProtocolVersion() < 47)
            {
                ChatComponentText chatcomponenttext1 = new ChatComponentText("Outdated client! Please use 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext1));
                this.networkManager.closeChannel(chatcomponenttext1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;

        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:41,代码来源:NetHandlerHandshakeTCP.java


示例4: func_147322_a

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
public void func_147322_a(String p_147322_1_)
{
    try
    {
        logger.info("Disconnecting " + this.func_147317_d() + ": " + p_147322_1_);
        ChatComponentText var2 = new ChatComponentText(p_147322_1_);
        this.field_147333_a.scheduleOutboundPacket(new S00PacketDisconnect(var2), new GenericFutureListener[0]);
        this.field_147333_a.closeChannel(var2);
    }
    catch (Exception var3)
    {
        logger.error("Error whilst disconnecting player", var3);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:15,代码来源:NetHandlerLoginServer.java


示例5: processHandshake

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake p_147383_1_)
{
    switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.field_151291_a[p_147383_1_.func_149594_c().ordinal()])
    {
        case 1:
            this.field_147386_b.setConnectionState(EnumConnectionState.LOGIN);
            ChatComponentText var2;

            if (p_147383_1_.func_149595_d() > 4)
            {
                var2 = new ChatComponentText("Outdated server! I\'m still on 1.7.2");
                this.field_147386_b.scheduleOutboundPacket(new S00PacketDisconnect(var2), new GenericFutureListener[0]);
                this.field_147386_b.closeChannel(var2);
            }
            else if (p_147383_1_.func_149595_d() < 4)
            {
                var2 = new ChatComponentText("Outdated client! Please use 1.7.2");
                this.field_147386_b.scheduleOutboundPacket(new S00PacketDisconnect(var2), new GenericFutureListener[0]);
                this.field_147386_b.closeChannel(var2);
            }
            else
            {
                this.field_147386_b.setNetHandler(new NetHandlerLoginServer(this.field_147387_a, this.field_147386_b));
            }

            break;

        case 2:
            this.field_147386_b.setConnectionState(EnumConnectionState.STATUS);
            this.field_147386_b.setNetHandler(new NetHandlerStatusServer(this.field_147387_a, this.field_147386_b));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + p_147383_1_.func_149594_c());
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:42,代码来源:NetHandlerHandshakeTCP.java


示例6: func_147322_a

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
public void func_147322_a(String p_147322_1_)
{
    try
    {
        logger.info("Disconnecting " + this.func_147317_d() + ": " + p_147322_1_);
        ChatComponentText chatcomponenttext = new ChatComponentText(p_147322_1_);
        this.field_147333_a.scheduleOutboundPacket(new S00PacketDisconnect(chatcomponenttext), new GenericFutureListener[0]);
        this.field_147333_a.closeChannel(chatcomponenttext);
    }
    catch (Exception exception)
    {
        logger.error("Error whilst disconnecting player", exception);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:15,代码来源:NetHandlerLoginServer.java


示例7: channelRead0

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, C00Handshake packet) throws Exception {
    if(!NettyChannelInitializer.serverStarting){
        ctx.fireChannelRead(packet);
        ctx.pipeline().remove(this);
    }else{
        ctx.writeAndFlush(new S00PacketDisconnect(new ChatComponentText("Server is still starting! Please wait before connecting!"))).addListener(ChannelFutureListener.CLOSE);
    }
}
 
开发者ID:nailed,项目名称:nailed,代码行数:10,代码来源:ServerStartingConnectionDestroyer.java


示例8: handleDisconnect

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
public void handleDisconnect(S00PacketDisconnect packetIn)
{
    this.networkManager.closeChannel(packetIn.func_149603_c());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:NetHandlerLoginClient.java


示例9: handleDisconnect

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
public void handleDisconnect(S00PacketDisconnect p_147388_1_)
{
    this.field_147393_d.closeChannel(p_147388_1_.func_149603_c());
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:5,代码来源:NetHandlerLoginClient.java


示例10: handleDisconnect

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
void handleDisconnect(S00PacketDisconnect packetIn); 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:2,代码来源:INetHandlerLoginClient.java


示例11: handleDisconnect

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
void handleDisconnect(S00PacketDisconnect var1); 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:2,代码来源:INetHandlerLoginClient.java


示例12: handleDisconnect

import net.minecraft.network.login.server.S00PacketDisconnect; //导入依赖的package包/类
void handleDisconnect(S00PacketDisconnect p_147388_1_); 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:2,代码来源:INetHandlerLoginClient.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DChoicePattern类代码示例发布时间:2022-05-23
下一篇:
Java OutputStats类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap