Files
src
build.gradle
manifest.kod
Code
15 656
src/main/java/com/moderation/ModerationSystem.java
package com.moderation;
import com.moderation.commands.BanCommand;
import com.moderation.commands.MuteCommand;
import com.moderation.commands.UnbanCommand;
import com.moderation.commands.UnmuteCommand;
import com.moderation.listeners.ChatListener;
import com.moderation.listeners.LoginListener;
import com.moderation.managers.PunishmentManager;
import org.bukkit.plugin.java.JavaPlugin;
public class ModerationSystem extends JavaPlugin {
private PunishmentManager punishmentManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.punishmentManager = new PunishmentManager(this);
registerCommands();
registerListeners();
getLogger().info("ModerationSystem has been enabled!");
}
@Override
public void onDisable() {
if (punishmentManager != null) {
punishmentManager.savePunishments();
}
getLogger().info("ModerationSystem has been disabled!");
}
private void registerCommands() {
getCommand("mute").setExecutor(new MuteCommand(this));
getCommand("unmute").setExecutor(new UnmuteCommand(this));
getCommand("ban").setExecutor(new BanCommand(this));
getCommand("unban").setExecutor(new UnbanCommand(this));
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new ChatListener(this), this);
getServer().getPluginManager().registerEvents(new LoginListener(this), this);
}
public PunishmentManager getPunishmentManager() {
return punishmentManager;
}
}