From e037fadfc97b6c2e3752d86096671534e5bfd9db Mon Sep 17 00:00:00 2001 From: Darto KLoning Date: Sun, 6 Sep 2026 17:21:18 +0700 Subject: [PATCH] Fix gamerule --- LICENSE | 56 +++++++++++++++++-- README.md | 24 ++++---- gradle.properties | 2 +- .../lobbysystems/LobbySystemsMod.java | 37 +++++++++--- src/main/resources/fabric.mod.json | 2 +- 5 files changed, 97 insertions(+), 24 deletions(-) diff --git a/LICENSE b/LICENSE index c61639b..52119b5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,55 @@ -MIT License +Lobby Systems Proprietary License -Copyright (c) 2026 DartoKloning +Copyright (c) 2026 DartoKloning. All Rights Reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +1. Ownership +Lobby Systems, including its source code, compiled binaries, documentation, +and derivative material, is proprietary software owned by DartoKloning. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +2. Public Source Access Does Not Grant a License +The source code may be made publicly accessible for viewing, auditing, and +reference purposes. Access to, possession of, downloading of, or visibility +of this repository does not grant any license or permission to use the +software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +3. Permission Required Before Use +No person or organization may use, run, deploy, host, or otherwise operate +Lobby Systems, including an official binary or a self-compiled binary, +without prior written permission from DartoKloning. + +4. Prohibited Without Prior Written Permission +Without prior written permission from DartoKloning, you may not: + +- compile or build the source code; +- copy or reproduce the source code except as technically necessary to view + the repository through the service on which it is published; +- modify, adapt, translate, or create derivative works from the software; +- redistribute, publish, mirror, sublicense, sell, rent, or otherwise provide + the source code or compiled binaries to any third party; +- re-upload the software or any substantial portion of it to another website, + repository, mod platform, file host, or distribution service; +- remove or alter copyright, attribution, or license notices. + +5. Permission Is Explicit +Permission is valid only when expressly granted by DartoKloning. Silence, +failure to respond, public availability of the repository, or access to an +official release does not constitute permission. Any permission granted may +be limited to a particular person, organization, server, version, purpose, +or period of time. + +6. Independent Implementations +This license does not prohibit anyone from independently creating software +with similar ideas or functionality without copying, modifying, deriving +from, or otherwise using Lobby Systems source code or binaries. + +7. No Warranty +The software is provided "AS IS", without warranty of any kind, express or +implied. To the maximum extent permitted by applicable law, the copyright +holder shall not be liable for any claim, damages, or other liability arising +from the software or its use. + +8. Contact for Permission +To request permission to use Lobby Systems, contact DartoKloning through an +official contact method associated with the repository or project. + +All rights not expressly granted in writing are reserved. diff --git a/README.md b/README.md index 1bdcea1..90c5799 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Lobby Systems v1.3.2 — Fabric 26.2 +# Lobby Systems v1.3.3 — Fabric 26.2 Server-side lobby routing untuk Minecraft 26.2/Fabric. Versi 1.3.0 menambahkan viewer gamerule per-dimension dengan pagination dan pengelolaan gamemode player berdasarkan dimension, sambil mempertahankan portal antar-dimensi, last-position, minimum playtime, dan konfigurasi terpusat di `config/lobby/`. -**v1.3.2 bugfix:** parser dimension command sekarang menerima resource identifier seperti `minecraft:lobby` tanpa memakan argumen sesudahnya. Ini memperbaiki `/ls gamerule `, `/ls gamemode `, dan `/ls gamemode set/remove ...`. +**v1.3.3 bugfix:** viewer gamerule sekarang membaca nilai gamerule Minecraft 26.x secara aman per-rule, melewati rule yang tidak aktif/tidak tersedia untuk feature set dimension, dan tidak lagi menggagalkan seluruh command ketika satu rule bermasalah. Versi ini juga mengganti lisensi project menjadi proprietary **All Rights Reserved** dengan penggunaan hanya berdasarkan izin tertulis dari DartoKloning. ### Reload feedback @@ -40,7 +40,7 @@ chmod +x compile.sh release.sh ```text ============================================ Lobby Systems - Fabric 26.2 Build - Version: 1.3.2 + Version: 1.3.3 Namespace: id.dartokloning.lobbysystems Mod ID: dartokloning ============================================ @@ -49,7 +49,7 @@ chmod +x compile.sh release.sh Output utama: ```text -build/libs/lobby-systems-1.3.2.jar +build/libs/lobby-systems-1.3.3.jar ``` `*-sources.jar` hanya source archive dan tidak perlu dipasang ke server. @@ -80,14 +80,14 @@ State penting Lobby Systems memakai separator agar mudah terlihat di server cons ```text ============================================ Lobby Systems - READY - Version: 1.3.2 + Version: 1.3.3 Minecraft: 26.2 Config directory: config/lobby WorldEdit: available ============================================ ``` -## Struktur konfigurasi v1.3.2 +## Struktur konfigurasi v1.3.3 ```text config/ @@ -157,7 +157,7 @@ Portal adalah region/cuboid, bukan harus Nether Portal asli. Anda bebas membuat ### `config/lobby/dimension-gamemodes.json` -Minecraft menyimpan gamemode pada player, bukan pada dimension. Lobby Systems v1.3.2 menambahkan mapping dimension → gamemode dan menerapkannya ketika player masuk ke dimension tersebut. File ini dibuat otomatis dan dapat dikelola lewat command admin. +Minecraft menyimpan gamemode pada player, bukan pada dimension. Lobby Systems v1.3.3 menambahkan mapping dimension → gamemode dan menerapkannya ketika player masuk ke dimension tersebut. File ini dibuat otomatis dan dapat dikelola lewat command admin. Contoh: @@ -173,7 +173,7 @@ Gamemode yang didukung: `survival`, `creative`, `adventure`, dan `spectator`. ## Migrasi dari v1.1.x -Pada startup pertama v1.3.2: +Pada startup pertama v1.3.3: ```text config/lobby-systems.json @@ -197,7 +197,7 @@ akan dimigrasikan ke: config/lobby/player-positions.json ``` -Nama file lama hanya digunakan oleh `LegacyConfigMigrator` untuk proses migrasi. Runtime v1.3.2 membaca dan menulis file baru di `config/lobby/`. +Nama file lama hanya digunakan oleh `LegacyConfigMigrator` untuk proses migrasi. Runtime v1.3.3 membaca dan menulis file baru di `config/lobby/`. Jika file tujuan baru sudah ada, migrator tidak menimpanya. @@ -371,4 +371,8 @@ Lobby fixed spawn ## Catatan pengujian -Karena project ini menargetkan Java 25, compile final sebaiknya dilakukan menggunakan `compile.bat`/`compile.ps1` pada mesin dengan JDK 25. Saat menguji portal, perhatikan console untuk log teleport dan error WorldEdit selection jika selection belum lengkap. +Karena project ini menargetkan Java 25, compile final sebaiknya dilakukan menggunakan `compile.bat` atau `compile.sh` pada mesin dengan JDK 25. Saat menguji portal, perhatikan console untuk log teleport dan error WorldEdit selection jika selection belum lengkap. + +## License + +Lobby Systems is **proprietary software — All Rights Reserved**. Public access to this repository is for viewing, auditing, and reference only. Using, running, compiling, modifying, redistributing, or re-uploading the mod requires prior written permission from DartoKloning. See [`LICENSE`](LICENSE) for the complete terms. diff --git a/gradle.properties b/gradle.properties index e0f39f5..abefead 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,6 @@ minecraft_version=26.2 loader_version=0.19.3 loom_version=1.17-SNAPSHOT fabric_api_version=0.156.0+26.2 -mod_version=1.3.2 +mod_version=1.3.3 maven_group=id.dartokloning archives_base_name=lobby-systems diff --git a/src/main/java/id/dartokloning/lobbysystems/LobbySystemsMod.java b/src/main/java/id/dartokloning/lobbysystems/LobbySystemsMod.java index 4ee1f78..ab8027d 100644 --- a/src/main/java/id/dartokloning/lobbysystems/LobbySystemsMod.java +++ b/src/main/java/id/dartokloning/lobbysystems/LobbySystemsMod.java @@ -335,10 +335,25 @@ public final class LobbySystemsMod implements ModInitializer { } List entries = new ArrayList<>(); + int skippedRules = 0; + for (GameRule rule : BuiltInRegistries.GAME_RULE) { - Identifier id = BuiltInRegistries.GAME_RULE.getKey(rule); - if (id == null) continue; - entries.add(new GameRuleEntry(id.toString(), gameRuleValue(level, rule))); + try { + // Minecraft 26.x stores gamerule values directly in GameRules. + // Some registered rules may be unavailable for the level's enabled + // feature set, so each rule is read independently and safely. + if (!rule.isEnabled(level.enabledFeatures())) { + skippedRules++; + continue; + } + + Identifier id = rule.getIdentifierWithFallback(); + entries.add(new GameRuleEntry(id.toString(), gameRuleValue(level, rule))); + } catch (RuntimeException e) { + skippedRules++; + LOGGER.warn("Unable to read gamerule '{}' for dimension '{}'; skipping it.", + safeGameRuleId(rule), level.dimension().identifier(), e); + } } entries.sort(Comparator.comparing(GameRuleEntry::name)); @@ -350,7 +365,8 @@ public final class LobbySystemsMod implements ModInitializer { sendCommandMessage(source, Component.literal( "§6§lLobby Systems Gamerules §r§7[§f" + page + "§7/§f" + totalPages + "§7]" + "\n§7Dimension: §f" + level.dimension().identifier() - + " §8| §7Rules: §f" + entries.size())); + + " §8| §7Rules: §f" + entries.size() + + (skippedRules > 0 ? " §8| §7Skipped: §e" + skippedRules : ""))); for (int i = start; i < end; i++) { GameRuleEntry entry = entries.get(i); @@ -366,12 +382,19 @@ public final class LobbySystemsMod implements ModInitializer { return entries.size(); } - @SuppressWarnings({"rawtypes", "unchecked"}) - private static String gameRuleValue(ServerLevel level, GameRule rule) { - Object value = level.getGameRules().get((GameRule) rule); + private static String gameRuleValue(ServerLevel level, GameRule rule) { + T value = level.getGameRules().get(rule); return String.valueOf(value); } + private static String safeGameRuleId(GameRule rule) { + try { + return rule.getIdentifierWithFallback().toString(); + } catch (RuntimeException ignored) { + return String.valueOf(rule); + } + } + private static int showDimensionGameMode(CommandSourceStack source, String dimensionId) { String mode = DIMENSION_GAMEMODES.get(dimensionId); if (mode == null) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 42dacd0..e2a5ab2 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,7 @@ "name": "Lobby Systems", "description": "Server-side Fabric lobby routing, persistent world positions, minimum playtime, portals, gamerule inspection, and per-dimension player gamemodes.", "authors": ["DartoKloning"], - "license": "MIT", + "license": "All Rights Reserved", "environment": "server", "entrypoints": { "main": ["id.dartokloning.lobbysystems.LobbySystemsMod"]