From 82d7d802ff471202042b91dd1d3015aaa1db24c0 Mon Sep 17 00:00:00 2001 From: pandaninjas Date: Thu, 20 Apr 2023 22:13:24 -0400 Subject: [PATCH 01/10] Allow configurable ingress URI --- src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt index d1e62ca..ee3c15e 100644 --- a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt +++ b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt @@ -42,7 +42,7 @@ data class DomainAssignedMessage(val DomainAssigned: String) data class ChannelOpenMessage(val ChannelOpen: List) data class ChannelClosedMessage(val ChannelClosed: Number) -class E4mcRelayHandler: WebSocketClient(URI("wss://ingress.e4mc.link")) { +class E4mcRelayHandler: WebSocketClient(URI(System.getProperty("vg.skye.e4mc_minecraft.ingress_uri", "wss://ingress.e4mc.link"))) { private val gson = Gson() private val childChannels = mutableMapOf() private val messageQueue = mutableMapOf>() From 7f646312b97f22c20e755a47f4282acef7b18203 Mon Sep 17 00:00:00 2001 From: GodGun968 <1005086949@qq.com> Date: Fri, 21 Apr 2023 09:57:59 +0000 Subject: [PATCH 02/10] Simplified Chinese Translation --- src/main/resources/assets/e4mc_quilt/lang/zh_cn. | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/resources/assets/e4mc_quilt/lang/zh_cn. diff --git a/src/main/resources/assets/e4mc_quilt/lang/zh_cn. b/src/main/resources/assets/e4mc_quilt/lang/zh_cn. new file mode 100644 index 0000000..cb7a012 --- /dev/null +++ b/src/main/resources/assets/e4mc_quilt/lang/zh_cn. @@ -0,0 +1,6 @@ +{ + "text.e4mc_minecraft.domainAssigned": "将本地游戏托管在域名[%s]上", + "text.e4mc_minecraft.closeServer": "不再公开托管本地游戏", + "text.e4mc_minecraft.serverAlreadyClosed": "本地游戏没有被公开托管", + "text.e4mc_minecraft.clickToStop": "(点击这里以停止)" +} \ No newline at end of file From d802ff27d8b86cd67ea3aa2252ff9050df775b1f Mon Sep 17 00:00:00 2001 From: GodGun968 <1005086949@qq.com> Date: Fri, 21 Apr 2023 09:59:15 +0000 Subject: [PATCH 03/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'src/main/resources/?= =?UTF-8?q?assets/e4mc=5Fquilt/lang/zh=5Fcn.json'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/assets/e4mc_quilt/lang/{zh_cn. => zh_cn.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/assets/e4mc_quilt/lang/{zh_cn. => zh_cn.json} (100%) diff --git a/src/main/resources/assets/e4mc_quilt/lang/zh_cn. b/src/main/resources/assets/e4mc_quilt/lang/zh_cn.json similarity index 100% rename from src/main/resources/assets/e4mc_quilt/lang/zh_cn. rename to src/main/resources/assets/e4mc_quilt/lang/zh_cn.json From 03bf7973d9a3466e7e8617b3c4d901c52e4b56bc Mon Sep 17 00:00:00 2001 From: Skye Date: Sat, 22 Apr 2023 13:01:08 +0900 Subject: [PATCH 04/10] docs: readme --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e810930 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# [e4mc_minecraft](https://e4mc.link) + +[![Modrinth Downloads](https://img.shields.io/modrinth/dt/qANg5Jrr?color=%2300af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) [![Modrinth Followers](https://img.shields.io/modrinth/followers/qANg5Jrr?color=00af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) ![Made with Java](https://forthebadge.com/images/badges/made-with-java.svg) ![Open Source](https://forthebadge.com/images/badges/open-source.svg) ![Works on my machine](https://forthebadge.com/images/badges/works-on-my-machine.svg) [![CurseForge Sucks](https://img.shields.io/badge/cuseforge-sucks-f16436?style=for-the-badge)](https://curseforge.com/minecraft/mc-mods/e4mc) + +Open a LAN server to anyone, anywhere, anytime. + +## Install + +[Modrinth](https://modrinth.com/project/qANg5Jrr) + +## Usage + +Open to LAN as normal + +## Contributing + +Please contribute + +## License + +[MIT](LICENSE) \ No newline at end of file From 914ec3479232d26652e8e70e17052db9e62aea74 Mon Sep 17 00:00:00 2001 From: Skye Date: Sat, 22 Apr 2023 13:03:03 +0900 Subject: [PATCH 05/10] docs: better? --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e810930..9c34200 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # [e4mc_minecraft](https://e4mc.link) -[![Modrinth Downloads](https://img.shields.io/modrinth/dt/qANg5Jrr?color=%2300af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) [![Modrinth Followers](https://img.shields.io/modrinth/followers/qANg5Jrr?color=00af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) ![Made with Java](https://forthebadge.com/images/badges/made-with-java.svg) ![Open Source](https://forthebadge.com/images/badges/open-source.svg) ![Works on my machine](https://forthebadge.com/images/badges/works-on-my-machine.svg) [![CurseForge Sucks](https://img.shields.io/badge/cuseforge-sucks-f16436?style=for-the-badge)](https://curseforge.com/minecraft/mc-mods/e4mc) +[![Modrinth Downloads](https://img.shields.io/modrinth/dt/qANg5Jrr?color=%2300af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) +[![Modrinth Followers](https://img.shields.io/modrinth/followers/qANg5Jrr?color=00af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) +![Made with Java](https://forthebadge.com/images/badges/made-with-java.svg) +![Open Source](https://forthebadge.com/images/badges/open-source.svg) +![Works on my machine](https://forthebadge.com/images/badges/works-on-my-machine.svg) +[![CurseForge Sucks](https://img.shields.io/badge/cuseforge-sucks-f16436?style=for-the-badge)](https://curseforge.com/minecraft/mc-mods/e4mc) Open a LAN server to anyone, anywhere, anytime. From 90bf86654d81892d3259942057aa520e8c70951f Mon Sep 17 00:00:00 2001 From: Skye Date: Sat, 22 Apr 2023 13:03:42 +0900 Subject: [PATCH 06/10] docs: remove a few badges --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 9c34200..908e5a7 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@ [![Modrinth Downloads](https://img.shields.io/modrinth/dt/qANg5Jrr?color=%2300af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) [![Modrinth Followers](https://img.shields.io/modrinth/followers/qANg5Jrr?color=00af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr) -![Made with Java](https://forthebadge.com/images/badges/made-with-java.svg) -![Open Source](https://forthebadge.com/images/badges/open-source.svg) -![Works on my machine](https://forthebadge.com/images/badges/works-on-my-machine.svg) [![CurseForge Sucks](https://img.shields.io/badge/cuseforge-sucks-f16436?style=for-the-badge)](https://curseforge.com/minecraft/mc-mods/e4mc) Open a LAN server to anyone, anywhere, anytime. From db9293e658a070a74cc9ff8654cc73b8f03c0a93 Mon Sep 17 00:00:00 2001 From: Basique Date: Sun, 14 May 2023 02:16:34 +0300 Subject: [PATCH 07/10] restrict /e4mc stop and touchup mixin --- .../skye/e4mc_minecraft/mixins/ServerNetworkIoMixin.java | 7 ++++--- src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/vg/skye/e4mc_minecraft/mixins/ServerNetworkIoMixin.java b/src/main/java/vg/skye/e4mc_minecraft/mixins/ServerNetworkIoMixin.java index efede88..180221b 100644 --- a/src/main/java/vg/skye/e4mc_minecraft/mixins/ServerNetworkIoMixin.java +++ b/src/main/java/vg/skye/e4mc_minecraft/mixins/ServerNetworkIoMixin.java @@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import vg.skye.e4mc_minecraft.E4mcClient; @@ -45,9 +46,9 @@ public abstract class ServerNetworkIoMixin { } } - @Redirect(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;channel(Ljava/lang/Class;)Lio/netty/bootstrap/AbstractBootstrap;", remap = false)) - private AbstractBootstrap redirectChannel(ServerBootstrap instance, Class aClass) { - return initializingE4mc.get() ? instance.channel(LocalServerChannel.class) : instance.channel(aClass); + @ModifyArg(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;channel(Ljava/lang/Class;)Lio/netty/bootstrap/AbstractBootstrap;", remap = false)) + private Class redirectChannel(Class aClass) { + return initializingE4mc.get() ? LocalServerChannel.class : aClass; } @Redirect(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;localAddress(Ljava/net/InetAddress;I)Lio/netty/bootstrap/AbstractBootstrap;", remap = false)) diff --git a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt index 5a53a8c..6a9a090 100644 --- a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt +++ b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt @@ -49,6 +49,13 @@ object E4mcClient : ModInitializer { dispatcher.register(literal("e4mc") .then( literal("stop") + .requires { src -> + if (src.server.isDedicated) { + src.hasPermissionLevel(4) + } else { + src.server.isHost((src.player ?: return@requires false).gameProfile) + } + } .executes { context -> if (HANDLER != null) { HANDLER!!.close() From 574ca7dbe44c4d1a9b554e52b1604449e76643be Mon Sep 17 00:00:00 2001 From: Basique Date: Sun, 14 May 2023 02:16:43 +0300 Subject: [PATCH 08/10] chmod +x gradlew --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From dfb6935b7b9e49ca0fe9b2235efdf4ed50ffe67c Mon Sep 17 00:00:00 2001 From: Skye Date: Sun, 14 May 2023 21:47:21 +0900 Subject: [PATCH 09/10] feat: error handling --- .../skye/e4mc_minecraft/E4mcRelayHandler.kt | 20 +++++++++++++++++++ .../assets/e4mc_quilt/lang/en_us.json | 3 ++- .../assets/e4mc_quilt/lang/ko_kr.json | 3 ++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt index ee3c15e..716b812 100644 --- a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt +++ b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcRelayHandler.kt @@ -86,6 +86,26 @@ class E4mcRelayHandler: WebSocketClient(URI(System.getProperty("vg.skye.e4mc_min override fun onError(ex: java.lang.Exception) { ex.printStackTrace() + //#if FABRIC==1 + val isClient = FabricLoader.getInstance().environmentType.equals(EnvType.CLIENT) + //#else + //$$ val isClient = FMLLoader.getDist().isClient + //#endif + if (isClient) { + try { + MinecraftClient.getInstance().inGameHud.chatHud.addMessage( + //#if MC>=11900 + Text.translatable("text.e4mc_minecraft.error") + //#elseif FABRIC==1 + //$$ TranslatableText("text.e4mc_minecraft.error") + //#else + //$$ TranslatableComponent("text.e4mc_minecraft.error") + //#endif + ) + } catch (e: Exception) { + e.printStackTrace() + } + } } private fun handleDomainAssigned(json: JsonObject) { diff --git a/src/main/resources/assets/e4mc_quilt/lang/en_us.json b/src/main/resources/assets/e4mc_quilt/lang/en_us.json index 84e4747..263159a 100644 --- a/src/main/resources/assets/e4mc_quilt/lang/en_us.json +++ b/src/main/resources/assets/e4mc_quilt/lang/en_us.json @@ -2,5 +2,6 @@ "text.e4mc_minecraft.domainAssigned": "Local game hosted on domain [%s]", "text.e4mc_minecraft.closeServer": "Local game no longer publicly hosted", "text.e4mc_minecraft.serverAlreadyClosed": "Local game not publicly hosted", - "text.e4mc_minecraft.clickToStop": " (Click here to stop)" + "text.e4mc_minecraft.clickToStop": " (Click here to stop)", + "text.e4mc_minecraft.error": "An error occurred in e4mc" } diff --git a/src/main/resources/assets/e4mc_quilt/lang/ko_kr.json b/src/main/resources/assets/e4mc_quilt/lang/ko_kr.json index 85b2264..59ca600 100644 --- a/src/main/resources/assets/e4mc_quilt/lang/ko_kr.json +++ b/src/main/resources/assets/e4mc_quilt/lang/ko_kr.json @@ -2,5 +2,6 @@ "text.e4mc_minecraft.domainAssigned": "로컬 게임을 도메인 [%s]에서 호스트합니다", "text.e4mc_minecraft.closeServer": "로컬 게임이 더이상 공개되지 않습니다", "text.e4mc_minecraft.serverAlreadyClosed": "로컬 게임이 이미 공개중이 아닙니다", - "text.e4mc_minecraft.clickToStop": " (멉추려면 여기를 클릭하세요)" + "text.e4mc_minecraft.clickToStop": " (멉추려면 여기를 클릭하세요)", + "text.e4mc_minecraft.error": "e4mc에서 오류가 발생했습니다." } \ No newline at end of file From 6042ea2ede04b5cb9f2f5c869cf9a0a85750eb32 Mon Sep 17 00:00:00 2001 From: Skye Date: Sun, 14 May 2023 21:47:46 +0900 Subject: [PATCH 10/10] 3.1.0 --- gradle.properties | 2 +- src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index fee6aae..669cd09 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx2G mod.name=e4mc mod.id=e4mc_minecraft -mod.version=3.0.0 +mod.version=3.1.0 mod.group=vg.skye \ No newline at end of file diff --git a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt index 6a9a090..fe1082a 100644 --- a/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt +++ b/src/main/kotlin/vg/skye/e4mc_minecraft/E4mcClient.kt @@ -33,7 +33,7 @@ object E4mcClient : ModInitializer { //#endif const val NAME = "e4mc" const val ID = "e4mc_minecraft" - const val VERSION = "3.0.0" + const val VERSION = "3.1.0" @JvmField val LOGGER: Logger = LoggerFactory.getLogger("e4mc") @JvmField