Skip to content

Commit

Permalink
🐛 Fixed DiscordSRV handling
Browse files Browse the repository at this point in the history
  • Loading branch information
PainOchoco committed May 5, 2022
1 parent 62795f6 commit f8ac90e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/net/laboulangerie/townychat/TownyChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ public void onEnable() {

this.registerShortcutCommands();

DiscordHook discordHook = new DiscordHook();

this.listeners = new ArrayList<>(Arrays.asList(
new TownyChatListener(),
new MiscListener(),
new TownyListener(),
discordHook));

this.registerListeners();
new TownyListener()));

// Is DiscordSRV enabled? It's a softdepend
if (getServer().getPluginManager().getPlugin("DiscordSRV") != null) {
DiscordHook discordHook = new DiscordHook();

this.listeners.add(discordHook);
this.registerListeners();
DiscordSRV.getPlugin().getPluginHooks().add(discordHook);
getLogger().info("Hooked to DiscordSRV!");
} else {
this.registerListeners();
}

getLogger().info("Plugin started");
Expand Down

0 comments on commit f8ac90e

Please sign in to comment.