Files
src
build.gradle
Code
8 557
src/main/java/com/lagcleaner/LagCleaner.java
package com.lagcleaner;
import com.lagcleaner.command.LagCleanerCommand;
import com.lagcleaner.config.ConfigManager;
import com.lagcleaner.task.CleanupTask;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class LagCleaner extends JavaPlugin {
private ConfigManager configManager;
private CleanupTask cleanupTask;
private Stats stats;
@Override
public void onEnable() {
this.saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.stats = new Stats();
this.cleanupTask = new CleanupTask(this);
this.getCommand("lagcleaner").setExecutor(new LagCleanerCommand(this));
if (this.configManager.isEnabled()) {
this.cleanupTask.start();
}
this.getLogger().info("LagCleaner has been enabled!");
}
@Override
public void onDisable() {
if (this.cleanupTask != null) {
this.cleanupTask.stop();
}
this.getLogger().info("LagCleaner has been disabled!");
}
public ConfigManager getConfigManager() {
return this.configManager;
}
public CleanupTask getCleanupTask() {
return this.cleanupTask;
}
public Stats getStats() {
return this.stats;
}
public void reload() {
this.reloadConfig();
this.configManager = new ConfigManager(this);
this.cleanupTask.stop();
this.cleanupTask = new CleanupTask(this);
if (this.configManager.isEnabled()) {
this.cleanupTask.start();
}
}
}