add commands
This commit is contained in:
parent
8bd1b4dedb
commit
8a6f280997
2 changed files with 30 additions and 25 deletions
|
@ -393,31 +393,36 @@ public class ProxyHandler implements Handler {
|
||||||
|
|
||||||
public void handleTabComplete(S3APacketTabComplete packetIn) {
|
public void handleTabComplete(S3APacketTabComplete packetIn) {
|
||||||
Handler.syncToMain(packetIn, this, this.proxy);
|
Handler.syncToMain(packetIn, this, this.proxy);
|
||||||
String[] comps = packetIn.getMatches();
|
if(this.completion == null) {
|
||||||
if(this.completion != null) {
|
this.sendToClient(new S3APacketTabComplete(new String[0]));
|
||||||
if(this.admin && this.completion.startsWith("/")) {
|
return;
|
||||||
if(this.completion.indexOf(' ') == -1) {
|
|
||||||
List<String> list = Lists.newArrayList(comps);
|
|
||||||
if("/vproxy".regionMatches(true, 0, this.completion, 0, this.completion.length()))
|
|
||||||
list.add("/vproxy");
|
|
||||||
Collections.sort(list);
|
|
||||||
this.sendToClient(new S3APacketTabComplete(list.toArray(new String[list.size()])));
|
|
||||||
this.completion = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(this.completion.startsWith("/vproxy ")) {
|
|
||||||
String[] args = this.completion.split(" ", -1);
|
|
||||||
String[] argv = new String[args.length - 1];
|
|
||||||
System.arraycopy(args, 1, argv, 0, argv.length);
|
|
||||||
List<String> list = this.getCompletions(argv);
|
|
||||||
this.sendToClient(new S3APacketTabComplete(list.toArray(new String[list.size()])));
|
|
||||||
this.completion = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.completion = null;
|
|
||||||
}
|
}
|
||||||
this.sendToClient(packetIn);
|
List<String> list = null;
|
||||||
|
if(this.completion.startsWith("/")) {
|
||||||
|
if(this.completion.indexOf(' ') == -1) {
|
||||||
|
list = Lists.newArrayList(packetIn.getMatches());
|
||||||
|
if(this.admin && "/vproxy".regionMatches(true, 0, this.completion, 0, this.completion.length()))
|
||||||
|
list.add("/vproxy");
|
||||||
|
Collections.sort(list);
|
||||||
|
}
|
||||||
|
else if(this.admin && this.completion.startsWith("/vproxy ")) {
|
||||||
|
String[] args = this.completion.split(" ", -1);
|
||||||
|
String[] argv = new String[args.length - 1];
|
||||||
|
System.arraycopy(args, 1, argv, 0, argv.length);
|
||||||
|
list = this.getCompletions(argv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String[] args = this.completion.split(" ", -1);
|
||||||
|
String param = args[args.length - 1];
|
||||||
|
list = Lists.newArrayList();
|
||||||
|
for(ProxyHandler player : this.proxy.getPlayers()) {
|
||||||
|
if(player.getUsername().regionMatches(true, 0, param, 0, param.length()))
|
||||||
|
list.add(player.getUsername());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sendToClient(list != null ? new S3APacketTabComplete(list.toArray(new String[list.size()])) : packetIn);
|
||||||
|
this.completion = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPlayerDigging(C07PacketPlayerDigging packetIn) {
|
public void processPlayerDigging(C07PacketPlayerDigging packetIn) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public enum Formatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String joinSpace(String ... objs) {
|
public static String joinSpace(String ... objs) {
|
||||||
return joinSpace(objs);
|
return joinSpace((Object[])objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String joinSpace(Object ... objs) {
|
public static String joinSpace(Object ... objs) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue