Skip to content

Commit

Permalink
handle plugin disable
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Feb 22, 2024
1 parent f58fa38 commit 85a44c2
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ public final class PumpkinPVPReloaded extends JavaPlugin {
private static BukkitAudiences audiences;
private static ComponentLogger logger;
private static Random random;
private Metrics metrics;

@Override
public void onEnable() {
instance = this;
audiences = BukkitAudiences.create(this);
logger = ComponentLogger.logger(getName());
foliaLib = new FoliaLib(this);
metrics = new Metrics(this, 20296);

// Fancy enable
final Style bold_green = Style.style().decorate(TextDecoration.BOLD).color(TextColor.color(163,235,30)).build();
Expand Down Expand Up @@ -56,7 +58,20 @@ public void onEnable() {

reloadConfiguration();
getCommand("pumpkinpvp").setExecutor(new PumpkinPVPCommand());
new Metrics(this, 20296);
}

@Override
public void onDisable() {
PumpkinPVPModule.modules.forEach(PumpkinPVPModule::disable);
PumpkinPVPModule.modules.clear();
if (audiences != null) {
audiences.close();
audiences = null;
}
if (metrics != null) {
metrics.shutdown();
metrics = null;
}
}

public void reloadConfiguration() {
Expand Down

0 comments on commit 85a44c2

Please sign in to comment.