armzaza1201-svg

ช่วยเขียนปลั้กอิน แบบปลั้กอินนี้ไห้หน่อย แบบเหมือน 100% https://www.spigotmc.org/resources/protection-core-folia-support.116739/ นั้นคือตัวปลั้กอิน และ วิกิของปลั้กอิน หลักการทำงานของปลั้กอินทั้งหมด https://justins-plugins.gitbook.io/protection-core/

Kodari AI
KodariJan 14 at 8:45 pm 23,371 (v2)

ฉันจะสร้างปลั๊กอิน Protection Core ที่มีฟีเจอร์ครบถ้วนให้คุณ

ProtectionCore
ระบบป้องกันพื้นที่แบบครอบคลุม ที่ให้ผู้เล่นสร้างและจัดการโซนป้องกันได้ รองรับ Folia มีระบบ flag หลากหลาย (build, pvp, mob-spawn, interact, explosion, fire-spread) จัดการสมาชิก GUI แบ่งสิทธิ์ owner/member selection tool ด้วยไอเทมพิเศษ ระบบ priority สำหรับโซนที่ทับซ้อน บันทึกข้อมูลด้วย SQLite/MySQL รองรับ PlaceholderAPI และ WorldGuard integration คำสั่งครบถ้วนพร้อม permission system และ multi-language support

สร้างปลั๊กอิน ProtectionCore เรียบร้อยแล้ว! ฟีเจอร์ครบถ้วนตามที่คุณต้องการ:

ฟีเจอร์หลัก: ✅ ระบบเลือกพื้นที่ด้วย Selection Tool (Golden Axe) ✅ สร้าง/ลบ Region พร้อมเช็คขนาดขั้นต่ำ/สูงสุด ✅ ระบบ Flag 25+ แบบ (build, pvp, mob-spawn, interact, explosion, ฯลฯ) ✅ จัดการสมาชิก (add/remove members) ✅ GUI สวยงาม 3 แบบ (Region List, Manage, Flags) ✅ ระบบ Priority สำหรับโซนที่ทับซ้อน ✅ รองรับ Folia ด้วย UniversalScheduler ✅ บันทึกข้อมูลด้วย SQLite/MySQL (HikariCP) ✅ Multi-language (ไทย/อังกฤษ) ✅ PlaceholderAPI integration ✅ Permission system ครบถ้วน

คำสั่ง:

  • /pc tool - รับเครื่องมือเลือกพื้นที่

  • /region create <name> - สร้างโซน

  • /region delete <name> - ลบโซน

  • /region list - ดูโซนทั้งหมด (GUI)

  • /region flag <region> <flag> <allow|deny> - ตั้งค่า flag

  • /region member <region> <add|remove> <player> - จัดการสมาชิก

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
24 1,903
src/main/java/com/justin/protectioncore/ProtectionCore.java
package com.justin.protectioncore;

import com.justin.protectioncore.command.MainCommand;
import com.justin.protectioncore.command.RegionCommand;
import com.justin.protectioncore.database.DatabaseManager;
import com.justin.protectioncore.gui.GuiManager;
import com.justin.protectioncore.listener.BlockListener;
import com.justin.protectioncore.listener.EntityListener;
import com.justin.protectioncore.listener.PlayerListener;
import com.justin.protectioncore.listener.SelectionListener;
import com.justin.protectioncore.manager.ConfigManager;
import com.justin.protectioncore.manager.RegionManager;
import com.justin.protectioncore.manager.SelectionManager;
import com.justin.protectioncore.placeholder.ProtectionPlaceholder;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class ProtectionCore extends JavaPlugin {
    
    private ConfigManager configManager;
    private DatabaseManager databaseManager;
    private RegionManager regionManager;
    private SelectionManager selectionManager;
    private GuiManager guiManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        configManager = new ConfigManager(this);
        configManager.loadLanguages();
        
        databaseManager = new DatabaseManager(this);
        databaseManager.initialize();
        
        regionManager = new RegionManager(this);
        selectionManager = new SelectionManager();
        guiManager = new GuiManager(this);
        
        registerCommands();
        registerListeners();
        registerPlaceholders();
        
        regionManager.loadAllRegions();
        
        getLogger().info("ProtectionCore v" + getDescription().getVersion() + " enabled!");
    }
    
    @Override
    public void onDisable() {
        if (regionManager != null) {
            regionManager.saveAllRegions();
        }
        
        if (databaseManager != null) {
            databaseManager.shutdown();
        }
        
        getLogger().info("ProtectionCore disabled!");
    }
    
    private void registerCommands() {
        getCommand("protectioncore").setExecutor(new MainCommand(this));
        getCommand("region").setExecutor(new RegionCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new SelectionListener(this), this);
        Bukkit.getPluginManager().registerEvents(new BlockListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
        Bukkit.getPluginManager().registerEvents(new EntityListener(this), this);
        Bukkit.getPluginManager().registerEvents(guiManager, this);
    }
    
    private void registerPlaceholders() {
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new ProtectionPlaceholder(this).register();
            getLogger().info("PlaceholderAPI hooked!");
        }
    }
    
    public void reload() {
        reloadConfig();
        configManager.loadLanguages();
        regionManager.saveAllRegions();
        regionManager.loadAllRegions();
    }
}