/** * Send the current packet to the server. * (Ensure the ID is suitable for viaversion) * * @throws Exception If it failed to write */ @Deprecated public void sendToServer() throws Exception { if (!isCancelled()) { ByteBuf output = inputBuffer == null ? user().getChannel().alloc().buffer() : inputBuffer.alloc().buffer(); writeToBuffer(output); user().sendRawPacketToServer(output, true); } }
protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper); wrapper.writeToBuffer(newPacket);
/** * Send this packet to the associated user. * Be careful not to send packets twice. * (Sends it after current) * <b>This method is no longer used, it's favoured to use {@link #send(Class)} as it will handle the pipeline properly.</b> * * @throws Exception if it fails to write */ @Deprecated public void send() throws Exception { if (!isCancelled()) { // Send ByteBuf output = inputBuffer == null ? user().getChannel().alloc().buffer() : inputBuffer.alloc().buffer(); writeToBuffer(output); user().sendRawPacket(output); } }
ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper); wrapper.writeToBuffer(bytebuf); } catch (Exception e) { bytebuf.clear();
ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper); wrapper.writeToBuffer(newPacket);
ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper); wrapper.writeToBuffer(newPacket);
ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper); wrapper.writeToBuffer(newPacket);
ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper); wrapper.writeToBuffer(newPacket);
ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper); wrapper.writeToBuffer(bytebuf); } catch (Exception e) { bytebuf.clear();
public void transform(ByteBuf bytebuf) throws Exception { if (bytebuf.readableBytes() == 0) { return; // Someone Already Decoded It! } // Increment sent info.incrementSent(); if (info.isActive()) { // Handle ID int id = Type.VAR_INT.read(bytebuf); // Transform ByteBuf oldPacket = bytebuf.copy(); bytebuf.clear(); try { PacketWrapper wrapper = new PacketWrapper(id, oldPacket, info); ProtocolInfo protInfo = info.get(ProtocolInfo.class); protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper); wrapper.writeToBuffer(bytebuf); } catch (Exception e) { bytebuf.clear(); throw e; } finally { oldPacket.release(); } } }