mirror of
https://github.com/unmojang/OnlineModeFix.git
synced 2025-09-10 16:00:40 -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 {
|
try {
|
||||||
propertiesFile.load(new FileInputStream(new File("server.properties")));
|
propertiesFile.load(new FileInputStream(new File("server.properties")));
|
||||||
String discordToken = propertiesFile.getProperty("discord-token", null);
|
String discordToken = mineOnlineConfig.getConfigString("discord-token");
|
||||||
String discordChannelID = propertiesFile.getProperty("discord-channel", null);
|
String discordChannelID = mineOnlineConfig.getConfigString("discord-channel");
|
||||||
String discordWebhookURL = propertiesFile.getProperty("discord-webhook-url", null);
|
String discordWebhookURL = mineOnlineConfig.getConfigString("discord-webhook-url");
|
||||||
serverName = propertiesFile.getProperty("server-name", serverName);
|
serverName = mineOnlineConfig.getConfigString("server-name");
|
||||||
|
|
||||||
|
|
||||||
if (discordToken != null && discordChannelID != null) { // Create the discord bot if token and channel are present
|
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("whitelist", false);
|
||||||
generateConfigOption("dont-list-players", false);
|
generateConfigOption("dont-list-players", false);
|
||||||
generateConfigOption("serverlist-motd", null);
|
generateConfigOption("serverlist-motd", null);
|
||||||
|
//Discord
|
||||||
|
generateConfigOption("discord-token", null);
|
||||||
|
generateConfigOption("discord-channel", null);
|
||||||
|
generateConfigOption("discord-webhook-url", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters Start
|
//Getters Start
|
||||||
@ -35,6 +40,15 @@ public class MineOnlineConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getConfigString(String key) {
|
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));
|
return String.valueOf(getConfigOption(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,10 +218,10 @@ public class MineOnlineBroadcastPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
propertiesFile.load(new FileInputStream(new File("server.properties")));
|
propertiesFile.load(new FileInputStream(new File("server.properties")));
|
||||||
String discordToken = propertiesFile.getProperty("discord-token", null);
|
String discordToken = mineOnlineConfig.getConfigString("discord-token");
|
||||||
String discordChannelID = propertiesFile.getProperty("discord-channel", null);
|
String discordChannelID = mineOnlineConfig.getConfigString("discord-channel");
|
||||||
String discordWebhookURL = propertiesFile.getProperty("discord-webhook-url", null);
|
String discordWebhookURL = mineOnlineConfig.getConfigString("discord-webhook-url");
|
||||||
String serverName = propertiesFile.getProperty("server-name", "Minecraft Server");
|
String serverName = mineOnlineConfig.getConfigString("server-name");
|
||||||
|
|
||||||
|
|
||||||
if (discordToken != null && discordChannelID != null) { // Create the discord bot if token and channel are present
|
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("whitelist", false);
|
||||||
generateConfigOption("dont-list-players", false);
|
generateConfigOption("dont-list-players", false);
|
||||||
generateConfigOption("serverlist-motd", null);
|
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) {
|
private void generateConfigOption(String key, Object defaultValue) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user