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

Commit 85992f5

Browse files
committed
Splitting RCON in Input and Output.
While output only returns if command was successful Input will return RCON return message. (There is not often one. But e.g. while using /list in minecraft RCON). Input will return null will it was unsuccessful
1 parent 94d1632 commit 85992f5

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.codeoverflow.chatoverflow.api.io.input;
2+
3+
public interface RconInput extends Input {
4+
String getCommandOutput(String command);
5+
}

src/main/java/org/codeoverflow/chatoverflow/api/io/output/RconOutput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
public interface RconOutput extends Output {
44

5-
String sendCommand(String command);
5+
boolean sendCommand(String command);
66
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.codeoverflow.chatoverflow.api.plugin.configuration;
22

33
import org.codeoverflow.chatoverflow.api.io.input.FileInput;
4+
import org.codeoverflow.chatoverflow.api.io.input.RconInput;
45
import org.codeoverflow.chatoverflow.api.io.input.SampleInput;
56
import org.codeoverflow.chatoverflow.api.io.input.SerialInput;
67
import org.codeoverflow.chatoverflow.api.io.input.chat.DiscordChatInput;
@@ -101,6 +102,18 @@ public Requirement<FileInput> file(String uniqueRequirementId, String displayNam
101102
return requirements.requireInput(uniqueRequirementId, displayName, isOptional, FileInput.class);
102103
}
103104

105+
/**
106+
* Requires a connection to a RCON Server
107+
*
108+
* @param uniqueRequirementId any unique id by which your plugin can identify the requirement
109+
* @param displayName Is displayed to the framework user and to tell him what to enter
110+
* @param isOptional true if this requirement is optional, false if mandatory
111+
* @return the requirement object
112+
*/
113+
public Requirement<RconInput> rcon(String uniqueRequirementId, String displayName, boolean isOptional) {
114+
return requirements.requireInput(uniqueRequirementId, displayName, isOptional, RconInput.class);
115+
}
116+
104117
// Add more inputs here
105118

106119
}

0 commit comments

Comments
 (0)