diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..1d953f4b --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index ccab28b0..c6036ccf 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties .mvn/wrapper/maven-wrapper.jar +.direnv diff --git a/build.gradle.kts b/build.gradle.kts index 09cbdc12..c570a852 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "de.eldoria" -version = "2.6.4" +version = "2.7.0" var publishModules = setOf("schematicbrushreborn-api", "schematicbrushreborn-core", @@ -41,7 +41,9 @@ allprojects { } java { - sourceCompatibility = JavaVersion.VERSION_17 + toolchain{ + languageVersion = JavaLanguageVersion.of(21) + } withSourcesJar() withJavadocJar() } @@ -62,7 +64,7 @@ allprojects { } compileOnly(libs.fawe.bukkit) - testImplementation(platform("org.junit:junit-bom:5.10.2")) + testImplementation(platform("org.junit:junit-bom:5.10.3")) testImplementation("org.junit.jupiter", "junit-jupiter") testImplementation(testlibs.mockbukkit) testImplementation(libs.worldedit) { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136..2c352119 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138..09523c0e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf13..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 7101f8e4..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/schematicbrushreborn-api/build.gradle.kts b/schematicbrushreborn-api/build.gradle.kts index 21a6d4ea..facaa764 100644 --- a/schematicbrushreborn-api/build.gradle.kts +++ b/schematicbrushreborn-api/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - api(libs.eldoutil.legacy) + api(libs.bundles.utilities) api(libs.eldoutil.jackson) api(libs.messageblocker) api(libs.adventure.bukkit) diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/SchematicBrushReborn.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/SchematicBrushReborn.java index c66e32b9..f4609457 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/SchematicBrushReborn.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/SchematicBrushReborn.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.cfg.MapperBuilder; import com.fasterxml.jackson.databind.module.SimpleModule; -import de.eldoria.eldoutilities.core.EldoUtilities; +import de.eldoria.EldoUtilities; import de.eldoria.eldoutilities.plugin.EldoPlugin; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.config.Configuration; diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/builder/BuildUtil.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/builder/BuildUtil.java index 6c034e9a..611f6f22 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/builder/BuildUtil.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/builder/BuildUtil.java @@ -30,32 +30,32 @@ public static String buildModifier(Permissible permissible, String baseCommand, var filteredProvider = provider.stream().filter(set -> set.hasPermission(permissible)).toList(); if (filteredProvider.size() > 1) { types = filteredProvider.stream() - .map(p -> String.format("%s'>[%s]", - p.commandType(), baseCommand, type.name(), p.name(), Colors.NEUTRAL, p.description(), p.name())) + .map(p -> String.format("%s'>[%s]", + p.commandType(), baseCommand, type.name(), p.name(), p.localizedDescription(), p.localizedName())) .collect(Collectors.joining(" ")); } else { - types = String.format("[Change]", + types = String.format("[]", filteredProvider.get(0).commandType(), baseCommand, type.name(), filteredProvider.get(0).name()); } var remove = ""; if (!type.required()) { - remove = String.format("<%s>[Remove]", Colors.REMOVE, removeBaseCommand, type.name()); + remove = String.format("[]", removeBaseCommand, type.name()); } - return String.format("%s'><%s>%s: <%s>%s %s\n %s", - Colors.NEUTRAL, type.description(), Colors.HEADING, type.name(), Colors.CHANGE, types, remove, + return String.format("%s'>%s: %s %s\n %s", + type.description(), type.getLocalizedName(), types, remove, filteredProvider.size() > 1 ? renderProvider(current) : renderSingleProvider(current)); } public static String renderProvider(ComponentProvider provider) { - return String.format("<%s>%s%s<%s>%s", Colors.NAME, provider.name(), - provider.descriptor() == null || provider.descriptor().isBlank() ? "" : ": ", Colors.VALUE, - provider.descriptor() == null || provider.descriptor().isBlank() ? "" : provider.descriptor()); + return String.format("%s%s%s", provider.localizedName(), + provider.localizedDescriptor() == null || provider.localizedDescriptor().isBlank() ? "" : ": ", + provider.localizedDescriptor() == null || provider.localizedDescriptor().isBlank() ? "" : provider.localizedDescriptor()); } public static String renderSingleProvider(ComponentProvider provider) { - return String.format("<%s>%s", Colors.VALUE, provider.descriptor()); + return String.format("%s", provider.localizedDescriptor()); } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/BaseModifier.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/BaseModifier.java index cd25c710..2b340e2d 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/BaseModifier.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/BaseModifier.java @@ -6,8 +6,11 @@ package de.eldoria.schematicbrush.brush.config.modifier; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.schematicbrush.brush.config.util.Nameable; +import java.util.Objects; + /** * Represents a modifier. *

@@ -15,25 +18,34 @@ */ public class BaseModifier extends Nameable { private final String description; + private final String localizedName; private final boolean required; - protected BaseModifier(String name, String description, boolean required) { + public BaseModifier(String name, String description, String localizedName, boolean required) { super(name); this.description = description; + this.localizedName = Objects.requireNonNullElse(localizedName, name); this.required = required; } + protected BaseModifier(String name, String description, boolean required) { + this(name, description, null, required); + } + /** * Get a short explanation about this modifier. * * @return the description */ public String description() { + if (ILocalizer.isLocaleCode(description)) { + return ILocalizer.escape(description); + } return description; } /** - * Defines wheather this provider is required or not for a brush. + * Defines whether this provider is required or not for a brush. * If the brush behaviour wouldn't change when the default value is applied a modifier is usually not considered required. * * @return true if the modifier is required. @@ -41,4 +53,8 @@ public String description() { public boolean required() { return required; } + + public String getLocalizedName() { + return ILocalizer.escape(localizedName); + } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/PlacementModifier.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/PlacementModifier.java index ed64aac0..6c65c601 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/PlacementModifier.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/PlacementModifier.java @@ -21,41 +21,57 @@ public class PlacementModifier extends BaseModifier { /** * Placement modifier key */ - public static final PlacementModifier PLACEMENT = of("Placement", "Define how the schematic should be placed on the position.", true); + public static final PlacementModifier PLACEMENT = of( + "Placement", + "components.modifier.type.placement.name", + "components.modifier.type.placement.description", + true); /** * IncludeAir modifier key */ - public static final PlacementModifier INCLUDE_AIR = of("IncludeAir", "Include air when placing. Will only have an effect when ReplaceAll is active.", true); + public static final PlacementModifier INCLUDE_AIR = of("IncludeAir", + "components.modifier.type.includeAir.name", + "components.modifier.type.includeAir.description", true); /** * ReplaceAll modifier key */ - public static final PlacementModifier REPLACE_ALL = of("ReplaceAll", "Replace non air blocks", true); + public static final PlacementModifier REPLACE_ALL = of("ReplaceAll", + "components.modifier.type.replaceAll.name", + "components.modifier.type.replaceAll.description", true); /** * Offset modifier key */ - public static final PlacementModifier OFFSET = of("Offset", "The schematic offset when placed.", false); + public static final PlacementModifier OFFSET = of("Offset", + "components.modifier.type.offset.name", + "components.modifier.type.offset.description", false); /** * Filter modifier key */ - public static final PlacementModifier FILTER = of("Filter", "Remove blocks from the schematic.", false); + public static final PlacementModifier FILTER = of("Filter", + "components.modifier.type.filter.name", + "components.modifier.type.filter.description", false); /** * Flip modifier key */ - public static final PlacementModifier FLIP = of("Flip", "Flip a schematic", false); + public static final PlacementModifier FLIP = of("Flip", + "components.modifier.type.flip.name", + "components.modifier.type.flip.description", false); /** * Rotation modifier key */ - public static final PlacementModifier ROTATION = of("Rotation", "Rotate a schematic", false); + public static final PlacementModifier ROTATION = of("Rotation", + "components.modifier.type.rotation.name", + "components.modifier.type.rotation.description", false); - private PlacementModifier(String name, String description, boolean required) { - super(name, description, required); + private PlacementModifier(String name, String description, String localizedName, boolean required) { + super(name, description, localizedName, required); } /** @@ -66,8 +82,8 @@ private PlacementModifier(String name, String description, boolean required) { * @param required true if this modifier is required to be set. This will enforce a default value for the modifier. * @return new PlacementModifier */ - public static PlacementModifier of(String name, String description, boolean required) { - return new PlacementModifier(name, description, required) { + public static PlacementModifier of(String name, String localizedName, String description, boolean required) { + return new PlacementModifier(name, description, localizedName, required) { }; } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/SchematicModifier.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/SchematicModifier.java index 7d9858b7..ab200f03 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/SchematicModifier.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/modifier/SchematicModifier.java @@ -21,17 +21,17 @@ public class SchematicModifier extends BaseModifier { /** * Rotation modifier key */ - public static final SchematicModifier ROTATION = of("Rotation", "Rotate a schematic", false); + public static final SchematicModifier ROTATION = of("Rotation", "components.modifier.type.rotation.name","components.modifier.type.rotation.description", false); /** * Flip modifier key */ - public static final SchematicModifier FLIP = of("Flip", "Flip a schematic", false); + public static final SchematicModifier FLIP = of("Flip", "components.modifier.type.flip.name","components.modifier.type.flip.description", false); /** * Offset modifier key */ - public static final SchematicModifier OFFSET = of("Offset", "The schematic offset when placed.", false); + public static final SchematicModifier OFFSET = of("Offset", "components.modifier.type.offset.name","components.modifier.type.offset.description", false); /** * Creates a new schematic modifier @@ -40,8 +40,8 @@ public class SchematicModifier extends BaseModifier { * @param description description of the modifier * @param required true if this modifier is required to be set. This will enforce a default value for the modifier. */ - public SchematicModifier(String name, String description, boolean required) { - super(name, description, required); + public SchematicModifier(String name, String localizedName, String description, boolean required) { + super(name, description, localizedName, required); } /** @@ -52,8 +52,8 @@ public SchematicModifier(String name, String description, boolean required) { * @param required true if this modifier is required to be set. This will enforce a default value for the modifier. * @return new PlacementModifier */ - public static SchematicModifier of(String name, String description, boolean required) { - return new SchematicModifier(name, description, required) { + public static SchematicModifier of(String name, String localizedName, String description, boolean required) { + return new SchematicModifier(name, localizedName, description, required) { }; } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/ModifierProvider.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/ModifierProvider.java index 85f4a31b..77a8d625 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/ModifierProvider.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/ModifierProvider.java @@ -17,8 +17,37 @@ public abstract class ModifierProvider extends SettingProvider> { * * @param clazz class which is provided * @param name name of provider + * @deprecated Use {@link #ModifierProvider(Class, String, String, String)} and provide a localized name and description */ + @SuppressWarnings("removal") + @Deprecated(forRemoval = true) public ModifierProvider(Class clazz, String name) { super(clazz, name); } + + /** + * Default constructor + * + * @param clazz which is returned by the provider + * @param name name. Must be unique inside the provider. + * @param localizedName The property key to the name + * @deprecated Use {@link #ModifierProvider(Class, String, String, String)} and provide a localized name and description + */ + @SuppressWarnings("removal") + @Deprecated(forRemoval = true) + public ModifierProvider(Class clazz, String name, String localizedName) { + super(clazz, name, localizedName); + } + + /** + * Default constructor + * + * @param clazz which is returned by the provider + * @param name name. Must be unique inside the provider. + * @param localizedName The property key for the name + * @param description A description. Might be a string or a property key + */ + public ModifierProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); + } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SchematicSelectionProvider.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SchematicSelectionProvider.java index 88777111..1e7b6449 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SchematicSelectionProvider.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SchematicSelectionProvider.java @@ -15,8 +15,14 @@ public abstract class SchematicSelectionProvider extends SettingProvider clazz, String name) { super(clazz, name); } + + public SchematicSelectionProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); + } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SelectorProvider.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SelectorProvider.java index b6a870bc..a5e926c9 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SelectorProvider.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SelectorProvider.java @@ -9,6 +9,7 @@ import de.eldoria.schematicbrush.SchematicBrushReborn; import de.eldoria.schematicbrush.brush.config.selector.Selector; import de.eldoria.schematicbrush.schematics.SchematicRegistry; +import org.bukkit.configuration.serialization.ConfigurationSerializable; /** * Provider used to provide instance of classes implementing a {@link Selector} @@ -23,12 +24,20 @@ public abstract class SelectorProvider extends SettingProvider { * @param clazz class which is provided * @param name name of selector * @param registry schematic registry. Can be retrieved via {@link SchematicBrushReborn#schematics()} + * @deprecated Use {@link #SelectorProvider(Class, String, String, String, SchematicRegistry)} and provide a localized name and description */ + @SuppressWarnings("removal") public SelectorProvider(Class clazz, String name, SchematicRegistry registry) { super(clazz, name); this.registry = registry; } + + public SelectorProvider(Class clazz, String name, String localizedName, String description, SchematicRegistry registry) { + super(clazz, name, localizedName, description); + this.registry = registry; + } + /** * Returns the provided registry * diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SettingProvider.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SettingProvider.java index 698d9a3d..e8b7d209 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SettingProvider.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/provider/SettingProvider.java @@ -9,11 +9,13 @@ import de.eldoria.eldoutilities.commands.command.util.Argument; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; +import de.eldoria.eldoutilities.localization.ILocalizer; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.entity.Player; import org.bukkit.permissions.Permissible; import java.util.List; +import java.util.Objects; /** * Base class for the provider classes. @@ -29,6 +31,8 @@ public abstract class SettingProvider { * Name of the provider */ protected final String name; + protected final String description; + private final String localizedName; private final Class clazz; /** @@ -36,9 +40,38 @@ public abstract class SettingProvider { * * @param clazz which is returned by the provider * @param name name. Must be unique inside the provider. + * @deprecated Use {@link #SettingProvider(Class, String, String, String)} and provide a localized name and description */ + @Deprecated(forRemoval = true) public SettingProvider(Class clazz, String name) { + this(clazz, name, null, null); + } + + /** + * Create a new settings provider + * + * @param clazz which is returned by the provider + * @param name name. Must be unique inside the provider. + * @param description A description. Might be a string or a property key + * @deprecated Use {@link #SettingProvider(Class, String, String, String)} and provide a localized name and description + */ + @Deprecated(forRemoval = true) + public SettingProvider(Class clazz, String name, String description) { + this(clazz, name, null, description); + } + + /** + * Create a new settings provider + * + * @param clazz which is returned by the provider + * @param name name. Must be unique inside the provider. + * @param localizedName The property key for the name + * @param description A description. Might be a string or a property key + */ + public SettingProvider(Class clazz, String name, String localizedName, String description) { this.clazz = clazz; + this.description = description; + this.localizedName = Objects.requireNonNullElse(localizedName, name); if (name.isBlank()) { throw new IllegalArgumentException("Name of provider can not be blank"); } @@ -118,6 +151,13 @@ public String name() { return name; } + public String localizedName() { + if (ILocalizer.isLocaleCode(localizedName)) { + return ILocalizer.escape(localizedName); + } + return localizedName; + } + /** * Provides a default instance for this type * @@ -161,7 +201,9 @@ public boolean hasPermission(Permissible permissible) { * * @return the setting description */ - public abstract String description(); + public String description() { + return description; + } @Override public boolean equals(Object o) { @@ -175,4 +217,11 @@ public boolean equals(Object o) { public int hashCode() { return name.hashCode(); } + + public String localizedDescription() { + if (ILocalizer.isLocaleCode(description())) { + return ILocalizer.escape(description()); + } + return description(); + } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/ComponentProvider.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/ComponentProvider.java index ed95cddf..fe6d66c4 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/ComponentProvider.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/ComponentProvider.java @@ -23,4 +23,12 @@ public interface ComponentProvider { * @return value as string */ String descriptor(); + + default String localizedName() { + return name(); + } + + default String localizedDescriptor() { + return descriptor(); + } } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/Nameable.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/Nameable.java index 4ace8f34..bf02793b 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/Nameable.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/brush/config/util/Nameable.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import de.eldoria.eldoutilities.localization.ILocalizer; /** * Represents a named key. diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfig.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfig.java index 81055c41..b6756e7d 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfig.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfig.java @@ -6,7 +6,6 @@ package de.eldoria.schematicbrush.config.sections; -import de.eldoria.eldoutilities.messages.MessageChannel; import de.eldoria.schematicbrush.brush.config.util.Nameable; import org.bukkit.Location; import org.bukkit.configuration.serialization.ConfigurationSerializable; @@ -103,4 +102,6 @@ default boolean isOutOfRenderRange(Location origin, Location other) { int maxEffectiveRenderSize(); int pasteBreak(); + + String language(); } diff --git a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/storage/base/ContainerHolder.java b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/storage/base/ContainerHolder.java index 727ccdb3..be5c7817 100644 --- a/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/storage/base/ContainerHolder.java +++ b/schematicbrushreborn-api/src/main/java/de/eldoria/schematicbrush/storage/base/ContainerHolder.java @@ -6,7 +6,7 @@ package de.eldoria.schematicbrush.storage.base; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; +import de.eldoria.eldoutilities.commands.Completion; import org.bukkit.entity.Player; import java.util.ArrayList; @@ -94,7 +94,7 @@ default List complete(Player player, String arg) { * @return list of matching values */ default List completeGlobal(String arg) { - return TabCompleteUtil.complete(arg, globalContainer().names()); + return Completion.complete(arg, globalContainer().names()); } /** @@ -106,7 +106,7 @@ default List completeGlobal(String arg) { */ default List completePlayer(Player player, String arg) { var names = playerContainer(player).names(); - return TabCompleteUtil.complete(arg, names); + return Completion.complete(arg, names); } /** diff --git a/schematicbrushreborn-core/build.gradle.kts b/schematicbrushreborn-core/build.gradle.kts index a43761e6..01b3ba24 100644 --- a/schematicbrushreborn-core/build.gradle.kts +++ b/schematicbrushreborn-core/build.gradle.kts @@ -19,6 +19,8 @@ dependencies { compileOnly("org.apache.logging.log4j", "log4j-slf4j2-impl", "2.23.1") compileOnly("org.apache.logging.log4j", "log4j-core", "2.23.1") + implementation(libs.bstats) + testImplementation(project(":schematicbrushreborn-api")) testImplementation(libs.jetbrains.annotations) testImplementation("org.mockito", "mockito-core", "5.12.0") diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/SchematicBrushRebornImpl.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/SchematicBrushRebornImpl.java index ac1645f3..69828db8 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/SchematicBrushRebornImpl.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/SchematicBrushRebornImpl.java @@ -18,18 +18,17 @@ import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; -import de.eldoria.eldoutilities.bstats.EldoMetrics; -import de.eldoria.eldoutilities.bstats.charts.AdvancedPie; -import de.eldoria.eldoutilities.bstats.charts.SimplePie; import de.eldoria.eldoutilities.config.template.PluginBaseConfiguration; import de.eldoria.eldoutilities.crossversion.ServerVersion; import de.eldoria.eldoutilities.debug.UserData; import de.eldoria.eldoutilities.debug.data.EntryData; -import de.eldoria.eldoutilities.localization.ILocalizer; +import de.eldoria.eldoutilities.localization.Localizer; import de.eldoria.eldoutilities.messages.MessageSender; +import de.eldoria.eldoutilities.metrics.EldoMetrics; import de.eldoria.eldoutilities.updater.Updater; import de.eldoria.eldoutilities.updater.lynaupdater.LynaUpdateChecker; import de.eldoria.eldoutilities.updater.lynaupdater.LynaUpdateData; +import de.eldoria.eldoutilities.utils.Version; import de.eldoria.jacksonbukkit.JacksonBukkit; import de.eldoria.jacksonbukkit.JacksonPaper; import de.eldoria.messageblocker.MessageBlockerAPI; @@ -71,20 +70,21 @@ import de.eldoria.schematicbrush.schematics.SchematicCache; import de.eldoria.schematicbrush.schematics.SchematicRegistry; import de.eldoria.schematicbrush.schematics.SchematicRegistryImpl; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.storage.StorageRegistryImpl; import de.eldoria.schematicbrush.storage.YamlStorage; import de.eldoria.schematicbrush.storage.preset.Preset; import de.eldoria.schematicbrush.util.InternalLogger; import de.eldoria.schematicbrush.util.Permissions; -import org.apache.logging.log4j.LogManager; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.tag.Tag; +import org.bstats.bukkit.Metrics; +import org.bstats.charts.AdvancedPie; +import org.bstats.charts.SimplePie; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPluginLoader; import org.jetbrains.annotations.NotNull; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.*; import java.io.File; import java.util.Arrays; @@ -105,10 +105,17 @@ public class SchematicBrushRebornImpl extends SchematicBrushReborn { private SimpleModule sbrModule; public SchematicBrushRebornImpl() { + configuration = new JacksonConfiguration(this); } public SchematicBrushRebornImpl(@NotNull JavaPluginLoader loader, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file) { super(loader, description, dataFolder, file); + configuration = new JacksonConfiguration(this); + } + + @Override + public Level getLogLevel() { + return configuration.secondary(PluginBaseConfiguration.KEY).logLevel(); } @Override @@ -121,7 +128,6 @@ public void onPluginLoad() throws Throwable { settingsRegistry.registerDefaults(schematics); - configuration = new JacksonConfiguration(this); PluginBaseConfiguration base = configuration.secondary(PluginBaseConfiguration.KEY); if (base.version() == 0) { var legacyConfiguration = new LegacyConfiguration(this); @@ -142,8 +148,27 @@ public void onPluginLoad() throws Throwable { @Override public void onPluginEnable() { - MessageSender.create(this, "§6[SB]"); - ILocalizer.create(this, "en_US").setLocale("en_US"); + var localizer = Localizer.builder(this, configuration.general().language()) + .setIncludedLocales("de_DE", "en_US", "zh_TW") + .build(); + MessageSender.builder(this) + .prefix("[SB]") + .messageColor(NamedTextColor.AQUA) + .addTag(tags -> tags + .tag("heading", Tag.styling(NamedTextColor.GOLD)) + .tag("name", Tag.styling(NamedTextColor.AQUA)) + .tag("value", Tag.styling(NamedTextColor.DARK_GREEN)) + .tag("change", Tag.styling(NamedTextColor.YELLOW)) + .tag("remove", Tag.styling(NamedTextColor.RED)) + .tag("add", Tag.styling(NamedTextColor.GREEN)) + .tag("warn", Tag.styling(NamedTextColor.RED)) + .tag("neutral", Tag.styling(NamedTextColor.AQUA)) + .tag("confirm", Tag.styling(NamedTextColor.GREEN)) + .tag("delete", Tag.styling(NamedTextColor.RED)) + .tag("inactive", Tag.styling(NamedTextColor.GRAY)) + ) + .localizer(localizer) + .register(); schematics.register(SchematicCache.STORAGE, new SchematicBrushCache(this, configuration)); @@ -153,7 +178,7 @@ public void onPluginEnable() { reload(); MessageBlocker messageBlocker; - if (!ServerVersion.between(ServerVersion.MC_1_19, ServerVersion.MC_1_20, ServerVersion.CURRENT_VERSION)) { + if (ServerVersion.CURRENT_VERSION.isOlder(Version.of(1, 19))) { messageBlocker = MessageBlockerAPI.builder(this).addWhitelisted("[SB]").build(); } else { messageBlocker = MessageBlocker.dummy(this); @@ -277,8 +302,8 @@ public void onPluginDisable() { } private void enableMetrics() { - var metrics = new EldoMetrics(this, 7683); - if (metrics.isEnabled()) { + var metrics = new Metrics(this, 7683); + if (EldoMetrics.isEnabled(this)) { logger().info("§2Metrics enabled. Thank you <3"); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/BrushSettingsRegistryImpl.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/BrushSettingsRegistryImpl.java index 76009310..e6a406b0 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/BrushSettingsRegistryImpl.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/BrushSettingsRegistryImpl.java @@ -6,25 +6,42 @@ package de.eldoria.schematicbrush.brush.config; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.container.Pair; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.modifier.BaseModifier; import de.eldoria.schematicbrush.brush.config.modifier.PlacementModifier; import de.eldoria.schematicbrush.brush.config.modifier.SchematicModifier; -import de.eldoria.schematicbrush.brush.config.provider.*; +import de.eldoria.schematicbrush.brush.config.provider.ModifierProvider; +import de.eldoria.schematicbrush.brush.config.provider.Mutator; +import de.eldoria.schematicbrush.brush.config.provider.SchematicSelectionProvider; +import de.eldoria.schematicbrush.brush.config.provider.SelectorProvider; +import de.eldoria.schematicbrush.brush.config.provider.SettingProvider; import de.eldoria.schematicbrush.brush.config.schematics.SchematicSelection; import de.eldoria.schematicbrush.brush.config.selector.Selector; import de.eldoria.schematicbrush.brush.config.util.Nameable; import de.eldoria.schematicbrush.brush.exceptions.AlreadyRegisteredException; -import de.eldoria.schematicbrush.brush.provider.*; +import de.eldoria.schematicbrush.brush.provider.FilterProvider; +import de.eldoria.schematicbrush.brush.provider.FlipProvider; +import de.eldoria.schematicbrush.brush.provider.IncludeAirProvider; +import de.eldoria.schematicbrush.brush.provider.OffsetProvider; +import de.eldoria.schematicbrush.brush.provider.PlacementProvider; +import de.eldoria.schematicbrush.brush.provider.ReplaceAllProvider; +import de.eldoria.schematicbrush.brush.provider.RotationProvider; +import de.eldoria.schematicbrush.brush.provider.SchematicSelectionProviderImpl; +import de.eldoria.schematicbrush.brush.provider.SelectorProviderImpl; import de.eldoria.schematicbrush.schematics.SchematicRegistry; import org.bukkit.configuration.serialization.ConfigurationSerialization; import org.bukkit.entity.Player; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -166,7 +183,7 @@ public Optional getSchematicModifier(String name) @Override public List completeSelector(Arguments args, Player player) throws CommandException { if (args.size() == 1) { - return TabCompleteUtil.complete(args.asString(0), selector.stream().map(SettingProvider::name)); + return Completion.complete(args.asString(0), selector.stream().map(SettingProvider::name)); } return getSettingProvider(args, selector).complete(args.subArguments(), player); } @@ -174,7 +191,7 @@ public List completeSelector(Arguments args, Player player) throws Comma @Override public List completeSchematicSelection(Arguments args, Player player) throws CommandException { if (args.size() == 1) { - return TabCompleteUtil.complete(args.asString(0), schematicSelection.stream().map(SettingProvider::name)); + return Completion.complete(args.asString(0), schematicSelection.stream().map(SettingProvider::name)); } return getSettingProvider(args, schematicSelection).complete(args.subArguments(), player); } @@ -191,7 +208,7 @@ public List completeSchematicModifier(Arguments args) throws CommandExce private List completeModifier(Arguments args, Map> map) throws CommandException { if (args.size() == 1) { - return TabCompleteUtil.complete(args.asString(0), map.keySet().stream().map(Nameable::name)); + return Completion.complete(args.asString(0), map.keySet().stream().map(Nameable::name)); } if (args.size() == 2) { return completeProvider(args, getProviders(args, map).second); @@ -213,18 +230,18 @@ private Pair> getProviders(Argume .filter(e -> e.getKey().name().equals(args.asString(0))) .map(e -> Pair.of(e.getKey(), e.getValue())) .findFirst() - .orElseThrow(() -> CommandException.message("Unkown modifier type")); + .orElseThrow(() -> CommandException.message("error.unknownModifierType")); } private > T getSettingProvider(Arguments args, List provider) throws CommandException { return provider.stream() .filter(p -> p.isMatch(args)) .findFirst() - .orElseThrow(() -> CommandException.message("Unkown modifier")); + .orElseThrow(() -> CommandException.message("error.unknownModifier")); } private > List completeProvider(Arguments args, List provider) { - return TabCompleteUtil.complete(args.asString(0), provider.stream().map(p -> p.name())); + return Completion.complete(args.asString(0), provider.stream().map(p -> p.name())); } public void registerDefaults(SchematicRegistry schematics) { diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/blockfilter/BlockFilter.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/blockfilter/BlockFilter.java index 8a33b654..25985596 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/blockfilter/BlockFilter.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/blockfilter/BlockFilter.java @@ -12,6 +12,7 @@ import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.SchematicBrushReborn; import de.eldoria.schematicbrush.brush.PasteMutation; @@ -47,13 +48,18 @@ public String name() { @Override public String descriptor() { - return maskString.isBlank() ? "None" : maskString; + return maskString.isBlank() ? "" : maskString; } @Override public void value(@NotNull String value) { } + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.blockfilter.name"); + } + @Override public @NotNull String value() { return maskString; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/builder/SchematicSetBuilderImpl.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/builder/SchematicSetBuilderImpl.java index 30f79744..2ff1f5e9 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/builder/SchematicSetBuilderImpl.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/builder/SchematicSetBuilderImpl.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.localization.MessageComposer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; @@ -40,7 +41,6 @@ */ @SerializableAs("sbrSchematicSetBuilder") public class SchematicSetBuilderImpl implements SchematicSetBuilder { - private static final String WEIGHT_DESCRIPTION = "The weight of the schematic set when multiple sets are used.\nHigher numbers will result in more schematics from this set."; private Selector selector; private Map> schematicModifier = new HashMap<>(); @JsonIgnore @@ -214,9 +214,10 @@ public int schematicCount() { @Override public String interactComponent(Player player, BrushSettingsRegistry registry, int id) { var composer = MessageComposer.create(); - composer.text("<%s>Selector: <%s>", Colors.HEADING, Colors.CHANGE) + composer.text(": ") .text(registry.selector().stream() - .map(sel -> String.format("%s'>[%s]", sel.commandType(), id, sel.name(), Colors.NEUTRAL, sel.description(), sel.name())) + .map(sel -> String.format("%s'>[%s]", + sel.commandType(), id, sel.name(), sel.localizedDescription(), sel.localizedName())) .collect(Collectors.joining(" "))) .newLine() .space(2) @@ -236,19 +237,21 @@ public String interactComponent(Player player, BrushSettingsRegistry registry, i } var missing = registry.schematicModifier().keySet().stream().filter(providers -> !mutatorMap.containsKey(providers)) - .map(provider -> String.format("%s'><%s>[%s]", - id, provider.name(), Colors.NEUTRAL, provider.description(), Colors.ADD, provider.name())) + .map(provider -> String.format("%s'>[%s]", + id, provider.name(), provider.description(), provider.getLocalizedName())) .toList(); if (!missing.isEmpty()) { composer.newLine() - .text("<%s>Add Modifiers: ", Colors.HEADING) + .text("") + .localeCode("commands.brush.sessions.addModifiers") + .text(": ") .text(missing, " "); } composer.newLine() - .text("<%s>%s'>Weight: <%s>%s <%s>[change]", - Colors.HEADING, Colors.NEUTRAL, WEIGHT_DESCRIPTION, Colors.VALUE, weight(), id, Colors.CHANGE); + .text("%s'>: %s []", + ILocalizer.escape("commands.brush.sessions.weight"), weight(), id); return composer.build(); } @@ -267,18 +270,18 @@ public String infoComponent() { var modifierStrings = new ArrayList(); for (var entry : mutatorMap.entrySet()) { - modifierStrings.add(String.format("<%s>%s%n %s", Colors.HEADING, entry.getKey().name(), BuildUtil.renderProvider(entry.getValue()))); + modifierStrings.add(String.format("%s%n %s", entry.getKey().name(), BuildUtil.renderProvider(entry.getValue()))); } composer.newLine() .text(modifierStrings); } composer.newLine() - .text("<%s>Weight: <%s>%s ", Colors.HEADING, Colors.VALUE, weight()); + .text(": %s ", weight()); return composer.build(); } private String schematicInfo() { - var result = String.format("<%s>%s<%s> Schematics%n", Colors.NAME, schematics.size(), Colors.HEADING); + var result = String.format("%s %n", schematics.size()); var showSchematics = schematics.stream() .sorted() @@ -292,11 +295,11 @@ private String schematicInfo() { showSchematics = schematics; } result += showSchematics.stream() - .map(schem -> String.format("<%s>%s", Colors.VALUE, schem)) + .map(schem -> String.format("%s", schem)) .collect(Collectors.joining("\n")); if (schematicCount() > 10) { - result += String.format("%n<%s>... and %s more.", Colors.NEUTRAL, schematics.size() - 10); + result += String.format("%n... %s .", schematics.size() - 10); } return result; } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/flip/AFlip.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/flip/AFlip.java index 8b95bc9e..9a0a103f 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/flip/AFlip.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/flip/AFlip.java @@ -7,12 +7,14 @@ package de.eldoria.schematicbrush.brush.config.flip; import com.sk89q.worldedit.math.Vector3; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.PasteMutation; import de.eldoria.schematicbrush.brush.config.provider.Mutator; import org.jetbrains.annotations.NotNull; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; @@ -68,6 +70,11 @@ public void invoke(PasteMutation mutation) { } } + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.flip.%s.name".formatted(name().toLowerCase())); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/includeair/IncludeAir.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/includeair/IncludeAir.java index f335168e..daf15a50 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/includeair/IncludeAir.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/includeair/IncludeAir.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.PasteMutation; import de.eldoria.schematicbrush.brush.config.provider.Mutator; @@ -74,6 +75,11 @@ public String name() { return "Fixed"; } + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.includeAir.fixed.name"); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/offset/AOffset.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/offset/AOffset.java index 964ba6f2..da7f6966 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/offset/AOffset.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/offset/AOffset.java @@ -6,6 +6,7 @@ package de.eldoria.schematicbrush.brush.config.offset; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.PasteMutation; import de.eldoria.schematicbrush.brush.config.provider.Mutator; @@ -49,6 +50,11 @@ public Map serialize() { .build(); } + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.offset.%s.name".formatted(name().toLowerCase())); + } + @Override public @NotNull Integer value() { return offset; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/placement/APlacement.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/placement/APlacement.java index 20ce17af..a162c4df 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/placement/APlacement.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/placement/APlacement.java @@ -9,6 +9,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.PasteMutation; import de.eldoria.schematicbrush.brush.config.provider.Mutator; @@ -77,6 +78,16 @@ public String descriptor() { return name(); } + @Override + public String localizedDescriptor() { + return localizedName(); + } + + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.placement.%s.name".formatted(name().toLowerCase())); + } + @Override public boolean equals(Object obj) { if (this == obj) return true; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/replaceall/ReplaceAll.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/replaceall/ReplaceAll.java index 6bf552b7..15713554 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/replaceall/ReplaceAll.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/replaceall/ReplaceAll.java @@ -11,6 +11,7 @@ import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.world.block.BlockTypes; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.PasteMutation; import de.eldoria.schematicbrush.brush.config.provider.Mutator; @@ -83,6 +84,12 @@ public String name() { return "Fixed"; } + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.replaceAll.fixed.name"); + } + + @Override public String descriptor() { return String.format("%s", value); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/rotation/ARotation.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/rotation/ARotation.java index 90513fa3..b52698e4 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/rotation/ARotation.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/rotation/ARotation.java @@ -6,6 +6,7 @@ package de.eldoria.schematicbrush.brush.config.rotation; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import de.eldoria.schematicbrush.brush.PasteMutation; import de.eldoria.schematicbrush.brush.config.provider.Mutator; @@ -66,6 +67,11 @@ public void invoke(PasteMutation mutation) { } } + @Override + public String localizedName() { + return ILocalizer.escape("components.modifier.rotation.%s.name".formatted(name().toLowerCase())); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/LockedOrderedSelection.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/LockedOrderedSelection.java index 6600b7d3..a7960b6e 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/LockedOrderedSelection.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/LockedOrderedSelection.java @@ -18,6 +18,9 @@ import java.util.Map; import java.util.Optional; +/** + * Returns the same schematic unless it is prompted by force to draw a new one. In that case it will act like {@link OrderedSelection}. + */ public class LockedOrderedSelection extends OrderedSelection { public LockedOrderedSelection() { diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/OrderedSelection.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/OrderedSelection.java index 4a9707a0..b5ed186a 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/OrderedSelection.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/schematics/OrderedSelection.java @@ -19,6 +19,10 @@ import java.util.Map; import java.util.Optional; + +/** + * A selection that returns the next schematic in the current set or the first schematic of the next set. + */ public class OrderedSelection implements SchematicSelection { public OrderedSelection() { diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/selector/BaseSelector.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/selector/BaseSelector.java index 21e85878..1ecbd7bd 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/selector/BaseSelector.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/config/selector/BaseSelector.java @@ -6,7 +6,7 @@ package de.eldoria.schematicbrush.brush.config.selector; -import com.fasterxml.jackson.annotation.JsonTypeInfo; +import de.eldoria.eldoutilities.localization.ILocalizer; import de.eldoria.eldoutilities.serialization.SerializationUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -51,6 +51,11 @@ public boolean equals(Object o) { return Objects.equals(term, baseSelector.term); } + @Override + public String localizedName() { + return ILocalizer.escape("components.selector.%s.name".formatted(name().toLowerCase())); + } + @Override public int hashCode() { return term != null ? term.hashCode() : 0; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FilterProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FilterProvider.java index e396b513..ebf65475 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FilterProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FilterProvider.java @@ -25,7 +25,10 @@ public abstract class FilterProvider extends ModifierProvider { private static final WorldEdit WORLD_EDIT = WorldEdit.getInstance(); - public static final FilterProvider BLOCK_FILTER = new FilterProvider(BlockFilter.class, "BlockFilter") { + public static final FilterProvider BLOCK_FILTER = new FilterProvider(BlockFilter.class, + "BlockFilter", + "components.provider.filter.blockFilter.name", + "components.provider.filter.blockFilter.description") { @Override public Mutator parse(Arguments args) throws CommandException { if ("none".equalsIgnoreCase(args.asString(0))) { @@ -59,11 +62,6 @@ public boolean hasArguments() { public Mutator defaultSetting() { return new BlockFilter(""); } - - @Override - public String description() { - return "Exclude blocks from pasting"; - } }; /** @@ -72,7 +70,7 @@ public String description() { * @param clazz class which is provided * @param name name of provider */ - public FilterProvider(Class clazz, String name) { - super(clazz, name); + public FilterProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FlipProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FlipProvider.java index dd390198..3010c31e 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FlipProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/FlipProvider.java @@ -6,10 +6,10 @@ package de.eldoria.schematicbrush.brush.provider; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.util.Argument; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.flip.AFlip; import de.eldoria.schematicbrush.brush.config.flip.Flip; import de.eldoria.schematicbrush.brush.config.flip.FlipFixed; @@ -27,7 +27,10 @@ public abstract class FlipProvider extends ModifierProvider { - public static final FlipProvider FIXED = new FlipProvider(FlipFixed.class, "Fixed") { + public static final FlipProvider FIXED = new FlipProvider(FlipFixed.class, + "Fixed", + "components.provider.flip.fixed.name", + "components.provider.flip.fixed.description") { private final Argument[] arguments = {Argument.unlocalizedInput("flip", true)}; @Override @@ -40,15 +43,10 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "A fixed flip value"; - } - @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { - return TabCompleteUtil.complete(args.asString(0), Arrays.stream(Flip.values()).map(Flip::name)); + return Completion.complete(args.asString(0), Arrays.stream(Flip.values()).map(Flip::name)); } return Collections.emptyList(); } @@ -59,7 +57,10 @@ public Mutator defaultSetting() { } }; - public static final FlipProvider LIST = new FlipProvider(FlipList.class, "List") { + public static final FlipProvider LIST = new FlipProvider(FlipList.class, + "List", + "components.provider.flip.list.name", + "components.provider.flip.list.description") { private final Argument[] arguments = {Argument.unlocalizedInput("flip...", true)}; @Override @@ -71,11 +72,6 @@ public Mutator parse(Arguments args) throws CommandException { return AFlip.list(flips); } - @Override - public String description() { - return "A list of possible flip values which will be choosen by random"; - } - @Override public Argument[] arguments() { return arguments; @@ -83,7 +79,7 @@ public Argument[] arguments() { @Override public List complete(Arguments args, Player player) { - return TabCompleteUtil.complete(args.asString(-1), Arrays.stream(Flip.values()).map(Flip::name)); + return Completion.complete(args.asString(-1), Arrays.stream(Flip.values()).map(Flip::name)); } @Override @@ -92,7 +88,12 @@ public Mutator defaultSetting() { } }; - public static final FlipProvider RANDOM = new FlipProvider(FlipRandom.class, "Random") { + public static final FlipProvider RANDOM = new FlipProvider(FlipRandom.class, + "Random", + "components.provider.flip.random.name", + "components.provider.flip.random.description") { + + @Override public Mutator parse(Arguments args) { return AFlip.random(); @@ -103,11 +104,6 @@ public List complete(Arguments args, Player player) { return Collections.emptyList(); } - @Override - public String description() { - return "A random flip falue of all flip values except \"up\""; - } - @Override public Mutator defaultSetting() { return new FlipRandom(); @@ -119,7 +115,7 @@ public boolean hasArguments() { } }; - public FlipProvider(Class clazz, String name) { - super(clazz, name); + public FlipProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/IncludeAirProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/IncludeAirProvider.java index 9007cf56..11cf8ab4 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/IncludeAirProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/IncludeAirProvider.java @@ -6,10 +6,10 @@ package de.eldoria.schematicbrush.brush.provider; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.util.Argument; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.includeair.IncludeAir; import de.eldoria.schematicbrush.brush.config.provider.ModifierProvider; import de.eldoria.schematicbrush.brush.config.provider.Mutator; @@ -20,7 +20,10 @@ import java.util.List; public abstract class IncludeAirProvider extends ModifierProvider { - public static final IncludeAirProvider FIXED = new IncludeAirProvider(IncludeAir.class, "Fixed") { + public static final IncludeAirProvider FIXED = new IncludeAirProvider(IncludeAir.class, + "Fixed", + "components.provider.includeAir.fixed.name", + "components.provider.includeAir.fixed.description") { private final Argument[] arguments = {Argument.unlocalizedInput("state", true)}; @Override @@ -33,15 +36,10 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "A fixed value which defines if air should be pasted."; - } - @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { - return TabCompleteUtil.completeBoolean(args.asString(0)); + return Completion.completeBoolean(args.asString(0)); } return Collections.emptyList(); } @@ -52,7 +50,7 @@ public Mutator defaultSetting() { } }; - public IncludeAirProvider(Class clazz, String name) { - super(clazz, name); + public IncludeAirProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/OffsetProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/OffsetProvider.java index f1e4a628..35a2ad11 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/OffsetProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/OffsetProvider.java @@ -6,11 +6,11 @@ package de.eldoria.schematicbrush.brush.provider; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.util.Argument; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.offset.AOffset; import de.eldoria.schematicbrush.brush.config.offset.OffsetFixed; import de.eldoria.schematicbrush.brush.config.offset.OffsetList; @@ -26,7 +26,10 @@ public abstract class OffsetProvider extends ModifierProvider { - public static final OffsetProvider FIXED = new OffsetProvider(OffsetFixed.class, "Fixed") { + public static final OffsetProvider FIXED = new OffsetProvider(OffsetFixed.class, + "Fixed", + "components.provider.offset.fixed.name", + "components.provider.offset.fixed.description") { private final Argument[] arguments = {Argument.unlocalizedInput("offset", true)}; @Override @@ -40,15 +43,10 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "A fixed offset value"; - } - @Override public List complete(Arguments args, Player player) throws CommandException { if (args.size() == 1) { - return TabCompleteUtil.completeInt(args.asString(0), -100, 100); + return Completion.completeInt(args.asString(0), -100, 100); } return Collections.emptyList(); } @@ -59,7 +57,10 @@ public Mutator defaultSetting() { } }; - public static final OffsetProvider LIST = new OffsetProvider(OffsetList.class, "List") { + public static final OffsetProvider LIST = new OffsetProvider(OffsetList.class, + "List", + "components.provider.offset.list.name", + "components.provider.offset.list.description") { private final Argument[] arguments = {Argument.unlocalizedInput("offsets...", true)}; @Override @@ -72,11 +73,6 @@ public Mutator parse(Arguments args) throws CommandException { return AOffset.list(values); } - @Override - public String description() { - return "A list of possible offset values which will be choosen by random."; - } - @Override public Argument[] arguments() { return arguments; @@ -84,7 +80,7 @@ public Argument[] arguments() { @Override public List complete(Arguments args, Player player) throws CommandException { - return TabCompleteUtil.completeInt(args.asString(-1), -100, 100); + return Completion.completeInt(args.asString(-1), -100, 100); } @Override @@ -93,7 +89,10 @@ public Mutator defaultSetting() { } }; - public static final OffsetProvider RANGE = new OffsetProvider(OffsetRange.class, "Range") { + public static final OffsetProvider RANGE = new OffsetProvider(OffsetRange.class, + "Range", + "components.provider.offset.range.name", + "components.provider.offset.range.description") { private final Argument[] arguments = {Argument.unlocalizedInput("offset_min", true), Argument.unlocalizedInput("offset_max", true)}; @Override @@ -103,11 +102,6 @@ public Mutator parse(Arguments args) throws CommandException { return AOffset.range(lower, upper); } - @Override - public String description() { - return "A offset range where the values will be between the min and max value (both inclusive)"; - } - @Override public Argument[] arguments() { return arguments; @@ -116,7 +110,7 @@ public Argument[] arguments() { @Override public List complete(Arguments args, Player player) throws CommandException { if (!args.isEmpty() && args.size() < 3) { - return TabCompleteUtil.completeInt(args.asString(-1), -100, 100); + return Completion.completeInt(args.asString(-1), -100, 100); } return Collections.emptyList(); } @@ -127,7 +121,7 @@ public Mutator defaultSetting() { } }; - public OffsetProvider(Class clazz, String name) { - super(clazz, name); + public OffsetProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/PlacementProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/PlacementProvider.java index b67e2a23..e63037c5 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/PlacementProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/PlacementProvider.java @@ -24,33 +24,28 @@ public abstract class PlacementProvider extends ModifierProvider { private static final APlacement bottom = new Bottom(); - public static final PlacementProvider BOTTOM = of("Bottom", bottom, "Lower bound"); + public static final PlacementProvider BOTTOM = of("Bottom", bottom, "components.provider.placement.bottom.name", "components.provider.placement.bottom.description"); private static final APlacement drop = new Drop(); - public static final PlacementProvider DROP = of("Drop", drop, "Lowest non air block"); + public static final PlacementProvider DROP = of("Drop", drop, "components.provider.placement.drop.name", "components.provider.placement.drop.description"); private static final APlacement middle = new Middle(); - public static final PlacementProvider MIDDLE = of("Middle", middle, "Center of the schematic"); + public static final PlacementProvider MIDDLE = of("Middle", middle, "components.provider.placement.middle.name", "components.provider.placement.middle.description"); private static final APlacement original = new Original(); - public static final PlacementProvider ORIGINAL = of("Original", original, "Original position when copied"); + public static final PlacementProvider ORIGINAL = of("Original", original, "components.provider.placement.original.name", "components.provider.placement.original.description"); private static final APlacement raise = new Raise(); - public static final PlacementProvider RAISE = of("Raise", raise, "Highest non air block"); + public static final PlacementProvider RAISE = of("Raise", raise, "components.provider.placement.raise.name", "components.provider.placement.raise.description"); private static final APlacement top = new Top(); - public static final PlacementProvider TOP = of("Top", top, "Upper bound"); + public static final PlacementProvider TOP = of("Top", top, "components.provider.placement.top.name", "components.provider.placement.top.description"); - public PlacementProvider(Class clazz, String name) { - super(clazz, name); + public PlacementProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } - private static PlacementProvider of(String name, APlacement placement, String description) { - return new PlacementProvider(placement.getClass(), name) { + private static PlacementProvider of(String name, APlacement placement, String localizedName, String description) { + return new PlacementProvider(placement.getClass(), name, localizedName, description) { @Override public Mutator parse(Arguments args) { return placement; } - - @Override - public String description() { - return description; - } }; } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/ReplaceAllProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/ReplaceAllProvider.java index 76572eee..c0ee92a7 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/ReplaceAllProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/ReplaceAllProvider.java @@ -6,10 +6,10 @@ package de.eldoria.schematicbrush.brush.provider; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.util.Argument; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.provider.ModifierProvider; import de.eldoria.schematicbrush.brush.config.provider.Mutator; import de.eldoria.schematicbrush.brush.config.replaceall.ReplaceAll; @@ -21,7 +21,10 @@ public abstract class ReplaceAllProvider extends ModifierProvider { - public static final ReplaceAllProvider FIXED = new ReplaceAllProvider(ReplaceAll.class, "Fixed") { + public static final ReplaceAllProvider FIXED = new ReplaceAllProvider(ReplaceAll.class, + "Fixed", + "components.provider.replaceAll.fixed.name", + "components.provider.replaceAll.fixed.description") { private final Argument[] arguments = {Argument.unlocalizedInput("state", true)}; @Override @@ -34,15 +37,10 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "A fixed value to allow replacing existing non air blocks."; - } - @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { - return TabCompleteUtil.completeBoolean(args.asString(0)); + return Completion.completeBoolean(args.asString(0)); } return Collections.emptyList(); } @@ -53,7 +51,7 @@ public Mutator defaultSetting() { } }; - public ReplaceAllProvider(Class clazz, String name) { - super(clazz, name); + public ReplaceAllProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/RotationProvider.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/RotationProvider.java index 01e7c106..6e0beb47 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/RotationProvider.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/RotationProvider.java @@ -6,10 +6,10 @@ package de.eldoria.schematicbrush.brush.provider; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.util.Argument; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.provider.ModifierProvider; import de.eldoria.schematicbrush.brush.config.provider.Mutator; import de.eldoria.schematicbrush.brush.config.rotation.ARotation; @@ -25,7 +25,10 @@ import java.util.List; public abstract class RotationProvider extends ModifierProvider { - public static final RotationProvider RANDOM = new RotationProvider(RotationRandom.class, "Random") { + public static final RotationProvider RANDOM = new RotationProvider(RotationRandom.class, + "Random", + "components.provider.rotation.random.name", + "components.provider.rotation.random.description") { @Override public Mutator parse(Arguments args) { return ARotation.random(); @@ -36,18 +39,16 @@ public List complete(Arguments args, Player player) { return Collections.emptyList(); } - @Override - public String description() { - return "A random rotation containing all allowed 90° rotations."; - } - @Override public boolean hasArguments() { return false; } }; private static final String[] ROTATIONS = {"0", "90", "180", "270"}; - public static final RotationProvider FIXED = new RotationProvider(RotationFixed.class, "Fixed") { + public static final RotationProvider FIXED = new RotationProvider(RotationFixed.class, + "Fixed", + "components.provider.rotation.fixed.name", + "components.provider.rotation.fixed.description") { private final Argument[] arguments = {Argument.unlocalizedInput("rotation", true)}; @Override @@ -55,11 +56,6 @@ public Mutator parse(Arguments args) throws CommandException { return ARotation.fixed(Rotation.parse(args.asString(0))); } - @Override - public String description() { - return "A fixed rotation."; - } - @Override public Argument[] arguments() { return arguments; @@ -68,13 +64,16 @@ public Argument[] arguments() { @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { - return TabCompleteUtil.complete(args.asString(0), ROTATIONS); + return Completion.complete(args.asString(0), ROTATIONS); } return Collections.emptyList(); } }; - public static final RotationProvider LIST = new RotationProvider(RotationList.class, "List") { + public static final RotationProvider LIST = new RotationProvider(RotationList.class, + "List", + "components.provider.rotation.list.name", + "components.provider.rotation.list.description") { private final Argument[] arguments = {Argument.unlocalizedInput("rotations...", true)}; @Override @@ -91,19 +90,14 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "A list of rotations which will be choosen by random"; - } - @Override public List complete(Arguments args, Player player) { - return TabCompleteUtil.complete(args.asString(-1), ROTATIONS); + return Completion.complete(args.asString(-1), ROTATIONS); } }; - public RotationProvider(Class clazz, String name) { - super(clazz, name); + public RotationProvider(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); } @Override diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SchematicSelectionProviderImpl.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SchematicSelectionProviderImpl.java index 67a04a9a..967a66e0 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SchematicSelectionProviderImpl.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SchematicSelectionProviderImpl.java @@ -9,7 +9,11 @@ import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.schematicbrush.brush.config.provider.SchematicSelectionProvider; -import de.eldoria.schematicbrush.brush.config.schematics.*; +import de.eldoria.schematicbrush.brush.config.schematics.LockedOrderedSelection; +import de.eldoria.schematicbrush.brush.config.schematics.LockedRandomSelection; +import de.eldoria.schematicbrush.brush.config.schematics.OrderedSelection; +import de.eldoria.schematicbrush.brush.config.schematics.RandomSelection; +import de.eldoria.schematicbrush.brush.config.schematics.SchematicSelection; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.entity.Player; @@ -17,17 +21,10 @@ import java.util.List; public abstract class SchematicSelectionProviderImpl extends SchematicSelectionProvider { - /** - * Create a new settings provider - * - * @param clazz which is returned by the provider - * @param name name. Must be unique inside the provider. - */ - public SchematicSelectionProviderImpl(Class clazz, String name) { - super(clazz, name); - } - - public static final SchematicSelectionProvider LOCKED_ORDERED_SELECTION = new SchematicSelectionProviderImpl(LockedOrderedSelection.class, "locked_ordered") { + public static final SchematicSelectionProvider LOCKED_ORDERED_SELECTION = new SchematicSelectionProviderImpl(LockedOrderedSelection.class, + "locked_ordered", + "components.provider.selection.lockedOrdered.name", + "components.provider.selection.lockedOrdered.description") { @Override public SchematicSelection parse(Arguments args) throws CommandException { return new LockedOrderedSelection(); @@ -42,14 +39,11 @@ public List complete(Arguments args, Player player) throws CommandExcept public SchematicSelection defaultSetting() { return new LockedOrderedSelection(); } - - @Override - public String description() { - return "A selector which only skips to the next schematic when prompted. Next schematic will be the next in the order."; - } }; - - public static final SchematicSelectionProvider LOCKED_RANDOM_SELECTION = new SchematicSelectionProviderImpl(LockedRandomSelection.class, "locked_random") { + public static final SchematicSelectionProvider LOCKED_RANDOM_SELECTION = new SchematicSelectionProviderImpl(LockedRandomSelection.class, + "locked_random", + "components.provider.selection.lockedRandom.name", + "components.provider.selection.lockedRandom.description") { @Override public SchematicSelection parse(Arguments args) throws CommandException { return new LockedRandomSelection(); @@ -64,13 +58,11 @@ public List complete(Arguments args, Player player) throws CommandExcept public SchematicSelection defaultSetting() { return new LockedRandomSelection(); } - - @Override - public String description() { - return "A selector which only skips to the next schematic when prompted. Next schematic will be random."; - } }; - public static final SchematicSelectionProvider RANDOM_SELECTION = new SchematicSelectionProviderImpl(RandomSelection.class, "random") { + public static final SchematicSelectionProvider RANDOM_SELECTION = new SchematicSelectionProviderImpl(RandomSelection.class, + "random", + "components.provider.selection.random.name", + "components.provider.selection.random.description") { @Override public SchematicSelection parse(Arguments args) throws CommandException { return new RandomSelection(); @@ -85,13 +77,11 @@ public List complete(Arguments args, Player player) throws CommandExcept public SchematicSelection defaultSetting() { return new RandomSelection(); } - - @Override - public String description() { - return "A selector which skips to the next schematic."; - } }; - public static final SchematicSelectionProvider ORDERED_SELECTION = new SchematicSelectionProviderImpl(OrderedSelection.class, "ordered") { + public static final SchematicSelectionProvider ORDERED_SELECTION = new SchematicSelectionProviderImpl(OrderedSelection.class, + "ordered", + "components.provider.selection.ordered.name", + "components.provider.selection.ordered.description") { @Override public SchematicSelection parse(Arguments args) throws CommandException { return new RandomSelection(); @@ -106,10 +96,19 @@ public List complete(Arguments args, Player player) throws CommandExcept public SchematicSelection defaultSetting() { return new RandomSelection(); } - - @Override - public String description() { - return "A selector which skips to the next schematic in the current order."; - } }; + + /** + * Create a new settings provider + * + * @param clazz which is returned by the provider + * @param name name. Must be unique inside the provider. + */ + public SchematicSelectionProviderImpl(Class clazz, String name) { + super(clazz, name); + } + + public SchematicSelectionProviderImpl(Class clazz, String name, String localizedName, String description) { + super(clazz, name, localizedName, description); + } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SelectorProviderImpl.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SelectorProviderImpl.java index 4648be2a..69297d59 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SelectorProviderImpl.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/brush/provider/SelectorProviderImpl.java @@ -15,6 +15,7 @@ import de.eldoria.schematicbrush.brush.config.selector.Selector; import de.eldoria.schematicbrush.schematics.SchematicCache; import de.eldoria.schematicbrush.schematics.SchematicRegistry; +import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.entity.Player; import java.util.Collections; @@ -24,7 +25,11 @@ public abstract class SelectorProviderImpl extends SelectorProvider { public static final Function DIRECTORY = registry -> - new SelectorProviderImpl(DirectorySelector.class, "Directory", registry) { + new SelectorProviderImpl(DirectorySelector.class, + "Directory", + "components.provider.selector.directory.name", + "components.provider.selector.directory.description", + registry) { private final Argument[] arguments = {Argument.unlocalizedInput("Directory", true), Argument.unlocalizedInput("name_filter", false)}; @@ -38,11 +43,6 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "Select schematics in a directory.\nUse dirname/* to select subdirectories as well.\nUse the second argument name filter to filter schematics in these directories"; - } - @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { @@ -58,7 +58,10 @@ public List complete(Arguments args, Player player) { }; public static final Function NAME = registry -> - new SelectorProviderImpl(NameSelector.class, "Name", registry) { + new SelectorProviderImpl(NameSelector.class, "Name", + "components.provider.selector.name.name", + "components.provider.selector.name.description", + registry) { private final Argument[] arguments = {Argument.unlocalizedInput("Name", true)}; @Override @@ -71,11 +74,6 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "Select schematics by name.\nUse a * as a wildcard."; - } - @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { @@ -86,7 +84,10 @@ public List complete(Arguments args, Player player) { }; public static final Function REGEX = registry -> - new SelectorProviderImpl(RegexSelector.class, "Regex", registry) { + new SelectorProviderImpl(RegexSelector.class, "Regex", + "components.provider.selector.regex.name", + "components.provider.selector.regex.description", + registry) { private final Argument[] arguments = {Argument.unlocalizedInput("Regex", true)}; @Override @@ -99,11 +100,6 @@ public Argument[] arguments() { return arguments; } - @Override - public String description() { - return "Select schematics with a regex.\nWanna try it out first? Use regex101.com"; - } - @Override public List complete(Arguments args, Player player) { if (args.size() == 1) { @@ -113,8 +109,8 @@ public List complete(Arguments args, Player player) { } }; - public SelectorProviderImpl(Class clazz, String name, SchematicRegistry registry) { - super(clazz, name, registry); + public SelectorProviderImpl(Class clazz, String name, String localizedName, String description, SchematicRegistry registry) { + super(clazz, name, localizedName, description, registry); } @Override diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Brush.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Brush.java index 7837b820..ca5afa58 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Brush.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Brush.java @@ -31,7 +31,6 @@ import de.eldoria.schematicbrush.commands.brush.ShowSet; import de.eldoria.schematicbrush.commands.brush.ShowSets; import de.eldoria.schematicbrush.schematics.SchematicRegistry; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.plugin.Plugin; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/BrushPresets.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/BrushPresets.java index 50d41064..c1743812 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/BrushPresets.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/BrushPresets.java @@ -14,7 +14,6 @@ import de.eldoria.schematicbrush.commands.brushpresets.Info; import de.eldoria.schematicbrush.commands.brushpresets.List; import de.eldoria.schematicbrush.commands.brushpresets.Remove; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.plugin.Plugin; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Preset.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Preset.java index 32fbe336..08931354 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Preset.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/Preset.java @@ -13,7 +13,6 @@ import de.eldoria.schematicbrush.commands.preset.Info; import de.eldoria.schematicbrush.commands.preset.List; import de.eldoria.schematicbrush.commands.preset.Remove; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.plugin.Plugin; diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Info.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Info.java index 92324f06..00d06c9c 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Info.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Info.java @@ -29,12 +29,12 @@ public Info(SchematicBrushRebornImpl plugin) { @Override public void onCommand(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) { var descr = instance.getDescription(); - var info = "§bSchematic Brush Reborn§r by §b" + String.join(", ", descr.getAuthors()) + "§r\n" - + "§bPremium:§r " + userData.isPremium() + "\n" - + "§bVersion:§r " + descr.getVersion() + "\n" - + "§bSpigot:§r https://www.spigotmc.org/resources/98499\n" - + "§bPatreon:§r https://www.patreon.com/eldoriaplugins\n" - + "§bSupport:§r https://discord.gg/zRW9Vpu"; + var info = "Schematic Brush Reborn§r by " + String.join(", ", descr.getAuthors()) + "\n" + + "Premium: " + userData.isPremium() + "\n" + + "Version: " + descr.getVersion() + "\n" + + "Spigot: https://www.spigotmc.org/resources/98499\n" + + "Patreon: https://www.patreon.com/eldoriaplugins\n" + + "Support: https://discord.gg/zRW9Vpu"; messageSender().sendMessage(sender, info); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Migrate.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Migrate.java index 79d2106a..6e2315e4 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Migrate.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Migrate.java @@ -6,14 +6,14 @@ package de.eldoria.schematicbrush.commands.admin; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.ITabExecutor; -import de.eldoria.eldoutilities.localization.Replacement; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.schematicbrush.brush.config.util.Nameable; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; @@ -46,26 +46,26 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String alias, @Not var source = storageRegistry.get(sourceNameable); var target = storageRegistry.get(targetNameable); - CommandAssertions.isFalse(source == null, "Source type %TYPE% is invalid.", - Replacement.create("TYPE", sourceNameable.name())); - CommandAssertions.isFalse(target == null, "Target type %TYPE% is invalid.", - Replacement.create("TYPE", targetNameable.name())); + CommandAssertions.isFalse(source == null, "commands.admin.migrate.sourceTypeInvalid", + Replacement.create("type", sourceNameable.name())); + CommandAssertions.isFalse(target == null, "commands.admin.migrate.targetTypeInvalid", + Replacement.create("type", targetNameable.name())); - messageSender().sendMessage(sender, "Migration started."); + messageSender().sendMessage(sender, "commands.admin.migrate.migrationStarted"); storageRegistry.migrate(sourceNameable, targetNameable) - .thenRun(() -> messageSender().sendMessage(sender, "Migration done.")); + .thenRun(() -> messageSender().sendMessage(sender, "commands.admin.migrate.migrationDone")); } @Override public @Nullable List onTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) throws CommandException { if (args.sizeIs(1)) { - return TabCompleteUtil.complete(args.asString(0), storageRegistry.registry().keySet() + return Completion.complete(args.asString(0), storageRegistry.registry().keySet() .stream() .map(Nameable::name)); } if (args.sizeIs(2)) { - return TabCompleteUtil.complete(args.asString(1), storageRegistry.registry().keySet() + return Completion.complete(args.asString(1), storageRegistry.registry().keySet() .stream() .map(Nameable::name)); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Reload.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Reload.java index 44ac7b83..595615ff 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Reload.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/Reload.java @@ -28,6 +28,6 @@ public Reload(SchematicBrushRebornImpl plugin) { @Override public void onCommand(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) { instance.reload(); - messageSender().sendMessage(sender, "Schematic Brush Reborn reloaded."); + messageSender().sendMessage(sender, "commands.admin.reload.done"); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/ReloadCache.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/ReloadCache.java index 678bfee5..6a8c74f8 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/ReloadCache.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/ReloadCache.java @@ -29,6 +29,6 @@ public ReloadCache(SchematicBrushRebornImpl plugin, SchematicRegistry cache) { @Override public void onCommand(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) { cache.reload(); - messageSender().sendMessage(sender, "Schematics reloaded"); + messageSender().sendMessage(sender, "commands.admin.reloadCache.done"); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/RestartRendering.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/RestartRendering.java index 8f1c9df0..54aee95d 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/RestartRendering.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/admin/RestartRendering.java @@ -28,6 +28,6 @@ public RestartRendering(SchematicBrushRebornImpl plugin) { @Override public void onCommand(@NotNull CommandSender sender, @NotNull String alias, @NotNull Arguments args) { instance.renderService().restart(); - messageSender().sendMessage(sender, "Rendering restarted"); + messageSender().sendMessage(sender, "commands.admin.restartRendering.done"); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddBrushModifier.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddBrushModifier.java index cf7ea40b..a4ac0d80 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddBrushModifier.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddBrushModifier.java @@ -13,7 +13,6 @@ import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; -import de.eldoria.schematicbrush.brush.config.util.Nameable; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; @@ -42,7 +41,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var modifier = args.get(0).asString(); var registration = registry.getPlacementModifier(modifier); - CommandAssertions.isTrue(registration.isPresent(), "Unknown modifier."); + CommandAssertions.isTrue(registration.isPresent(), "error.unknownModifier"); session.setPlacementModifier(registration.get().modifier(), registration.get().mutators().get(0).defaultSetting()); sessions.showBrush(player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddPreset.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddPreset.java index 425dfb0b..e83e04ba 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddPreset.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddPreset.java @@ -14,7 +14,6 @@ import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.eldoutilities.utils.Consumers; import de.eldoria.eldoutilities.utils.Futures; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -45,7 +44,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar storage.activeStorage().presets().containerByName(player, name) .get(strippedName) .whenComplete(Futures.whenComplete(preset -> { - CommandAssertions.isTrue(preset.isPresent(), "Unknown preset."); + CommandAssertions.isTrue(preset.isPresent(), "error.unknownPreset"); for (var builder : preset.get().schematicSetsCopy()) { session.addSchematicSet(builder.copy()); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddSetModifier.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddSetModifier.java index bec5c0b9..470d5e2b 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddSetModifier.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/AddSetModifier.java @@ -13,7 +13,6 @@ import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; -import de.eldoria.schematicbrush.brush.config.util.Nameable; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; @@ -43,11 +42,11 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var modifier = args.get(1).asString(); var registration = registry.getSchematicModifier(modifier); - CommandAssertions.isTrue(registration.isPresent(), "Unknown modifier."); + CommandAssertions.isTrue(registration.isPresent(), "error.unknownModifier"); var setId = args.get(0).asInt(); var schematicSet = session.getSchematicSet(setId); - CommandAssertions.isTrue(schematicSet.isPresent(), "Invalid set id"); + CommandAssertions.isTrue(schematicSet.isPresent(), "error.invalidSetId"); schematicSet.get().setModifier(registration.get().modifier(), registration.get().mutators().get(0).defaultSetting()); sessions.showSet(player, setId); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Bind.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Bind.java index 1f01cc3d..9d176c11 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Bind.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Bind.java @@ -12,8 +12,9 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; +import de.eldoria.eldoutilities.localization.MessageComposer; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.messageblocker.blocker.MessageBlocker; -import de.eldoria.schematicbrush.util.Colors; import de.eldoria.schematicbrush.util.WorldEditBrush; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; @@ -41,8 +42,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var session = sessions.getOrCreateSession(player); - - CommandAssertions.isFalse(session.getSchematicCount() == 0, "Brush is empty."); + CommandAssertions.isFalse(session.getSchematicCount() == 0, "error.emptyBrush"); var brush = session.build(plugin(), player); if (!WorldEditBrush.setBrush(player, brush)) { @@ -51,8 +51,10 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var schematicCount = brush.settings().getSchematicCount(); var setcount = brush.settings().schematicSets().size(); - var message = String.format("<%s>Brush bound. Using <%s>%s<%s> Schematics in <%s>%s<%s> Sets. <%s>[Edit]", - Colors.NEUTRAL, Colors.VALUE, schematicCount, Colors.NEUTRAL, Colors.VALUE, setcount, Colors.NEUTRAL, Colors.CHANGE); + var message = MessageComposer.create() + .localeCode("commands.brush.bind.bound", Replacement.create("schematics", schematicCount), Replacement.create("sets", setcount)) + .text("[]") + .build(); messageBlocker.unblockPlayer(player).thenRun(() -> audiences.sender(player).sendMessage(miniMessage.deserialize(message))); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/LoadBrush.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/LoadBrush.java index cc85ef72..32288380 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/LoadBrush.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/LoadBrush.java @@ -16,7 +16,6 @@ import de.eldoria.eldoutilities.utils.Futures; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.schematics.SchematicRegistry; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -49,7 +48,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar storage.activeStorage().brushes().containerByName(player, name) .get(strippedName) .whenComplete(Futures.whenComplete(brush -> { - CommandAssertions.isTrue(brush.isPresent(), "Unkown brush."); + CommandAssertions.isTrue(brush.isPresent(), "error.unknownBrush"); sessions.setSession(player, brush.get().snapshot().load(player, settingsRegistry, schematicRegistry)); sessions.showBrush(player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/ModifySet.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/ModifySet.java index c8d371c3..7080e87d 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/ModifySet.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/ModifySet.java @@ -6,15 +6,13 @@ package de.eldoria.schematicbrush.commands.brush; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.messages.MessageChannel; -import de.eldoria.eldoutilities.messages.MessageType; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.schematics.SchematicRegistry; import org.bukkit.entity.Player; @@ -47,13 +45,13 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var builder = sessions.getOrCreateSession(player); var set = builder.getSchematicSet(args.asInt(0)); if (set.isEmpty()) { - messageSender().send(MessageChannel.ACTION_BAR, MessageType.ERROR, player, "Invalid set"); + messageSender().sendErrorActionBar(player, "Invalid set"); return; } if ("selector".equalsIgnoreCase(args.asString(1))) { var selector = registry.parseSelector(args.subArguments().subArguments()); - CommandAssertions.isFalse(selector.select(player, schematics).isEmpty(), "No schematics matching this selector."); + CommandAssertions.isFalse(selector.select(player, schematics).isEmpty(), "error.noMatchSelector"); set.get().selector(selector); set.get().refreshSchematics(player, schematics); } else if ("weight".equalsIgnoreCase(args.asString(1))) { @@ -77,7 +75,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar if (args.size() == 2) { var strings = registry.completeSchematicModifier(args.subArguments()); - strings.addAll(TabCompleteUtil.complete(args.asString(1), "selector", "weight")); + strings.addAll(Completion.complete(args.asString(1), "selector", "weight")); return strings; } @@ -85,7 +83,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar return registry.completeSelector(args.subArguments().subArguments(), player); } if ("weight".equalsIgnoreCase(args.asString(1))) { - return TabCompleteUtil.completeInt(args.asString(2), -1, 100); + return Completion.completeInt(args.asString(2), -1, 100); } return registry.completeSchematicModifier(args.subArguments()); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RefreshSchematics.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RefreshSchematics.java index 8abab58f..9a72ec69 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RefreshSchematics.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RefreshSchematics.java @@ -53,9 +53,9 @@ private void refreshBrush(@NotNull Player player) throws CommandException { var brushBuilder = brush.toBuilder(settingsRegistry, schematicRegistry); brushBuilder.refresh(); if (WorldEditBrush.setBrush(player, brushBuilder.build(plugin(), player))) { - messageSender().sendMessage(player, "Brush schematics refreshed."); + messageSender().sendMessage(player, "commands.brush.refresh.refreshed"); } else { - messageSender().sendError(player, "Could not refresh schematics."); + messageSender().sendError(player, "commands.brush.refresh.refreshFailed"); } } @@ -63,6 +63,6 @@ private void refreshSession(@NotNull Player player) { var builder = sessions.getOrCreateSession(player); builder.refresh(); sessions.showSets(player); - messageSender().sendMessage(player, "Schematics refreshed."); + messageSender().sendMessage(player, "commands.brush.refresh.refreshSession"); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveBrushModifier.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveBrushModifier.java index 8f4524e2..83bf53db 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveBrushModifier.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveBrushModifier.java @@ -41,9 +41,9 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var modifier = args.get(0).asString(); var registration = registry.getPlacementModifier(modifier); - CommandAssertions.isTrue(registration.isPresent(), "Unknown modifier."); + CommandAssertions.isTrue(registration.isPresent(), "error.unknownModifier"); - CommandAssertions.isFalse(registration.get().modifier().required(), "This modifier is required."); + CommandAssertions.isFalse(registration.get().modifier().required(), "error.modifierRequired"); session.removePlacementModifier(registration.get().modifier()); sessions.showBrush(player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSet.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSet.java index 997960a9..bda4af9f 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSet.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSet.java @@ -6,14 +6,12 @@ package de.eldoria.schematicbrush.commands.brush; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.messages.MessageChannel; -import de.eldoria.eldoutilities.messages.MessageType; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; @@ -37,7 +35,7 @@ public RemoveSet(Plugin plugin, Sessions sessions) { public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { var success = sessions.getOrCreateSession(player).removeSchematicSet(args.asInt(0)); if (!success) { - messageSender().send(MessageChannel.ACTION_BAR, MessageType.ERROR, player, "Invalid set."); + messageSender().sendErrorActionBar(player, "error.invalidSetId"); } sessions.showSets(player); } @@ -46,7 +44,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar public @Nullable List onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { if (args.size() == 1) { var size = sessions.getOrCreateSession(player).schematicSets().size(); - return TabCompleteUtil.completeInt(args.asString(0), 0, size - 1); + return Completion.completeInt(args.asString(0), 0, size - 1); } return Collections.emptyList(); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSetModifier.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSetModifier.java index 348053fa..9b2a98d8 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSetModifier.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/RemoveSetModifier.java @@ -41,13 +41,13 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var registration = registry.getSchematicModifier(args.get(1).asString()); - CommandAssertions.isTrue(registration.isPresent(), "Unknown modifier."); + CommandAssertions.isTrue(registration.isPresent(), "error.unknownModifier"); var setId = args.get(0).asInt(); var schematicSet = session.getSchematicSet(setId); - CommandAssertions.isTrue(schematicSet.isPresent(), "Invalid set id"); - CommandAssertions.isFalse(registration.get().modifier().required(), "This modifier is required."); + CommandAssertions.isTrue(schematicSet.isPresent(), "error.invalidSetId"); + CommandAssertions.isFalse(registration.get().modifier().required(), "error.modifierRequired"); schematicSet.get().removeModifier(registration.get().modifier()); sessions.showSet(player, setId); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SaveBrush.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SaveBrush.java index f8e88e8c..671f7a36 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SaveBrush.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SaveBrush.java @@ -13,7 +13,6 @@ import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.eldoutilities.utils.Futures; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.storage.brush.Brush; import de.eldoria.schematicbrush.util.Permissions; @@ -53,7 +52,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar addition = storage.activeStorage().brushes().globalContainer().get(brush.name()) .whenComplete(Futures.whenComplete(succ -> { if (succ.isPresent()) { - CommandAssertions.isTrue(args.flags().has("f"), "Brush already exists. Use -f to override"); + CommandAssertions.isTrue(args.flags().has("f"), "error.brushExists"); } storage.activeStorage().brushes().globalContainer().add(brush).join(); }, err -> handleCommandError(player, err))); @@ -61,14 +60,14 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar addition = storage.activeStorage().brushes().playerContainer(player).get(brush.name()) .whenComplete(Futures.whenComplete(succ -> { if (succ.isPresent()) { - CommandAssertions.isTrue(args.flags().has("f"), "Brush already exists. Use -f to override"); + CommandAssertions.isTrue(args.flags().has("f"), "error.brushExists"); } storage.activeStorage().brushes().playerContainer(player).add(brush).join(); }, err -> handleCommandError(player, err))); } addition.whenComplete(Futures.whenComplete(res -> { storage.activeStorage().save(); - messageSender().sendMessage(player, "Brush saved."); + messageSender().sendMessage(player, "commands.brush.saveBrush.saved"); }, err -> handleCommandError(player, err))); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SavePreset.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SavePreset.java index 59a2648f..b423775f 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SavePreset.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/SavePreset.java @@ -14,7 +14,6 @@ import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.eldoutilities.utils.Futures; import de.eldoria.schematicbrush.brush.config.builder.SchematicSetBuilder; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.storage.preset.Preset; import de.eldoria.schematicbrush.util.Permissions; @@ -56,7 +55,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar addition = storage.activeStorage().presets().globalContainer().get(preset.name()) .whenComplete(Futures.whenComplete(succ -> { if (succ.isPresent()) { - CommandAssertions.isTrue(args.flags().has("f"), "Preset already exists. Use -f to override"); + CommandAssertions.isTrue(args.flags().has("f"), "error.presetExists"); } storage.activeStorage().presets().globalContainer().add(preset).join(); }, err -> handleCommandError(player, err))); @@ -64,7 +63,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar addition = storage.activeStorage().presets().playerContainer(player).get(preset.name()) .whenComplete(Futures.whenComplete(succ -> { if (succ.isPresent()) { - CommandAssertions.isTrue(args.flags().has("f"), "Preset already exists. Use -f to override"); + CommandAssertions.isTrue(args.flags().has("f"), "error.presetExists"); } storage.activeStorage().presets().playerContainer(player).add(preset).join(); }, err -> handleCommandError(player, err))); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Sessions.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Sessions.java index 407a2fe2..7e6cad0b 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Sessions.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brush/Sessions.java @@ -7,6 +7,7 @@ package de.eldoria.schematicbrush.commands.brush; import de.eldoria.eldoutilities.localization.MessageComposer; +import de.eldoria.eldoutilities.messages.MessageSender; import de.eldoria.messageblocker.blocker.MessageBlocker; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.brush.config.builder.BrushBuilder; @@ -17,7 +18,6 @@ import de.eldoria.schematicbrush.util.Colors; import de.eldoria.schematicbrush.util.Permissions; import de.eldoria.schematicbrush.util.WorldEditBrush; -import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -33,17 +33,17 @@ public class Sessions { private final MiniMessage miniMessage = MiniMessage.miniMessage(); - private final BukkitAudiences audiences; private final BrushSettingsRegistry registry; private final SchematicRegistry schematicRegistry; private final MessageBlocker messageBlocker; private final Map session = new HashMap<>(); + private final MessageSender messageSender; public Sessions(Plugin plugin, BrushSettingsRegistry registry, SchematicRegistry schematicRegistry, MessageBlocker messageBlocker) { this.registry = registry; - audiences = BukkitAudiences.create(plugin); this.schematicRegistry = schematicRegistry; this.messageBlocker = messageBlocker; + messageSender = MessageSender.getPluginMessageSender(plugin); } public BrushBuilder getOrCreateSession(Player player) { @@ -66,10 +66,15 @@ public void showBrush(Player player) { var selectors = builder.schematicSets().stream().map(set -> BuildUtil.renderProvider(set.selector())).collect(Collectors.joining("\n")); var composer = MessageComposer.create() - .text("<%s>Schematic Brush Menu", Colors.HEADING) + .text("") + .localeCode("commands.brush.sessions.menu") .newLine() - .text("<%s>Schematic Sets: <%s>%s Sets <%s>[Change]", - Colors.HEADING, selectors, Colors.VALUE, builder.schematicSets().size(), Colors.CHANGE); + .text("") + .localeCode("words.schematicSets") + .text(":") + .space() + .text("%s []", + selectors, builder.schematicSets().size()); var mutatorMap = builder.placementModifier(); var modifierStrings = new ArrayList(); @@ -83,30 +88,36 @@ public void showBrush(Player player) { .text(modifierStrings); var missing = registry.placementModifier().keySet().stream().filter(providers -> !mutatorMap.containsKey(providers)) - .map(provider -> String.format("%s'><%s>[%s]", - provider.name(), Colors.NEUTRAL, provider.description(), Colors.CHANGE, provider.name())) + .map(provider -> String.format("%s'>[%s]", + provider.name(), provider.description(), provider.getLocalizedName())) .toList(); if (!missing.isEmpty()) { composer.newLine() - .text("<%s>Add Modifiers: ", Colors.HEADING) + .text("") + .localeCode("commands.brush.sessions.addModifiers") + .text(": ") .text(missing, " "); } composer.newLine() - .text("<%s>[Bind]", Colors.ADD) + .text("[]") .space() - .text("<%s>[Clear]", Colors.REMOVE); + .text("[]"); if (player.hasPermission(Permissions.BrushPreset.USE)) { - composer.space().text("<%s>[Load Brush]", Colors.ADD) - .space().text("<%s>[Save Brush]", Colors.CHANGE); + composer.space().text("[") + .localeCode("commands.brush.sessions.loadBrush") + .text("]") + .space().text("[") + .localeCode("commands.brush.sessions.saveBrush") + .text("]"); } composer.prependLines(20); - messageBlocker.ifEnabled(composer, mess -> mess.newLine().text("<%s>[x]", Colors.REMOVE)); + messageBlocker.ifEnabled(composer, mess -> mess.newLine().text("[x]")); messageBlocker.announce(player, "[x]"); - audiences.player(player).sendMessage(miniMessage.deserialize(composer.build())); + messageSender.sendMessage(player, composer.build()); } public void showSet(Player player, int id) { @@ -114,7 +125,7 @@ public void showSet(Player player, int id) { var builder = getOrCreateSession(player); var optSet = builder.getSchematicSet(id); if (optSet.isEmpty()) { - audiences.player(player).sendMessage(miniMessage.deserialize("[SB] Invalid set.")); + messageSender.sendError(player, "error.invalidSetId"); return; } @@ -124,11 +135,11 @@ public void showSet(Player player, int id) { var composer = MessageComposer.create() .text(interactComponent) .newLine() - .text("<%s>[Back]", Colors.CHANGE); + .text("[]"); - messageBlocker.ifEnabled(() -> composer.newLine().text("<%s>[x]", Colors.REMOVE)); + messageBlocker.ifEnabled(() -> composer.newLine().text("[x]")); messageBlocker.announce(player, "[x]"); - audiences.player(player).sendMessage(miniMessage.deserialize(MessageComposer.create().text(composer.build()).prependLines(20).build())); + messageSender.sendMessage(player, MessageComposer.create().text(composer.build()).prependLines(20).build()); } public void showSets(Player player) { @@ -137,30 +148,35 @@ public void showSets(Player player) { var count = new AtomicInteger(0); var composer = MessageComposer.create() - .text("<%s>Schematic Sets: <%s>[Add]", Colors.HEADING, Colors.ADD) - .space().text("<%s>[Refresh Schematics]", Colors.ADD); + .text("Schematic Sets: []") + .space().text("[") + .localeCode("commands.brush.sessions.refreshSchematics") + .text("]"); if (player.hasPermission(Permissions.Preset.USE)) { - composer.space().text("<%s>[Add Preset]", Colors.ADD); + composer.space().text("[") + .localeCode("commands.brush.sessions.addPreset") + .text("]", Colors.ADD); } var sets = builder.schematicSets().stream() - .map(set -> String.format(" <%s>%s <%s>[Edit] <%s>[Remove]", - Colors.NAME, set.infoComponent(), BuildUtil.renderProvider(set.selector()), Colors.CHANGE, count.get(), Colors.REMOVE, count.getAndIncrement())) + .map(set -> String.format(" %s [] []", + set.infoComponent(), BuildUtil.renderProvider(set.selector()), count.get(), count.getAndIncrement())) .collect(Collectors.joining("\n")); composer.newLine().text(sets); if (player.hasPermission(Permissions.Preset.USE)) { - composer.newLine().text("<%s>[Save Preset]", Colors.CHANGE); + composer.newLine().text("[").localeCode("commands.brush.sessions.savePreset") + .text("]"); } - composer.newLine().text("<%s>[Back]", Colors.CHANGE); + composer.newLine().text("[]"); - messageBlocker.ifEnabled(composer, mess -> mess.newLine().text("<%s>[x]", Colors.REMOVE)); + messageBlocker.ifEnabled(composer, mess -> mess.newLine().text("[x]", Colors.REMOVE)); messageBlocker.announce(player, "[x]"); - audiences.player(player).sendMessage(miniMessage.deserialize(composer.prependLines(20).build())); + messageSender.sendMessage(player, composer.prependLines(20).build()); } public void setSession(Player player, BrushBuilder load) { diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Descr.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Descr.java index e8af0099..7aabf9a3 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Descr.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Descr.java @@ -12,9 +12,8 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.localization.Replacement; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.eldoutilities.utils.Futures; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.entity.Player; @@ -47,11 +46,11 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var container = storage.activeStorage().brushes().containerByName(player, name); container.get(strippedName) .whenComplete(Futures.whenComplete(brush -> { - CommandAssertions.isTrue(brush.isPresent(), "error.unkownBrush", Replacement.create("name", name).addFormatting('b')); + CommandAssertions.isTrue(brush.isPresent(), "error.unknownBrush", Replacement.create("name", name)); brush.get().description(args.join(1)); container.add(brush.get()); - messageSender().sendMessage(player, "Changed description of brush §b" + name + "§r!"); + messageSender().sendMessage(player, "commands.brushPresets.descr.changed", Replacement.create("name", name)); }, err -> handleCommandError(player, err))); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Info.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Info.java index d660b32b..1e059121 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Info.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Info.java @@ -13,14 +13,12 @@ import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.eldoutilities.localization.MessageComposer; -import de.eldoria.eldoutilities.localization.Replacement; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.eldoutilities.utils.Consumers; import de.eldoria.eldoutilities.utils.Futures; import de.eldoria.messageblocker.blocker.MessageBlocker; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; -import de.eldoria.schematicbrush.util.Colors; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.entity.Player; @@ -55,16 +53,18 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var strippedName = name.replaceAll("^g:", ""); storage.activeStorage().brushes().containerByName(player, name).get(strippedName) .whenComplete(Futures.whenComplete(res -> { - CommandAssertions.isTrue(res.isPresent(), "error.unkownBrush", Replacement.create("name", strippedName).addFormatting('b')); + CommandAssertions.isTrue(res.isPresent(), "error.unknownBrush", Replacement.create("name", strippedName)); var preset = res.get(); var global = name.startsWith("g:"); var composer = MessageComposer.create() .text(preset.detailComponent(global, registry)) .newLine() - .text("<%s>[Back]", global ? "global" : "private", Colors.CHANGE) + .text("[", global ? "global" : "private") + .localeCode("words.back") + .text("]") .prependLines(20); - messageBlocker.ifEnabled(composer, comp -> comp.newLine().text("<%s>[x]", Colors.REMOVE)); + messageBlocker.ifEnabled(composer, comp -> comp.newLine().text("[x]")); messageBlocker.announce(player, "[x]"); audiences.player(player).sendMessage(miniMessage.deserialize(composer.build())); }, err -> handleCommandError(player, err))) diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/List.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/List.java index 9e6030fa..64949225 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/List.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/List.java @@ -19,7 +19,7 @@ public class List extends AdvancedCommand { public List(Plugin plugin, StorageRegistry storage, MessageBlocker messageBlocker, BrushSettingsRegistry registry) { super(plugin, CommandMeta.builder("list") - .buildSubCommands((cmds, builder) ->{ + .buildSubCommands((cmds, builder) -> { var privateList = new Private(plugin, storage, messageBlocker, registry); var globalList = new Global(plugin, storage, messageBlocker, registry); builder.withDefaultCommand(privateList); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Remove.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Remove.java index 6e231323..10a65c6b 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Remove.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/Remove.java @@ -12,9 +12,8 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.localization.Replacement; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.eldoutilities.utils.Futures; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.entity.Player; @@ -45,16 +44,16 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar CommandAssertions.permission(player, false, Permissions.Preset.GLOBAL); removal = storage.activeStorage().brushes().globalContainer().remove(name) .whenComplete(Futures.whenComplete( - success -> CommandAssertions.isTrue(success, "error.unkownBrush", Replacement.create("name", name).addFormatting('b')), + success -> CommandAssertions.isTrue(success, "error.unknownBrush", Replacement.create("name", name)), err -> handleCommandError(player, err))); } else { removal = storage.activeStorage().brushes().playerContainer(player).remove(name) .whenComplete(Futures.whenComplete( - success -> CommandAssertions.isTrue(success, "error.unkownBrush", Replacement.create("name", name).addFormatting('b')), + success -> CommandAssertions.isTrue(success, "error.unknownBrush", Replacement.create("name", name)), err -> handleCommandError(player, err))); } removal.whenComplete(Futures.whenComplete( - succ -> messageSender().sendMessage(player, "Brush §b" + name + "§r deleted!"), + succ -> messageSender().sendMessage(player, "command.brushpresets.remove.removed", Replacement.create("name", name)), err -> handleCommandError(player, err))); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Global.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Global.java index 12b6890a..68593c87 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Global.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Global.java @@ -15,7 +15,6 @@ import de.eldoria.messageblocker.blocker.MessageBlocker; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.commands.util.BasePageCommand; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.entity.Player; @@ -42,7 +41,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar paged.page(index, PAGE_SIZE).whenComplete(Futures.whenComplete(entries -> { boolean delete = player.hasPermission(Permissions.Preset.GLOBAL); var composer = MessageComposer.create(); - addPageHeader(composer, "Brush Presets", true); + addPageHeader(composer, "words.brushPreset", true); addEntries(composer, entries, e -> e.infoComponent(true, delete, registry)); addPageFooter(composer, index, paged); send(composer, player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Private.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Private.java index e2c54161..b05527c0 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Private.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/brushpresets/info/Private.java @@ -15,7 +15,6 @@ import de.eldoria.messageblocker.blocker.MessageBlocker; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.commands.util.BasePageCommand; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -40,7 +39,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar storage.activeStorage().brushes().playerContainer(player).paged().whenComplete(Futures.whenComplete(paged -> { paged.page(index, PAGE_SIZE).whenComplete(Futures.whenComplete(entries -> { var composer = MessageComposer.create(); - addPageHeader(composer, "Brush Presets", false); + addPageHeader(composer, "words.brushPreset", false); addEntries(composer, entries, e -> e.infoComponent(false, true, registry)); addPageFooter(composer, index, paged); send(composer, player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Next.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Next.java index 49796d35..ff9ee2d5 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Next.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Next.java @@ -12,8 +12,6 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.messages.MessageChannel; -import de.eldoria.eldoutilities.messages.MessageType; import de.eldoria.schematicbrush.brush.SchematicBrush; import de.eldoria.schematicbrush.util.WorldEditBrush; import org.bukkit.entity.Player; @@ -31,11 +29,11 @@ public Next(Plugin plugin) { @Override public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { Optional schematicBrush = WorldEditBrush.getSchematicBrush(player); - CommandAssertions.isTrue(schematicBrush.isPresent(), "You are not holding a schematic brush"); + CommandAssertions.isTrue(schematicBrush.isPresent(), "error.notABrush"); if (schematicBrush.get().nextPaste().nextSchematic()) { - messageSender().send(MessageChannel.ACTION_BAR, MessageType.NORMAL, player, "§2Skipped Schematic."); + messageSender().sendActionBar(player, "commands.modify.next.skip"); } else { - messageSender().send(MessageChannel.ACTION_BAR, MessageType.ERROR, player, "The brush contains only 1 schematic"); + messageSender().sendErrorActionBar(player, "error.oneschematic"); } } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Previous.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Previous.java index adf88147..8ffeff93 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Previous.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Previous.java @@ -12,8 +12,6 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.messages.MessageChannel; -import de.eldoria.eldoutilities.messages.MessageType; import de.eldoria.schematicbrush.brush.SchematicBrush; import de.eldoria.schematicbrush.util.WorldEditBrush; import org.bukkit.entity.Player; @@ -31,11 +29,11 @@ public Previous(Plugin plugin) { @Override public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { Optional schematicBrush = WorldEditBrush.getSchematicBrush(player); - CommandAssertions.isTrue(schematicBrush.isPresent(), "You are not holding a schematic brush"); + CommandAssertions.isTrue(schematicBrush.isPresent(), "error.notABrush"); if (schematicBrush.get().nextPaste().previousSchematic()) { - messageSender().send(MessageChannel.ACTION_BAR, MessageType.NORMAL, player, "§2Previous Schematic"); + messageSender().sendActionBar(player, "commands.modify.previous.previous"); } else { - messageSender().send(MessageChannel.ACTION_BAR, MessageType.ERROR, player, "The history is empty"); + messageSender().sendErrorActionBar(player, "commands.modify.previous.empty"); } } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Selection.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Selection.java index b93abede..ea79cadb 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Selection.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/modify/Selection.java @@ -12,8 +12,6 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.messages.MessageChannel; -import de.eldoria.eldoutilities.messages.MessageType; import de.eldoria.schematicbrush.brush.SchematicBrush; import de.eldoria.schematicbrush.brush.config.BrushSettingsRegistry; import de.eldoria.schematicbrush.brush.config.schematics.SchematicSelection; @@ -39,10 +37,10 @@ public Selection(BrushSettingsRegistry registry, Plugin plugin) { @Override public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { Optional schematicBrush = WorldEditBrush.getSchematicBrush(player); - CommandAssertions.isTrue(schematicBrush.isPresent(), "You are not holding a schematic brush"); + CommandAssertions.isTrue(schematicBrush.isPresent(), "error.notABrush"); SchematicSelection schematicSelection = registry.parseSchematicSelection(args); schematicBrush.get().settings().schematicSelection(schematicSelection); - messageSender().send(MessageChannel.CHAT, MessageType.NORMAL, player, "Schematic selection changed."); + messageSender().sendMessage(player, "commands.modify.selection.changed"); } @Override diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Descr.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Descr.java index 470c609e..9ff40bcc 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Descr.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Descr.java @@ -12,9 +12,8 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.localization.Replacement; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.eldoutilities.utils.Futures; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.entity.Player; @@ -47,11 +46,11 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var container = storage.activeStorage().presets().containerByName(player, name); container.get(strippedName) .whenComplete(Futures.whenComplete(preset -> { - CommandAssertions.isTrue(preset.isPresent(), "error.unkownPreset", Replacement.create("name", name).addFormatting('b')); + CommandAssertions.isTrue(preset.isPresent(), "error.unknownPreset", Replacement.create("name", name)); preset.get().description(args.join(1)); container.add(preset.get()); - messageSender().sendMessage(player, "Changed description of preset §b" + name + "§r!"); + messageSender().sendMessage(player, "commands.preset.descr.changed"); }, err -> handleCommandError(player, err))); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Info.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Info.java index cb367c19..21a77092 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Info.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Info.java @@ -13,13 +13,11 @@ import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; import de.eldoria.eldoutilities.localization.MessageComposer; -import de.eldoria.eldoutilities.localization.Replacement; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.eldoutilities.utils.Consumers; import de.eldoria.eldoutilities.utils.Futures; import de.eldoria.messageblocker.blocker.MessageBlocker; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; -import de.eldoria.schematicbrush.util.Colors; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.entity.Player; @@ -52,16 +50,16 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar var strippedName = name.replaceAll("^g:", ""); storage.activeStorage().presets().containerByName(player, name).get(strippedName) .whenComplete(Futures.whenComplete(res -> { - CommandAssertions.isTrue(res.isPresent(), "error.unkownPreset", Replacement.create("name", strippedName).addFormatting('b')); + CommandAssertions.isTrue(res.isPresent(), "error.unknownPreset", Replacement.create("name", strippedName)); var preset = res.get(); var global = name.startsWith("g:"); var composer = MessageComposer.create() .text(preset.detailComponent(global)) .newLine() - .text("<%s>[Back]", global ? "global" : "private", Colors.CHANGE) + .text("[]", global ? "global" : "private") .prependLines(20); - messageBlocker.ifEnabled(composer, comp -> comp.newLine().text("<%s>[x]", Colors.REMOVE)); + messageBlocker.ifEnabled(composer, comp -> comp.newLine().text("[x]")); messageBlocker.announce(player, "[x]"); audiences.player(player).sendMessage(miniMessage.deserialize(composer.build())); }, err -> handleCommandError(player, err))) diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/List.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/List.java index 6282e9fd..9426577f 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/List.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/List.java @@ -18,7 +18,7 @@ public class List extends AdvancedCommand { public List(Plugin plugin, StorageRegistry storage, MessageBlocker messageBlocker) { super(plugin, CommandMeta.builder("list") - .buildSubCommands((cmds, builder) ->{ + .buildSubCommands((cmds, builder) -> { var privateList = new Private(plugin, storage, messageBlocker); var globalList = new Global(plugin, storage, messageBlocker); builder.withDefaultCommand(privateList); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Remove.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Remove.java index 69204c6b..9f2fdadf 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Remove.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/Remove.java @@ -12,9 +12,8 @@ import de.eldoria.eldoutilities.commands.command.util.CommandAssertions; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.localization.Replacement; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.eldoutilities.utils.Futures; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.entity.Player; @@ -45,16 +44,16 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar CommandAssertions.permission(player, false, Permissions.Preset.GLOBAL); removal = storage.activeStorage().presets().globalContainer().remove(name) .whenComplete(Futures.whenComplete( - success -> CommandAssertions.isTrue(success, "error.unkownPreset", Replacement.create("name", name).addFormatting('b')), + success -> CommandAssertions.isTrue(success, "error.unknownPreset", Replacement.create("name", name)), err -> handleCommandError(player, err))); } else { removal = storage.activeStorage().presets().playerContainer(player).remove(name) .whenComplete(Futures.whenComplete( - success -> CommandAssertions.isTrue(success, "error.unkownPreset", Replacement.create("name", name).addFormatting('b')), + success -> CommandAssertions.isTrue(success, "error.unknownPreset", Replacement.create("name", name)), err -> handleCommandError(player, err))); } removal.whenComplete(Futures.whenComplete( - succ -> messageSender().sendMessage(player, "Preset §b" + name + "§r deleted!"), + succ -> messageSender().sendMessage(player, "commands.preset.remove.removed", Replacement.create("name", name)), err -> handleCommandError(player, err))); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Global.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Global.java index 07afe0c6..9845f652 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Global.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Global.java @@ -14,7 +14,6 @@ import de.eldoria.eldoutilities.utils.Futures; import de.eldoria.messageblocker.blocker.MessageBlocker; import de.eldoria.schematicbrush.commands.util.BasePageCommand; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import de.eldoria.schematicbrush.util.Permissions; import org.bukkit.entity.Player; @@ -39,7 +38,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar paged.page(index, PAGE_SIZE).whenComplete(Futures.whenComplete(entries -> { var delete = player.hasPermission(Permissions.Preset.GLOBAL); var composer = MessageComposer.create(); - addPageHeader(composer, "Presets", true); + addPageHeader(composer, "words.preset", true); addEntries(composer, entries, e -> e.infoComponent(true, delete)); addPageFooter(composer, index, paged); send(composer, player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Private.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Private.java index 11dbf55b..4bae226a 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Private.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/preset/info/Private.java @@ -14,7 +14,6 @@ import de.eldoria.eldoutilities.utils.Futures; import de.eldoria.messageblocker.blocker.MessageBlocker; import de.eldoria.schematicbrush.commands.util.BasePageCommand; -import de.eldoria.schematicbrush.storage.Storage; import de.eldoria.schematicbrush.storage.StorageRegistry; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -37,7 +36,7 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar storage.activeStorage().presets().playerContainer(player).paged().whenComplete(Futures.whenComplete(paged -> { paged.page(index, PAGE_SIZE).whenComplete(Futures.whenComplete(entries -> { var composer = MessageComposer.create(); - addPageHeader(composer, "Presets", false); + addPageHeader(composer, "words.preset", false); addEntries(composer, entries, e -> e.infoComponent(false, true)); addPageFooter(composer, index, paged); send(composer, player); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/Preview.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/Preview.java index 8e17aa6c..0658c711 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/Preview.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/Preview.java @@ -8,22 +8,12 @@ import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; -import de.eldoria.eldoutilities.commands.command.CommandRoute; -import de.eldoria.eldoutilities.commands.command.util.Arguments; -import de.eldoria.eldoutilities.commands.exceptions.CommandException; -import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.commands.settings.preview.Enable; import de.eldoria.schematicbrush.commands.settings.preview.Subscribe; import de.eldoria.schematicbrush.commands.settings.preview.Unsubscribe; import de.eldoria.schematicbrush.rendering.RenderService; import de.eldoria.schematicbrush.util.Permissions; -import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.List; public class Preview extends AdvancedCommand { public Preview(Plugin plugin, RenderService renderService) { diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/ShowNames.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/ShowNames.java index a055c24c..8bb60fe7 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/ShowNames.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/ShowNames.java @@ -6,12 +6,12 @@ package de.eldoria.schematicbrush.commands.settings; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.config.Configuration; import de.eldoria.schematicbrush.config.sections.MessageChannel; import de.eldoria.schematicbrush.listener.NotifyListener; @@ -46,19 +46,19 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar } listener.setState(player, args.asBoolean(0), messageChannel); if (args.asBoolean(0)) { - messageSender().sendMessage(player, "Names will be pasted."); + messageSender().sendMessage(player, "commands.settings.showNames.pasted"); } else { - messageSender().sendMessage(player, "Names will be hidden."); + messageSender().sendMessage(player, "commands.settings.showNames.hidden"); } } @Override public @Nullable List onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) { if (args.sizeIs(1)) { - return TabCompleteUtil.completeBoolean(args.asString(0)); + return Completion.completeBoolean(args.asString(0)); } if (args.sizeIs(2)) { - return TabCompleteUtil.complete(args.asString(1), "CHAT", "TITLE", "SUB_TITLE", "ACTION_BAR"); + return Completion.complete(args.asString(1), "CHAT", "TITLE", "SUB_TITLE", "ACTION_BAR"); } return Collections.emptyList(); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Enable.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Enable.java index 23c1be96..74a86592 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Enable.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Enable.java @@ -6,12 +6,12 @@ package de.eldoria.schematicbrush.commands.settings.preview; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.rendering.RenderService; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -35,11 +35,11 @@ public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Ar boolean state = args.isEmpty() ? !renderService.getState(player) : args.asBoolean(0); renderService.setState(player, state); - messageSender().sendMessage(player, state ? "Preview active." : "Preview disabled."); + messageSender().sendMessage(player, state ? "commands.settings.preview.enable.true" : "commands.settings.preview.enable.false"); } @Override public @Nullable List onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) { - return TabCompleteUtil.completeBoolean(args.asString(0)); + return Completion.completeBoolean(args.asString(0)); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Subscribe.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Subscribe.java index 56516950..ebd9c24b 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Subscribe.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Subscribe.java @@ -6,12 +6,12 @@ package de.eldoria.schematicbrush.commands.settings.preview; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.rendering.RenderService; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -34,14 +34,14 @@ public Subscribe(Plugin plugin, RenderService renderService) { public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { var target = args.asPlayer(0); if (renderService.subscribe(target, player)) { - messageSender().sendMessage(player, "Subscribed to preview."); + messageSender().sendMessage(player, "commands.settings.preview.subscribe.subscribed"); } else { - messageSender().sendMessage(player, "Player has not preview enabled"); + messageSender().sendMessage(player, "commands.settings.preview.subscribe.notEnabled"); } } @Override public @Nullable List onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) { - return TabCompleteUtil.completeOnlinePlayers(args.asString(0)); + return Completion.completeOnlinePlayers(args.asString(0)); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Unsubscribe.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Unsubscribe.java index 17247226..37a81157 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Unsubscribe.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/settings/preview/Unsubscribe.java @@ -6,12 +6,12 @@ package de.eldoria.schematicbrush.commands.settings.preview; +import de.eldoria.eldoutilities.commands.Completion; import de.eldoria.eldoutilities.commands.command.AdvancedCommand; import de.eldoria.eldoutilities.commands.command.CommandMeta; import de.eldoria.eldoutilities.commands.command.util.Arguments; import de.eldoria.eldoutilities.commands.exceptions.CommandException; import de.eldoria.eldoutilities.commands.executor.IPlayerTabExecutor; -import de.eldoria.eldoutilities.simplecommands.TabCompleteUtil; import de.eldoria.schematicbrush.rendering.RenderService; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -32,11 +32,11 @@ public Unsubscribe(Plugin plugin, RenderService renderService) { @Override public void onCommand(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) throws CommandException { renderService.unsubscribe(player); - messageSender().sendMessage(player, "Unsubscribed from preview."); + messageSender().sendMessage(player, "commands.settings.preview.unsubscribe.unsubscribed"); } @Override public @Nullable List onTabComplete(@NotNull Player player, @NotNull String alias, @NotNull Arguments args) { - return TabCompleteUtil.completeBoolean(args.asString(0)); + return Completion.completeBoolean(args.asString(0)); } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/util/BasePageCommand.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/util/BasePageCommand.java index 48e50bea..6842a686 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/util/BasePageCommand.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/commands/util/BasePageCommand.java @@ -37,14 +37,18 @@ public BasePageCommand(Plugin plugin, CommandMeta meta, MessageBlocker messageBl protected void addPageHeader(MessageComposer composer, String title, boolean global) { var baseCommand = "/" + meta().parent().meta().createCommandCall(); - composer.text("<%s>", Colors.HEADING).text(global ? "Global" : "Private").space().text(title).newLine() + composer.text("").localeCode(global ? "words.global" : "words.private").space().localeCode(title).newLine() .text(runCommand(baseCommand, !global)) .newLine(); } private String runCommand(String baseCommand, boolean global) { - var type = global ? "Global" : "Private"; - return String.format("<%s>[%s]", Colors.CHANGE, baseCommand, type.toLowerCase(), type); + var type = global ? "words.global" : "words.private"; + return MessageComposer.create() + .text("[", baseCommand, global ? "global" : "private") + .localeCode(type) + .text("]") + .build(); } protected void addEntries(MessageComposer composer, List entries, Function map) { @@ -53,25 +57,25 @@ protected void addEntries(MessageComposer composer, List entries, Functio } protected void addPageFooter(MessageComposer composer, int index, ContainerPagedAccess paged) { - var baseCommand = "/" +meta().createCommandCall(); + var baseCommand = "/" + meta().createCommandCall(); if (index == 0) { - composer.text("<%s>%s", Colors.INACTIVE, LEFT_ARROW); + composer.text("%s", Colors.INACTIVE, LEFT_ARROW); } else { - composer.text("<%s>%s", baseCommand, index - 1, Colors.CHANGE, LEFT_ARROW); + composer.text("%s", baseCommand, index - 1, LEFT_ARROW); } composer.text(" <%s>%s / %s ", Colors.NEUTRAL, index + 1, Math.max(1, paged.pages(PAGE_SIZE))); if (index + 1 >= paged.pages(PAGE_SIZE)) { - composer.text("<%s>%s", Colors.INACTIVE, RIGHT_ARROW); + composer.text("%s", Colors.INACTIVE, RIGHT_ARROW); } else { - composer.text("<%s>%s", baseCommand, index + 1, Colors.CHANGE, RIGHT_ARROW); + composer.text("%s", baseCommand, index + 1, RIGHT_ARROW); } } protected void send(MessageComposer composer, Player player) { composer.prependLines(20); messageBlocker.blockPlayer(player); - messageBlocker.ifEnabled(() -> composer.newLine().text("<%s>[x]", Colors.REMOVE)); + messageBlocker.ifEnabled(() -> composer.newLine().text("[x]")); messageBlocker.announce(player, "[x]"); audiences.sender(player).sendMessage(miniMessage.deserialize(composer.build())); } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfigImpl.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfigImpl.java index 66647f1b..321773ee 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfigImpl.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/config/sections/GeneralConfigImpl.java @@ -28,6 +28,7 @@ public class GeneralConfigImpl implements GeneralConfig { private int maxEffectiveRenderSize = maxRenderSize; private int renderDistance = 100; private int pasteBreak = 20; + private String language = "en_US"; public GeneralConfigImpl() { } @@ -124,4 +125,8 @@ public int pasteBreak() { return pasteBreak; } + @Override + public String language() { + return language; + } } diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/listener/BrushModifier.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/listener/BrushModifier.java index 27409539..71cf5cd7 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/listener/BrushModifier.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/listener/BrushModifier.java @@ -6,9 +6,7 @@ package de.eldoria.schematicbrush.listener; -import de.eldoria.eldoutilities.messages.MessageChannel; import de.eldoria.eldoutilities.messages.MessageSender; -import de.eldoria.eldoutilities.messages.MessageType; import de.eldoria.schematicbrush.SchematicBrushRebornImpl; import de.eldoria.schematicbrush.util.WorldEditBrush; import org.bukkit.event.EventHandler; @@ -32,15 +30,15 @@ public void onLeftClick(PlayerInteractEvent event) { var brush = schematicBrush.get(); if (event.getPlayer().isSneaking()) { if (brush.nextPaste().shiftFlip()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.NORMAL, event.getPlayer(), "§2Changed flip."); + messageSender.sendActionBar(event.getPlayer(), "§2Changed flip."); } else { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, event.getPlayer(), "Flip is not shiftable."); + messageSender.sendErrorActionBar(event.getPlayer(), "Flip is not shiftable."); } } else { if (brush.nextPaste().shiftRotation()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.NORMAL, event.getPlayer(), "§2Changed rotation."); + messageSender.sendActionBar(event.getPlayer(), "§2Changed rotation."); } else { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, event.getPlayer(), "Rotation is not shiftable."); + messageSender.sendErrorActionBar(event.getPlayer(), "Rotation is not shiftable."); } } event.setCancelled(true); @@ -54,15 +52,15 @@ public void onItemDrop(PlayerSwapHandItemsEvent event) { if (schematicBrush.isEmpty()) return; if (event.getPlayer().isSneaking()) { if (schematicBrush.get().nextPaste().shiftOffset()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.NORMAL, event.getPlayer(), "§2Changed Offset."); + messageSender.sendActionBar(event.getPlayer(), "§2Changed Offset."); } else { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, event.getPlayer(), "Offset is not shiftable."); + messageSender.sendErrorActionBar(event.getPlayer(), "Offset is not shiftable."); } } else { if (schematicBrush.get().nextPaste().nextSchematic()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.NORMAL, event.getPlayer(), "§2Skipped Schematic."); + messageSender.sendActionBar(event.getPlayer(), "§2Skipped Schematic."); } else { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, event.getPlayer(), "The set only contains 1 schematic"); + messageSender.sendErrorActionBar(event.getPlayer(), "The set only contains 1 schematic"); } } event.setCancelled(true); diff --git a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/rendering/RenderService.java b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/rendering/RenderService.java index b54f76f2..a0e3e550 100644 --- a/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/rendering/RenderService.java +++ b/schematicbrushreborn-core/src/main/java/de/eldoria/schematicbrush/rendering/RenderService.java @@ -6,14 +6,14 @@ package de.eldoria.schematicbrush.rendering; -import de.eldoria.eldoutilities.messages.MessageChannel; import de.eldoria.eldoutilities.messages.MessageSender; -import de.eldoria.eldoutilities.messages.MessageType; +import de.eldoria.eldoutilities.messages.Replacement; import de.eldoria.schematicbrush.SchematicBrushReborn; import de.eldoria.schematicbrush.brush.config.modifier.PlacementModifier; import de.eldoria.schematicbrush.config.Configuration; import de.eldoria.schematicbrush.event.PostPasteEvent; import de.eldoria.schematicbrush.event.PrePasteEvent; +import de.eldoria.schematicbrush.util.Permissions; import de.eldoria.schematicbrush.util.RollingQueue; import de.eldoria.schematicbrush.util.Text; import de.eldoria.schematicbrush.util.WorldEditBrush; @@ -73,7 +73,7 @@ public RenderService(SchematicBrushReborn plugin, Configuration configuration) { @EventHandler public void onJoin(PlayerJoinEvent event) { - if (event.getPlayer().hasPermission("schematicbrush.brush.preview")) { + if (event.getPlayer().hasPermission(Permissions.Brush.PREVIEW)) { if (configuration.general().isPreviewDefault()) { setState(event.getPlayer(), true); } @@ -126,7 +126,7 @@ public void run() { try { tick(); } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "An error occured during rendering", e); + plugin.getLogger().log(Level.SEVERE, "An error occurred during rendering", e); } } @@ -135,12 +135,12 @@ private void tick() { var start = System.currentTimeMillis(); count += players.size() / (double) configuration.general().previewRefreshInterval(); while (count > 0 && !players.isEmpty() - && System.currentTimeMillis() - start < configuration.general().maxRenderMs()) { + && System.currentTimeMillis() - start < configuration.general().maxRenderMs()) { count--; try { handlePlayerTick(nextPlayer()); } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "An error occured during player rendering", e); + plugin.getLogger().log(Level.SEVERE, "An error occurred during player rendering", e); } } timings.add(System.currentTimeMillis() - start); @@ -155,7 +155,7 @@ private void handlePlayerTick(Player player) { render(player); } else if (sinks.containsKey(player.getUniqueId())) { resolveBlocked(player); - }else { + } else { getSink(player).skipped(); } } @@ -188,22 +188,25 @@ private void render(Player player) { var replaceAll = (boolean) brush.settings().getMutator(PlacementModifier.REPLACE_ALL).value(); if (includeAir && replaceAll && brush.nextPaste().schematic().size() > general.maxRenderSize()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, brush.brushOwner(), - "Schematic exceeds the maximum render size. %,d of %,d".formatted(brush.nextPaste().schematic().size(), general.maxRenderSize())); + messageSender.sendErrorActionBar(brush.brushOwner(), "service.renderService.error.sizeExceeded", + Replacement.create("actual", "%,d".formatted(brush.nextPaste().schematic().size())), + Replacement.create("max", "%,d".formatted(general.maxRenderSize()))); resolveChanges(player); return; } if (!includeAir && brush.nextPaste().schematic().effectiveSize() > general.maxRenderSize()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, brush.brushOwner(), - "Schematic exceeds the maximum render size. %,d of %,d".formatted(brush.nextPaste().schematic().effectiveSize(), general.maxRenderSize())); + messageSender.sendErrorActionBar(brush.brushOwner(), "service.renderService.error.sizeExceeded", + Replacement.create("actual", "%,d".formatted(brush.nextPaste().schematic().effectiveSize())), + Replacement.create("max", "%,d".formatted(general.maxRenderSize()))); resolveChanges(player); return; } if (!includeAir && brush.nextPaste().schematic().effectiveSize() > general.maxEffectiveRenderSize()) { - messageSender.send(MessageChannel.ACTION_BAR, MessageType.ERROR, brush.brushOwner(), - "Schematic exceeds the maximum render size. %,d of %,d".formatted(brush.nextPaste().schematic().effectiveSize(), general.maxEffectiveRenderSize())); + messageSender.sendErrorActionBar(brush.brushOwner(), "service.renderService.error.sizeExceeded", + Replacement.create("actual", "%,d".formatted(brush.nextPaste().schematic().effectiveSize())), + Replacement.create("max", "%,d".formatted(general.maxEffectiveRenderSize()))); resolveChanges(player); return; } diff --git a/schematicbrushreborn-core/src/main/resources/messages.properties b/schematicbrushreborn-core/src/main/resources/messages.properties index 72f7220b..40a52a76 100644 --- a/schematicbrushreborn-core/src/main/resources/messages.properties +++ b/schematicbrushreborn-core/src/main/resources/messages.properties @@ -1,10 +1,139 @@ about= + +command.brushpresets.remove.removed= + +commands.admin.migrate.migrationDone= +commands.admin.migrate.migrationStarted= +commands.admin.migrate.sourceTypeInvalid= +commands.admin.migrate.targetTypeInvalid= +commands.admin.reload.done= +commands.admin.reloadCache.done= +commands.admin.restartRendering.done= +commands.brush.bind.bound= +commands.brush.refresh.refreshFailed= +commands.brush.refresh.refreshSession= +commands.brush.refresh.refreshed= +commands.brush.saveBrush.saved= +commands.brush.sessions.addModifiers= +commands.brush.sessions.addPreset= +commands.brush.sessions.loadBrush= +commands.brush.sessions.menu= +commands.brush.sessions.refreshSchematics= +commands.brush.sessions.saveBrush= +commands.brush.sessions.savePreset= +commands.brush.sessions.weight= +commands.brushPreset.info.global.title= +commands.brushPreset.info.private.title= +commands.brushPresets.descr.changed= +commands.modify.next.skip= +commands.modify.previous.empty= +commands.modify.previous.previous= +commands.modify.selection.changed= +commands.preset.descr.changed= +commands.preset.remove.removed= +commands.settings.preview.enable.false= +commands.settings.preview.enable.true= +commands.settings.preview.subscribe.notEnabled= +commands.settings.preview.subscribe.subscribed= +commands.settings.preview.unsubscribe.unsubscribed= +commands.settings.showNames.hidden= +commands.settings.showNames.pasted= + +components.modifier.blockfilter.name= +components.modifier.flip.fixed.name= +components.modifier.flip.list.name= +components.modifier.flip.random.name= +components.modifier.includeAir.fixed.name= +components.modifier.offset.fixed.name= +components.modifier.offset.list.name= +components.modifier.offset.range.name= +components.modifier.placement.bottom.name= +components.modifier.placement.drop.name= +components.modifier.placement.middle.name= +components.modifier.placement.original.name= +components.modifier.placement.raise.name= +components.modifier.placement.top.name= +components.modifier.replaceAll.fixed.name= +components.modifier.rotation.fixed.name= +components.modifier.rotation.list.name= +components.modifier.rotation.random.name= +components.modifier.type.filter.description= +components.modifier.type.filter.name= +components.modifier.type.flip.description= +components.modifier.type.flip.name= +components.modifier.type.includeAir.description= +components.modifier.type.includeAir.name= +components.modifier.type.offset.description= +components.modifier.type.offset.name= +components.modifier.type.placement.description= +components.modifier.type.placement.name= +components.modifier.type.replaceAll.description= +components.modifier.type.replaceAll.name= +components.modifier.type.rotation.description= +components.modifier.type.rotation.name= +components.provider.filter.blockFilter.description= +components.provider.filter.blockFilter.name= +components.provider.flip.fixed.description= +components.provider.flip.fixed.name= +components.provider.flip.list.description= +components.provider.flip.list.name= +components.provider.flip.random.description= +components.provider.flip.random.name= +components.provider.includeAir.fixed.description= +components.provider.includeAir.fixed.name= +components.provider.offset.fixed.description= +components.provider.offset.fixed.name= +components.provider.offset.list.description= +components.provider.offset.list.name= +components.provider.offset.range.description= +components.provider.offset.range.name= +components.provider.placement.bottom.description= +components.provider.placement.bottom.name= +components.provider.placement.drop.description= +components.provider.placement.drop.name= +components.provider.placement.middle.description= +components.provider.placement.middle.name= +components.provider.placement.original.description= +components.provider.placement.original.name= +components.provider.placement.raise.description= +components.provider.placement.raise.name= +components.provider.placement.top.description= +components.provider.placement.top.name= +components.provider.replaceAll.fixed.description= +components.provider.replaceAll.fixed.name= +components.provider.rotation.fixed.description= +components.provider.rotation.fixed.name= +components.provider.rotation.list.description= +components.provider.rotation.list.name= +components.provider.rotation.random.description= +components.provider.rotation.random.name= +components.provider.selection.lockedOrdered.description= +components.provider.selection.lockedOrdered.name= +components.provider.selection.lockedRandom.description= +components.provider.selection.lockedRandom.name= +components.provider.selection.ordered.description= +components.provider.selection.ordered.name= +components.provider.selection.random.description= +components.provider.selection.random.name= +components.provider.selector.directory.description= +components.provider.selector.directory.name= +components.provider.selector.name.description= +components.provider.selector.name.name= +components.provider.selector.regex.description= +components.provider.selector.regex.name= +components.selector.directory.name= +components.selector.name.name= +components.selector.regex.name= + dialog.accept= dialog.add= dialog.deny= dialog.leftClickChange= dialog.remove= dialog.rightClickRemove= + +error.brushExists= +error.emptyBrush= error.invalidArguments= error.invalidBoolean= error.invalidCommand= @@ -14,17 +143,46 @@ error.invalidMaterial= error.invalidNumber= error.invalidRange= error.invalidSender= +error.invalidSetId= error.missingArgument= +error.modifierRequired= +error.noMatchSelector= +error.notABrush= error.notAsConsole= error.notAsPlayer= error.notOnline= +error.oneschematic= error.onlyConsole= error.onlyPlayer= error.permission= +error.presetExists= error.tooLarge= error.tooSmall= -error.unkownPlayer= -error.unkownWorld= -error.notABrush= -error.unkownPreset= -error.unkownBrush= +error.unknownBrush= +error.unknownModifier= +error.unknownModifierType= +error.unknownPlayer= +error.unknownPreset= +error.unknownWorld= + +service.renderService.error.sizeExceeded= + +words.add= +words.and= +words.back= +words.bind= +words.brushPreset= +words.change= +words.clear= +words.edit= +words.global= +words.more= +words.none= +words.preset= +words.private= +words.remove= +words.schematicSets= +words.schematics= +words.selector= +words.sets= +words.weight= diff --git a/schematicbrushreborn-core/src/main/resources/messages_de_DE.properties b/schematicbrushreborn-core/src/main/resources/messages_de_DE.properties new file mode 100644 index 00000000..27ff31f9 --- /dev/null +++ b/schematicbrushreborn-core/src/main/resources/messages_de_DE.properties @@ -0,0 +1,188 @@ +about= von \nVersion: \nSpigot: \nSupport: + +command.brushpresets.remove.removed=Brush entfernt. + +commands.admin.migrate.migrationDone=Migration abgeschlossen +commands.admin.migrate.migrationStarted=Migration gestartet +commands.admin.migrate.sourceTypeInvalid=Quelle ist ungültig. +commands.admin.migrate.targetTypeInvalid=Ziel ist ungültig. +commands.admin.reload.done=Schematic Brush Reborn neu geladen. +commands.admin.reloadCache.done=Schematics neu geladen. +commands.admin.restartRendering.done=Rendering neu gestartet. +commands.brush.bind.bound=Brush gebunden. Verwendet Schematics in Sets. +commands.brush.refresh.refreshFailed=Schematics konnten nicht aktualisiert werden. +commands.brush.refresh.refreshSession=Schematics aktualisiert. +commands.brush.refresh.refreshed=Brush-Schemtics aktualisiert. +commands.brush.saveBrush.saved=Brush gespeichert. +commands.brush.sessions.addModifiers=Modifikatoren hinzufügen +commands.brush.sessions.addPreset=Vorlage hinzufügen +commands.brush.sessions.loadBrush=Brush laden +commands.brush.sessions.menu=Schematic Brush Menü +commands.brush.sessions.refreshSchematics=Schematics aktualisieren +commands.brush.sessions.saveBrush=Brush speichern +commands.brush.sessions.savePreset=Vorlage speichern +commands.brush.sessions.weight=Die Gewichtung des Sets wenn mehrere Sets verwendet werden.\nEin höherer Wert resultiert in mehr Schematic von diesem Set. +commands.brushPreset.info.global.title=Globale Voreinstellungen +commands.brushPreset.info.private.title=Private Voreinstellungen +commands.brushPresets.descr.changed=Beschreibung von Brush geändert! +commands.modify.next.skip=Schemic übersprungen. +commands.modify.previous.empty=Die Historie ist leer +commands.modify.previous.previous=Vorherige Schematic +commands.modify.selection.changed=Schema-Auswahl geändert. +commands.preset.descr.changed=Beschreibung der Voreinstellung geändert! +commands.preset.remove.removed=Voreinstellung entfernt. +commands.settings.preview.enable.false=Vorschau deaktiviert. +commands.settings.preview.enable.true=Vorschau aktiviert. +commands.settings.preview.subscribe.notEnabled=Spieler hat Vorschau nicht aktiviert +commands.settings.preview.subscribe.subscribed=Vorschau abonniert. +commands.settings.preview.unsubscribe.unsubscribed=Vorschau abbestellt. +commands.settings.showNames.hidden=Namen werden ausgeblendet. +commands.settings.showNames.pasted=Namen werden eingefügt. + +components.modifier.blockfilter.name=Block Filter +components.modifier.flip.fixed.name=Statisch +components.modifier.flip.list.name=Liste +components.modifier.flip.random.name=Zufällig +components.modifier.includeAir.fixed.name=Luft hinzufügen +components.modifier.offset.fixed.name=Statisch +components.modifier.offset.list.name=Liste +components.modifier.offset.range.name=Zufällig +components.modifier.placement.bottom.name=Boden +components.modifier.placement.drop.name=Fallen +components.modifier.placement.middle.name=Mitte +components.modifier.placement.original.name=Original +components.modifier.placement.raise.name=Erhöhen +components.modifier.placement.top.name=Oben +components.modifier.replaceAll.fixed.name=Alles ersetzen +components.modifier.rotation.fixed.name=Statisch +components.modifier.rotation.list.name=Liste +components.modifier.rotation.random.name=Zufällig +components.modifier.type.filter.description=Entferne Blöcke von der Schematic. +components.modifier.type.filter.name=Filter +components.modifier.type.flip.description=Spiegle die Schematic. +components.modifier.type.flip.name=Spiegeln +components.modifier.type.includeAir.description=Platziere Luft. Hat nur einen Effekt, wenn "Alles Ersetzen" aktiv ist. +components.modifier.type.includeAir.name=Luft platzieren +components.modifier.type.offset.description=Die Verschiebung der Schematic von ihrer originalen Platzierung. +components.modifier.type.offset.name=Verschiebung +components.modifier.type.placement.description=Definiere wie die Schematic platziert werden soll. +components.modifier.type.placement.name=Platzierung +components.modifier.type.replaceAll.description=Ersetze bestehende Blöcke +components.modifier.type.replaceAll.name=Alles Ersetzen +components.modifier.type.rotation.description=Rotiere die Schematic. +components.modifier.type.rotation.name=Rotation +components.provider.filter.blockFilter.description=Exkludiere Blöcke beim einfügen +components.provider.filter.blockFilter.name=Block Filter +components.provider.flip.fixed.description=Ein statischer Spiegel Wert +components.provider.flip.fixed.name=Statisch +components.provider.flip.list.description=Eine Liste von möglichen Spiegelungen die zufällig ausgewählt werden. +components.provider.flip.list.name=Liste +components.provider.flip.random.description=Eine zufällige Spiegelung in alle Richtungen außer "up" +components.provider.flip.random.name=Zufällig +components.provider.includeAir.fixed.description=Ein statischer Wert der definiert ob Luft eingefügt werden soll. +components.provider.includeAir.fixed.name=Statisch +components.provider.offset.fixed.description=Eine statische Verschiebung +components.provider.offset.fixed.name=Statisch +components.provider.offset.list.description=Eine Liste von möglichen Verschiebungen die zufällig ausgewählt werden. +components.provider.offset.list.name=Liste +components.provider.offset.range.description=Ein Bereich aus dem Verschiebungen ausgewählt werden. Obere und untere Grenze sind inklusive. +components.provider.offset.range.name=Bereich +components.provider.placement.bottom.description=Untere Grenze +components.provider.placement.bottom.name=Unten +components.provider.placement.drop.description=Unterster nicht Luft Block +components.provider.placement.drop.name=Fallen +components.provider.placement.middle.description=Zentrum der Schematic +components.provider.placement.middle.name=Mitte +components.provider.placement.original.description=Originale relative Position beim Speichern +components.provider.placement.original.name=Original +components.provider.placement.raise.description=Höchster nicht Luft Block +components.provider.placement.raise.name=Erhöhen +components.provider.placement.top.description=Obere Grenze +components.provider.placement.top.name=Oben +components.provider.replaceAll.fixed.description=ein statischer Wert der es erlaubt nicht Lust Blöcke zu ersetzen. +components.provider.replaceAll.fixed.name=Statisch +components.provider.rotation.fixed.description=Eine statische Rotation. +components.provider.rotation.fixed.name=Statisch +components.provider.rotation.list.description=Eine Liste möglicher Rotationen. +components.provider.rotation.list.name=Liste +components.provider.rotation.random.description=Zufällige Rotationen in 90° Schritten +components.provider.rotation.random.name=Zufällig +components.provider.selection.lockedOrdered.description=Eine Selektor der auf der aktuellen Schematic bleibt bis zur nächsten Schematic gesprungen werden soll. Die nächste Schematic ist entweder die nächste in alphabetischer Reihenfolge im aktuellen Set oder die Erste im nächsten Set. +components.provider.selection.lockedOrdered.name=Statisch Geordnet +components.provider.selection.lockedRandom.description=Eine Selektor der auf der aktuellen Schematic bleibt bis zur nächsten Schematic gesprungen werden soll. Die Nächste Schematic ist eine zufällige aber andere Schematic. +components.provider.selection.lockedRandom.name=Statisch Zufällig +components.provider.selection.ordered.description=Ein Selektor der die nächste in alphabetischer Reihenfolge im aktuellen Set oder die Erste im nächsten Set zurückgibt. +components.provider.selection.ordered.name=Geordnet +components.provider.selection.random.description=Ein Selektor der eine zufällige, aber andere Schematic zurückgibt. +components.provider.selection.random.name=Zufällig +components.provider.selector.directory.description=Wähle Schematic in einem Verzeichnis aus.\nNutze /* als Verzeichnis um Unterverzeichnisse auszuwählen.\nNutze das zweite Argument um Schematics nach Namen zu filtern in den Verzeichnissen. +components.provider.selector.directory.name=Verzeichnis +components.provider.selector.name.description=Wähle Schematics basierend auf ihren Namen aus.\nNutze * als einen Platzhalter. +components.provider.selector.name.name=Name +components.provider.selector.regex.description=Wähle Schematics mit einem RegEx aus\nProbiere es auf regex101.com aus. +components.provider.selector.regex.name=RegEx +components.selector.directory.name=Verzeichnis +components.selector.name.name=Name +components.selector.regex.name=RegEx + +dialog.accept=Akzeptieren +dialog.add=Hinzufügen +dialog.deny=Ablehnen +dialog.leftClickChange=Linksklick zum ändern +dialog.remove=Entfernen +dialog.rightClickRemove=Rechsklick zum entfernen + +error.brushExists=Brush existiert bereits. Nutze -f zum Überschreiben. +error.emptyBrush=Brush ist leer. +error.invalidArguments=Ungültige Argumente. Syntax: +error.invalidBoolean=Ungültiger Wert, oder +error.invalidCommand=Ungültiger Befehl +error.invalidEnumValue=Ungültiger Wert. Gültige Werte sind . +error.invalidLength=Eingabe zu lang. Max: Zeichen. +error.invalidMaterial=Ungültiges Material. +error.invalidNumber=Ungültige Nummer +error.invalidRange=Der Wert ist außerhalb des Bereichs. Min: Max: +error.invalidSender=Dieser Command kann hier nicht ausgeführt werden. +error.invalidSetId=Ungültige Set ID +error.missingArgument=Argument wird gelesen, aber existiert nicht. +error.modifierRequired=Dieser Modifier ist erforderlich. +error.noMatchSelector=Keine Schematics treffen auf diesen Selektor zu. +error.notABrush=Das ist kein Schematic Brush. +error.notAsConsole=Dieser Befehl kann nicht in der Konsole ausgeführt werden. +error.notAsPlayer=Dieser Befehl kann nicht als Spieler ausgeführt werden. +error.notOnline=Ungültiger Spieler. Dieser Spieler ist nicht online +error.oneschematic=Der Brush enthält nur eine Schematic. +error.onlyConsole=Dieser Befehl kann nur in der Konsole verwendet werden. +error.onlyPlayer=Dieser Befehl kann nur als Spieler verwendet werden- +error.permission=Du hast nicht die Berechtigung das zu tun. () +error.presetExists=Vorlage existiert bereits. Nutze -f zum Überschreiben +error.tooLarge=Nummer ist zu groß. Max: +error.tooSmall=Nummer ist zu klein. Min: +error.unknownBrush=Brush existiert nicht. +error.unknownModifier=Unbekannter Modifier +error.unknownModifierType=Unbekannter Modifier Typ +error.unknownPlayer=Ungültiger Spieler. Dieser Spieler hat nicht auf deinem Server gespielt. +error.unknownPreset=Vorlage existiert nicht. +error.unknownWorld=Ungültige Welt. + +service.renderService.error.sizeExceeded=Schematic überschreitet die maximale Vorschaugröße. von + +words.add=Hinzufügen +words.and=und +words.back=Zurück +words.bind=Anwenden +words.brushPreset=Brush Vorlagen +words.change=Ändern +words.clear=Leeren +words.edit=Bearbeiten +words.global=Global +words.mode=mehr +words.none=None +words.preset=Vorlagen +words.private=Global +words.remove=Entfernen +words.schematicSets=Schematic Sets +words.schematics=Schematics +words.selector=Selektor +words.sets=Sets +words.weight=Gewichtung diff --git a/schematicbrushreborn-core/src/main/resources/messages_en_US.properties b/schematicbrushreborn-core/src/main/resources/messages_en_US.properties index 3c46b9b8..d6398384 100644 --- a/schematicbrushreborn-core/src/main/resources/messages_en_US.properties +++ b/schematicbrushreborn-core/src/main/resources/messages_en_US.properties @@ -1,30 +1,188 @@ -about=%PLUGIN_NAME% by %AUTHORS%\nVersion: %VERSION%\nSpigot: %WEBSITE%\nSupport: %DISCORD% +about= by \nVersion: \nSpigot: \nSupport: + +command.brushpresets.remove.removed=Brush removed. + +commands.admin.migrate.migrationDone=Migration done +commands.admin.migrate.migrationStarted=Migration started +commands.admin.migrate.sourceTypeInvalid=Source type is invalid. +commands.admin.migrate.targetTypeInvalid=Target type is invalid. +commands.admin.reload.done=Schematic Brush Reborn reloaded. +commands.admin.reloadCache.done=Schematics reloaded. +commands.admin.restartRendering.done=Rendering restarted. +commands.brush.bind.bound=Brush bound. Using Schematics in Sets. +commands.brush.refresh.refreshFailed=Could not refresh schematics. +commands.brush.refresh.refreshSession=Schematics refreshed. +commands.brush.refresh.refreshed=Brush schematics refreshed. +commands.brush.saveBrush.saved=Brush Saved. +commands.brush.sessions.addModifiers=Add Modifiers +commands.brush.sessions.addPreset=Add Preset +commands.brush.sessions.loadBrush=Load Brush +commands.brush.sessions.menu=Schematic Brush Menu +commands.brush.sessions.refreshSchematics=Refresh Schematics +commands.brush.sessions.saveBrush=Save Brush +commands.brush.sessions.savePreset=Save Preset +commands.brush.sessions.weight=The weight of the schematic set when multiple sets are used.\nHigher numbers will result in more schematics from this set. +commands.brushPreset.info.global.title=Global Presets +commands.brushPreset.info.private.title=Private Presets +commands.brushPresets.descr.changed=Changed description of brush ! +commands.modify.next.skip=Skipped Schematic. +commands.modify.previous.empty=The history is empty +commands.modify.previous.previous=Previous Schematic +commands.modify.selection.changed=Schematic selection changed. +commands.preset.descr.changed=Changed description of preset ! +commands.preset.remove.removed=Preset removed. +commands.settings.preview.enable.false=Preview disabled. +commands.settings.preview.enable.true=Preview enabled. +commands.settings.preview.subscribe.notEnabled=Player has not preview enabled +commands.settings.preview.subscribe.subscribed=Subscribed to preview. +commands.settings.preview.unsubscribe.unsubscribed=Unsubscribed from preview. +commands.settings.showNames.hidden=Names will be hidden. +commands.settings.showNames.pasted=Names will be pasted. + +components.modifier.blockfilter.name=Block Filter +components.modifier.flip.fixed.name=Fixed +components.modifier.flip.list.name=List +components.modifier.flip.random.name=Random +components.modifier.includeAir.fixed.name=Include Air +components.modifier.offset.fixed.name=Fixed +components.modifier.offset.list.name=List +components.modifier.offset.range.name=Random +components.modifier.placement.bottom.name=Bottom +components.modifier.placement.drop.name=Drop +components.modifier.placement.middle.name=Middle +components.modifier.placement.original.name=Original +components.modifier.placement.raise.name=Raise +components.modifier.placement.top.name=Top +components.modifier.replaceAll.fixed.name=Replace All +components.modifier.rotation.fixed.name=Fixed +components.modifier.rotation.list.name=List +components.modifier.rotation.random.name=Random +components.modifier.type.filter.description=Remove blocks from the schematic. +components.modifier.type.filter.name=Filter +components.modifier.type.flip.description=Flip a schematic. +components.modifier.type.flip.name=Flip +components.modifier.type.includeAir.description=Include air when placing. Will only have an effect when ReplaceAll is active. +components.modifier.type.includeAir.name=Include Air +components.modifier.type.offset.description=The schematic offset when placed. +components.modifier.type.offset.name=Offset +components.modifier.type.placement.description=Define how the schematic should be placed on the position. +components.modifier.type.placement.name=Placement +components.modifier.type.replaceAll.description=Replace non air blocks. +components.modifier.type.replaceAll.name=Replace All +components.modifier.type.rotation.description=Rotate a schematic. +components.modifier.type.rotation.name=Rotation +components.provider.filter.blockFilter.description=Exclude blocks from pasting +components.provider.filter.blockFilter.name= +components.provider.flip.fixed.description=A fixed flip value +components.provider.flip.fixed.name=Fixed +components.provider.flip.list.description=A list of possible flip values which will be chosen by random +components.provider.flip.list.name=List +components.provider.flip.random.description=A random flip value of all flip values except "up" +components.provider.flip.random.name=Random +components.provider.includeAir.fixed.description=A fixed value which defines if air should be pasted. +components.provider.includeAir.fixed.name=Fixed +components.provider.offset.fixed.description=A fixed offset value +components.provider.offset.fixed.name=Fixed +components.provider.offset.list.description=A list of possible offset values which will be chosen by random. +components.provider.offset.list.name=List +components.provider.offset.range.description=A offset range where the values will be between the min and max value (both inclusive) +components.provider.offset.range.name=Range +components.provider.placement.bottom.description=Lower bound +components.provider.placement.bottom.name=Bottom +components.provider.placement.drop.description=Lowest non-air block +components.provider.placement.drop.name=Drop +components.provider.placement.middle.description=Center of the schematic +components.provider.placement.middle.name=Middle +components.provider.placement.original.description=Original position when copied +components.provider.placement.original.name=Original +components.provider.placement.raise.description=Highest non-air block +components.provider.placement.raise.name=Raise +components.provider.placement.top.description=Upper bound +components.provider.placement.top.name=Top +components.provider.replaceAll.fixed.description=A fixed value to allow replacing existing non-air blocks. +components.provider.replaceAll.fixed.name=Fixed +components.provider.rotation.fixed.description=A fixed rotation. +components.provider.rotation.fixed.name=Fixed +components.provider.rotation.list.description=A list of rotations which will be chosen by random +components.provider.rotation.list.name=List +components.provider.rotation.random.description=A random rotation containing all allowed 90° rotations. +components.provider.rotation.random.name=Random +components.provider.selection.lockedOrdered.description=A selector which only skips to the next schematic when prompted. Next schematic will be the next in the order. +components.provider.selection.lockedOrdered.name=Locked Ordered +components.provider.selection.lockedRandom.description=A selector which only skips to the next schematic when prompted. Next schematic will be random. +components.provider.selection.lockedRandom.name=Locked Random +components.provider.selection.ordered.description=A selector which skips to the next schematic in the current order. +components.provider.selection.ordered.name=Ordered +components.provider.selection.random.description=A selector which skips to the next schematic. +components.provider.selection.random.name=Random +components.provider.selector.directory.description=Select schematics in a directory.\nUse dirname/* to select subdirectories as well.\nUse the second argument name filter to filter schematics in these directories +components.provider.selector.directory.name=Directory +components.provider.selector.name.description=Select schematics by name.\nUse a * as a wildcard. +components.provider.selector.name.name=Name +components.provider.selector.regex.description=Select schematics with a regex.\nWanna try it out first? Use regex101.com +components.provider.selector.regex.name=Regex +components.selector.directory.name=Directory +components.selector.name.name=Name +components.selector.regex.name=Regex + dialog.accept=accept dialog.add=add dialog.deny=deny dialog.leftClickChange=Left click to change dialog.remove=remove dialog.rightClickRemove=Right click to remove -error.invalidArguments=Invalid arguments. Syntax: %SYNTAX% -error.invalidBoolean=Invalid value, %TRUE% or %FALSE% + +error.brushExists=Brush already exists. Use -f to override +error.emptyBrush=Brush is empty. +error.invalidArguments=Invalid arguments. Syntax: +error.invalidBoolean=Invalid value, or error.invalidCommand=Invalid Command -error.invalidEnumValue=Invalid input value. Valid inputs are %VALUES%. -error.invalidLength=This input is too long. Max: %MAX% chars. +error.invalidEnumValue=Invalid input value. Valid inputs are . +error.invalidLength=This input is too long. Max: chars. error.invalidMaterial=Invalid material. error.invalidNumber=Invalid number -error.invalidRange=This value is out of range. Min: %MIN% Max: %MAX% +error.invalidRange=This value is out of range. Min: Max: error.invalidSender=This command can not be executed from here. -error.missingArgument=Argument %INDEX% is accessed but not present. +error.invalidSetId=Invalid set id. +error.missingArgument=Argument is accessed but not present. +error.modifierRequired=This modifier is required. +error.noMatchSelector=No schematics matching this selector. +error.notABrush=This is not a schematic brush. error.notAsConsole=This command can not be executed from console. error.notAsPlayer=This command can not be executed as player error.notOnline=Invalid player. This player is not online. +error.oneschematic=The brush contains only 1 schematic error.onlyConsole=This command can only be used by console. error.onlyPlayer=This command can only be used by players. -error.permission=You do not have the permissionNode to do this. (%PERMISSION%) -error.tooLarge=The number is too Large. Max: %MAX% -error.tooSmall=The number is too small. Min: %MIN% -error.unkownPlayer=Invalid player. This player has never played on this server. -error.unkownWorld=Invalid player. This player has never played on this server. -error.notABrush=This is not a schematic brush. -error.unkownPreset=Preset %NAME% does not exist. -error.unkownBrush=Brush %NAME% does not exist. +error.permission=You do not have the permissionNode to do this. () +error.presetExists=Preset already exists. Use -f to override +error.tooLarge=The number is too Large. Max: +error.tooSmall=The number is too small. Min: +error.unknownBrush=Brush does not exist. +error.unknownModifier=Unknown Modifier +error.unknownModifierType=Unknown modifier type +error.unknownPlayer=Invalid player. This player has never played on this server. +error.unknownPreset=Preset does not exist. +error.unknownWorld=Invalid World. + +service.renderService.error.sizeExceeded=Schematic exceeds the maximum render size. of + +words.add=Add +words.and=and +words.back=Back +words.bind=Bind +words.brushPreset=Brush Presets +words.change=Change +words.clear=Clear +words.edit=Edit +words.global=Global +words.more=more +words.none=None +words.preset=Presets +words.private=Global +words.remove=Remove +words.schematicSets=Schematic Sets +words.schematics=Schematics +words.selector=Selector +words.sets=Sets +words.weight=Weight diff --git a/schematicbrushreborn-paper-legacy/build.gradle.kts b/schematicbrushreborn-paper-legacy/build.gradle.kts index f361cd99..5eb19f61 100644 --- a/schematicbrushreborn-paper-legacy/build.gradle.kts +++ b/schematicbrushreborn-paper-legacy/build.gradle.kts @@ -8,6 +8,7 @@ val shadebase = "de.eldoria.schematicbrush.libs." dependencies { implementation(project(":schematicbrushreborn-core")) implementation(libs.bundles.jackson) + implementation(libs.bundles.utilities) implementation(libs.adventure.bukkit) implementation(libs.adventure.minimessage) } @@ -56,6 +57,7 @@ publishing { tasks { shadowJar { + relocate("org.bstats", shadebase + "bstats") relocate("de.eldoria.eldoutilities", shadebase + "eldoutilities") relocate("de.eldoria.jacksonbukkit", shadebase + "jacksonbukkit") relocate("de.eldoria.messageblocker", shadebase + "messageblocker") diff --git a/schematicbrushreborn-paper/build.gradle.kts b/schematicbrushreborn-paper/build.gradle.kts index a93d6a77..a1332944 100644 --- a/schematicbrushreborn-paper/build.gradle.kts +++ b/schematicbrushreborn-paper/build.gradle.kts @@ -7,7 +7,7 @@ val shadebase = "de.eldoria.schematicbrush.libs." dependencies { implementation(project(":schematicbrushreborn-core")) - bukkitLibrary(libs.bundles.jackson) + bukkitLibrary(libs.bundles.utilities) bukkitLibrary(libs.adventure.bukkit) } @@ -55,8 +55,7 @@ publishing { tasks { shadowJar { - relocate("de.eldoria.eldoutilities", shadebase + "eldoutilities") - relocate("de.eldoria.jacksonbukkit", shadebase + "jacksonbukkit") + relocate("org.bstats", shadebase + "bstats") relocate("de.eldoria.messageblocker", shadebase + "messageblocker") mergeServiceFiles() archiveVersion.set(rootProject.version as String) diff --git a/schematicbrushreborn-spigot/build.gradle.kts b/schematicbrushreborn-spigot/build.gradle.kts index 534b66ef..fe5c150d 100644 --- a/schematicbrushreborn-spigot/build.gradle.kts +++ b/schematicbrushreborn-spigot/build.gradle.kts @@ -6,6 +6,7 @@ plugins { val shadebase = "de.eldoria.schematicbrush.libs." dependencies { + bukkitLibrary(libs.bundles.utilities) bukkitLibrary(libs.jackson.yaml) bukkitLibrary(libs.bundles.jackson) bukkitLibrary(libs.adventure.bukkit) @@ -57,6 +58,7 @@ publishing { tasks { shadowJar { + relocate("org.bstats", shadebase + "bstats") relocate("de.eldoria.eldoutilities", shadebase + "eldoutilities") relocate("de.eldoria.jacksonbukkit", shadebase + "jacksonbukkit") relocate("de.eldoria.messageblocker", shadebase + "messageblocker") diff --git a/settings.gradle.kts b/settings.gradle.kts index d1f3f7c3..5a05cbc4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,7 +21,7 @@ dependencyResolutionManagement { versionCatalogs { create("libs") { // jackson & serialization - version("jackson", "2.15.3") + version("jackson", "2.17.2") library("jackson-databind", "com.fasterxml.jackson.core","jackson-databind").versionRef("jackson") library("jackson-annotations", "com.fasterxml.jackson.core","jackson-annotations").versionRef("jackson") library("jackson-yaml", "com.fasterxml.jackson.dataformat","jackson-dataformat-yaml").versionRef("jackson") @@ -32,8 +32,18 @@ dependencyResolutionManagement { library("adventure-bukkit", "net.kyori:adventure-platform-bukkit:4.3.3") library("adventure-minimessage", "net.kyori:adventure-text-minimessage:4.17.0") // utilities - library("eldoutil-legacy", "de.eldoria:eldo-util:1.14.4") - library("eldoutil-jackson", "de.eldoria.util:jackson-configuration:2.0.6") + version("utilities", "2.1.1") + library("eldoutil-plugin", "de.eldoria.util","plugin").versionRef("utilities") + library("eldoutil-jackson", "de.eldoria.util","jackson-configuration").versionRef("utilities") + library("eldoutil-serialization", "de.eldoria.util","legacy-serialization").versionRef("utilities") + library("eldoutil-metrics", "de.eldoria.util","metrics").versionRef("utilities") + library("eldoutil-updater", "de.eldoria.util","updater").versionRef("utilities") + library("eldoutil-crossversion", "de.eldoria.util","crossversion").versionRef("utilities") + bundle("utilities", listOf("eldoutil-jackson", "eldoutil-plugin", "eldoutil-serialization", "eldoutil-metrics", + "eldoutil-updater", "eldoutil-crossversion")) + + library("bstats", "org.bstats:bstats-bukkit:3.0.2") + library("messageblocker", "de.eldoria:messageblocker:1.1.3") // misc library("jetbrains-annotations", "org.jetbrains:annotations:24.1.0") @@ -45,15 +55,15 @@ dependencyResolutionManagement { library("paper-v17", "io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT") library("spigot-v16", "io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT") // world edit - library("worldedit", "com.sk89q.worldedit:worldedit-bukkit:7.3.0") - version("fawe", "2.9.2") + library("worldedit", "com.sk89q.worldedit:worldedit-bukkit:7.3.5") + version("fawe", "2.11.0") library("fawe-core", "com.fastasyncworldedit","FastAsyncWorldEdit-Core").versionRef("fawe") library("fawe-bukkit", "com.fastasyncworldedit","FastAsyncWorldEdit-Bukkit").versionRef("fawe") // plugins plugin("publishdata", "de.chojo.publishdata").version("1.4.0") plugin("spotless", "com.diffplug.spotless").version("6.25.0") - plugin("shadow", "com.github.johnrengelman.shadow").version("8.1.1") + plugin("shadow", "io.github.goooler.shadow").version("8.1.8") plugin("pluginyml-bukkit", "net.minecrell.plugin-yml.bukkit").version("0.6.0") //plugin("pluginyml-paper","net.minecrell.plugin-yml.paper").version( "0.5.3") diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..e6613cbb --- /dev/null +++ b/shell.nix @@ -0,0 +1,11 @@ +{ pkgs ? import {}, ... }: + +let +jdk = pkgs.jdk21; +gradle= pkgs.gradle.override { java = jdk; }; +in +pkgs.mkShell +{ + packages = with pkgs; [jdk gradle]; +} +