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


Java S00PacketKeepAlive类代码示例

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


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

示例1: update

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    this.field_147366_g = false;
    ++this.networkTickCount;
    this.serverController.theProfiler.startSection("keepAlive");

    if ((long)this.networkTickCount - this.lastSentPingPacket > 40L)
    {
        this.lastSentPingPacket = (long)this.networkTickCount;
        this.lastPingTime = this.currentTimeMillis();
        this.field_147378_h = (int)this.lastPingTime;
        this.sendPacket(new S00PacketKeepAlive(this.field_147378_h));
    }

    this.serverController.theProfiler.endSection();

    if (this.chatSpamThresholdCount > 0)
    {
        --this.chatSpamThresholdCount;
    }

    if (this.itemDropThreshold > 0)
    {
        --this.itemDropThreshold;
    }

    if (this.playerEntity.getLastActiveTime() > 0L && this.serverController.getMaxPlayerIdleMinutes() > 0 && MinecraftServer.getCurrentTimeMillis() - this.playerEntity.getLastActiveTime() > (long)(this.serverController.getMaxPlayerIdleMinutes() * 1000 * 60))
    {
        this.kickPlayerFromServer("You have been idle for too long!");
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:35,代码来源:NetHandlerPlayServer.java

示例2: queueUnwrappedPacket

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
public boolean queueUnwrappedPacket(EntityPlayer player, Object packetObj) {
    if (packetObj == null) return true;
    if (player == null) {
        if (packetObj instanceof C00PacketKeepAlive || packetObj instanceof S00PacketKeepAlive) {
            NORELEASE.fixme("Shouldn't this, like, not happen?");
            return true;
        }
        NORELEASE.println("No player to handle: " + packetObj + " " + packetObj.getClass().getSimpleName());
        return true;
    }
    if (player.worldObj.isRemote) return false;
    Packet packet = (Packet) packetObj;
    // May possibly need to inject the liason into things up higher, during reading. Somehow. Hopefulloy won't be needed.
    InteractionLiason liason = InteractionLiason.activeLiasons.get(player);
    if (liason == null) {
        if (!(packet instanceof C00PacketKeepAlive)) {
            // Seems our system isn't perfect. :/
            // Keepalives are generated from a different thread I guess.
            Hammer.logWarning("Liasonless wrapped packet: " + packet.getClass().getSimpleName() + " " + packet.toString());
        }
        return true;
    }
    NetHandlerPlayServer handler = liason.playerNetServerHandler;
    if (packet instanceof FMLProxyPacket) {
        FMLProxyPacket fml = (FMLProxyPacket) packet;
        NetworkDispatcher dispatcher = handler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
        fml.setTarget(Side.CLIENT);
        fml.setDispatcher(dispatcher);
        if (fml.payload().readerIndex() != 0) {
            Core.logSevere("Packet double-processing detected! Channel: " + fml.channel());
            return true;
        }
    }
    packet.processPacket(handler);
    return true;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:37,代码来源:HammerProxy.java

示例3: onNetworkTick

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
/**
 * For scheduled network tasks. Used in NetHandlerPlayServer to send keep-alive packets and in NetHandlerLoginServer
 * for a login-timeout
 */
public void onNetworkTick()
{
    this.field_147366_g = false;
    ++this.networkTickCount;
    this.serverController.theProfiler.startSection("keepAlive");

    if ((long)this.networkTickCount - this.field_147377_k > 40L)
    {
        this.field_147377_k = (long)this.networkTickCount;
        this.field_147379_i = this.func_147363_d();
        this.field_147378_h = (int)this.field_147379_i;
        this.sendPacket(new S00PacketKeepAlive(this.field_147378_h));
    }

    if (this.chatSpamThresholdCount > 0)
    {
        --this.chatSpamThresholdCount;
    }

    if (this.field_147375_m > 0)
    {
        --this.field_147375_m;
    }

    this.serverController.theProfiler.endStartSection("playerTick");
    this.serverController.theProfiler.endSection();
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:32,代码来源:NetHandlerPlayServer.java

示例4: onNetworkTick

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
public void onNetworkTick()
{
    this.field_147366_g = false;
    ++this.networkTickCount;
    this.serverController.theProfiler.startSection("keepAlive");

    if ((long)this.networkTickCount - this.field_147377_k > 40L)
    {
        this.field_147377_k = (long)this.networkTickCount;
        this.field_147379_i = this.func_147363_d();
        this.field_147378_h = (int)this.field_147379_i;
        this.sendPacket(new S00PacketKeepAlive(this.field_147378_h));
    }

    // CraftBukkit start
    for (int spam; (spam = this.chatSpamThresholdCount) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1);) ;

    /* Use thread-safe field access instead
    if (this.chatSpamThresholdCount > 0)
    {
        --this.chatSpamThresholdCount;
    }
    */
    // CraftBukkit end

    if (this.field_147375_m > 0)
    {
        --this.field_147375_m;
    }

    if (this.playerEntity.func_154331_x() > 0L && this.serverController.func_143007_ar() > 0 && MinecraftServer.getSystemTimeMillis() - this.playerEntity.func_154331_x() > (long)(this.serverController.func_143007_ar() * 1000 * 60))
    {
        this.kickPlayerFromServer("You have been idle for too long!");
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:36,代码来源:NetHandlerPlayServer.java

示例5: onNetworkTick

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
public void onNetworkTick()
{
    this.field_147366_g = false;
    ++this.networkTickCount;
    this.serverController.theProfiler.startSection("keepAlive");

    if ((long)this.networkTickCount - this.field_147377_k > 40L)
    {
        this.field_147377_k = (long)this.networkTickCount;
        this.field_147379_i = this.func_147363_d();
        this.field_147378_h = (int)this.field_147379_i;
        this.sendPacket(new S00PacketKeepAlive(this.field_147378_h));
    }

    if (this.chatSpamThresholdCount > 0)
    {
        --this.chatSpamThresholdCount;
    }

    if (this.field_147375_m > 0)
    {
        --this.field_147375_m;
    }

    if (this.playerEntity.func_154331_x() > 0L && this.serverController.func_143007_ar() > 0 && MinecraftServer.getSystemTimeMillis() - this.playerEntity.func_154331_x() > (long)(this.serverController.func_143007_ar() * 1000 * 60))
    {
        this.kickPlayerFromServer("You have been idle for too long!");
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:30,代码来源:NetHandlerPlayServer.java

示例6: handleKeepAlive

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
public void handleKeepAlive(S00PacketKeepAlive packetIn)
{
    this.addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c()));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:NetHandlerPlayClient.java

示例7: handleKeepAlive

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
public void handleKeepAlive(S00PacketKeepAlive packetIn) {
	this.addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c()));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:4,代码来源:NetHandlerPlayClient.java

示例8: handleKeepAlive

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
public void handleKeepAlive(S00PacketKeepAlive p_147272_1_)
{
    this.addToSendQueue(new C00PacketKeepAlive(p_147272_1_.func_149134_c()));
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:5,代码来源:NetHandlerPlayClient.java

示例9: handleKeepAlive

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

示例10: handleKeepAlive

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

示例11: handleKeepAlive

import net.minecraft.network.play.server.S00PacketKeepAlive; //导入依赖的package包/类
void handleKeepAlive(S00PacketKeepAlive p_147272_1_); 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:2,代码来源:INetHandlerPlayClient.java


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