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