Skip to content

Commit

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

setGroup("net.elytrium")
setVersion("1.0.4")
setVersion("1.0.5")

java {
setSourceCompatibility(JavaVersion.VERSION_17)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/elytrium/fastmotd/FastMOTD.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.velocitypowered.proxy.network.ConnectionManager;
import com.velocitypowered.proxy.network.ServerChannelInitializerHolder;
import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.DisconnectPacket;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
Expand Down Expand Up @@ -198,7 +198,7 @@ public void reload() {
Component kickReasonComponent = serializer.deserialize(Settings.IMP.MAINTENANCE.KICK_MESSAGE);
this.kickReason = this.preparedPacketFactory
.createPreparedPacket(ProtocolVersion.MINIMUM_VERSION, ProtocolVersion.MAXIMUM_VERSION)
.prepare(version -> Disconnect.create(kickReasonComponent, version, true))
.prepare(version -> DisconnectPacket.create(kickReasonComponent, version, true))
.build();

this.kickWhitelist = Settings.IMP.MAINTENANCE.KICK_WHITELIST.stream().map((String host) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder;
import com.velocitypowered.proxy.protocol.packet.Handshake;
import com.velocitypowered.proxy.protocol.packet.LegacyHandshake;
import com.velocitypowered.proxy.protocol.packet.LegacyPing;
import com.velocitypowered.proxy.protocol.packet.StatusPing;
import com.velocitypowered.proxy.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.protocol.packet.HandshakePacket;
import com.velocitypowered.proxy.protocol.packet.LegacyHandshakePacket;
import com.velocitypowered.proxy.protocol.packet.LegacyPingPacket;
import com.velocitypowered.proxy.protocol.packet.StatusPingPacket;
import com.velocitypowered.proxy.protocol.packet.StatusRequestPacket;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
Expand All @@ -54,19 +54,19 @@ public HandshakeSessionHandlerHook(FastMOTD plugin, MinecraftConnection connecti
}

@Override
public boolean handle(LegacyPing packet) {
public boolean handle(LegacyPingPacket packet) {
this.connection.close();
return true;
}

@Override
public boolean handle(LegacyHandshake packet) {
public boolean handle(LegacyHandshakePacket packet) {
this.connection.close();
return true;
}

@Override
public boolean handle(Handshake handshake) {
public boolean handle(HandshakePacket handshake) {
if (handshake.getNextStatus() == StateRegistry.STATUS_ID) {
this.protocolVersion = handshake.getProtocolVersion();
this.serverAddress = handshake.getServerAddress() + ":" + handshake.getPort();
Expand All @@ -91,7 +91,7 @@ public boolean handle(Handshake handshake) {

@Override
public void handleGeneric(MinecraftPacket packet) {
if (packet instanceof StatusPing) {
if (packet instanceof StatusPingPacket) {
if (Settings.IMP.MAINTENANCE.MAINTENANCE_ENABLED) {
this.connection.close();
return;
Expand All @@ -103,7 +103,7 @@ public void handleGeneric(MinecraftPacket packet) {
packet.encode(buf, null, null);
this.channel.writeAndFlush(buf);
this.connection.close();
} else if (packet instanceof StatusRequest) {
} else if (packet instanceof StatusRequestPacket) {
this.channel.writeAndFlush(this.plugin.getNext(this.protocolVersion, this.serverAddress));
} else {
this.original.handleGeneric(packet);
Expand Down

0 comments on commit 06517b1

Please sign in to comment.