Skip to content

Commit

Permalink
jut assume its good lol
Browse files Browse the repository at this point in the history
  • Loading branch information
adryd325 committed Nov 29, 2023
1 parent 4465629 commit 1ccbf35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
loader_version=0.14.22
minecraft_version=1.20.3-pre4
yarn_mappings=1.20.3-pre4+build.2
loader_version=0.14.25

# Mod Properties
mod_version = 1.0.11
mod_version = 1.0.12
maven_group = com.adryd
archives_base_name = sneaky
23 changes: 3 additions & 20 deletions src/main/java/com/adryd/sneaky/mixin/MixinLegacyQueryHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,26 @@
@Mixin(LegacyQueryHandler.class)
public abstract class MixinLegacyQueryHandler extends ChannelInboundHandlerAdapter {
@Shadow
protected static void reply(ChannelHandlerContext ctx, ByteBuf buf) {
private static void reply(ChannelHandlerContext ctx, ByteBuf buf) {
}

@Shadow
@Final
private QueryableServer server;

@Shadow
protected static ByteBuf createBuf(ByteBufAllocator allocator, String string) {
private static ByteBuf createBuf(ByteBufAllocator allocator, String string) {
return null;
}

@Shadow
protected static String getResponse(QueryableServer server) {
private static String getResponse(QueryableServer server) {
return null;
}

@Unique
private final QueryableServer sneakyMetadata = new LegacyPingMetadata();

@Unique
private String get13PingData(SocketAddress addr) {
;
if (Config.INSTANCE.getHideServerPingData() && !IPList.INSTANCE.canPing(addr)) {
return String.format(Locale.ROOT, "%s§%d§%d", "A Minecraft Server", 0, 20);
}
return String.format(Locale.ROOT, "%s§%d§%d", this.server.getServerMotd(), this.server.getCurrentPlayerCount(), this.server.getMaxPlayerCount());
}

@Unique
private String get14to16PingData(SocketAddress addr) {
if (Config.INSTANCE.getHideServerPingData() && !IPList.INSTANCE.canPing(addr)) {
return String.format(Locale.ROOT, "§1\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, this.server.getVersion(), "A Minecraft Server", 0, 20);
}
return String.format(Locale.ROOT, "§1\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, this.server.getVersion(), this.server.getServerMotd(), this.server.getCurrentPlayerCount(), this.server.getMaxPlayerCount());
}

@Inject(method = "channelRead", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/handler/LegacyQueryHandler;getResponseFor1_2(Lnet/minecraft/network/QueryableServer;)Ljava/lang/String;"))
private void send13Ping(ChannelHandlerContext ctx, Object msg, CallbackInfo ci) {
QueryableServer pingData = this.sneakyMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
class MixinServerLoginNetworkHandler {
@Shadow
@Final
private ClientConnection connection;
ClientConnection connection;

@Shadow
@Final
private MinecraftServer server;
MinecraftServer server;

@Shadow
@Nullable
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

"depends": {
"fabricloader": ">=0.14.19",
"minecraft": "1.20.2",
"minecraft": ">=1.20.2",
"java": ">=17"
},
"suggests": {
Expand Down

0 comments on commit 1ccbf35

Please sign in to comment.