Skip to content

Commit 9426a46

Browse files
committed
cleaner debug menu, patched melonJoin race condition and make server ip check case-insensitive
1 parent a6ff267 commit 9426a46

2 files changed

Lines changed: 21 additions & 19 deletions

File tree

src/main/java/dev/lycanea/mwonmod/Mwonmod.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public void onInitializeClient() {
7373
ClientTickEvents.END_CLIENT_TICK.register(client -> {
7474
DiscordManager.tick();
7575
if (client.player != null && client.player.getTeam() != null && onMelonKing()) {
76+
if (GameState.melonJoin == null) GameState.melonJoin = LocalDateTime.now();
7677
HashSet<String> currentPlayers = new HashSet<>(client.player.getTeam().getPlayers());
7778
boolean recentJoin = Duration.between(GameState.melonJoin, LocalDateTime.now()).getSeconds() < 3;
7879
for (String iterPlayer : currentPlayers) {
@@ -168,7 +169,8 @@ public static boolean onMelonKing() {
168169
if (Config.HANDLER.instance().ignoreMelonKingCheck) return true;
169170
if (Minecraft.getInstance().getCurrentServer() == null || Minecraft.getInstance().level == null || Minecraft.getInstance().player == null) return false;
170171
// check on df
171-
if (!Minecraft.getInstance().getCurrentServer().ip.endsWith("mcdiamondfire.com") && !Minecraft.getInstance().getCurrentServer().ip.endsWith("diamondfire.games") && !Minecraft.getInstance().getCurrentServer().ip.endsWith("mcdiamondfire.net")) return false;
172+
String serverIp = Minecraft.getInstance().getCurrentServer().ip.toLowerCase();
173+
if (!serverIp.endsWith("mcdiamondfire.com") && !serverIp.endsWith("diamondfire.games") && !serverIp.endsWith("mcdiamondfire.net")) return false;
172174
// check for node 2
173175
if (Minecraft.getInstance().level.getRespawnData().globalPos().pos().getX() != -675) return false;
174176
// check in plot bounds

src/main/java/dev/lycanea/mwonmod/util/HUD.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,36 @@ public static void renderHUDOverlay(GuiGraphics context) {
3535
if (Config.HANDLER.instance().debugMode) {
3636
List<String> debugLines = new ArrayList<>(List.of(
3737
"DEBUG MODE",
38-
"ON MWON: " + Mwonmod.onMelonKing(),
39-
"ON BETA: " + GameState.beta_plot
38+
"On Melon King: " + Mwonmod.onMelonKing() + (GameState.beta_plot ? " (Beta)" : "")
4039
));
41-
if (GameState.housing_pos != null) debugLines.add("HOUSING LOCATION: " + GameState.housing_pos);
42-
if (GameState.currentPath != null) debugLines.add("CURRENT PATH: " + GameState.currentPath);
43-
if (GameState.currentMonarch != null) debugLines.add("CURRENT MONARCH: " + GameState.currentMonarch);
44-
if (GameState.coins != null) debugLines.add("CURRENT COINS: " + GameState.coins);
45-
if (GameState.bank_gold != null) debugLines.add("CURRENT BANK GOLD: " + GameState.bank_gold);
46-
if (GameState.playerLocation != null) debugLines.add("CURRENT LOCATION: " + GameState.playerLocation);
47-
if (GameState.personal_bank != null) debugLines.add("CURRENT PERSONAL BANK: " + GameState.personal_bank);
48-
if (GameState.medals != null) debugLines.add("CURRENT MEDALS: " + GameState.medals);
49-
if (GameState.trophies != null) debugLines.add("CURRENT TROPHIES: " + GameState.trophies);
50-
if (GameState.karma != null) debugLines.add("CURRENT KARMA: " + GameState.karma);
51-
if (GameState.melonJoin != null) debugLines.add("MWON TIMER: " + Duration.between(GameState.melonJoin, LocalDateTime.now()).getSeconds());
52-
if (BossState.boss != null) debugLines.add("CURRENT BOSS: " + BossState.boss.bossID);
40+
if (GameState.housing_pos != null) debugLines.add("Housing Loc: " + GameState.housing_pos);
41+
if (GameState.currentPath != null) debugLines.add("Path: " + GameState.currentPath);
42+
if (GameState.currentMonarch != null) debugLines.add("Monarch: " + GameState.currentMonarch);
43+
if (GameState.coins != null) debugLines.add("Coins: " + GameState.coins);
44+
if (GameState.bank_gold != null) debugLines.add("Bank Gold: " + GameState.bank_gold);
45+
if (GameState.playerLocation != null) debugLines.add("Current Location: " + GameState.playerLocation);
46+
if (GameState.personal_bank != null) debugLines.add("Personal Bank: " + GameState.personal_bank);
47+
if (GameState.medals != null) debugLines.add("Medals: " + GameState.medals);
48+
if (GameState.trophies != null) debugLines.add("Trophies: " + GameState.trophies);
49+
if (GameState.karma != null) debugLines.add("Karma: " + GameState.karma);
50+
if (GameState.melonJoin != null) debugLines.add("Time Since Plot Join: " + Duration.between(GameState.melonJoin, LocalDateTime.now()).getSeconds());
51+
if (BossState.boss != null) debugLines.add("Current Boss: " + BossState.boss);
52+
if (GameState.conquest_difficulty != null) debugLines.add("Conquest Difficulty: " + GameState.conquest_difficulty);
5353

5454
assert Minecraft.getInstance().player != null;
5555
BlockPos pos = Minecraft.getInstance().player.blockPosition().offset(-RegionLoader.plot_origin.x, 0, -RegionLoader.plot_origin.y);
5656
if (GameState.beta_plot) {
5757
pos = Minecraft.getInstance().player.blockPosition().offset(-RegionLoader.beta_plot_origin.x, 0, -RegionLoader.beta_plot_origin.y);
5858
}
59-
debugLines.add("PLOTSPACE POS: " + pos);
59+
debugLines.add("Plotspace Position: " + pos.toShortString());
6060

6161
int startY = context.guiHeight() /2 - debugLines.toArray().length*5;
62-
drawDebugLines(context, client, debugLines, startY, 10, 0xFF82B7ED);
62+
drawDebugLines(context, client, debugLines, startY, 10, 0xFF62B75D);
6363
}
6464

6565
if (!Mwonmod.onMelonKing()) return;
6666

67-
if (!(client.player == null) && !(client.level == null)) {
67+
if (client.player != null && client.level != null) {
6868
long auctionwaitMillis = TimeUtils.auctionTime();
6969
if (!auctionNotificationSent && auctionwaitMillis <= 30000) {
7070
if (Config.HANDLER.instance().auctionDesktopNotification) {
@@ -203,7 +203,7 @@ public static void drawDebugLines(GuiGraphics context, Minecraft client, List<St
203203
maxWidth = Math.max(maxWidth, client.font.width(line));
204204
}
205205

206-
context.fill(0, startY - 2, maxWidth + 4, startY + (lines.size() * lineSpacing), 0xFF000000);
206+
context.fill(0, startY - 2, maxWidth + 4, startY + (lines.size() * lineSpacing), 0x90000000);
207207

208208
int y = startY;
209209
for (String line : lines) {

0 commit comments

Comments
 (0)