nichttimo25

Erstelle ein punish plugin

Kodari AI
KodariMar 16 at 12:34 pm 16,778 (v2)

Ich erstelle ein umfassendes Bestrafungs-Plugin mit Ban, Mute, Kick und Warn-Funktionen.

PunishmentSystem
Advanced punishment management system for Minecraft servers. Supports permanent and temporary bans, mutes, kicks, and warnings with comprehensive punishment history tracking. Features include customizable messages, automatic punishment expiration, database storage, and detailed admin commands for managing player infractions. Includes punishment appeal system and configurable severity levels.

Ich erstelle nun die restlichen Dateien für das Punishment-System.

Punishment-System vollständig erstellt mit Ban, TempBan, Mute, TempMute, Kick, Warn, Unban, Unmute, Check und History Commands sowie automatischer Ablaufprüfung und YAML-Speicherung.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
21 1,359
src/main/java/com/punish/system/PunishmentSystem.java
package com.punish.system;

import com.punish.system.commands.*;
import com.punish.system.listeners.ChatListener;
import com.punish.system.listeners.JoinListener;
import com.punish.system.managers.ConfigManager;
import com.punish.system.managers.PunishmentManager;
import com.punish.system.managers.StorageManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class PunishmentSystem extends JavaPlugin {

    private ConfigManager configManager;
    private StorageManager storageManager;
    private PunishmentManager punishmentManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.storageManager = new StorageManager(this);
        this.punishmentManager = new PunishmentManager(this);
        
        storageManager.load();
        punishmentManager.checkExpiredPunishments();
        
        registerCommands();
        registerListeners();
        
        getLogger().info("PunishmentSystem aktiviert!");
    }

    @Override
    public void onDisable() {
        if (storageManager != null) {
            storageManager.save();
        }
        getLogger().info("PunishmentSystem deaktiviert!");
    }

    private void registerCommands() {
        getCommand("ban").setExecutor(new BanCommand(this));
        getCommand("tempban").setExecutor(new TempBanCommand(this));
        getCommand("unban").setExecutor(new UnbanCommand(this));
        getCommand("mute").setExecutor(new MuteCommand(this));
        getCommand("tempmute").setExecutor(new TempMuteCommand(this));
        getCommand("unmute").setExecutor(new UnmuteCommand(this));
        getCommand("kick").setExecutor(new KickCommand(this));
        getCommand("warn").setExecutor(new WarnCommand(this));
        getCommand("punishcheck").setExecutor(new CheckCommand(this));
        getCommand("punishhistory").setExecutor(new HistoryCommand(this));
    }

    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new JoinListener(this), this);
        getServer().getPluginManager().registerEvents(new ChatListener(this), this);
    }
}