Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
f5cdedcc
Commit
f5cdedcc
authored
May 15, 2022
by
AnimeGitB
Committed by
Melledy
May 15, 2022
Browse files
Fix logic error in remove command
parent
efd7467a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/RemoveCommand.java
View file @
f5cdedcc
...
...
@@ -8,7 +8,6 @@ import emu.grasscutter.server.packet.send.PacketChangeMpTeamAvatarRsp;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
...
...
@@ -28,7 +27,9 @@ public class RemoveCommand implements CommandHandler {
for
(
String
arg
:
args
)
{
try
{
int
avatarIndex
=
Integer
.
parseInt
(
arg
);
avatarIndexList
.
add
(
avatarIndex
);
if
(!
avatarIndexList
.
contains
(
avatarIndex
))
{
avatarIndexList
.
add
(
avatarIndex
);
}
}
catch
(
Exception
ignored
)
{
ignored
.
printStackTrace
();
CommandHandler
.
sendMessage
(
sender
,
translate
(
"commands.remove.invalid_index"
));
...
...
@@ -36,7 +37,7 @@ public class RemoveCommand implements CommandHandler {
}
}
Collections
.
reverse
(
avatarIndexList
);
Collections
.
sort
(
avatarIndexList
,
Collections
.
reverseOrder
()
);
for
(
int
i
=
0
;
i
<
avatarIndexList
.
size
();
i
++)
{
if
(
avatarIndexList
.
get
(
i
)
>
targetPlayer
.
getTeamManager
().
getCurrentTeamInfo
().
getAvatars
().
size
()
||
avatarIndexList
.
get
(
i
)
<=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment