Files
src
build.gradle
manifest.kod
Code
20 1,462
src/main/java/com/offendplugin/OffendPlugin.java
package com.offendplugin;
import com.offendplugin.command.*;
import com.offendplugin.integration.VoiceChatIntegration;
import com.offendplugin.listener.PlayerListener;
import com.offendplugin.manager.ConfigManager;
import com.offendplugin.manager.PunishmentManager;
import lombok.Getter;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class OffendPlugin extends JavaPlugin {
private ConfigManager configManager;
private PunishmentManager punishmentManager;
private PlayerListener playerListener;
private VoiceChatIntegration voiceChatIntegration;
@Override
public void onEnable() {
saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.punishmentManager = new PunishmentManager(this);
this.playerListener = new PlayerListener(this);
this.voiceChatIntegration = new VoiceChatIntegration(this);
getServer().getPluginManager().registerEvents(playerListener, this);
getServer().getPluginManager().registerEvents(voiceChatIntegration, this);
// Safe command registration
registerCommand("offend", new OffendCommand(this));
registerCommand("unban", new UnbanCommand(this));
registerCommand("unmute", new UnmuteCommand(this));
registerCommand("vcunmute", new VcUnmuteCommand(this));
}
private void registerCommand(String name, CommandExecutor executor) {
PluginCommand command = getCommand(name);
if (command != null) {
command.setExecutor(executor);
} else {
getLogger().severe("Command '" + name + "' not found in plugin.yml!");
}
}
@Override
public void onDisable() {
punishmentManager.savePunishments();
}
}