From 9177907710231256ccab91926832bb4fc71c77ff Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 10:46:23 +0300 Subject: [PATCH 1/7] Update minestom to 26.2 and gradle to 9.7.0 --- README.md | 4 ++-- TokyoAPI/build.gradle.kts | 3 ++- build.gradle.kts | 6 ++++-- gradle.properties | 5 +++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ae7a1fd..5456612 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ```txt Простой майнкрафт сервер, над которым я работаю. -Базируется на Minestom, версии 1.21.4 +Базируется на Minestom, версии 26.2 (Для версии новее нужна более новая IDE (Нууу вообще нет, но IDE моей версии не поддерживает 9 Gradle нативно)) @@ -56,7 +56,7 @@ Lavender (Идея реализации Bukkit API & Spigot API) (Само ядро их содержать не будет, но будет модуль совместимости) Оригинальный репо: https://github.com/wildmaster84/Lavender - Реализация: https://github.com/DestroyTokyo/DeBukkit + Реализация: https://github.com/DestroyTokyo/DeBukkit ``` diff --git a/TokyoAPI/build.gradle.kts b/TokyoAPI/build.gradle.kts index dd075ff..9c90cd2 100644 --- a/TokyoAPI/build.gradle.kts +++ b/TokyoAPI/build.gradle.kts @@ -14,7 +14,8 @@ group = "delta.cion.tokyo.api" version = projectVersion dependencies { - implementation("net.minestom:minestom-snapshots:$minestomVersion") + // net.minestom:minestom-snapshots =< 26.2 + implementation("net.minestom:minestom:$minestomVersion") implementation("ch.qos.logback:logback-classic:${logbackVersion}") implementation("com.github.luben:zstd-jni:${zstdVersion}") implementation("org.json:json:${jsonVersion}") diff --git a/build.gradle.kts b/build.gradle.kts index f2125c7..79b4039 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,8 @@ allprojects { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + // Java 21 is old versions <= v2.2.0-predemo + languageVersion = JavaLanguageVersion.of(25) } } @@ -28,7 +29,8 @@ allprojects { dependencies { checkstyle("com.puppycrawl.tools:checkstyle:$checkstyleVersion") - compileOnly("net.minestom:minestom-snapshots:$minestomVersion") + // net.minestom:minestom-snapshots - Is old version + compileOnly("net.minestom:minestom:$minestomVersion") compileOnly("ch.qos.logback:logback-classic:$logbackVersion") compileOnly("org.json:json:$jsonVersion") } diff --git a/gradle.properties b/gradle.properties index 09acd6c..8e437ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,13 +8,14 @@ org.gradle.experimental.watching=false checkstyleVersion = 10.12.4 # Versions of main dependencies -projectVersion = v2.2.0-predemo +projectVersion = v2.3.0-predemo # Compressor zstdVersion = "1.5.7-7" # Base minestom implementation -minestomVersion = fb895cb899 +# Old version: fb895cb899 +minestomVersion = 2026.07.22-26.2 # Logs and input logbackVersion = 1.5.32 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9963aa6..37ba69c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri May 01 04:17:31 MSK 2026 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From acee9eabd48c39d9758c3b18185022987d4010ea Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 10:48:02 +0300 Subject: [PATCH 2/7] Set gradle to 9.6.1 im idiot sorr --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37ba69c..692f83e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri May 01 04:17:31 MSK 2026 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From cedd7764c15066b396400339900bb5daf8cf3738 Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 10:53:39 +0300 Subject: [PATCH 3/7] Update & fix zstd depend --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8e437ef..90999cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ checkstyleVersion = 10.12.4 projectVersion = v2.3.0-predemo # Compressor -zstdVersion = "1.5.7-7" +zstdVersion = 1.5.7-12 # Base minestom implementation # Old version: fb895cb899 From 1f6b022976025414981d115014c799e0f8513e08 Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 11:07:47 +0300 Subject: [PATCH 4/7] Update workflow and add nightly action --- .github/workflows/build-nightly.yml | 49 +++++++++++++++++++++++++++++ .github/workflows/build.yml | 4 +-- 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-nightly.yml diff --git a/.github/workflows/build-nightly.yml b/.github/workflows/build-nightly.yml new file mode 100644 index 0000000..7c57217 --- /dev/null +++ b/.github/workflows/build-nightly.yml @@ -0,0 +1,49 @@ +name: Build Nightly + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-version: '9.6.1' + + - name: Build + run: gradle build + + - name: Get current date + id: date + run: echo "timestamp=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + + - name: Upload nightly release + uses: softprops/action-gh-release@v2 + with: + tag_name: nightly + name: "Nightly build" + body: | + Unstable build of Tokyo. + ```txt + ${{ steps.date.outputs.timestamp }} + ``` + files: | + Tokyo/build/libs/*.jar + TokyoAPI/build/libs/*.jar + TokyoTest/build/libs/*.jar + allow_updates: true + prerelease: true + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c4f0e9..9cd9e30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 with: - gradle-version: '8.5' + gradle-version: '9.6.1' - name: Build run: gradle build @@ -28,7 +28,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: CherryBuild + name: TokyoBuild path: | Tokyo/build/libs/*.jar TokyoAPI/build/libs/*.jar From 339b6871b8300308ffb021708ba1e0c235ed6b7d Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 11:59:22 +0300 Subject: [PATCH 5/7] Fix various api --- .../java/delta/cion/tokyo/server/Server.java | 3 +- .../server/command/WhitelistCommand.java | 2 +- .../cion/tokyo/server/motd/MOTDHandler.java | 42 ++++++++------ .../cion/tokyo/server/motd/ServerMOTD.java | 49 ---------------- .../delta/cion/tokyo/api/online/BanList.java | 4 -- .../delta/cion/tokyo/api/online/OpsList.java | 4 -- .../cion/tokyo/api/online/ServerMOTD.java | 58 +++++++++++++++++++ .../cion/tokyo/api/online/lists/BanList.java | 4 ++ .../cion/tokyo/api/online/lists/OpsList.java | 4 ++ .../api/online/{ => lists}/PlayerInfo.java | 2 +- .../api/online/{ => lists}/WhiteList.java | 2 +- .../cion/tokyo/api/online/package-info.java | 3 +- .../event/PlayerConnectionEvent.java | 2 +- .../test_plugin/event/PlayerDamageEvent.java | 19 ++++-- .../cion/tokyo/test_plugin/util/InfoBook.java | 4 +- 15 files changed, 113 insertions(+), 89 deletions(-) delete mode 100644 Tokyo/src/main/java/delta/cion/tokyo/server/motd/ServerMOTD.java delete mode 100644 TokyoAPI/src/main/java/delta/cion/tokyo/api/online/BanList.java delete mode 100644 TokyoAPI/src/main/java/delta/cion/tokyo/api/online/OpsList.java create mode 100644 TokyoAPI/src/main/java/delta/cion/tokyo/api/online/ServerMOTD.java create mode 100644 TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/BanList.java create mode 100644 TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/OpsList.java rename TokyoAPI/src/main/java/delta/cion/tokyo/api/online/{ => lists}/PlayerInfo.java (75%) rename TokyoAPI/src/main/java/delta/cion/tokyo/api/online/{ => lists}/WhiteList.java (99%) diff --git a/Tokyo/src/main/java/delta/cion/tokyo/server/Server.java b/Tokyo/src/main/java/delta/cion/tokyo/server/Server.java index 346b5b5..e0f9082 100644 --- a/Tokyo/src/main/java/delta/cion/tokyo/server/Server.java +++ b/Tokyo/src/main/java/delta/cion/tokyo/server/Server.java @@ -3,10 +3,9 @@ import delta.cion.tokyo.api.plugin.Plugin; import delta.cion.tokyo.api.ServerBranding; import delta.cion.tokyo.api.locales.Localize; -import delta.cion.tokyo.api.online.WhiteList; +import delta.cion.tokyo.api.online.lists.WhiteList; import delta.cion.tokyo.api.permission.PermissionHandler; import delta.cion.tokyo.server.command.*; -import delta.cion.tokyo.server.command.*; import delta.cion.tokyo.server.config.property.PropertiesHandler; import delta.cion.tokyo.server.console.ConsoleHandler; import delta.cion.tokyo.server.console.DeExceptionManager; diff --git a/Tokyo/src/main/java/delta/cion/tokyo/server/command/WhitelistCommand.java b/Tokyo/src/main/java/delta/cion/tokyo/server/command/WhitelistCommand.java index 117bd2b..1a5291b 100644 --- a/Tokyo/src/main/java/delta/cion/tokyo/server/command/WhitelistCommand.java +++ b/Tokyo/src/main/java/delta/cion/tokyo/server/command/WhitelistCommand.java @@ -2,7 +2,7 @@ import delta.cion.tokyo.api.command.DeltaCommand; import delta.cion.tokyo.api.locales.Localize; -import delta.cion.tokyo.api.online.WhiteList; +import delta.cion.tokyo.api.online.lists.WhiteList; import delta.cion.tokyo.api.permission.PermissionManager; import net.minestom.server.command.CommandSender; import net.minestom.server.command.builder.Command; diff --git a/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java b/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java index 58fa1ca..4c18126 100644 --- a/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java +++ b/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java @@ -1,14 +1,14 @@ package delta.cion.tokyo.server.motd; import delta.cion.tokyo.api.ServerBranding; +import delta.cion.tokyo.api.online.ServerMOTD; import delta.cion.tokyo.server.Server; import net.minestom.server.MinecraftServer; import net.minestom.server.entity.Player; import net.minestom.server.event.server.ServerListPingEvent; import net.minestom.server.network.player.PlayerConnection; -import net.minestom.server.ping.ResponseData; import delta.cion.tokyo.api.event.DeltaEvent; -import net.minestom.server.utils.identity.NamedAndIdentified; +import net.minestom.server.ping.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,7 +18,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Base64; +import java.util.ArrayList; import java.util.Collection; import java.util.function.Consumer; @@ -36,32 +36,40 @@ public class MOTDHandler { Collection players = MinecraftServer.getConnectionManager().getOnlinePlayers(); - ResponseData response = new ServerMOTD() + String serverDescription = ServerBranding.getBrandName() + " Server"; + + Status.Builder rawResponse = new ServerMOTD() .setMOTDVersion(ServerBranding.getBrandName() + " 1.21.4") - .setMOTDDescription(ServerBranding.getBrandName() + " Server") - .setMOTDMaxPlayer(players.size()) - .setMOTDOnline(-1) - .get(); + .setMOTDDescription(serverDescription) + .getRaw(); + + rawResponse.playerInfo(Status.PlayerInfo.builder() + .onlinePlayers(players.size()) + .maxPlayers(-1) + .sample(new ArrayList<>(players)) + .build() + ); + if (buildServerIcon() != null) + rawResponse.favicon(buildServerIcon()); - for (Player player : players) - response.addEntry(NamedAndIdentified.of(player.getName(), player.getUuid())); - if (buildServerIcon() != null) response.setFavicon(buildServerIcon()); - event.setResponseData(response); + Status response = rawResponse.build(); + + event.setStatus(response); }; - private static String buildServerIcon() { + private static byte[] buildServerIcon() { if (!SERVER_ICON.toFile().exists()) return null; + try { byte[] data = Files.readAllBytes(SERVER_ICON); BufferedImage image = ImageIO.read(new ByteArrayInputStream(data)); if (image == null) return null; - if (image.getWidth() != image.getHeight() - || image.getHeight() > 64) return null; + if (image.getWidth() > 64) return null; + if (image.getWidth() != image.getHeight()) return null; - String base64 = Base64.getEncoder().encodeToString(data); - return "data:image/png;base64," + base64; + return data; } catch (IOException e) { LOGGER.warn("Incorrect image {}", SERVER_ICON); return null; diff --git a/Tokyo/src/main/java/delta/cion/tokyo/server/motd/ServerMOTD.java b/Tokyo/src/main/java/delta/cion/tokyo/server/motd/ServerMOTD.java deleted file mode 100644 index 9aa06ce..0000000 --- a/Tokyo/src/main/java/delta/cion/tokyo/server/motd/ServerMOTD.java +++ /dev/null @@ -1,49 +0,0 @@ -package delta.cion.tokyo.server.motd; - -import net.kyori.adventure.text.Component; -import net.minestom.server.ping.ResponseData; - -public class ServerMOTD { - - private final ResponseData RESPONSE; - - public ServerMOTD() { - this.RESPONSE = new ResponseData(); - } - - public ServerMOTD setMOTDOnline(int i) { - this.RESPONSE.setOnline(i); - return this; - } - - public ServerMOTD setMOTDMaxPlayer(int i) { - this.RESPONSE.setMaxPlayer(i); - return this; - } - - public ServerMOTD setMOTDVersion(String s) { - this.RESPONSE.setVersion(s); - return this; - } - - @SuppressWarnings("deprecation") - public ServerMOTD setMOTDDescription(String s) { - this.RESPONSE.setDescription(s); - return this; - } - - public ServerMOTD setMOTDDescription(Component c) { - this.RESPONSE.setDescription(c); - return this; - } - - public ServerMOTD setMOTDFavicon(String s) { - this.RESPONSE.setFavicon(s); - return this; - } - - public ResponseData get() { - return this.RESPONSE; - } - -} diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/BanList.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/BanList.java deleted file mode 100644 index 5624509..0000000 --- a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/BanList.java +++ /dev/null @@ -1,4 +0,0 @@ -package delta.cion.tokyo.api.online; - -public class BanList { -} diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/OpsList.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/OpsList.java deleted file mode 100644 index 720b802..0000000 --- a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/OpsList.java +++ /dev/null @@ -1,4 +0,0 @@ -package delta.cion.tokyo.api.online; - -public class OpsList { -} diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/ServerMOTD.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/ServerMOTD.java new file mode 100644 index 0000000..7e1a676 --- /dev/null +++ b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/ServerMOTD.java @@ -0,0 +1,58 @@ +package delta.cion.tokyo.api.online; + +import net.kyori.adventure.text.Component; +import net.minestom.server.ping.Status; + +public class ServerMOTD { + + private final Status.Builder RESPONSE; + + public ServerMOTD() { + this.RESPONSE = Status.builder(); + } + + public ServerMOTD setMOTDFavicon(byte[] b) { + this.RESPONSE.favicon(b); + return this; + } + + public ServerMOTD setMOTDOnline(int online, int max) { + this.RESPONSE.playerInfo(online, max); + return this; + } + + public ServerMOTD setMOTDPlayerInfo(Status.PlayerInfo playerInfo) { + this.RESPONSE.playerInfo(playerInfo); + return this; + } + + public ServerMOTD setMOTDVersion(String s) { + this.RESPONSE.versionInfo(new Status.VersionInfo(s, Status.VersionInfo.DEFAULT.protocolVersion())); + return this; + } + + public ServerMOTD setMOTDVersion(String s, int protocolVersion) { + this.RESPONSE.versionInfo(new Status.VersionInfo(s, protocolVersion)); + return this; + } + + @SuppressWarnings("deprecation") + public ServerMOTD setMOTDDescription(String s) { + this.RESPONSE.description(Component.text(s)); + return this; + } + + public ServerMOTD setMOTDDescription(Component c) { + this.RESPONSE.description(c); + return this; + } + + public Status get() { + return this.RESPONSE.build(); + } + + public Status.Builder getRaw() { + return this.RESPONSE; + } + +} diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/BanList.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/BanList.java new file mode 100644 index 0000000..6674757 --- /dev/null +++ b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/BanList.java @@ -0,0 +1,4 @@ +package delta.cion.tokyo.api.online.lists; + +public class BanList { +} diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/OpsList.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/OpsList.java new file mode 100644 index 0000000..666c0d4 --- /dev/null +++ b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/OpsList.java @@ -0,0 +1,4 @@ +package delta.cion.tokyo.api.online.lists; + +public class OpsList { +} diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/PlayerInfo.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/PlayerInfo.java similarity index 75% rename from TokyoAPI/src/main/java/delta/cion/tokyo/api/online/PlayerInfo.java rename to TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/PlayerInfo.java index 9a8eedf..1182ec5 100644 --- a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/PlayerInfo.java +++ b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/PlayerInfo.java @@ -1,4 +1,4 @@ -package delta.cion.tokyo.api.online; +package delta.cion.tokyo.api.online.lists; import java.time.LocalDateTime; import java.util.UUID; diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/WhiteList.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/WhiteList.java similarity index 99% rename from TokyoAPI/src/main/java/delta/cion/tokyo/api/online/WhiteList.java rename to TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/WhiteList.java index e7a15ee..88fe32e 100644 --- a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/WhiteList.java +++ b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/lists/WhiteList.java @@ -1,4 +1,4 @@ -package delta.cion.tokyo.api.online; +package delta.cion.tokyo.api.online.lists; import net.minestom.server.MinecraftServer; import net.minestom.server.entity.Player; diff --git a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/package-info.java b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/package-info.java index 9d2a2e7..728a133 100644 --- a/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/package-info.java +++ b/TokyoAPI/src/main/java/delta/cion/tokyo/api/online/package-info.java @@ -1,5 +1,6 @@ /** - * Util package. I think I can move it to core + * Contain online handlers. + * like motd or ban-/ops-/white-lists */ package delta.cion.tokyo.api.online; diff --git a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerConnectionEvent.java b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerConnectionEvent.java index 39fe0de..6f8d53f 100644 --- a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerConnectionEvent.java +++ b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerConnectionEvent.java @@ -1,7 +1,7 @@ package delta.cion.tokyo.test_plugin.event; import delta.cion.tokyo.api.locales.Localize; -import delta.cion.tokyo.api.online.WhiteList; +import delta.cion.tokyo.api.online.lists.WhiteList; import delta.cion.tokyo.api.event.DeltaEvent; import delta.cion.tokyo.test_plugin.TestPlugin; import delta.cion.tokyo.test_plugin.util.InfoBook; diff --git a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java index 2ab3094..0fda332 100644 --- a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java +++ b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java @@ -2,6 +2,7 @@ import delta.cion.tokyo.api.event.DeltaEvent; import delta.cion.tokyo.test_plugin.pvp.CountDamage; +import net.minestom.server.MinecraftServer; import net.minestom.server.entity.Entity; import net.minestom.server.entity.LivingEntity; import net.minestom.server.entity.Player; @@ -10,7 +11,8 @@ import net.minestom.server.event.entity.EntityAttackEvent; import net.minestom.server.event.entity.EntityDamageEvent; import net.minestom.server.item.ItemStack; -import net.minestom.server.registry.DynamicRegistry; +import net.minestom.server.registry.RegistryKey; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,24 +42,29 @@ public static DeltaEvent entityAttackEvent() { return; } - DynamicRegistry.Key damageType = null; + DamageType damageType = null; + Entity attacker = event.getEntity(); float damageCount = 0f; if (attacker instanceof Player player) { - damageType = DamageType.PLAYER_ATTACK; + damageType = DamageType.PLAYER_ATTACK.asValue(); ItemStack item = player.getItemInMainHand(); damageCount = CountDamage.countDamage(item, attacker); } else if (!(attacker instanceof LivingEntity livingAttacker)) { - damageType = DamageType.MOB_ATTACK; + damageType = DamageType.MOB_ATTACK.asValue(); damageCount = 1f; } else { - damageType = DamageType.MOB_ATTACK; + damageType = DamageType.MOB_ATTACK.asValue(); damageCount = 1f; } - Damage damage = new Damage(damageType, target, attacker, target.getPosition(), damageCount); + assert damageType != null; + RegistryKey<@NotNull DamageType> damageTypeRegistryKey = MinecraftServer.getDamageTypeRegistry().getKey(damageType); + + assert damageTypeRegistryKey != null; + Damage damage = new Damage(damageTypeRegistryKey, target, attacker, target.getPosition(), damageCount); livingTarget.damage(damage); }); } diff --git a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/util/InfoBook.java b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/util/InfoBook.java index b8bdc34..4fda8b5 100644 --- a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/util/InfoBook.java +++ b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/util/InfoBook.java @@ -1,8 +1,8 @@ package delta.cion.tokyo.test_plugin.util; import net.kyori.adventure.text.Component; +import net.minestom.server.component.DataComponents; import net.minestom.server.entity.Player; -import net.minestom.server.item.ItemComponent; import net.minestom.server.item.ItemStack; import net.minestom.server.item.Material; import net.minestom.server.item.component.WrittenBookContent; @@ -16,7 +16,7 @@ public class InfoBook { public static void getBook(Player player) { ItemStack book = ItemStack.of(Material.WRITTEN_BOOK) - .with(ItemComponent.WRITTEN_BOOK_CONTENT, // <-- ключ + .with(DataComponents.WRITTEN_BOOK_CONTENT, new WrittenBookContent("-==[ Server info ]==-", "Nionim", getPages())); player.getInventory().addItemStack(book); From 730eebf229764deac6be76c009f9fef7a22c31af Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 12:14:42 +0300 Subject: [PATCH 6/7] Edit Server branding --- .../src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java b/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java index 4c18126..e407f5d 100644 --- a/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java +++ b/Tokyo/src/main/java/delta/cion/tokyo/server/motd/MOTDHandler.java @@ -39,7 +39,7 @@ public class MOTDHandler { String serverDescription = ServerBranding.getBrandName() + " Server"; Status.Builder rawResponse = new ServerMOTD() - .setMOTDVersion(ServerBranding.getBrandName() + " 1.21.4") + .setMOTDVersion(ServerBranding.getBrandName() + " " + MinecraftServer.VERSION_NAME) .setMOTDDescription(serverDescription) .getRaw(); From a3291a472c7d643c848c4af16b137328fd5c8988 Mon Sep 17 00:00:00 2001 From: Nionim Date: Wed, 29 Jul 2026 12:18:21 +0300 Subject: [PATCH 7/7] Fix damage event --- .../tokyo/test_plugin/event/PlayerDamageEvent.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java index 0fda332..5a37eb0 100644 --- a/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java +++ b/TokyoTest/src/main/java/delta/cion/tokyo/test_plugin/event/PlayerDamageEvent.java @@ -42,28 +42,24 @@ public static DeltaEvent entityAttackEvent() { return; } - DamageType damageType = null; + RegistryKey<@NotNull DamageType> damageTypeRegistryKey = null; Entity attacker = event.getEntity(); float damageCount = 0f; if (attacker instanceof Player player) { - damageType = DamageType.PLAYER_ATTACK.asValue(); + damageTypeRegistryKey = DamageType.PLAYER_ATTACK; ItemStack item = player.getItemInMainHand(); damageCount = CountDamage.countDamage(item, attacker); - } else if (!(attacker instanceof LivingEntity livingAttacker)) { - damageType = DamageType.MOB_ATTACK.asValue(); + } else if (!(attacker instanceof LivingEntity)) { + damageTypeRegistryKey = DamageType.MOB_ATTACK; damageCount = 1f; } else { - damageType = DamageType.MOB_ATTACK.asValue(); + damageTypeRegistryKey = DamageType.MOB_ATTACK; damageCount = 1f; } - assert damageType != null; - RegistryKey<@NotNull DamageType> damageTypeRegistryKey = MinecraftServer.getDamageTypeRegistry().getKey(damageType); - - assert damageTypeRegistryKey != null; Damage damage = new Damage(damageTypeRegistryKey, target, attacker, target.getPosition(), damageCount); livingTarget.damage(damage); });