diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 88b31dd..0d20fc4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -12,7 +12,7 @@ permissions: jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v3 @@ -22,7 +22,7 @@ jobs: java-version: '8' distribution: 'zulu' - name: Build with Gradle - run: chmod +x ./gradlew && ./gradlew setupCiWorkspace && ./gradlew -Dfile.encoding=UTF-8 build + run: ./gradlew setupCiWorkspace && ./gradlew -Dfile.encoding=UTF-8 build - uses: actions/upload-artifact@v3 with: name: LiquidLunarForge diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c1c9876..875d82d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,11 +4,13 @@ - + + + + + + + true + true + false + false + + + + @@ -204,7 +231,7 @@ - + - @@ -499,7 +534,6 @@ diff --git a/README.md b/README.md index 310bd2e..5c9f98f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ ![last commit](https://img.shields.io/github/last-commit/CubeWhyMC/LiquidLunar) ![code size](https://img.shields.io/github/repo-size/CubeWhyMC/LiquidLunar) -![code lines](https://img.shields.io/tokei/lines/github/CubeWhyMC/LiquidLunar) [![Latest Release](https://img.shields.io/github/v/release/CubewhyMC/LiquidLunar)](https://github.com/CubewhyMC/LiquidLunar/release) [![License](https://img.shields.io/github/license/CubewhyMC/LiquidLunar)](https://github.com/Cubewhy/LiquidLunar/blob/master/LICENSE) [![GitHub commit activity](https://img.shields.io/github/commit-activity/m/CubewhyMC/LiquidLunar)](https://github.com/CubewhyMC/LiquidLunar/actions) @@ -26,7 +25,17 @@ LiquidLunar is an open source Minecraft 1.8.9 PvP client This project didn't use any codes from [LunarClient](https://lunarclient.com) -If you want contribute to this project, you can open a [pull request](https://github.com/CubeWhyMC/LiquidLunar/pulls) +If you want to contribute to this project, you can open a [pull request](https://github.com/CubeWhyMC/LiquidLunar/pulls) + +## License + +LiquidLunar license under GPLv3 + +You are allowed to + +- use +- share +- modify ## Build error and fix diff --git a/README_CN.md b/README_CN.md index ed202e7..3c2bea8 100644 --- a/README_CN.md +++ b/README_CN.md @@ -2,7 +2,6 @@ ![last commit](https://img.shields.io/github/last-commit/CubeWhyMC/LiquidLunar) ![code size](https://img.shields.io/github/repo-size/CubeWhyMC/LiquidLunar) -![code lines](https://img.shields.io/tokei/lines/github/CubeWhyMC/LiquidLunar) [![Discord](https://img.shields.io/discord/1047866655033802802.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/rCqCepgWJc) [![Latest Release](https://img.shields.io/github/v/release/CubewhyMC/LiquidLunar)](https://github.com/CubewhyMC/LiquidLunar/release) [![License](https://img.shields.io/github/license/CubewhyMC/LiquidLunar)](https://github.com/Cubewhy/LiquidLunar/blob/master/LICENSE) diff --git a/src/main/java/org/cubewhy/lunarcn/worker/PingWorker.java b/src/main/java/org/cubewhy/lunarcn/worker/PingWorker.java index 20adb1b..69bb077 100644 --- a/src/main/java/org/cubewhy/lunarcn/worker/PingWorker.java +++ b/src/main/java/org/cubewhy/lunarcn/worker/PingWorker.java @@ -1,5 +1,7 @@ package org.cubewhy.lunarcn.worker; +import static org.cubewhy.lunarcn.utils.ClientUtils.logger; + public class PingWorker implements Runnable { private PingWorkerCallable callable; private int ping; @@ -59,8 +61,8 @@ public void run() { } Thread.sleep(5000L); - } catch (Exception var2) { - var2.printStackTrace(); + } catch (Exception e) { + logger.catching(e); } if (this.runOnce) { diff --git a/src/main/kotlin/org/cubewhy/lunarcn/module/impl/server/ServerPing.kt b/src/main/kotlin/org/cubewhy/lunarcn/module/impl/server/ServerPing.kt deleted file mode 100644 index adddf80..0000000 --- a/src/main/kotlin/org/cubewhy/lunarcn/module/impl/server/ServerPing.kt +++ /dev/null @@ -1,85 +0,0 @@ -package org.cubewhy.lunarcn.module.impl.server - -import org.cubewhy.lunarcn.event.EventTarget -import org.cubewhy.lunarcn.event.events.JoinServerEvent -import org.cubewhy.lunarcn.event.events.ScreenChangeEvent -import org.cubewhy.lunarcn.gui.hud.ScreenPosition -import org.cubewhy.lunarcn.module.ModuleCategory -import org.cubewhy.lunarcn.module.ModuleDraggable -import org.cubewhy.lunarcn.module.ModuleInfo -import org.cubewhy.lunarcn.worker.PingWorker -import java.awt.Color - -@ModuleInfo(name = "ServerPing", description = "Show current server's ping", category = ModuleCategory.SERVER) -class ServerPing : ModuleDraggable() { - private var position: ScreenPosition? = null - - private var text: String = "Ping: 0ms" - private var worker = PingWorker() - private var workerThread = Thread(worker) - - override fun onEnabled() { - workerThread.start() - worker.isRun = true - } - - override fun onDisabled() { - worker.isRun = false - } - - override fun save(position: ScreenPosition?) { - this.position = position - } - - override fun load(): ScreenPosition { - if (this.position == null) { - this.position = ScreenPosition.fromRelativePosition(0.5, 0.5) - } - return this.position!! - } - - @EventTarget - fun onJoinServer(event: JoinServerEvent) { - // change ip - worker.currentConnection = event.address - if (!worker.isRun) { - // start ping thread - workerThread.start() - worker.isRun = true - } - } - - @EventTarget - fun onScreenChange(event: ScreenChangeEvent) { - // if not in game or in single-player, disable worker - if (mc.isSingleplayer || mc.thePlayer == null) { - worker.isRun = false // disable worker - } - } - - override fun getWidth(): Int { - return fontRenderer.getStringWidth(this.text) - } - - override fun getHeight(): Int { - return fontRenderer.FONT_HEIGHT - } - - override fun render(position: ScreenPosition) { - val x = position.absoluteX - val y = position.absoluteY - fontRenderer.drawString(text, x, y, Color(255, 255, 255).rgb) - if (mc.isSingleplayer) { - this.text = "Ping: SinglePlayer" // single-player - } else { - this.text = "Ping: " + worker.ping + "ms" // set test - } - } - - override fun renderDummy(position: ScreenPosition) { - if (this.text.isEmpty()) { - this.text = "Ping" - } - render(position) - } -} \ No newline at end of file