add commands

This commit is contained in:
Sen 2025-06-04 12:59:16 +02:00
parent 8bd1b4dedb
commit 8a6f280997
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
2 changed files with 30 additions and 25 deletions

View file

@ -393,31 +393,36 @@ public class ProxyHandler implements Handler {
public void handleTabComplete(S3APacketTabComplete packetIn) {
Handler.syncToMain(packetIn, this, this.proxy);
String[] comps = packetIn.getMatches();
if(this.completion != null) {
if(this.admin && this.completion.startsWith("/")) {
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;
if(this.completion == null) {
this.sendToClient(new S3APacketTabComplete(new String[0]));
return;
}
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) {

View file

@ -77,7 +77,7 @@ public enum Formatter {
}
public static String joinSpace(String ... objs) {
return joinSpace(objs);
return joinSpace((Object[])objs);
}
public static String joinSpace(Object ... objs) {