Fixed maven url

This commit is contained in:
nulli0n committed 2025-06-25 17:41:43 +05:00
1 parent 432eca7513
commit 0839e8b16e
3 files changed
+33 -9

No files matched your search

@@ -6,14 +6,20 @@ import io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver;
import org.eclipse.aether.artifact.DefaultArtifact; import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.graph.Dependency; import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.repository.RemoteRepository; import org.eclipse.aether.repository.RemoteRepository;
import org.jetbrains.annotations.NotNull;
public class NightCoreLoader implements PluginLoader { public class NightCoreLoader implements PluginLoader {
@Override @Override
public void classloader(PluginClasspathBuilder classpathBuilder) { public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) {
MavenLibraryResolver resolver = new MavenLibraryResolver(); 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("com.zaxxer:HikariCP:6.0.0"), null));
resolver.addDependency(new Dependency(new DefaultArtifact("it.unimi.dsi:fastutil-core:8.5.13"), null)); resolver.addDependency(new Dependency(new DefaultArtifact("it.unimi.dsi:fastutil-core:8.5.13"), null));
@@ -202,11 +202,11 @@ public class CoreLang {
); );
public static final LangString EDITOR_BUTTON_CURRENT_INFO = LangString.of("Editor.Button.Current.Info", 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", 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))
); );
@@ -11,7 +11,7 @@ import java.util.function.UnaryOperator;
public class PlaceholderList<T> { public class PlaceholderList<T> {
private final List<PlaceholderEntry<T>> entries; private final Map<String, PlaceholderEntry<T>> entries;
public PlaceholderList() { public PlaceholderList() {
this(new ArrayList<>()); this(new ArrayList<>());
@@ -22,7 +22,12 @@ public class PlaceholderList<T> {
} }
public PlaceholderList(@NotNull List<PlaceholderEntry<T>> entries) { public PlaceholderList(@NotNull List<PlaceholderEntry<T>> entries) {
this.entries = new ArrayList<>(entries); //this.entries = new ArrayList<>(entries);
this(fromList(entries));
}
public PlaceholderList(@NotNull Map<String, PlaceholderEntry<T>> entries) {
this.entries = new LinkedHashMap<>(entries);
} }
@NotNull @NotNull
@@ -32,9 +37,18 @@ public class PlaceholderList<T> {
return placeholderList; return placeholderList;
} }
@NotNull
private static <T> Map<String, PlaceholderEntry<T>> fromList(@NotNull List<PlaceholderEntry<T>> entries) {
Map<String, PlaceholderEntry<T>> map = new HashMap<>();
entries.forEach(entry -> map.put(entry.getKey().toLowerCase(), entry));
return map;
}
@NotNull @NotNull
public List<PlaceholderEntry<T>> getEntries() { public List<PlaceholderEntry<T>> getEntries() {
return this.entries; return new ArrayList<>(this.entries.values());
} }
@NotNull @NotNull
@@ -60,17 +74,21 @@ public class PlaceholderList<T> {
@NotNull @NotNull
public PlaceholderList<T> add(@NotNull String key, @NotNull Function<T, String> replacer) { public PlaceholderList<T> add(@NotNull String key, @NotNull Function<T, String> replacer) {
this.entries.add(new PlaceholderEntry<>(key, replacer)); this.entries.put(key.toLowerCase(), new PlaceholderEntry<>(key, replacer));
return this; return this;
} }
public boolean remove(@NotNull String key) {
return this.entries.remove(key.toLowerCase()) != null;
}
public void clear() { public void clear() {
this.entries.clear(); this.entries.clear();
} }
@NotNull @NotNull
public UnaryOperator<String> replacer(@NotNull T source) { public UnaryOperator<String> replacer(@NotNull T source) {
return str -> StringUtil.replaceEach(str, this.entries, source); return str -> StringUtil.replaceEach(str, this.getEntries(), source);
} }
@NotNull @NotNull