Skip to content

Commit

Permalink
1.2.1: Velocity b329+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
UserNugget committed Jan 23, 2024
1 parent 3680030 commit 7be3d06
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins() {
}

this.group = "net.elytrium"
this.version = "1.2.0"
this.version = "1.2.1"

compileJava() {
sourceCompatibility = 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.velocitypowered.proxy.network.Connections;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.Handshake;
import com.velocitypowered.proxy.protocol.packet.DisconnectPacket;
import com.velocitypowered.proxy.protocol.packet.HandshakePacket;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand All @@ -38,7 +38,7 @@
import net.elytrium.velocitytools.handlers.HostnamesManagerHandler;
import net.kyori.adventure.text.Component;

public class HandshakeHook extends Handshake implements PacketHook {
public class HandshakeHook extends HandshakePacket implements PacketHook {

private static Method GET_STATE_FOR_PROTOCOL;
private static Field CONNECTION_FIELD;
Expand Down Expand Up @@ -82,7 +82,7 @@ public Supplier<MinecraftPacket> getHook() {

@Override
public Class<? extends MinecraftPacket> getType() {
return Handshake.class;
return HandshakePacket.class;
}

@Override
Expand Down Expand Up @@ -110,7 +110,7 @@ public static void reload(PreparedPacketFactory factory) {

DISCONNECT_PACKET = factory
.createPreparedPacket(ProtocolVersion.MINIMUM_VERSION, ProtocolVersion.MAXIMUM_VERSION)
.prepare(version -> Disconnect.create(kickReasonComponent, version, false));
.prepare(version -> DisconnectPacket.create(kickReasonComponent, version, false));

DISABLE_INVALID_PROTOCOL = Settings.IMP.TOOLS.DISABLE_INVALID_PROTOCOL;
} catch (NoSuchMethodException | NoSuchFieldException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.packet.PluginMessagePacket;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
Expand All @@ -36,7 +36,7 @@
import net.elytrium.commons.utils.reflection.ReflectionException;
import net.elytrium.velocitytools.Settings;

class PluginMessageHook extends PluginMessage implements PacketHook {
class PluginMessageHook extends PluginMessagePacket implements PacketHook {

protected static MethodHandle SERVER_CONNECTION_BACKEND_PLAY_FIELD;
protected static MethodHandle SERVER_CONNECTION_CONFIG_FIELD;
Expand Down Expand Up @@ -65,7 +65,7 @@ public boolean handle(MinecraftSessionHandler handler) {
return super.handle(handler);
}

private PluginMessage rewriteMinecraftBrand(PluginMessage message, ProtocolVersion protocolVersion) {
private PluginMessagePacket rewriteMinecraftBrand(PluginMessagePacket message, ProtocolVersion protocolVersion) {
String currentBrand = PluginMessageUtil.readBrandMessage(message.content());
String rewrittenBrand = MessageFormat.format(this.inGameBrand, currentBrand);
ByteBuf rewrittenBuf = Unpooled.buffer();
Expand All @@ -75,7 +75,7 @@ private PluginMessage rewriteMinecraftBrand(PluginMessage message, ProtocolVersi
rewrittenBuf.writeCharSequence(rewrittenBrand, StandardCharsets.UTF_8);
}

return new PluginMessage(message.getChannel(), rewrittenBuf);
return new PluginMessagePacket(message.getChannel(), rewrittenBuf);
}

@Override
Expand All @@ -85,7 +85,7 @@ public Supplier<MinecraftPacket> getHook() {

@Override
public Class<? extends MinecraftPacket> getType() {
return PluginMessage.class;
return PluginMessagePacket.class;
}

@Override
Expand Down

0 comments on commit 7be3d06

Please sign in to comment.