-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVupeModule.java
More file actions
36 lines (29 loc) · 903 Bytes
/
Copy pathVupeModule.java
File metadata and controls
36 lines (29 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package dev.vupe.core.module;
import dev.vupe.core.VupeCore;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
public abstract class VupeModule implements Listener {
protected final VupeCore plugin;
private final String id;
private boolean enabled;
protected VupeModule(VupeCore plugin, String id) {
this.plugin = plugin;
this.id = id;
}
public final void enable() {
if (enabled) return;
enabled = true;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
onEnable();
}
public final void disable() {
if (!enabled) return;
onDisable();
HandlerList.unregisterAll(this);
enabled = false;
}
protected void onEnable() {}
protected void onDisable() {}
public String id() { return id; }
public boolean enabled() { return enabled; }
}