Skip to content

Commit 690b19e

Browse files
committed
Implement Hypixel safety features to disable scaling in competitive games and add Hypixel status command
1 parent 319a896 commit 690b19e

File tree

7 files changed

+456
-17
lines changed

7 files changed

+456
-17
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ minecraft_version=1.21.5
66
yarn_mappings=1.21.5+build.1
77
loader_version=0.16.14
88
# Mod Properties
9-
mod_version=1.1.0
9+
mod_version=1.1.1
1010
maven_group=com.github
1111
archives_base_name=scaleme
1212
# Dependencies

src/main/java/com/github/scaleme/client/ScalemeClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.scaleme.client;
22

33
import com.github.scaleme.Scaleme;
4+
import com.github.scaleme.client.command.HypixelStatusCommand;
45
import com.github.scaleme.client.command.PresetCommand;
56
import com.github.scaleme.client.gui.PlayerPresetScreen;
67
import com.github.scaleme.client.util.ScaleManager;
@@ -41,6 +42,7 @@ public void onInitializeClient() {
4142
// Register commands
4243
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
4344
PresetCommand.register(dispatcher);
45+
HypixelStatusCommand.register(dispatcher);
4446
});
4547

4648
// Handle key presses
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.github.scaleme.client.command;
2+
3+
import com.github.scaleme.client.util.HypixelDetector;
4+
import com.github.scaleme.client.util.ScaleManager;
5+
import com.mojang.brigadier.CommandDispatcher;
6+
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
7+
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
8+
import net.minecraft.text.Text;
9+
import net.minecraft.util.Formatting;
10+
11+
public class HypixelStatusCommand {
12+
13+
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
14+
dispatcher.register(ClientCommandManager.literal("scaleme")
15+
.then(ClientCommandManager.literal("hypixel")
16+
.executes(context -> {
17+
// Update detection before showing status
18+
HypixelDetector.updateDetection();
19+
20+
boolean onHypixel = HypixelDetector.isOnHypixel();
21+
boolean inCompetitive = HypixelDetector.isInCompetitiveGame();
22+
boolean scalingAllowed = HypixelDetector.isScalingAllowed();
23+
String gameMode = HypixelDetector.getCurrentGameMode();
24+
25+
context.getSource().sendFeedback(Text.literal("=== ScaleMe Hypixel Status ===")
26+
.formatted(Formatting.GOLD));
27+
28+
context.getSource().sendFeedback(Text.literal("On Hypixel: " + (onHypixel ? "Yes" : "No"))
29+
.formatted(onHypixel ? Formatting.GREEN : Formatting.RED));
30+
31+
if (onHypixel) {
32+
context.getSource().sendFeedback(Text.literal("In Competitive Game: " + (inCompetitive ? "Yes" : "No"))
33+
.formatted(inCompetitive ? Formatting.RED : Formatting.GREEN));
34+
35+
if (inCompetitive && !gameMode.isEmpty()) {
36+
context.getSource().sendFeedback(Text.literal("Current Game: " + gameMode)
37+
.formatted(Formatting.YELLOW));
38+
}
39+
}
40+
41+
context.getSource().sendFeedback(Text.literal("Scaling Allowed: " + (scalingAllowed ? "Yes" : "No"))
42+
.formatted(scalingAllowed ? Formatting.GREEN : Formatting.RED));
43+
44+
if (!scalingAllowed) {
45+
String reason = ScaleManager.getRestrictionReason();
46+
if (!reason.isEmpty()) {
47+
context.getSource().sendFeedback(Text.literal("Reason: " + reason)
48+
.formatted(Formatting.GRAY));
49+
}
50+
}
51+
52+
return 1;
53+
})));
54+
}
55+
}

0 commit comments

Comments
 (0)