Zmiana nazwy serwera pod F3 w Minecraft 1.13

Glenor | 2018-07-25 14:25:32 UTC | #1

Witam wie ktoś jak zmienić wiadomość na F3 w wersji na 1.13 Bungee tam pisze wersja i coś jeszcze xDD


Nieznajomy11 | 2018-07-25 16:02:07 UTC | #2

Należy wysłać pakiet z ByteBufem na kanał MC|Brand, a w tej chwili już minecraft:brand.

https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCustomPayload.java


Nieznajomy11 | 2018-07-25 16:49:43 UTC | #3

Wygląda na to, że pojawił się już na to plugin. Łap.
https://www.spigotmc.org/resources/f3name-edit-your-server-brand-in-debug-screen.58997/


A tutaj jakby ktoś bardzo chciał u siebie to hakersko zaimplementować.

public class MCBrandOverwrite extends PacketAdapter {

    public MCBrandOverwrite(Plugin plugin) {
        super(plugin, PacketType.Play.Server.CUSTOM_PAYLOAD);
    }

    @Override
    public void onPacketSending(PacketEvent event) {

        PacketContainer packet = event.getPacket();
        String channel = packet.getStrings().read(0);

        if (!"MC|Brand".equals(channel)) {
            return;
        }

        String newBrand = "Hello World!";
        ByteBuf brandBuf = ByteBufAllocator.DEFAULT.heapBuffer();

        this.writeString(newBrand, brandBuf);
        this.writePacketContents(packet, brandBuf);
    }

    private void writePacketContents(PacketContainer handle, ByteBuf contents) {
        if (MinecraftReflection.is(MinecraftReflection.getPacketDataSerializerClass(), contents)) {
            handle.getModifier().withType(ByteBuf.class).write(0, contents);
        } else {
            Object serializer = MinecraftReflection.getPacketDataSerializer(contents);
            handle.getModifier().withType(ByteBuf.class).write(0, serializer);
        }
    }

    private void writeString(String s, ByteBuf buf) {
        byte[] bytes = s.getBytes(Charsets.UTF_8);
        this.writeVarInt(bytes.length, buf);
        buf.writeBytes(bytes);
    }

    private void writeArray(byte[] bytes, ByteBuf buf) {
        this.writeVarInt(bytes.length, buf);
        buf.writeBytes(bytes);
    }

    private void writeVarInt(int value, ByteBuf output) {
        int part;
        while (true) {
            part = value & 0x7F;
            value >>>= 7;
            if (value != 0) {
                part |= 0x80;
            }
            output.writeByte(part);
            if (value == 0) {
                break;
            }
        }
    }
}

system | 2018-08-26 15:57:00 UTC | #4

Ten temat został automatycznie zamknięty 32 dni po ostatnim wpisie. Tworzenie nowych odpowiedzi nie jest już możliwe.