Verified Commit dced5d80 authored by Yannick Schinko's avatar Yannick Schinko
Browse files

Updated to MultiPlatformCore 1.2.3 and used new features

parent 63186753
......@@ -14,6 +14,6 @@ caffeine_version=2.8.0
configurate_version=3.6.1
luckPerms_version=5.2
multiPlatformCore_version=1.2.1.+
multiPlatformCore_version=1.2.3.+
slf4j_version=1.7.25
slf4jPlugin_version=1.2.0.39
......@@ -3,6 +3,8 @@ package team.aura_dev.aurasudo.platform.common;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import lombok.Getter;
import lombok.SneakyThrows;
......@@ -15,6 +17,7 @@ import team.aura_dev.aurasudo.platform.common.context.SudoContextCalculator;
import team.aura_dev.aurasudo.platform.common.dependency.RuntimeDependencies;
import team.aura_dev.aurasudo.platform.common.player.PlayerManagerCommon;
import team.aura_dev.lib.multiplatformcore.DependencyClassLoader;
import team.aura_dev.lib.multiplatformcore.dependency.RuntimeDependency;
import team.aura_dev.lib.multiplatformcore.download.DependencyDownloader;
import team.aura_dev.lib.multiplatformcore.download.DependencyList;
......@@ -67,6 +70,9 @@ public abstract class AuraSudoBase implements AuraSudoApi, AuraSudoBaseBootstrap
// We need Configurate for the config
dependencyList.add(RuntimeDependencies.CONFIGURATE_HOCON);
// Don't load platform dependencies at all
getPlatformDependencies().forEach(dependencyList::deny);
return dependencyList;
}
......@@ -74,9 +80,22 @@ public abstract class AuraSudoBase implements AuraSudoApi, AuraSudoBaseBootstrap
// We need caffeine as a loading cache in several classes
dependencyList.add(RuntimeDependencies.CAFFEINE);
// Don't load platform dependencies at all
getPlatformDependencies().forEach(dependencyList::deny);
return dependencyList;
}
/**
* A list of dependencies that are on the platform and therefore need not be loaded.<br>
* By default this list is empty.
*
* @return A list of dependencies present on the platform
*/
public Collection<RuntimeDependency> getPlatformDependencies() {
return Collections.emptyList();
}
protected abstract PlayerManagerCommon generatePlayerManager();
protected abstract void registerEventListeners();
......
package team.aura_dev.aurasudo.platform.sponge;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import org.spongepowered.api.Platform;
import org.spongepowered.api.Sponge;
import team.aura_dev.aurasudo.api.AuraSudo;
import team.aura_dev.aurasudo.platform.common.AuraSudoBase;
import team.aura_dev.aurasudo.platform.common.dependency.RuntimeDependencies;
import team.aura_dev.aurasudo.platform.common.player.PlayerManagerCommon;
import team.aura_dev.aurasudo.platform.sponge.listener.PlayerEventListenerSponge;
import team.aura_dev.aurasudo.platform.sponge.player.PlayerManagerSponge;
import team.aura_dev.lib.multiplatformcore.DependencyClassLoader;
import team.aura_dev.lib.multiplatformcore.download.DependencyList;
import team.aura_dev.lib.multiplatformcore.dependency.RuntimeDependency;
public class AuraSudoSponge extends AuraSudoBase {
private final AuraSudoSpongeBootstrap plugin;
......@@ -35,9 +38,9 @@ public class AuraSudoSponge extends AuraSudoBase {
}
@Override
public DependencyList getEarlyDependencies(DependencyList dependencyList) {
// Super only adds CONFIGURATE_HOCON, which we have
return dependencyList;
public Collection<RuntimeDependency> getPlatformDependencies() {
// Caffeine is outdated, else we could remove it as well
return Collections.singleton(RuntimeDependencies.CONFIGURATE_HOCON);
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment