mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-04 06:31:28 +01:00
Implement getPotentialWorlds
This commit is contained in:
parent
80ff02a92b
commit
fda0e038f5
@ -141,7 +141,7 @@ public class MVCommandCompletions extends PaperCommandCompletions {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
case "potential" -> {
|
case "potential" -> {
|
||||||
return Collections.emptyList(); // TODO: Implement getPotentialWorlds
|
return worldManager.getPotentialWorlds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logging.severe("Invalid MVWorld scope: " + scope);
|
Logging.severe("Invalid MVWorld scope: " + scope);
|
||||||
|
@ -29,7 +29,9 @@ import org.jvnet.hk2.annotations.Service;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -343,6 +345,16 @@ public class WorldManager {
|
|||||||
return Result.success(DeleteWorldResult.Success.DELETED);
|
return Result.success(DeleteWorldResult.Success.DELETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getPotentialWorlds() {
|
||||||
|
File[] files = Bukkit.getWorldContainer().listFiles();
|
||||||
|
if (files == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return Arrays.stream(files).filter(worldNameChecker::isValidWorldFolder)
|
||||||
|
.map(File::getName)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
public Option<OfflineWorld> getOfflineOnlyWorld(@Nullable String worldName) {
|
public Option<OfflineWorld> getOfflineOnlyWorld(@Nullable String worldName) {
|
||||||
return isMVWorld(worldName) ? Option.none() : Option.of(offlineWorldsMap.get(worldName));
|
return isMVWorld(worldName) ? Option.none() : Option.of(offlineWorldsMap.get(worldName));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user