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


Java Timings.getSendDataPacketTiming方法代码示例

本文整理汇总了Java中co.aikar.timings.Timings.getSendDataPacketTiming方法的典型用法代码示例。如果您正苦于以下问题:Java Timings.getSendDataPacketTiming方法的具体用法?Java Timings.getSendDataPacketTiming怎么用?Java Timings.getSendDataPacketTiming使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在co.aikar.timings.Timings的用法示例。


在下文中一共展示了Timings.getSendDataPacketTiming方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: batchDataPacket

import co.aikar.timings.Timings; //导入方法依赖的package包/类
public boolean batchDataPacket(DataPacket packet) {
    if (!this.connected) {
        return false;
    }

    try (Timing timing = Timings.getSendDataPacketTiming(packet)) {
        DataPacketSendEvent event = new DataPacketSendEvent(this, packet);
        this.server.getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            timing.stopTiming();
            return false;
        }

        if (!this.batchedPackets.containsKey(packet.getChannel())) {
            this.batchedPackets.put(packet.getChannel(), new ArrayList<>());
        }

        this.batchedPackets.get(packet.getChannel()).add(packet.clone());
    }
    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:22,代码来源:Player.java

示例2: dataPacket

import co.aikar.timings.Timings; //导入方法依赖的package包/类
public int dataPacket(DataPacket packet, boolean needACK) {
    if (!this.connected) {
        return -1;
    }

    try (Timing timing = Timings.getSendDataPacketTiming(packet)) {
        DataPacketSendEvent ev = new DataPacketSendEvent(this, packet);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            timing.stopTiming();
            return -1;
        }

        Integer identifier = this.interfaz.putPacket(this, packet, needACK, false);

        if (needACK && identifier != null) {
            this.needACK.put(identifier, false);
            timing.stopTiming();
            return identifier;
        }
    }
    return 0;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:24,代码来源:Player.java

示例3: directDataPacket

import co.aikar.timings.Timings; //导入方法依赖的package包/类
public int directDataPacket(DataPacket packet, boolean needACK) {
    if (!this.connected) {
        return -1;
    }

    try (Timing timing = Timings.getSendDataPacketTiming(packet)) {
        DataPacketSendEvent ev = new DataPacketSendEvent(this, packet);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            timing.stopTiming();
            return -1;
        }

        Integer identifier = this.interfaz.putPacket(this, packet, needACK, true);

        if (needACK && identifier != null) {
            this.needACK.put(identifier, false);
            timing.stopTiming();
            return identifier;
        }
    }
    return 0;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:24,代码来源:Player.java

示例4: dataPacket

import co.aikar.timings.Timings; //导入方法依赖的package包/类
public int dataPacket(DataPacket packet, boolean needACK) {
    if (!this.connected) {
        return -1;
    }

    if(this.printPackets)
        this.getServer().getLogger().info(TextFormat.YELLOW + "[SEND] " + TextFormat.WHITE + packet.getName());

    try (Timing timing = Timings.getSendDataPacketTiming(packet)) {
        DataPacketSendEvent ev = new DataPacketSendEvent(this, packet);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            timing.stopTiming();
            return -1;
        }

        Integer identifier = this.interfaz.putPacket(this, packet, needACK, false);

        if (needACK && identifier != null) {
            this.needACK.put(identifier.intValue(), false);
            timing.stopTiming();
            return identifier;
        }
    }
    return 0;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:27,代码来源:Player.java

示例5: directDataPacket

import co.aikar.timings.Timings; //导入方法依赖的package包/类
public int directDataPacket(DataPacket packet, boolean needACK) {
    if (!this.connected) {
        return -1;
    }

    if(this.printPackets)
        this.getServer().getLogger().info(TextFormat.LIGHT_PURPLE + "[SEND-DIRECT] " + TextFormat.WHITE + packet.getClass().getSimpleName());

    try (Timing timing = Timings.getSendDataPacketTiming(packet)) {
        DataPacketSendEvent ev = new DataPacketSendEvent(this, packet);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            timing.stopTiming();
            return -1;
        }

        Integer identifier = this.interfaz.putPacket(this, packet, needACK, true);

        if (needACK && identifier != null) {
            this.needACK.put(identifier.intValue(), false);
            timing.stopTiming();
            return identifier;
        }
    }
    return 0;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:27,代码来源:Player.java

示例6: sendPacket

import co.aikar.timings.Timings; //导入方法依赖的package包/类
public void sendPacket(PEPacket packet, boolean immediate) {
    if (packet == null)
        return;

    // System.out.println("Sending [" + packet.getClass().getSimpleName() + "] ");
    try (Timing timing = Timings.getSendDataPacketTiming(packet)) {

        packet.encode();

        byte[] buffer;
        try {
            buffer = Zlib.deflate(Binary.appendBytes(Binary.writeUnsignedVarInt(packet.getBuffer().length), packet.getBuffer()), 6);
        } catch (Exception e) {
            timing.stopTiming();
            e.printStackTrace();
            return;
        }

        // handler.sendEncapsulated(identifier, encapsulated, RakNet.FLAG_NEED_ACK |
        // (overridedImmediate ? RakNet.PRIORITY_IMMEDIATE : RakNet.PRIORITY_NORMAL));
        raknetClient.sendMessage(Reliability.RELIABLE_ORDERED, 0,
                new net.marfgamer.jraknet.Packet(Binary.appendBytes((byte) 0xfe, buffer)));
    }
}
 
开发者ID:DragonetMC,项目名称:DragonProxy,代码行数:25,代码来源:UpstreamSession.java


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