From 9b043b74446538ff847fb78f8ee08cc5669e630d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 8 Jun 2021 10:49:26 +0200 Subject: [PATCH] Make `/plot rate` categories translatable --- Bukkit/build.gradle.kts | 2 +- .../com/plotsquared/core/command/Rate.java | 36 ++++++++++++++----- Core/src/main/resources/lang/messages_en.json | 9 +++++ gradle/libs.versions.toml | 2 +- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index 358d6b547..1a538aedf 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -105,7 +105,7 @@ tasks { opt.links("https://papermc.io/javadocs/paper/1.16/") opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.5/") opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.5/") - opt.links("https://jd.adventure.kyori.net/api/4.7.0/") + opt.links("https://jd.adventure.kyori.net/api/4.8.0/") opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/") opt.links("https://checkerframework.org/api/") } diff --git a/Core/src/main/java/com/plotsquared/core/command/Rate.java b/Core/src/main/java/com/plotsquared/core/command/Rate.java index f362c33d8..90e80d397 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Rate.java +++ b/Core/src/main/java/com/plotsquared/core/command/Rate.java @@ -184,15 +184,33 @@ public class Rate extends SubCommand { return true; } }; - inventory.setItem(0, new PlotItemStack(Settings.Ratings.BLOCK_0, 1, "0/8")); - inventory.setItem(1, new PlotItemStack(Settings.Ratings.BLOCK_1, 1, "1/8")); - inventory.setItem(2, new PlotItemStack(Settings.Ratings.BLOCK_2, 2, "2/8")); - inventory.setItem(3, new PlotItemStack(Settings.Ratings.BLOCK_3, 3, "3/8")); - inventory.setItem(4, new PlotItemStack(Settings.Ratings.BLOCK_4, 4, "4/8")); - inventory.setItem(5, new PlotItemStack(Settings.Ratings.BLOCK_5, 5, "5/8")); - inventory.setItem(6, new PlotItemStack(Settings.Ratings.BLOCK_6, 6, "6/8")); - inventory.setItem(7, new PlotItemStack(Settings.Ratings.BLOCK_7, 7, "7/8")); - inventory.setItem(8, new PlotItemStack(Settings.Ratings.BLOCK_8, 8, "8/8")); + inventory.setItem(0, new PlotItemStack(Settings.Ratings.BLOCK_0, 1, + TranslatableCaption.of("ratings.0-8").getComponent(player) + )); + inventory.setItem(1, new PlotItemStack(Settings.Ratings.BLOCK_1, 1, + TranslatableCaption.of("ratings.1-8").getComponent(player) + )); + inventory.setItem(2, new PlotItemStack(Settings.Ratings.BLOCK_2, 2, + TranslatableCaption.of("ratings.2-8").getComponent(player) + )); + inventory.setItem(3, new PlotItemStack(Settings.Ratings.BLOCK_3, 3, + TranslatableCaption.of("ratings.3-8").getComponent(player) + )); + inventory.setItem(4, new PlotItemStack(Settings.Ratings.BLOCK_4, 4, + TranslatableCaption.of("ratings.4-8").getComponent(player) + )); + inventory.setItem(5, new PlotItemStack(Settings.Ratings.BLOCK_5, 5, + TranslatableCaption.of("ratings.5-8").getComponent(player) + )); + inventory.setItem(6, new PlotItemStack(Settings.Ratings.BLOCK_6, 6, + TranslatableCaption.of("ratings.6-8").getComponent(player) + )); + inventory.setItem(7, new PlotItemStack(Settings.Ratings.BLOCK_7, 7, + TranslatableCaption.of("ratings.7-8").getComponent(player) + )); + inventory.setItem(8, new PlotItemStack(Settings.Ratings.BLOCK_8, 8, + TranslatableCaption.of("ratings.8-8").getComponent(player) + )); inventory.openInventory(); } }; diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index ff437a8f2..5f19458ac 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -100,6 +100,15 @@ "ratings.rating_not_your_own": "You cannot rate your own plot.", "ratings.rating_not_done": "You can only rate finished plots.", "ratings.rating_not_owned": "You cannot rate a plot that is not claimed by anyone.", + "ratings.0-8": "0/8", + "ratings.1-8": "1/8", + "ratings.2-8": "2/8", + "ratings.3-8": "3/8", + "ratings.4-8": "4/8", + "ratings.5-8": "5/8", + "ratings.6-8": "6/8", + "ratings.7-8": "7/8", + "ratings.8-8": "8/8", "tutorial.rate_this": "Rate this plot!", "tutorial.comment_this": "Leave some feedback on this plot: .", "economy.econ_disabled": "Economy is not enabled.", diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 71c9636fb..3d1e182f6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ gson = "2.8.0" snakeyaml = "1.27" -adventure-api = "4.7.0" +adventure-api = "4.8.0" adventure-text-minimessage = "4.1.0-SNAPSHOT" adventure-platform-bukkit = "4.0.0-SNAPSHOT"