Fixed numerous bugs and improved performance
This commit is contained in:
parent
584515199d
commit
2ab7c27fd4
1 changed files with 5 additions and 8 deletions
|
@ -31,7 +31,7 @@ public class Commands implements CommandExecutor
|
||||||
String[] args)
|
String[] args)
|
||||||
{
|
{
|
||||||
StringBuilder acmdb = new StringBuilder("minecraft:execute "
|
StringBuilder acmdb = new StringBuilder("minecraft:execute "
|
||||||
+ sender.getName() + " ~ ~ ~");
|
+ sender.getName() + " ~ ~ ~ ");
|
||||||
if (sender != Bukkit.getConsoleSender()
|
if (sender != Bukkit.getConsoleSender()
|
||||||
&& !(sender instanceof BlockCommandSender))
|
&& !(sender instanceof BlockCommandSender))
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ public class Commands implements CommandExecutor
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
CommandBlock cmdblock = (CommandBlock) block.getState();
|
CommandBlock cmdblock = (CommandBlock) block.getState();
|
||||||
acmdb.append(" ").append(cmdblock.getCommand());
|
acmdb.append(cmdblock.getCommand());
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
|
@ -52,18 +52,15 @@ public class Commands implements CommandExecutor
|
||||||
sender.sendMessage("§cUsage: /" + alias + " <onecommand>");
|
sender.sendMessage("§cUsage: /" + alias + " <onecommand>");
|
||||||
return true; //Why use the builtin usage shoing thing
|
return true; //Why use the builtin usage shoing thing
|
||||||
}
|
}
|
||||||
for (String arg : args)
|
|
||||||
acmdb.append(" ").append(arg);
|
|
||||||
}
|
}
|
||||||
String acmd = acmdb.toString();
|
String acmd = acmdb.toString();
|
||||||
StringBuilder replace = new StringBuilder("(" + replacecmds[0]);
|
StringBuilder replace = new StringBuilder("(" + replacecmds[0]);
|
||||||
for (int i = 1; i < replacecmds.length; i++)
|
for (int i = 1; i < replacecmds.length; i++)
|
||||||
replace.append("|" + replacecmds[i]);
|
replace.append("|" + replacecmds[i]);
|
||||||
replace.append(")");
|
replace.append(")");
|
||||||
acmd = acmd.replaceAll("Command:\\/" + replace, "Command:/minecraft:$1")
|
acmd = acmd.replaceAll("([^t]|^)( |:| \\/|:\\/)" + replace + " ",
|
||||||
.replaceAll("Command\\:" + replace, "Command:minecraft:$1")
|
"$1$2minecraft:$3 ").replaceAll("\" (\\/*)minecraft:",
|
||||||
.replaceAll(" " + replace + " ", " minecraft:$1 ");
|
"\"$1minecraft:"); //Tellraw
|
||||||
System.out.println(acmd); //TODO
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), acmd);
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), acmd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue