Config and such

This commit is contained in:
Norbi Peti 2020-09-12 01:54:45 +02:00
parent cd2132ba45
commit beae6e6ce0
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 12 additions and 7 deletions

View file

@ -231,6 +231,7 @@ public class DiscordPlugin extends ButtonPlugin {
} else {
dc.updatePresence(Presence.online(Activity.playing("testing"))).subscribe();
}
getLogger().info("Loaded!");
} catch (Exception e) {
TBMCCoreAPI.SendException("An error occurred while enabling DiscordPlugin!", e);
}

View file

@ -117,6 +117,7 @@ public class MinecraftChatModule extends Component<DiscordPlugin> {
/**
* Whether players logged on from Discord should be recognised by other plugins. Some plugins might break if it's turned off.
* But it's really hacky.
*/
public final ConfigData<Boolean> addFakePlayersToBukkit = getConfig().getData("addFakePlayersToBukkit", true);
@ -164,17 +165,20 @@ public class MinecraftChatModule extends Component<DiscordPlugin> {
//e.printStackTrace();
}
try { //TODO: Config ^^
if (addFakePlayersToBukkit.get()) {
try {
serverWatcher = new ServerWatcher();
serverWatcher.enableDisable(true);
} catch (Exception e) {
TBMCCoreAPI.SendException("Failed to hack the server (object)!", e);
}
}
}
@Override
protected void disable() {
try {
try { //If it's not enabled it won't do anything
if (serverWatcher != null)
serverWatcher.enableDisable(false);
} catch (Exception e) {
TBMCCoreAPI.SendException("Failed to restore the server object!", e);