-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bungeecord hooks for NuVotifier, LiteBans, AdvancedBan
- Loading branch information
1 parent
b9cb01c
commit c8668e9
Showing
3 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
module/universal/src/io/purecore/mcplugin/bungee/events/LiteBansHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.purecore.mcplugin.bungee.events; | ||
|
||
import io.purecore.api.call.ApiException; | ||
import io.purecore.mcplugin.common.thirdPartyIntegration.LiteBans; | ||
import litebans.api.Entry; | ||
import litebans.api.Events; | ||
import net.md_5.bungee.api.plugin.Plugin; | ||
import org.json.JSONException; | ||
|
||
import java.io.IOException; | ||
import java.util.logging.Level; | ||
|
||
public class LiteBansHandler { | ||
|
||
Plugin plugin; | ||
|
||
public LiteBansHandler(Plugin plugin){ | ||
this.plugin=plugin; | ||
this.plugin.getLogger().log(Level.INFO,"Hooked into LiteBans"); | ||
|
||
// no need for scheduler, this block is already async | ||
Events.get().register(new Events.Listener() { | ||
@Override | ||
public void entryRemoved(Entry entry){ | ||
try { | ||
LiteBans.handleEntryDelete(entry); | ||
} catch (JSONException | ApiException | IOException e) { | ||
plugin.getLogger().log(Level.WARNING, "There was an error while removing a LiteBans punishment: " + e.getMessage()); | ||
} | ||
} | ||
|
||
@Override | ||
public void entryAdded(Entry entry) { | ||
try { | ||
LiteBans.handleEntryAdd(entry); | ||
} catch (JSONException | ApiException | IOException e) { | ||
plugin.getLogger().log(Level.WARNING, "There was an error while creating a LiteBans punishment: " + e.getMessage()); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
module/universal/src/io/purecore/mcplugin/bungee/events/NuVotifierHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.purecore.mcplugin.bungee.events; | ||
|
||
import net.md_5.bungee.api.plugin.Listener; | ||
import net.md_5.bungee.api.plugin.Plugin; | ||
|
||
import java.util.logging.Level; | ||
|
||
public class NuVotifierHandler implements Listener { | ||
|
||
Plugin plugin; | ||
|
||
public NuVotifierHandler(Plugin plugin){ | ||
this.plugin=plugin; | ||
this.plugin.getLogger().log(Level.INFO,"Hooked into NuVotifier"); | ||
} | ||
|
||
} |