made clientversion changeable

This commit is contained in:
Phyrone
2019-07-16 23:47:05 +09:00
parent d7b996e897
commit 06c21c0c56
2 changed files with 64 additions and 42 deletions
@@ -228,10 +228,21 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
"clientinit", "clientinit",
ProtocolRole.CLIENT, ProtocolRole.CLIENT,
new CommandSingleParameter("client_nickname", getClient().getNickname()), new CommandSingleParameter("client_nickname", getClient().getNickname()),
new CommandSingleParameter("client_version", "3.?.? [Build: 5680278000]"), new CommandSingleParameter(
new CommandSingleParameter("client_platform", "Windows"), "client_version",
getClient().getOption("client.version_string", String.class) != null ?
getClient().getOption("client.version_string", String.class) :
"3.?.? [Build: 5680278000]"
),
new CommandSingleParameter("client_platform",
getClient().getOption("client.version_platform", String.class) != null ?
getClient().getOption("client.version_platform", String.class) :
"Windows"
),
new CommandSingleParameter( new CommandSingleParameter(
"client_version_sign", "client_version_sign",
getClient().getOption("client.version_sign", String.class) != null ?
getClient().getOption("client.version_sign", String.class) :
"DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg==" "DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="
), ),
new CommandSingleParameter("client_input_hardware", "1"), new CommandSingleParameter("client_input_hardware", "1"),
@@ -60,9 +60,9 @@ public class LocalTeamspeakClientSocket
/** /**
* The internal command buffer * The internal command buffer
* * <p>
* This buffer ascends through specific command codes, which are calculated using: * This buffer ascends through specific command codes, which are calculated using:
* * <p>
* get * get
*/ */
private Map<Integer, ClientCommandResponse> awaitingCommands = new ConcurrentHashMap<>(); private Map<Integer, ClientCommandResponse> awaitingCommands = new ConcurrentHashMap<>();
@@ -159,7 +159,7 @@ public class LocalTeamspeakClientSocket
* Enables or disables event callback multi-threading. This is dangerous. If this is enabled, events can be * Enables or disables event callback multi-threading. This is dangerous. If this is enabled, events can be
* processed out-of-order. It is suggested you use your own threading system for particular events you feel safe * processed out-of-order. It is suggested you use your own threading system for particular events you feel safe
* parallelling, such as chat messages. * parallelling, such as chat messages.
* * <p>
* This is not enabled by default. * This is not enabled by default.
* *
* @param enabled Event simultaneous (parallel) processing enabled * @param enabled Event simultaneous (parallel) processing enabled
@@ -307,6 +307,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Initiates a connection to a server * Initiates a connection to a server
*
* @param hostname Hostname to contact * @param hostname Hostname to contact
* @param timeout timeout, in milliseconds, to complete a connection. * @param timeout timeout, in milliseconds, to complete a connection.
*/ */
@@ -316,6 +317,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Initiates a connection to a server * Initiates a connection to a server
*
* @param hostname Hostname to contact * @param hostname Hostname to contact
* @param password server password (may be null) * @param password server password (may be null)
* @param timeout timeout, in milliseconds, to complete a connection. * @param timeout timeout, in milliseconds, to complete a connection.
@@ -338,6 +340,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Initiates a connection to a server * Initiates a connection to a server
*
* @param remote remote sever to contact * @param remote remote sever to contact
* @param password server password (may be null) * @param password server password (may be null)
* @param timeout timeout, in milliseconds, to complete a connection. * @param timeout timeout, in milliseconds, to complete a connection.
@@ -457,6 +460,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Executes a command. * Executes a command.
*
* @param command Command to execute. * @param command Command to execute.
* @return Future, command response object. * @return Future, command response object.
* @throws IOException if there is a connectivity-level exception. * @throws IOException if there is a connectivity-level exception.
@@ -1016,14 +1020,14 @@ public class LocalTeamspeakClientSocket
/** /**
* Displays a list of clients that are in the channel specified by the cid * Displays a list of clients that are in the channel specified by the cid
parameter. Included information is the clientID, client database id, nickname, * parameter. Included information is the clientID, client database id, nickname,
channelID and client type. * channelID and client type.
Please take note that you can only view clients in channels that you are * Please take note that you can only view clients in channels that you are
currently subscribed to. * currently subscribed to.
* <p>
Here is a list of the additional display paramters you will receive for * Here is a list of the additional display paramters you will receive for
each of the possible modifier parameters. * each of the possible modifier parameters.
*
* @param channelId channel ID to look at * @param channelId channel ID to look at
* @return list of channel clients * @return list of channel clients
* @throws IOException * @throws IOException
@@ -1041,7 +1045,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Sends a text message a specified target. The type of the target is determined by targetmode while target * Sends a text message a specified target. The type of the target is determined by targetmode while target
specifies the ID of the recipient, whether it be a virtual server, a channel or a client. * specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
*/ */
public void sendServerMessage(String message) public void sendServerMessage(String message)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1056,7 +1060,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Sends a text message a specified target. The type of the target is determined by targetmode while target * Sends a text message a specified target. The type of the target is determined by targetmode while target
specifies the ID of the recipient, whether it be a virtual server, a channel or a client. * specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
*/ */
public void sendChannelMessage(int channelId, String message) public void sendChannelMessage(int channelId, String message)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1071,7 +1075,7 @@ public class LocalTeamspeakClientSocket
/** /**
* Sends a text message a specified target. The type of the target is determined by targetmode while target * Sends a text message a specified target. The type of the target is determined by targetmode while target
specifies the ID of the recipient, whether it be a virtual server, a channel or a client. * specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
*/ */
public void sendPrivateMessage(int clientId, String message) public void sendPrivateMessage(int clientId, String message)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1086,8 +1090,8 @@ public class LocalTeamspeakClientSocket
/** /**
* Moves one or more clients specified with clid to the channel with ID cid. If * Moves one or more clients specified with clid to the channel with ID cid. If
the target channel has a password, it needs to be specified with cpw. If the * the target channel has a password, it needs to be specified with cpw. If the
channel has no password, the parameter can be omitted. * channel has no password, the parameter can be omitted.
*/ */
public void clientMove(int clientId, int channelId, String password) public void clientMove(int clientId, int channelId, String password)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1107,8 +1111,8 @@ public class LocalTeamspeakClientSocket
/** /**
* Moves one or more clients specified with clid to the channel with ID cid. If * Moves one or more clients specified with clid to the channel with ID cid. If
the target channel has a password, it needs to be specified with cpw. If the * the target channel has a password, it needs to be specified with cpw. If the
channel has no password, the parameter can be omitted. * channel has no password, the parameter can be omitted.
*/ */
public Iterable<Channel> listChannels() public Iterable<Channel> listChannels()
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1119,8 +1123,8 @@ public class LocalTeamspeakClientSocket
/** /**
* Moves one or more clients specified with clid to the channel with ID cid. If * Moves one or more clients specified with clid to the channel with ID cid. If
the target channel has a password, it needs to be specified with cpw. If the * the target channel has a password, it needs to be specified with cpw. If the
channel has no password, the parameter can be omitted. * channel has no password, the parameter can be omitted.
*/ */
public Iterable<Client> listClients() public Iterable<Client> listClients()
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1151,8 +1155,8 @@ public class LocalTeamspeakClientSocket
/** /**
* Moves one or more clients specified with clid to the channel with ID cid. If * Moves one or more clients specified with clid to the channel with ID cid. If
the target channel has a password, it needs to be specified with cpw. If the * the target channel has a password, it needs to be specified with cpw. If the
channel has no password, the parameter can be omitted. * channel has no password, the parameter can be omitted.
*/ */
public void clientPoke(int clientId, String message) public void clientPoke(int clientId, String message)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1166,9 +1170,9 @@ public class LocalTeamspeakClientSocket
/** /**
* Kicks one or more clients specified with clid from their currently joined * Kicks one or more clients specified with clid from their currently joined
channel or from the server, depending on reasonid. The reasonmsg parameter * channel or from the server, depending on reasonid. The reasonmsg parameter
specifies a text message sent to the kicked clients. This parameter is optional * specifies a text message sent to the kicked clients. This parameter is optional
and may only have a maximum of 40 characters. * and may only have a maximum of 40 characters.
*/ */
public void kick(Collection<Integer> clientIds, String message) public void kick(Collection<Integer> clientIds, String message)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
@@ -1192,6 +1196,13 @@ public class LocalTeamspeakClientSocket
executeCommand(command).get(); executeCommand(command).get();
} }
public void setClientVersion(String platform, String version, String sign) {
setOption("client.version_platform", platform);
setOption("client.version_string", version);
setOption("client.version_sign", sign);
}
public Client getClientInfo(int clientId) public Client getClientInfo(int clientId)
throws IOException, TimeoutException, InterruptedException, CommandException { throws IOException, TimeoutException, InterruptedException, CommandException {
Command command = new SingleCommand( Command command = new SingleCommand(