forked from virt-mirrors/Sit
command code cleanup
This commit is contained in:
parent
3a56b1980d
commit
6da81cb4af
1 changed files with 6 additions and 6 deletions
|
@ -37,13 +37,13 @@ public class SitCommand {
|
||||||
|
|
||||||
private static int command(ServerCommandSource source, String arg) {
|
private static int command(ServerCommandSource source, String arg) {
|
||||||
ServerPlayerEntity player = source.getPlayer();
|
ServerPlayerEntity player = source.getPlayer();
|
||||||
//trim all the arguments before the command
|
// trim all the arguments before the command (for commands like /execute)
|
||||||
String keyword = "sit";
|
int index = arg.indexOf("sit");
|
||||||
int index = Integer.MAX_VALUE;
|
// trims the words before the text
|
||||||
if (arg.contains(keyword)) index = arg.indexOf(keyword);
|
if (index != -1) arg = arg.substring(index).trim();
|
||||||
//trims the words before the text
|
|
||||||
if (index != Integer.MAX_VALUE) arg = arg.substring(index).trim();
|
|
||||||
String[] args = arg.split(" ");
|
String[] args = arg.split(" ");
|
||||||
|
// if command string starts with sit, remove it
|
||||||
if (args[0].equalsIgnoreCase("sit"))
|
if (args[0].equalsIgnoreCase("sit"))
|
||||||
args = arg.replaceFirst("sit ", "").split(" ");
|
args = arg.replaceFirst("sit ", "").split(" ");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue