SimpleCommand object
This commit is contained in:
@@ -3,10 +3,6 @@ package com.github.manevolent.ts3j.command;
|
||||
import com.github.manevolent.ts3j.command.part.CommandParameter;
|
||||
|
||||
public interface Command {
|
||||
boolean willExpectResponse();
|
||||
|
||||
Iterable<CommandParameter> getParameters();
|
||||
|
||||
void appendParameter(CommandParameter parameter);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.github.manevolent.ts3j.command;
|
||||
|
||||
import com.github.manevolent.ts3j.command.part.CommandParameter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class SimpleCommand implements Command {
|
||||
private final String name;
|
||||
private final List<CommandParameter> parameterList = new LinkedList<>();
|
||||
|
||||
public SimpleCommand(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<CommandParameter> getParameters() {
|
||||
return Collections.unmodifiableList(parameterList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendParameter(CommandParameter parameter) {
|
||||
parameterList.add(parameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(name);
|
||||
|
||||
for (CommandParameter parameter : getParameters()) {
|
||||
builder.append(" ");
|
||||
builder.append(parameter.toString());
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.manevolent.ts3j.handler;
|
||||
|
||||
import com.github.manevolent.ts3j.Teamspeak3Client;
|
||||
import com.github.manevolent.ts3j.command.Command;
|
||||
import com.github.manevolent.ts3j.protocol.NetworkPacket;
|
||||
import com.github.manevolent.ts3j.protocol.ProtocolRole;
|
||||
import com.github.manevolent.ts3j.protocol.packet.Packet8Init1;
|
||||
@@ -106,6 +107,7 @@ public class TeamspeakClientHandlerConnecting extends TeamspeakClientHandler {
|
||||
step4.setY(y);
|
||||
step4.setServerStuff(serverReplyStep3.getServerStuff());
|
||||
|
||||
|
||||
step4.setClientIVcommand(new byte[4]); // TODO
|
||||
|
||||
response4.setStep(step4);
|
||||
|
||||
Reference in New Issue
Block a user