Skip to content

Commit 541d9c4

Browse files
committed
Fix incorrect inputQueue usage in some argument types
1 parent f029e84 commit 541d9c4

8 files changed

Lines changed: 13 additions & 7 deletions

File tree

cloud-core/src/main/java/cloud/commandframework/arguments/standard/BooleanArgument.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,15 @@ public BooleanParser(final boolean liberal) {
181181
commandContext
182182
));
183183
}
184-
inputQueue.remove();
185184

186185
if (!this.liberal) {
187186
if (input.equalsIgnoreCase("true")) {
187+
inputQueue.remove();
188188
return ArgumentParseResult.success(true);
189189
}
190190

191191
if (input.equalsIgnoreCase("false")) {
192+
inputQueue.remove();
192193
return ArgumentParseResult.success(false);
193194
}
194195

@@ -198,10 +199,12 @@ public BooleanParser(final boolean liberal) {
198199
final String uppercaseInput = input.toUpperCase();
199200

200201
if (LIBERAL_TRUE.contains(uppercaseInput)) {
202+
inputQueue.remove();
201203
return ArgumentParseResult.success(true);
202204
}
203205

204206
if (LIBERAL_FALSE.contains(uppercaseInput)) {
207+
inputQueue.remove();
205208
return ArgumentParseResult.success(false);
206209
}
207210

cloud-core/src/main/java/cloud/commandframework/arguments/standard/CharArgument.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public static final class CharacterParser<C> implements ArgumentParser<C, Charac
141141
return ArgumentParseResult.failure(new CharParseException(input, commandContext));
142142
}
143143

144+
inputQueue.remove();
144145
return ArgumentParseResult.success(input.charAt(0));
145146
}
146147

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/OfflinePlayerArgument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ public static final class OfflinePlayerParser<C> implements ArgumentParser<C, Of
159159
commandContext
160160
));
161161
}
162-
inputQueue.remove();
163162

164163
final OfflinePlayer player = Bukkit.getOfflinePlayer(input);
165164

166165
if (!player.hasPlayedBefore() && !player.isOnline()) {
167166
return ArgumentParseResult.failure(new OfflinePlayerParseException(input, commandContext));
168167
}
169168

169+
inputQueue.remove();
170170
return ArgumentParseResult.success(player);
171171
}
172172

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/PlayerArgument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ public static final class PlayerParser<C> implements ArgumentParser<C, Player> {
151151
commandContext
152152
));
153153
}
154-
inputQueue.remove();
155154

156155
Player player = Bukkit.getPlayer(input);
157156

158157
if (player == null) {
159158
return ArgumentParseResult.failure(new PlayerParseException(input, commandContext));
160159
}
161160

161+
inputQueue.remove();
162162
return ArgumentParseResult.success(player);
163163
}
164164

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/MultipleEntitySelectorArgument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public static final class MultipleEntitySelectorParser<C> implements ArgumentPar
148148
commandContext
149149
));
150150
}
151-
inputQueue.remove();
152151

153152
List<Entity> entities;
154153
try {
@@ -162,6 +161,7 @@ public static final class MultipleEntitySelectorParser<C> implements ArgumentPar
162161
));
163162
}
164163

164+
inputQueue.remove();
165165
return ArgumentParseResult.success(new MultipleEntitySelector(input, entities));
166166
}
167167

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/MultiplePlayerSelectorArgument.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public static final class MultiplePlayerSelectorParser<C> implements ArgumentPar
144144
commandContext
145145
));
146146
}
147-
inputQueue.remove();
148147

149148
if (!commandContext.get(BukkitCommandContextKeys.CLOUD_BUKKIT_CAPABILITIES).contains(
150149
CloudBukkitCapabilities.BRIGADIER)) {
@@ -154,6 +153,7 @@ public static final class MultiplePlayerSelectorParser<C> implements ArgumentPar
154153
if (player == null) {
155154
return ArgumentParseResult.failure(new PlayerArgument.PlayerParseException(input, commandContext));
156155
}
156+
inputQueue.remove();
157157
return ArgumentParseResult.success(new MultiplePlayerSelector(input, ImmutableList.of(player)));
158158
}
159159

@@ -180,6 +180,7 @@ public static final class MultiplePlayerSelectorParser<C> implements ArgumentPar
180180
}
181181
}
182182

183+
inputQueue.remove();
183184
return ArgumentParseResult.success(new MultiplePlayerSelector(input, entities));
184185
}
185186

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/SingleEntitySelectorArgument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public static final class SingleEntitySelectorParser<C> implements ArgumentParse
154154
commandContext
155155
));
156156
}
157-
inputQueue.remove();
158157

159158
List<Entity> entities;
160159
try {
@@ -177,6 +176,7 @@ public static final class SingleEntitySelectorParser<C> implements ArgumentParse
177176
));
178177
}
179178

179+
inputQueue.remove();
180180
return ArgumentParseResult.success(new SingleEntitySelector(input, entities));
181181
}
182182

cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/selector/SinglePlayerSelectorArgument.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ public static final class SinglePlayerSelectorParser<C> implements ArgumentParse
150150
commandContext
151151
));
152152
}
153-
inputQueue.remove();
154153

155154
if (!commandContext.get(BukkitCommandContextKeys.CLOUD_BUKKIT_CAPABILITIES).contains(
156155
CloudBukkitCapabilities.BRIGADIER)) {
@@ -160,6 +159,7 @@ public static final class SinglePlayerSelectorParser<C> implements ArgumentParse
160159
if (player == null) {
161160
return ArgumentParseResult.failure(new PlayerArgument.PlayerParseException(input, commandContext));
162161
}
162+
inputQueue.remove();
163163
return ArgumentParseResult.success(new SinglePlayerSelector(input, ImmutableList.of(player)));
164164
}
165165

@@ -194,6 +194,7 @@ public static final class SinglePlayerSelectorParser<C> implements ArgumentParse
194194
));
195195
}
196196

197+
inputQueue.remove();
197198
return ArgumentParseResult.success(new SinglePlayerSelector(input, entities));
198199
}
199200

0 commit comments

Comments
 (0)