Skip to content

Commit

Permalink
Release 2.7.0 (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs authored Jul 27, 2024
2 parents 2765c82 + 2a0d33b commit 76f9059
Show file tree
Hide file tree
Showing 97 changed files with 1,218 additions and 481 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.direnv
8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "de.eldoria"
version = "2.6.4"
version = "2.7.0"

var publishModules = setOf("schematicbrushreborn-api",
"schematicbrushreborn-core",
Expand Down Expand Up @@ -41,7 +41,9 @@ allprojects {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
toolchain{
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
withJavadocJar()
}
Expand All @@ -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) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion schematicbrushreborn-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<click:%s:'%s %s %s '><hover:show_text:'<%s>%s'>[%s]</hover></click>",
p.commandType(), baseCommand, type.name(), p.name(), Colors.NEUTRAL, p.description(), p.name()))
.map(p -> String.format("<click:%s:'%s %s %s '><hover:show_text:'<neutral>%s'>[%s]</hover></click>",
p.commandType(), baseCommand, type.name(), p.name(), p.localizedDescription(), p.localizedName()))
.collect(Collectors.joining(" "));
} else {
types = String.format("<click:%s:'%s %s %s '>[Change]</click>",
types = String.format("<click:%s:'%s %s %s '>[<i18n:words.change>]</click>",
filteredProvider.get(0).commandType(), baseCommand, type.name(), filteredProvider.get(0).name());
}

var remove = "";

if (!type.required()) {
remove = String.format("<%s><click:run_command:'%s %s'>[Remove]</click>", Colors.REMOVE, removeBaseCommand, type.name());
remove = String.format("<remove><click:run_command:'%s %s'>[<i18n:words.remove>]</click>", removeBaseCommand, type.name());
}

return String.format("<hover:show_text:'<%s>%s'><%s>%s:</hover> <%s>%s %s\n %s",
Colors.NEUTRAL, type.description(), Colors.HEADING, type.name(), Colors.CHANGE, types, remove,
return String.format("<hover:show_text:'<neutral>%s'><heading>%s:</hover> <change>%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("<name>%s%s<value>%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("<value>%s", provider.localizedDescriptor());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,55 @@

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.
* <p>
* A modifier is an extended {@link Nameable} which also has a description.
*/
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.
*/
public boolean required() {
return required;
}

public String getLocalizedName() {
return ILocalizer.escape(localizedName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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) {
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}

/**
Expand All @@ -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) {
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,37 @@ public abstract class ModifierProvider extends SettingProvider<Mutator<?>> {
*
* @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<? extends ConfigurationSerializable> 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<? extends ConfigurationSerializable> 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<? extends ConfigurationSerializable> clazz, String name, String localizedName, String description) {
super(clazz, name, localizedName, description);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ public abstract class SchematicSelectionProvider extends SettingProvider<Schemat
*
* @param clazz which is returned by the provider
* @param name name. Must be unique inside the provider.
* @deprecated Use {@link #SchematicSelectionProvider(Class, String, String, String)} and provide a localized name and description
*/
@SuppressWarnings("removal")
public SchematicSelectionProvider(Class<? extends ConfigurationSerializable> clazz, String name) {
super(clazz, name);
}

public SchematicSelectionProvider(Class<? extends ConfigurationSerializable> clazz, String name, String localizedName, String description) {
super(clazz, name, localizedName, description);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -23,12 +24,20 @@ public abstract class SelectorProvider extends SettingProvider<Selector> {
* @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<? extends Selector> clazz, String name, SchematicRegistry registry) {
super(clazz, name);
this.registry = registry;
}


public SelectorProvider(Class<? extends ConfigurationSerializable> clazz, String name, String localizedName, String description, SchematicRegistry registry) {
super(clazz, name, localizedName, description);
this.registry = registry;
}

/**
* Returns the provided registry
*
Expand Down
Loading

0 comments on commit 76f9059

Please sign in to comment.