mirror of
https://github.com/unmojang/OnlineModeFix.git
synced 2025-09-10 07:47:20 -04:00
Discord config moved to plugin config
This commit is contained in:
parent
311f190d92
commit
c941d621c4
@ -240,10 +240,10 @@ public class MineOnlineBroadcast extends Plugin {
|
||||
|
||||
try {
|
||||
propertiesFile.load(new FileInputStream(new File("server.properties")));
|
||||
String discordToken = propertiesFile.getProperty("discord-token", null);
|
||||
String discordChannelID = propertiesFile.getProperty("discord-channel", null);
|
||||
String discordWebhookURL = propertiesFile.getProperty("discord-webhook-url", null);
|
||||
serverName = propertiesFile.getProperty("server-name", serverName);
|
||||
String discordToken = mineOnlineConfig.getConfigString("discord-token");
|
||||
String discordChannelID = mineOnlineConfig.getConfigString("discord-channel");
|
||||
String discordWebhookURL = mineOnlineConfig.getConfigString("discord-webhook-url");
|
||||
serverName = mineOnlineConfig.getConfigString("server-name");
|
||||
|
||||
|
||||
if (discordToken != null && discordChannelID != null) { // Create the discord bot if token and channel are present
|
||||
|
@ -27,6 +27,11 @@ public class MineOnlineConfig {
|
||||
generateConfigOption("whitelist", false);
|
||||
generateConfigOption("dont-list-players", false);
|
||||
generateConfigOption("serverlist-motd", null);
|
||||
//Discord
|
||||
generateConfigOption("discord-token", null);
|
||||
generateConfigOption("discord-channel", null);
|
||||
generateConfigOption("discord-webhook-url", null);
|
||||
|
||||
}
|
||||
|
||||
//Getters Start
|
||||
@ -35,6 +40,15 @@ public class MineOnlineConfig {
|
||||
}
|
||||
|
||||
public String getConfigString(String key) {
|
||||
if(getConfigOption(key) == null) {
|
||||
return null;
|
||||
}
|
||||
//Hacky solution for hmod config storing null as text
|
||||
if(String.valueOf(getConfigOption(key)).equalsIgnoreCase("null")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return String.valueOf(getConfigOption(key));
|
||||
}
|
||||
|
||||
|
@ -218,10 +218,10 @@ public class MineOnlineBroadcastPlugin extends JavaPlugin {
|
||||
|
||||
try {
|
||||
propertiesFile.load(new FileInputStream(new File("server.properties")));
|
||||
String discordToken = propertiesFile.getProperty("discord-token", null);
|
||||
String discordChannelID = propertiesFile.getProperty("discord-channel", null);
|
||||
String discordWebhookURL = propertiesFile.getProperty("discord-webhook-url", null);
|
||||
String serverName = propertiesFile.getProperty("server-name", "Minecraft Server");
|
||||
String discordToken = mineOnlineConfig.getConfigString("discord-token");
|
||||
String discordChannelID = mineOnlineConfig.getConfigString("discord-channel");
|
||||
String discordWebhookURL = mineOnlineConfig.getConfigString("discord-webhook-url");
|
||||
String serverName = mineOnlineConfig.getConfigString("server-name");
|
||||
|
||||
|
||||
if (discordToken != null && discordChannelID != null) { // Create the discord bot if token and channel are present
|
||||
|
@ -26,7 +26,10 @@ public class MineOnlineConfig extends Configuration {
|
||||
generateConfigOption("whitelist", false);
|
||||
generateConfigOption("dont-list-players", false);
|
||||
generateConfigOption("serverlist-motd", null);
|
||||
|
||||
//Discord
|
||||
generateConfigOption("discord-token", null);
|
||||
generateConfigOption("discord-channel", null);
|
||||
generateConfigOption("discord-webhook-url", null);
|
||||
}
|
||||
|
||||
private void generateConfigOption(String key, Object defaultValue) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user