mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-25 12:05:14 +01:00
Add getAvailableWorldGenerators method to WorldManager,
This commit is contained in:
parent
835ca69b78
commit
e2bf1a2bbe
@ -158,6 +158,13 @@ public interface MVWorldManager {
|
||||
*/
|
||||
ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName);
|
||||
|
||||
/**
|
||||
* Get possible generator plugins.
|
||||
*
|
||||
* @return A list of plugin names that is detected to have a chunk generator.
|
||||
*/
|
||||
List<String> getAvailableWorldGenerators();
|
||||
|
||||
/**
|
||||
* Returns a list of all the worlds Multiverse knows about.
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ import java.util.Stack;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Public facing API to add/remove Multiverse worlds.
|
||||
@ -104,6 +105,21 @@ public class WorldManager implements MVWorldManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public List<String> getAvailableWorldGenerators() {
|
||||
return Arrays.stream(Bukkit.getServer().getPluginManager().getPlugins())
|
||||
.filter(Plugin::isEnabled)
|
||||
.filter(plugin -> this.plugin.getUnsafeCallWrapper().wrap(
|
||||
() -> plugin.getDefaultWorldGenerator("world", ""),
|
||||
plugin.getName(),
|
||||
"Get generator"
|
||||
) != null)
|
||||
.map(plugin -> plugin.getDescription().getName())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #cloneWorld(String, String)} instead.
|
||||
|
Loading…
Reference in New Issue
Block a user