Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ allprojects {

// Root-project-specific dependencies
dependencies {
implementation "me.lucko:fabric-permissions-api:${project.permissions_api_version}"

// JIJ Dependencies (include for packaging)
implementation "me.lucko:fabric-permissions-api:${project.permissions_api_version}"
include "me.lucko:fabric-permissions-api:${project.permissions_api_version}"
include "eu.pb4:placeholder-api:${project.placeholder_api_version}"
include "xyz.nucleoid:server-translations-api:${project.server_translations_api_version}"
implementation "org.yaml:snakeyaml:${project.snakeyaml_version}"
Expand Down
41 changes: 22 additions & 19 deletions ec-core/src/main/java/dev/jpcode/eccore/config/ConfigUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.util.GsonHelper;
import com.google.gson.JsonNull;
import com.google.gson.JsonSyntaxException;
Expand All @@ -28,8 +30,8 @@ public final class ConfigUtil {

private ConfigUtil() {}

// TODO do not delclair serializer objects out here. Pretty sure is bad for concurrent parsing.
// private static final Style.Serializer STYLE_JSON_DESERIALIZER = new Style.Serializer();
// TODO do not declare serializer objects out here. Pretty sure is bad for concurrent parsing.
// private static final Style.Serializer STYLE_JSON_DESERIALIZER = new Style.Serializer();

public static Style parseStyleOrDefault(String styleStr, String defaultStyleStr) {
Style outStyle = null;
Expand All @@ -49,26 +51,27 @@ public static Style parseStyleOrDefault(String styleStr, String defaultStyleStr)

@Nullable
public static Style parseStyle(String styleStr) {
Style outStyle = null;
ChatFormatting formatting = ChatFormatting.getByName(styleStr);
if (formatting != null) {
outStyle = Style.EMPTY.applyFormat(formatting);
}

if (outStyle == null) {
try {
outStyle = Style.Serializer.CODEC.parse(
JsonOps.INSTANCE,
GsonHelper.parse(styleStr)
).result().orElse(null);
} catch (JsonSyntaxException e) {
LOGGER.log(Level.ERROR, String.format(
"Malformed Style JSON in config: %s", styleStr
));
{
var simpleFormattingStyle = TextColor.parseColor(styleStr)
.result()
.map(Style.EMPTY::withColor);
if (simpleFormattingStyle.isPresent()) {
return simpleFormattingStyle.get();
}
}

return outStyle;
try {
var styleJson = GsonHelper.parse(styleStr);
return Style.Serializer.CODEC
.parse(JsonOps.INSTANCE, styleJson)
.result()
.orElse(null);
} catch (JsonSyntaxException e) {
LOGGER.log(Level.ERROR, String.format(
"Malformed Style JSON in config: %s", styleStr
));
return null;
}
}

public static Component parseTextOrDefault(String textStr, String defaultTextStr) {
Expand Down
20 changes: 9 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx2048M

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=26.1.1
loader_version=0.18.6
loom_version=1.16-SNAPSHOT
minecraft_version=26.2-rc-2
loader_version=0.18.3
loom_version=1.17-SNAPSHOT

# Fabric API
fabric_api_version=0.145.4+26.1.1
fabric_api_version=0.152.1+26.2

# Mod Properties
mod_name = Essential Commands
Expand All @@ -19,23 +19,21 @@ maven_group = com.fibermc
archives_base_name = essential_commands

# Common Publishing
game_versions=26.1.1
game_versions=26.2
gh_owner=John-Paul-R
gh_repo=essential-commands

# Dependencies
# check this on https://github.com/lucko/fabric-permissions-api/releases
permissions_api_version=0.7.0
# check this on https://github.com/Patbox/TextPlaceholderAPI/releases
placeholder_api_version=3.0.0-beta.2+26.1
placeholder_api_version=3.1.0-beta.1+26.2
# check this on https://maven.nucleoid.xyz/xyz/nucleoid/server-translations-api/
server_translations_api_version=3.0.3+26.1
server_translations_api_version=3.1.0+26.2
# check this on https://github.com/Ladysnake/PlayerAbilityLib/releases
pal_version=1.16.0
# check this on https://github.com/DrexHD/Vanish/releases
vanish_version=1.6.8+26.1
vanish_version=1.6.11+26.2-rc-2
# check this on https://github.com/TerraformersMC/ModMenu/releases
mod_menu_version=18.0.0-alpha.8
mod_menu_version=20.0.0-beta.2

snakeyaml_version=2.5
jetbrains_annotations_version=22.0.0
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 1 addition & 4 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 10 additions & 22 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading