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

Adding RCON Connector #8

Merged
merged 4 commits into from
Nov 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.codeoverflow.chatoverflow.api.io.input;

public interface RconInput extends Input {

/**
* Get the output of a rcon command
* Command will be directly executed on the rcon server and the returned response will be returned
* 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)
* 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.
* @param command the command which should be executed on the remote server
* @return response of the server or null
*/
String getCommandOutput(String command);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.codeoverflow.chatoverflow.api.io.output;

public interface RconOutput extends Output {


/**
* Execute a command on a remote (rcon) server.
* Notice: There is no way of knowing if the commands exists.
* @param command the command which should be executed
* @return if the command was successfully sent to the server. (Returns false for e.g. a not anymore existent server)
*/
boolean sendCommand(String command);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.codeoverflow.chatoverflow.api.plugin.configuration;

import org.codeoverflow.chatoverflow.api.io.input.FileInput;
import org.codeoverflow.chatoverflow.api.io.input.RconInput;
import org.codeoverflow.chatoverflow.api.io.input.SampleInput;
import org.codeoverflow.chatoverflow.api.io.input.SerialInput;
import org.codeoverflow.chatoverflow.api.io.input.chat.DiscordChatInput;
Expand Down Expand Up @@ -101,6 +102,18 @@ public Requirement<FileInput> file(String uniqueRequirementId, String displayNam
return requirements.requireInput(uniqueRequirementId, displayName, isOptional, FileInput.class);
}

/**
* Requires a connection to a RCON Server
*
* @param uniqueRequirementId any unique id by which your plugin can identify the requirement
* @param displayName Is displayed to the framework user and to tell him what to enter
* @param isOptional true if this requirement is optional, false if mandatory
* @return the requirement object
*/
public Requirement<RconInput> rcon(String uniqueRequirementId, String displayName, boolean isOptional) {
return requirements.requireInput(uniqueRequirementId, displayName, isOptional, RconInput.class);
}

// Add more inputs here

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.codeoverflow.chatoverflow.api.plugin.configuration;

import org.codeoverflow.chatoverflow.api.io.output.FileOutput;
import org.codeoverflow.chatoverflow.api.io.output.RconOutput;
import org.codeoverflow.chatoverflow.api.io.output.SerialOutput;
import org.codeoverflow.chatoverflow.api.io.output.chat.DiscordChatOutput;
import org.codeoverflow.chatoverflow.api.io.output.chat.TwitchChatOutput;
Expand Down Expand Up @@ -62,6 +63,18 @@ public Requirement<FileOutput> file(String uniqueRequirementId, String displayNa
return requirements.requireOutput(uniqueRequirementId, displayName, isOptional, FileOutput.class);
}

/**
* Requires a game server with enabled rcon
*
* @param uniqueRequirementId any unique id by which your plugin can identify the requirement
* @param displayName Is displayed to the framework user and to tell him what to enter
* @param isOptional true if this requirement is optional, false if mandatory
* @return the requirement object
*/
public Requirement<RconOutput> rcon(String uniqueRequirementId, String displayName, boolean isOptional) {
return requirements.requireOutput(uniqueRequirementId, displayName, isOptional, RconOutput.class);
}

// Add more outputs here

}