Fix incorrect inputQueue usage in some argument types
This commit is contained in:
parent
33c51967e2
commit
c26fbcb6fc
8 changed files with 13 additions and 7 deletions
|
|
@ -181,14 +181,15 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
if (!this.liberal) {
|
if (!this.liberal) {
|
||||||
if (input.equalsIgnoreCase("true")) {
|
if (input.equalsIgnoreCase("true")) {
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(true);
|
return ArgumentParseResult.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("false")) {
|
if (input.equalsIgnoreCase("false")) {
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(false);
|
return ArgumentParseResult.success(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,10 +199,12 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
|
||||||
final String uppercaseInput = input.toUpperCase();
|
final String uppercaseInput = input.toUpperCase();
|
||||||
|
|
||||||
if (LIBERAL_TRUE.contains(uppercaseInput)) {
|
if (LIBERAL_TRUE.contains(uppercaseInput)) {
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(true);
|
return ArgumentParseResult.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LIBERAL_FALSE.contains(uppercaseInput)) {
|
if (LIBERAL_FALSE.contains(uppercaseInput)) {
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(false);
|
return ArgumentParseResult.success(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
|
||||||
return ArgumentParseResult.failure(new CharParseException(input, commandContext));
|
return ArgumentParseResult.failure(new CharParseException(input, commandContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(input.charAt(0));
|
return ArgumentParseResult.success(input.charAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
final OfflinePlayer player = Bukkit.getOfflinePlayer(input);
|
final OfflinePlayer player = Bukkit.getOfflinePlayer(input);
|
||||||
|
|
||||||
|
|
@ -167,6 +166,7 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
|
||||||
return ArgumentParseResult.failure(new OfflinePlayerParseException(input, commandContext));
|
return ArgumentParseResult.failure(new OfflinePlayerParseException(input, commandContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(player);
|
return ArgumentParseResult.success(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
Player player = Bukkit.getPlayer(input);
|
Player player = Bukkit.getPlayer(input);
|
||||||
|
|
||||||
|
|
@ -159,6 +158,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
|
||||||
return ArgumentParseResult.failure(new PlayerParseException(input, commandContext));
|
return ArgumentParseResult.failure(new PlayerParseException(input, commandContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(player);
|
return ArgumentParseResult.success(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,6 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
List<Entity> entities;
|
List<Entity> entities;
|
||||||
try {
|
try {
|
||||||
|
|
@ -162,6 +161,7 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(new MultipleEntitySelector(input, entities));
|
return ArgumentParseResult.success(new MultipleEntitySelector(input, entities));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,6 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
if (!commandContext.get(BukkitCommandContextKeys.CLOUD_BUKKIT_CAPABILITIES).contains(
|
if (!commandContext.get(BukkitCommandContextKeys.CLOUD_BUKKIT_CAPABILITIES).contains(
|
||||||
CloudBukkitCapabilities.BRIGADIER)) {
|
CloudBukkitCapabilities.BRIGADIER)) {
|
||||||
|
|
@ -154,6 +153,7 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return ArgumentParseResult.failure(new PlayerArgument.PlayerParseException(input, commandContext));
|
return ArgumentParseResult.failure(new PlayerArgument.PlayerParseException(input, commandContext));
|
||||||
}
|
}
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(new MultiplePlayerSelector(input, ImmutableList.of(player)));
|
return ArgumentParseResult.success(new MultiplePlayerSelector(input, ImmutableList.of(player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,6 +180,7 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(new MultiplePlayerSelector(input, entities));
|
return ArgumentParseResult.success(new MultiplePlayerSelector(input, entities));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,6 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
List<Entity> entities;
|
List<Entity> entities;
|
||||||
try {
|
try {
|
||||||
|
|
@ -177,6 +176,7 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(new SingleEntitySelector(input, entities));
|
return ArgumentParseResult.success(new SingleEntitySelector(input, entities));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
|
||||||
commandContext
|
commandContext
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
inputQueue.remove();
|
|
||||||
|
|
||||||
if (!commandContext.get(BukkitCommandContextKeys.CLOUD_BUKKIT_CAPABILITIES).contains(
|
if (!commandContext.get(BukkitCommandContextKeys.CLOUD_BUKKIT_CAPABILITIES).contains(
|
||||||
CloudBukkitCapabilities.BRIGADIER)) {
|
CloudBukkitCapabilities.BRIGADIER)) {
|
||||||
|
|
@ -160,6 +159,7 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return ArgumentParseResult.failure(new PlayerArgument.PlayerParseException(input, commandContext));
|
return ArgumentParseResult.failure(new PlayerArgument.PlayerParseException(input, commandContext));
|
||||||
}
|
}
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(new SinglePlayerSelector(input, ImmutableList.of(player)));
|
return ArgumentParseResult.success(new SinglePlayerSelector(input, ImmutableList.of(player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,6 +194,7 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputQueue.remove();
|
||||||
return ArgumentParseResult.success(new SinglePlayerSelector(input, entities));
|
return ArgumentParseResult.success(new SinglePlayerSelector(input, entities));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue