mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-15 20:12:02 +01:00
Fix wrong context optional check and arg being null
This commit is contained in:
parent
c253dc1322
commit
ec0000bc8a
@ -199,7 +199,7 @@ public class MVCommandContexts extends PaperCommandContexts {
|
||||
context.popFirstArg();
|
||||
return world;
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("World " + worldName + " is not a loaded multiverse world.");
|
||||
@ -225,7 +225,7 @@ public class MVCommandContexts extends PaperCommandContexts {
|
||||
}
|
||||
|
||||
String worldStrings = context.getFirstArg();
|
||||
String[] worldNames = worldStrings.split(",");
|
||||
String[] worldNames = worldStrings == null ? new String[0] : worldStrings.split(",");
|
||||
Set<MVWorld> worlds = new HashSet<>(worldNames.length);
|
||||
for (String worldName : worldNames) {
|
||||
if ("*".equals(worldName)) {
|
||||
@ -259,7 +259,7 @@ public class MVCommandContexts extends PaperCommandContexts {
|
||||
context.popFirstArg();
|
||||
return worlds.toArray(new MVWorld[0]);
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("World " + worldStrings + " is not a loaded multiverse world.");
|
||||
@ -303,7 +303,7 @@ public class MVCommandContexts extends PaperCommandContexts {
|
||||
context.popFirstArg();
|
||||
return player;
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Player " + playerIdentifier + " not found.");
|
||||
@ -348,7 +348,7 @@ public class MVCommandContexts extends PaperCommandContexts {
|
||||
context.popFirstArg();
|
||||
return players;
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Player " + playerIdentifier + " not found.");
|
||||
|
Loading…
Reference in New Issue
Block a user