mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-21 11:46:46 +01:00
Adds support to SlimeWorld plugins for loading worlds if they are unloaded
This commit is contained in:
parent
328212b0ca
commit
f301d02544
@ -0,0 +1,18 @@
|
|||||||
|
package com.bgsoftware.wildloaders.api.hooks;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public interface WorldsProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a world.
|
||||||
|
*
|
||||||
|
* @param worldName The name of the world
|
||||||
|
* @return The loaded world, or null if couldn't load the world.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
World loadWorld(String worldName);
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.bgsoftware.wildloaders.api.managers;
|
|||||||
|
|
||||||
import com.bgsoftware.wildloaders.api.hooks.ClaimsProvider;
|
import com.bgsoftware.wildloaders.api.hooks.ClaimsProvider;
|
||||||
import com.bgsoftware.wildloaders.api.hooks.TickableProvider;
|
import com.bgsoftware.wildloaders.api.hooks.TickableProvider;
|
||||||
|
import com.bgsoftware.wildloaders.api.hooks.WorldsProvider;
|
||||||
|
|
||||||
public interface ProvidersManager {
|
public interface ProvidersManager {
|
||||||
|
|
||||||
@ -17,4 +18,11 @@ public interface ProvidersManager {
|
|||||||
*/
|
*/
|
||||||
void addTickableProvider(TickableProvider tickableProvider);
|
void addTickableProvider(TickableProvider tickableProvider);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a worlds provider to the plugin.
|
||||||
|
*
|
||||||
|
* @param worldsProvider The worlds provider to add.
|
||||||
|
*/
|
||||||
|
void addWorldsProvider(WorldsProvider worldsProvider);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
19
Hooks/AdvancedSlimePaper/build.gradle
Normal file
19
Hooks/AdvancedSlimePaper/build.gradle
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
group 'Hooks:AdvancedSlimePaper'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly 'com.infernalsuite:AdvancedSlimePaper:1.19.4-R0.1'
|
||||||
|
compileOnly "org.spigotmc:v1_8_R3-Taco:latest"
|
||||||
|
compileOnly project(":API")
|
||||||
|
compileOnly rootProject
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.hasProperty('hook.compile_advancedslimepaper') &&
|
||||||
|
!Boolean.valueOf(project.findProperty("hook.compile_advancedslimepaper").toString())) {
|
||||||
|
project.tasks.all { task -> task.enabled = false }
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.bgsoftware.wildloaders.hooks;
|
||||||
|
|
||||||
|
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
||||||
|
import com.bgsoftware.wildloaders.api.hooks.WorldsProvider;
|
||||||
|
import com.infernalsuite.aswm.api.SlimePlugin;
|
||||||
|
import com.infernalsuite.aswm.api.loaders.SlimeLoader;
|
||||||
|
import com.infernalsuite.aswm.api.world.SlimeWorld;
|
||||||
|
import com.infernalsuite.aswm.api.world.properties.SlimePropertyMap;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WorldsProvider_AdvancedSlimePaper implements WorldsProvider {
|
||||||
|
|
||||||
|
private static final List<String> WORLD_LOADERS = Arrays.asList("file", "mysql", "mongodb", "redis", "api");
|
||||||
|
private static final SlimePropertyMap EMPTY_PROPERTIES = new SlimePropertyMap();
|
||||||
|
|
||||||
|
private final SlimePlugin slimePlugin;
|
||||||
|
|
||||||
|
public WorldsProvider_AdvancedSlimePaper() {
|
||||||
|
this.slimePlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World loadWorld(String worldName) {
|
||||||
|
for (String loaderName : WORLD_LOADERS) {
|
||||||
|
SlimeLoader slimeLoader = this.slimePlugin.getLoader(loaderName);
|
||||||
|
try {
|
||||||
|
if (slimeLoader != null && slimeLoader.worldExists(worldName)) {
|
||||||
|
SlimeWorld slimeWorld = slimePlugin.loadWorld(slimeLoader, worldName, false, EMPTY_PROPERTIES);
|
||||||
|
if (slimeWorld != null) {
|
||||||
|
slimePlugin.loadWorld(slimeWorld);
|
||||||
|
World bukkitWorld = Bukkit.getWorld(slimeWorld.getName());
|
||||||
|
if (bukkitWorld != null)
|
||||||
|
return bukkitWorld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception error) {
|
||||||
|
WildLoadersPlugin.log("An error occurred while trying to load world " + worldName);
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
Hooks/AdvancedSlimeWorldManager/build.gradle
Normal file
19
Hooks/AdvancedSlimeWorldManager/build.gradle
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
group 'Hooks:AdvancedSlimeWorldManager'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly "com.grinderwolf:slimeworldmanager-api:2.10.0"
|
||||||
|
compileOnly "org.spigotmc:v1_8_R3-Taco:latest"
|
||||||
|
compileOnly project(":API")
|
||||||
|
compileOnly rootProject
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.hasProperty('hook.compile_advancedslimeworldmanager') &&
|
||||||
|
!Boolean.valueOf(project.findProperty("hook.compile_advancedslimeworldmanager").toString())) {
|
||||||
|
project.tasks.all { task -> task.enabled = false }
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.bgsoftware.wildloaders.hooks;
|
||||||
|
|
||||||
|
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
||||||
|
import com.bgsoftware.wildloaders.api.hooks.WorldsProvider;
|
||||||
|
import com.grinderwolf.swm.api.SlimePlugin;
|
||||||
|
import com.grinderwolf.swm.api.loaders.SlimeLoader;
|
||||||
|
import com.grinderwolf.swm.api.world.SlimeWorld;
|
||||||
|
import com.grinderwolf.swm.api.world.properties.SlimePropertyMap;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WorldsProvider_AdvancedSlimeWorldManager implements WorldsProvider {
|
||||||
|
|
||||||
|
private static final List<String> WORLD_LOADERS = Arrays.asList("file", "mysql", "mongodb", "redis", "api");
|
||||||
|
private static final SlimePropertyMap EMPTY_PROPERTIES = new SlimePropertyMap();
|
||||||
|
|
||||||
|
private final SlimePlugin slimePlugin;
|
||||||
|
|
||||||
|
public WorldsProvider_AdvancedSlimeWorldManager() {
|
||||||
|
this.slimePlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World loadWorld(String worldName) {
|
||||||
|
for (String loaderName : WORLD_LOADERS) {
|
||||||
|
SlimeLoader slimeLoader = this.slimePlugin.getLoader(loaderName);
|
||||||
|
try {
|
||||||
|
if (slimeLoader != null && slimeLoader.worldExists(worldName)) {
|
||||||
|
SlimeWorld slimeWorld = slimePlugin.loadWorld(slimeLoader, worldName, false, EMPTY_PROPERTIES);
|
||||||
|
if (slimeWorld != null) {
|
||||||
|
World bukkitWorld = Bukkit.getWorld(slimeWorld.getName());
|
||||||
|
if (bukkitWorld != null)
|
||||||
|
return bukkitWorld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception error) {
|
||||||
|
WildLoadersPlugin.log("An error occurred while trying to load world " + worldName);
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
Hooks/SlimeWorldManager/build.gradle
Normal file
13
Hooks/SlimeWorldManager/build.gradle
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
group 'Hooks:SlimeWorldManager'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly "com.grinderwolf:slimeworldmanager-api:2.2.1"
|
||||||
|
compileOnly "org.spigotmc:v1_8_R3-Taco:latest"
|
||||||
|
compileOnly project(":API")
|
||||||
|
compileOnly rootProject
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.hasProperty('hook.compile_slimeworldmanager') &&
|
||||||
|
!Boolean.valueOf(project.findProperty("hook.compile_slimeworldmanager").toString())) {
|
||||||
|
project.tasks.all { task -> task.enabled = false }
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.bgsoftware.wildloaders.hooks;
|
||||||
|
|
||||||
|
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
||||||
|
import com.bgsoftware.wildloaders.api.hooks.WorldsProvider;
|
||||||
|
import com.grinderwolf.swm.api.SlimePlugin;
|
||||||
|
import com.grinderwolf.swm.api.loaders.SlimeLoader;
|
||||||
|
import com.grinderwolf.swm.api.world.SlimeWorld;
|
||||||
|
import com.grinderwolf.swm.api.world.properties.SlimePropertyMap;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WorldsProvider_SlimeWorldManager implements WorldsProvider {
|
||||||
|
|
||||||
|
private static final List<String> WORLD_LOADERS = Arrays.asList("file", "mysql", "mongodb", "redis", "api");
|
||||||
|
private static final SlimePropertyMap EMPTY_PROPERTIES = new SlimePropertyMap();
|
||||||
|
|
||||||
|
private final SlimePlugin slimePlugin;
|
||||||
|
|
||||||
|
public WorldsProvider_SlimeWorldManager() {
|
||||||
|
this.slimePlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World loadWorld(String worldName) {
|
||||||
|
for (String loaderName : WORLD_LOADERS) {
|
||||||
|
SlimeLoader slimeLoader = this.slimePlugin.getLoader(loaderName);
|
||||||
|
try {
|
||||||
|
if (slimeLoader != null && slimeLoader.worldExists(worldName)) {
|
||||||
|
SlimeWorld slimeWorld = slimePlugin.loadWorld(slimeLoader, worldName, false, EMPTY_PROPERTIES);
|
||||||
|
if (slimeWorld != null) {
|
||||||
|
World bukkitWorld = Bukkit.getWorld(slimeWorld.getName());
|
||||||
|
if (bukkitWorld != null)
|
||||||
|
return bukkitWorld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception error) {
|
||||||
|
WildLoadersPlugin.log("An error occurred while trying to load world " + worldName);
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,10 +8,13 @@ nms.compile_v1_17=true
|
|||||||
nms.compile_v1_18=true
|
nms.compile_v1_18=true
|
||||||
nms.compile_v1_19=true
|
nms.compile_v1_19=true
|
||||||
nms.compile_v1_20=true
|
nms.compile_v1_20=true
|
||||||
|
hook.compile_advancedslimepaper=true
|
||||||
|
hook.compile_advancedslimeworldmanager=true
|
||||||
hook.compile_epicspawners6=true
|
hook.compile_epicspawners6=true
|
||||||
hook.compile_epicspawners7=true
|
hook.compile_epicspawners7=true
|
||||||
hook.compile_factionsuuid=true
|
hook.compile_factionsuuid=true
|
||||||
hook.compile_factionsx=true
|
hook.compile_factionsx=true
|
||||||
hook.compile_lands=true
|
hook.compile_lands=true
|
||||||
hook.compile_massivefactions=true
|
hook.compile_massivefactions=true
|
||||||
|
hook.compile_slimeworldmanager=true
|
||||||
hook.compile_superiorskyblock=true
|
hook.compile_superiorskyblock=true
|
@ -9,6 +9,8 @@ rootProject.name = 'WildLoaders'
|
|||||||
|
|
||||||
include 'API'
|
include 'API'
|
||||||
include 'Hooks'
|
include 'Hooks'
|
||||||
|
include 'Hooks:AdvancedSlimePaper'
|
||||||
|
include 'Hooks:AdvancedSlimeWorldManager'
|
||||||
include 'Hooks:EpicSpawners6'
|
include 'Hooks:EpicSpawners6'
|
||||||
include 'Hooks:EpicSpawners7'
|
include 'Hooks:EpicSpawners7'
|
||||||
include 'Hooks:EpicSpawners8'
|
include 'Hooks:EpicSpawners8'
|
||||||
@ -16,6 +18,7 @@ include 'Hooks:FactionsUUID'
|
|||||||
include 'Hooks:FactionsX'
|
include 'Hooks:FactionsX'
|
||||||
include 'Hooks:Lands'
|
include 'Hooks:Lands'
|
||||||
include 'Hooks:MassiveFactions'
|
include 'Hooks:MassiveFactions'
|
||||||
|
include 'Hooks:SlimeWorldManager'
|
||||||
include 'Hooks:SuperiorSkyblock'
|
include 'Hooks:SuperiorSkyblock'
|
||||||
include 'NMS'
|
include 'NMS'
|
||||||
include 'NMS:v1_7_R4'
|
include 'NMS:v1_7_R4'
|
||||||
|
@ -3,12 +3,10 @@ package com.bgsoftware.wildloaders.handlers;
|
|||||||
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
||||||
import com.bgsoftware.wildloaders.api.loaders.LoaderData;
|
import com.bgsoftware.wildloaders.api.loaders.LoaderData;
|
||||||
import com.bgsoftware.wildloaders.utils.BlockPosition;
|
import com.bgsoftware.wildloaders.utils.BlockPosition;
|
||||||
import com.bgsoftware.wildloaders.utils.ServerVersion;
|
|
||||||
import com.bgsoftware.wildloaders.utils.database.Database;
|
import com.bgsoftware.wildloaders.utils.database.Database;
|
||||||
import com.bgsoftware.wildloaders.utils.threads.Executor;
|
import com.bgsoftware.wildloaders.utils.threads.Executor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -54,6 +52,10 @@ public final class DataHandler {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
World world = blockPosition.getWorld();
|
World world = blockPosition.getWorld();
|
||||||
|
if (world == null)
|
||||||
|
// Try loading the world
|
||||||
|
world = plugin.getProviders().loadWorld(blockPosition.getWorldName());
|
||||||
|
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
Location location = blockPosition.getLocation();
|
Location location = blockPosition.getLocation();
|
||||||
plugin.getLoaders().addChunkLoaderWithoutDBSave(loaderData.get(), placer,
|
plugin.getLoaders().addChunkLoaderWithoutDBSave(loaderData.get(), placer,
|
||||||
|
@ -3,15 +3,19 @@ package com.bgsoftware.wildloaders.handlers;
|
|||||||
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
||||||
import com.bgsoftware.wildloaders.api.hooks.ClaimsProvider;
|
import com.bgsoftware.wildloaders.api.hooks.ClaimsProvider;
|
||||||
import com.bgsoftware.wildloaders.api.hooks.TickableProvider;
|
import com.bgsoftware.wildloaders.api.hooks.TickableProvider;
|
||||||
|
import com.bgsoftware.wildloaders.api.hooks.WorldsProvider;
|
||||||
import com.bgsoftware.wildloaders.api.managers.ProvidersManager;
|
import com.bgsoftware.wildloaders.api.managers.ProvidersManager;
|
||||||
import com.bgsoftware.wildloaders.utils.threads.Executor;
|
import com.bgsoftware.wildloaders.utils.threads.Executor;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -20,11 +24,13 @@ public final class ProvidersHandler implements ProvidersManager {
|
|||||||
|
|
||||||
private final WildLoadersPlugin plugin;
|
private final WildLoadersPlugin plugin;
|
||||||
|
|
||||||
private final List<ClaimsProvider> claimsProviders = new ArrayList<>();
|
private final List<ClaimsProvider> claimsProviders = new LinkedList<>();
|
||||||
private final List<TickableProvider> tickableProviders = new ArrayList<>();
|
private final List<TickableProvider> tickableProviders = new LinkedList<>();
|
||||||
|
private final List<WorldsProvider> worldsProviders = new LinkedList<>();
|
||||||
|
|
||||||
public ProvidersHandler(WildLoadersPlugin plugin) {
|
public ProvidersHandler(WildLoadersPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
loadWorldProviders();
|
||||||
Executor.sync(() -> {
|
Executor.sync(() -> {
|
||||||
loadClaimsProviders();
|
loadClaimsProviders();
|
||||||
loadTickableProviders();
|
loadTickableProviders();
|
||||||
@ -64,7 +70,7 @@ public final class ProvidersHandler implements ProvidersManager {
|
|||||||
if (version.startsWith("6")) {
|
if (version.startsWith("6")) {
|
||||||
Optional<TickableProvider> tickableProvider = createInstance("TickableProvider_EpicSpawners6");
|
Optional<TickableProvider> tickableProvider = createInstance("TickableProvider_EpicSpawners6");
|
||||||
tickableProvider.ifPresent(this::addTickableProvider);
|
tickableProvider.ifPresent(this::addTickableProvider);
|
||||||
} else if(version.startsWith("7")) {
|
} else if (version.startsWith("7")) {
|
||||||
Optional<TickableProvider> tickableProvider = createInstance("TickableProvider_EpicSpawners7");
|
Optional<TickableProvider> tickableProvider = createInstance("TickableProvider_EpicSpawners7");
|
||||||
tickableProvider.ifPresent(this::addTickableProvider);
|
tickableProvider.ifPresent(this::addTickableProvider);
|
||||||
} else {
|
} else {
|
||||||
@ -74,16 +80,42 @@ public final class ProvidersHandler implements ProvidersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadWorldProviders() {
|
||||||
|
Optional<WorldsProvider> worldsProvider;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName("com.infernalsuite.aswm.api.SlimePlugin");
|
||||||
|
worldsProvider = createInstance("WorldsProvider_AdvancedSlimePaper");
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
try {
|
||||||
|
Class.forName("com.grinderwolf.swm.nms.world.AbstractSlimeNMSWorld");
|
||||||
|
worldsProvider = createInstance("WorldsProvider_AdvancedSlimeWorldManager");
|
||||||
|
} catch (Throwable error) {
|
||||||
|
worldsProvider = createInstance("WorldsProvider_SlimeWorldManager");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
worldsProvider.ifPresent(this::addWorldsProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addClaimsProvider(ClaimsProvider claimsProvider) {
|
public void addClaimsProvider(ClaimsProvider claimsProvider) {
|
||||||
|
Preconditions.checkNotNull(claimsProvider, "claimsProvider cannot be null");
|
||||||
claimsProviders.add(claimsProvider);
|
claimsProviders.add(claimsProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTickableProvider(TickableProvider tickableProvider) {
|
public void addTickableProvider(TickableProvider tickableProvider) {
|
||||||
|
Preconditions.checkNotNull(tickableProvider, "tickableProvider cannot be null");
|
||||||
tickableProviders.add(tickableProvider);
|
tickableProviders.add(tickableProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWorldsProvider(WorldsProvider worldsProvider) {
|
||||||
|
Preconditions.checkNotNull(worldsProvider, "worldsProvider cannot be null");
|
||||||
|
worldsProviders.add(worldsProvider);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasChunkAccess(UUID player, Chunk chunk) {
|
public boolean hasChunkAccess(UUID player, Chunk chunk) {
|
||||||
for (ClaimsProvider claimsProvider : claimsProviders) {
|
for (ClaimsProvider claimsProvider : claimsProviders) {
|
||||||
if (claimsProvider.hasClaimAccess(player, chunk))
|
if (claimsProvider.hasClaimAccess(player, chunk))
|
||||||
@ -97,6 +129,17 @@ public final class ProvidersHandler implements ProvidersManager {
|
|||||||
tickableProviders.forEach(tickableProvider -> tickableProvider.tick(chunks));
|
tickableProviders.forEach(tickableProvider -> tickableProvider.tick(chunks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public World loadWorld(String worldName) {
|
||||||
|
for (WorldsProvider worldsProvider : this.worldsProviders) {
|
||||||
|
World loadedWorld = worldsProvider.loadWorld(worldName);
|
||||||
|
if (loadedWorld != null)
|
||||||
|
return loadedWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private <T> Optional<T> createInstance(String className) {
|
private <T> Optional<T> createInstance(String className) {
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName("com.bgsoftware.wildloaders.hooks." + className);
|
Class<?> clazz = Class.forName("com.bgsoftware.wildloaders.hooks." + className);
|
||||||
|
Loading…
Reference in New Issue
Block a user