Clarify state when asking for caps with no platforms (+ fuzzy system changes)

This commit is contained in:
Kenzie Togami
2018-12-28 22:20:12 -08:00
committed by IronApollo
parent 7d7da78dbc
commit 8f11d0469b
3 changed files with 40 additions and 18 deletions

View File

@ -170,8 +170,13 @@ public class PlatformManager {
if (platform != null) {
return platform;
} else {
if (preferences.isEmpty() && !platforms.isEmpty()) {
return platforms.get(0); // Use the first available if preferences have not been decided yet.
if (preferences.isEmpty()) {
// Use the first available if preferences have not been decided yet.
if (platforms.isEmpty()) {
// No platforms registered, this is being called too early!
throw new NoCapablePlatformException("No platforms have been registered yet! Please wait until WorldEdit is initialized.");
}
return platforms.get(0);
}
throw new NoCapablePlatformException("No platform was found supporting " + capability.name());
}