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 { } else {
dc.updatePresence(Presence.online(Activity.playing("testing"))).subscribe(); dc.updatePresence(Presence.online(Activity.playing("testing"))).subscribe();
} }
getLogger().info("Loaded!");
} catch (Exception e) { } catch (Exception e) {
TBMCCoreAPI.SendException("An error occurred while enabling DiscordPlugin!", 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. * 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); public final ConfigData<Boolean> addFakePlayersToBukkit = getConfig().getData("addFakePlayersToBukkit", true);
@ -164,18 +165,21 @@ public class MinecraftChatModule extends Component<DiscordPlugin> {
//e.printStackTrace(); //e.printStackTrace();
} }
try { //TODO: Config ^^ if (addFakePlayersToBukkit.get()) {
serverWatcher = new ServerWatcher(); try {
serverWatcher.enableDisable(true); serverWatcher = new ServerWatcher();
} catch (Exception e) { serverWatcher.enableDisable(true);
TBMCCoreAPI.SendException("Failed to hack the server (object)!", e); } catch (Exception e) {
TBMCCoreAPI.SendException("Failed to hack the server (object)!", e);
}
} }
} }
@Override @Override
protected void disable() { protected void disable() {
try { try { //If it's not enabled it won't do anything
serverWatcher.enableDisable(false); if (serverWatcher != null)
serverWatcher.enableDisable(false);
} catch (Exception e) { } catch (Exception e) {
TBMCCoreAPI.SendException("Failed to restore the server object!", e); TBMCCoreAPI.SendException("Failed to restore the server object!", e);
} }