#I send a buffer with a message

1 messages · Page 1 of 1 (latest)

rapid creek
#

tf do I do

rancid rune
#

?nocode

elder wedgeBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

rapid creek
#

I did provide it

rapid creek
past blade
#

@rapid creek

rapid creek
#

but

past blade
#

?nocode

elder wedgeBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

rapid creek
#

I did

past blade
#

a g a i n p l s

rapid creek
#

jump to the messages

#

okay

#

so

#

wait lemme send the newest

#
    @SuppressWarnings("UnstableApiUsage")
    public static ByteBuf createBuffer(PacketWrapper<?> wrapper, int initialCapacity) {
        if (wrapper.buffer != null) throw new AlixException("Incorrect invocation of NettyUtils.createBuffer - buffer exists ");

        wrapper.buffer = Unpooled.buffer(initialCapacity);
        wrapper.writeVarInt(wrapper.getPacketTypeData().getNativePacketId());
        wrapper.write();

        return (ByteBuf) wrapper.buffer;
    }

    public static ByteBuf constBuffer(PacketWrapper<?> wrapper) {
        return Unpooled.unreleasableBuffer(Unpooled.unmodifiableBuffer(createBuffer(wrapper, 1)));
    }
#

This is how I create a constant Buffer

#

with constBuffer and the appriopriate wrapper

past blade
#

how do you make the wrapper

rapid creek
#
    public static ChannelFuture writeConst(ChannelHandlerContext context, ByteBuf constByteBuf) {
        ByteBuf send = context.alloc().buffer().writeBytes(constByteBuf);
        return context.write(send);
    }

    public static ChannelFuture writeAndFlushConst(ChannelHandlerContext context, ByteBuf constByteBuf) {
        ByteBuf send = context.alloc().buffer().writeBytes(constByteBuf);
        return context.writeAndFlush(send);
    }
``` is how I send
past blade
#

PacketWrapper.createUniversalWrapper exists

rapid creek
#

like this

#

for example

rapid creek
past blade
#

i see

rapid creek
#
    @SuppressWarnings("UnstableApiUsage")
    public static ChannelHandlerContext getSilentContext(Channel channel) {
        return channel.pipeline().context(PacketEvents.ENCODER_NAME);
    }
#

this is how I get the context

#

I haven't tested with others and dunno if it's important

#

but I send an action bar message as the first packet

#
    public static ByteBuf constructConst(String message) {
        return constructConst(message, false);
    }

    public static ByteBuf constructConst(String message, boolean actionBar) {
        return NettyUtils.constBuffer(packetWrapper(message, actionBar));
        //return newerConstructor ? construct_1_19(message, actionBar) : construct_old(message, actionBar);
    }

    public static PacketWrapper<?> packetWrapper(String message) {
        return packetWrapper(message, false);
    }

    //From User#sendMessage(Component, ChatType)
    public static PacketWrapper<?> packetWrapper(String message, boolean actionBar) {
        ServerVersion version = PacketEvents.getAPI().getServerManager().getVersion();
        Component component = Component.text(message);

        if (version.isNewerThanOrEquals(ServerVersion.V_1_19)) {
            return new WrapperPlayServerSystemChatMessage(actionBar, component);
        } else {
            if (actionBar) return new WrapperPlayServerActionBar(component);

            ChatMessage m;
            ChatType type = ChatTypes.CHAT;
            if (version.isNewerThanOrEquals(ServerVersion.V_1_16))
                m = new ChatMessage_v1_16(component, type, new UUID(0L, 0L));
            else m = new ChatMessageLegacy(component, type);

            return new WrapperPlayServerChatMessage(m);
        }
    }
#

like this

#

the server version is 1.20.1 and so is my mc ver

#

I use ViaVersion tho

past blade
#

have you tried

#

sending

#

using my methods

rapid creek
#

nope

past blade
#

try

#

sending

#

using

#

my

#

methods

rapid creek
#

okay

past blade
#

we need to get to the crust

#

of the situation

#

the crumbles

rapid creek
#

yeah I guess only that's left

past blade
#

the quark

#

the lepton

rapid creek
#

and I thought that I had studied the source code of yours

rapid creek
past blade
#

what

rapid creek
#

cuz string theory hehe

past blade
#

i havent gotten that far

#

yet

#

in physications

rapid creek
#

uh

rapid creek
past blade
#

im a high school student

rapid creek
#

makes sense

#

so am I

#

how old are you?

past blade
#

why does that matter

rapid creek
#

curiosity

#

how do you spell that

rapid creek
#

okay so

#

@past blade

#

it works with your

#

methods

past blade
#

mister munke

#

yeah idk

#

cope

#

u can ask netty

#

why the difference matters

#

or whats going on

#

by providing code

#

so they can assess the situation

rapid creek
#

the maintainers ignored me last time

rapid creek
#

will try

#

wait

#

@past blade

#

doesn't minecraft use like

#

PacketDataSerializer

#

or the FriendlyByteBuf instead of

#

like an UnpooledByteBuf?

past blade
#

FriendlyByteBuf is almost equivalent to our PacketWrapper in packetevents

#

It is not the buffer, it contains it though.

rapid creek
past blade
#

you pinged agian btw :)

rapid creek
#

but you pinged me as well

#

so we're fair

past blade
#

to annoy u

rapid creek
#

(kinda)

rapid creek
rapid creek
#

@past blade The problem is probably within packet compression, since that's what the error suggests and what the netty guys told me

#

Do you have any special measures you take for compression?

#

Like Via rearranges their handlers

#

(hehe I ping)

past blade
#

you monk

#

you laugh as you ping

rapid creek
#

I found what was wrong

#

it's so stupid

#

I was caching the silent context from login start

#

but compression set is sent after that

#

and you relocate handlers because of compression

#

so the context was invalid

#

BRAH

#

took me like 4 days to figure it out

past blade
#

yeah i purposely didn't respond

#

since u pinged me

#

nahh u are not gonna laugh at me

#

after pinging me

#

nah mate

rapid creek
#

I even asked if you do some stuff regarding compression

#

monk

#

what does that even mean?

rapid creek
#

or the fantasy class?

#

or maybe a short for "monkey"?

#

can't tell

past blade
#

to that

#

but yes we do

#

generally speaking we try to emulate viaversion

rapid creek
#

I can't tell, really

past blade
#

maybe short for monkey

#

i'm not sure?

#

did you just ping me again

rapid creek
#

hehe

#

you have no power here, old man

#

(pls don't block me)

past blade
#

you're lucky

#

that i'm a nice guy

rapid creek
#

I sure am lucky

#

also, I just noticed

#

your avatar is oddly similar to md5

past blade
#

no

#

his avatar is similar to mine

rapid creek
#

well it works both ways

past blade
#

so u fixed everything?

rapid creek
#

ye

#

I can now fully use PE by utilizing buffer creation

past blade
#

you pinged me with “a”

rapid creek
#

now did I?

past blade
#

wrong gif

rapid creek
#

oh

#

send the correct

#

then

past blade
#

it dissapeared

past blade
#

lucky its spigotmc

rapid creek
#

ay, you would've punished me on PE's server?

#

cuz

#

pingz

past blade
#

i still could

rapid creek
#

noo

#

not

#

I beg