Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 136781c

Browse files
committed
Merge pull request #8 from strifel/master
Adding RCON Connector
2 parents 93cccba + 9c712ca commit 136781c

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.codeoverflow.chatoverflow.api.io.input;
2+
3+
import org.codeoverflow.chatoverflow.api.IsRequirement;
4+
5+
@IsRequirement(requires = "remote control for game servers using RCON protocol")
6+
public interface RconInput extends Input {
7+
8+
/**
9+
* Get the output of a rcon command
10+
* Command will be directly executed on the rcon server and the returned response will be returned
11+
* If null is returned this means that there is some problem with the connection (typically the server is shut down or there is some other reason for a lost connection)
12+
* Notice: There is no way of knowing that a command exists, which does not return a response. Every command without response will return an empty string.
13+
* @param command the command which should be executed on the remote server
14+
* @return response of the server or null
15+
*/
16+
String getCommandOutput(String command);
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.codeoverflow.chatoverflow.api.io.output;
2+
3+
import org.codeoverflow.chatoverflow.api.IsRequirement;
4+
5+
@IsRequirement(requires = "remote control for game servers using RCON protocol")
6+
public interface RconOutput extends Output {
7+
8+
9+
/**
10+
* Execute a command on a remote (rcon) server.
11+
* Notice: There is no way of knowing if the commands exists.
12+
* @param command the command which should be executed
13+
* @return if the command was successfully sent to the server. (Returns false for e.g. a not anymore existent server)
14+
*/
15+
boolean sendCommand(String command);
16+
}

Diff for: src/main/java/org/codeoverflow/chatoverflow/api/plugin/configuration/Input.java

+23
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// THIS FILE IS GENERATED WHILE COMPILING. DO NOT CHANGE ANYTHING HERE!
44

55
import org.codeoverflow.chatoverflow.api.io.input.FileInput;
6+
import org.codeoverflow.chatoverflow.api.io.input.RconInput;
67
import org.codeoverflow.chatoverflow.api.io.input.SampleInput;
78
import org.codeoverflow.chatoverflow.api.io.input.SerialInput;
89
import org.codeoverflow.chatoverflow.api.io.input.chat.DiscordChatInput;
@@ -44,6 +45,28 @@ public Requirement<FileInput> file(String uniqueRequirementId) {
4445
return requirements.requireInput(uniqueRequirementId, "File", false, FileInput.class);
4546
}
4647

48+
/**
49+
* Requires a remote control for game servers using RCON protocol which has to be specified by the user.
50+
*
51+
* @param uniqueRequirementId a plugin unique identifier which is stored for your plugin
52+
* @param displayName a string to display to the user while setting your requirement
53+
* @param isOptional true if this requirement is optional, false if mandatory
54+
* @return the requirement object. Use the get() method only at runtime!
55+
*/
56+
public Requirement<RconInput> rcon(String uniqueRequirementId, String displayName, boolean isOptional) {
57+
return requirements.requireInput(uniqueRequirementId, displayName, isOptional, RconInput.class);
58+
}
59+
60+
/**
61+
* Requires a remote control for game servers using RCON protocol which has to be specified by the user.
62+
*
63+
* @param uniqueRequirementId a plugin unique identifier which is stored for your plugin
64+
* @return the requirement object. Use the get() method only at runtime!
65+
*/
66+
public Requirement<RconInput> rcon(String uniqueRequirementId) {
67+
return requirements.requireInput(uniqueRequirementId, "Rcon", false, RconInput.class);
68+
}
69+
4770
/**
4871
* Requires a SampleInput which has to be specified by the user.
4972
*

Diff for: src/main/java/org/codeoverflow/chatoverflow/api/plugin/configuration/Output.java

+23
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// THIS FILE IS GENERATED WHILE COMPILING. DO NOT CHANGE ANYTHING HERE!
44

55
import org.codeoverflow.chatoverflow.api.io.output.FileOutput;
6+
import org.codeoverflow.chatoverflow.api.io.output.RconOutput;
67
import org.codeoverflow.chatoverflow.api.io.output.SerialOutput;
78
import org.codeoverflow.chatoverflow.api.io.output.chat.DiscordChatOutput;
89
import org.codeoverflow.chatoverflow.api.io.output.chat.TwitchChatOutput;
@@ -42,6 +43,28 @@ public Requirement<FileOutput> file(String uniqueRequirementId) {
4243
return requirements.requireOutput(uniqueRequirementId, "File", false, FileOutput.class);
4344
}
4445

46+
/**
47+
* Requires a remote control for game servers using RCON protocol which has to be specified by the user.
48+
*
49+
* @param uniqueRequirementId a plugin unique identifier which is stored for your plugin
50+
* @param displayName a string to display to the user while setting your requirement
51+
* @param isOptional true if this requirement is optional, false if mandatory
52+
* @return the requirement object. Use the get() method only at runtime!
53+
*/
54+
public Requirement<RconOutput> rcon(String uniqueRequirementId, String displayName, boolean isOptional) {
55+
return requirements.requireOutput(uniqueRequirementId, displayName, isOptional, RconOutput.class);
56+
}
57+
58+
/**
59+
* Requires a remote control for game servers using RCON protocol which has to be specified by the user.
60+
*
61+
* @param uniqueRequirementId a plugin unique identifier which is stored for your plugin
62+
* @return the requirement object. Use the get() method only at runtime!
63+
*/
64+
public Requirement<RconOutput> rcon(String uniqueRequirementId) {
65+
return requirements.requireOutput(uniqueRequirementId, "Rcon", false, RconOutput.class);
66+
}
67+
4568
/**
4669
* Requires a connection with a device connected to a serial port (an Arduino for example) which has to be specified by the user.
4770
*

0 commit comments

Comments
 (0)