From 0839e8b16e248afbfe18b4ba01589a64f74e8119 Mon Sep 17 00:00:00 2001 From: nulli0n Date: Wed, 25 Jun 2025 17:41:43 +0500 Subject: [PATCH] Fixed maven url --- .../nightcore/NightCoreLoader.java | 10 +++++-- .../nightexpress/nightcore/core/CoreLang.java | 4 +-- .../util/placeholder/PlaceholderList.java | 28 +++++++++++++++---- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/main/src/main/java/su/nightexpress/nightcore/NightCoreLoader.java b/main/src/main/java/su/nightexpress/nightcore/NightCoreLoader.java index 2340b3c..b2882a2 100644 --- a/main/src/main/java/su/nightexpress/nightcore/NightCoreLoader.java +++ b/main/src/main/java/su/nightexpress/nightcore/NightCoreLoader.java @@ -6,14 +6,20 @@ import io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver; import org.eclipse.aether.artifact.DefaultArtifact; import org.eclipse.aether.graph.Dependency; import org.eclipse.aether.repository.RemoteRepository; +import org.jetbrains.annotations.NotNull; public class NightCoreLoader implements PluginLoader { @Override - public void classloader(PluginClasspathBuilder classpathBuilder) { + public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) { MavenLibraryResolver resolver = new MavenLibraryResolver(); - resolver.addRepository(new RemoteRepository.Builder("maven", "default", "https://repo1.maven.org/maven2/").build()); + try { + resolver.addRepository(new RemoteRepository.Builder("maven", "default", MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR).build()); + } + catch (NoSuchFieldError error) { + resolver.addRepository(new RemoteRepository.Builder("maven", "default", "https://maven-central.storage-download.googleapis.com/maven2").build()); + } resolver.addDependency(new Dependency(new DefaultArtifact("com.zaxxer:HikariCP:6.0.0"), null)); resolver.addDependency(new Dependency(new DefaultArtifact("it.unimi.dsi:fastutil-core:8.5.13"), null)); diff --git a/main/src/main/java/su/nightexpress/nightcore/core/CoreLang.java b/main/src/main/java/su/nightexpress/nightcore/core/CoreLang.java index 633c353..2c5a15f 100644 --- a/main/src/main/java/su/nightexpress/nightcore/core/CoreLang.java +++ b/main/src/main/java/su/nightexpress/nightcore/core/CoreLang.java @@ -202,11 +202,11 @@ public class CoreLang { ); public static final LangString EDITOR_BUTTON_CURRENT_INFO = LangString.of("Editor.Button.Current.Info", - LIGHT_YELLOW.wrap("● " + LIGHT_GRAY.wrap(GENERIC_NAME + ": ") + GENERIC_VALUE) + LIGHT_YELLOW.wrap("➥ " + GRAY.wrap(GENERIC_NAME + ": ") + GENERIC_VALUE) ); public static final LangString EDITOR_BUTTON_CLICK_KEY = LangString.of("Editor.Button.ClickKey", - LIGHT_YELLOW.wrap("[▶]") + " " + LIGHT_GRAY.wrap(GENERIC_NAME + " to " + LIGHT_YELLOW.wrap(GENERIC_VALUE) + ".") + LIGHT_YELLOW.wrap("→ " + UNDERLINED.wrap(GENERIC_NAME + " to " + GENERIC_VALUE)) ); diff --git a/main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderList.java b/main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderList.java index 9c5a3c0..7d4d543 100644 --- a/main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderList.java +++ b/main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderList.java @@ -11,7 +11,7 @@ import java.util.function.UnaryOperator; public class PlaceholderList { - private final List> entries; + private final Map> entries; public PlaceholderList() { this(new ArrayList<>()); @@ -22,7 +22,12 @@ public class PlaceholderList { } public PlaceholderList(@NotNull List> entries) { - this.entries = new ArrayList<>(entries); + //this.entries = new ArrayList<>(entries); + this(fromList(entries)); + } + + public PlaceholderList(@NotNull Map> entries) { + this.entries = new LinkedHashMap<>(entries); } @NotNull @@ -32,9 +37,18 @@ public class PlaceholderList { return placeholderList; } + @NotNull + private static Map> fromList(@NotNull List> entries) { + Map> map = new HashMap<>(); + + entries.forEach(entry -> map.put(entry.getKey().toLowerCase(), entry)); + + return map; + } + @NotNull public List> getEntries() { - return this.entries; + return new ArrayList<>(this.entries.values()); } @NotNull @@ -60,17 +74,21 @@ public class PlaceholderList { @NotNull public PlaceholderList add(@NotNull String key, @NotNull Function replacer) { - this.entries.add(new PlaceholderEntry<>(key, replacer)); + this.entries.put(key.toLowerCase(), new PlaceholderEntry<>(key, replacer)); return this; } + public boolean remove(@NotNull String key) { + return this.entries.remove(key.toLowerCase()) != null; + } + public void clear() { this.entries.clear(); } @NotNull public UnaryOperator replacer(@NotNull T source) { - return str -> StringUtil.replaceEach(str, this.entries, source); + return str -> StringUtil.replaceEach(str, this.getEntries(), source); } @NotNull