Skip to content

Commit e6ad3b4

Browse files
committed
Server IP added to ServerBrand HUD
1 parent e09f035 commit e6ad3b4

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

src/main/kotlin/com/lambda/client/gui/hudgui/elements/misc/ServerBrand.kt

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.lambda.client.gui.hudgui.elements.misc
2+
3+
import com.lambda.client.event.SafeClientEvent
4+
import com.lambda.client.gui.hudgui.LabelHud
5+
6+
internal object ServerInfo : LabelHud(
7+
name = "ServerInfo",
8+
category = Category.MISC,
9+
description = "Brand / type and ip of the server"
10+
) {
11+
private val showBrand by setting("Show Brand", true)
12+
private val showIP by setting("Show full server ip", false)
13+
14+
override fun SafeClientEvent.updateText() {
15+
if (mc.isIntegratedServerRunning) {
16+
displayText.add("Singleplayer: " + mc.player?.serverBrand)
17+
} else {
18+
if (showBrand) {
19+
val serverBrand = player.serverBrand ?: "Unknown Server Type"
20+
displayText.add("Brand", secondaryColor)
21+
displayText.addLine(serverBrand, primaryColor)
22+
}
23+
24+
if (showIP) {
25+
val serverIp = player.connection.networkManager.remoteAddress.toString()
26+
displayText.add("IP", secondaryColor)
27+
displayText.addLine(serverIp, primaryColor)
28+
}
29+
}
30+
}
31+
32+
}

0 commit comments

Comments
 (0)