K

มอบไอเทม compass enchant คลิกขวาเพื่อใช้คำสั่ง ทุกครั้งที่เข้าเกม ตรวจสอบถ้ามีไอเทมนี้อยู่ในตัวแล้ว จะไม่ได้รับ เมื่อไอเทมนี้ เมื่อไอเทมนี้ไม่ได้อยู่ในตัวของผู้เล่น ไอเทมนี้จะถูกลบออกจากทุกที่ภายใน 5 นาที สามารเปลี่ยน ไอเทม,ชื่อ,lore.คำสั่ง ได้ผ่าน config plugin นี้เป็นภาษาไทย config ภาษาไทย

Kodari AI
KodariJun 5 at 4:10 pm 1

I’ll build a plugin that gives players a special compass for executing commands via right-click, with Thai-language config and automatic cleanup.

CompassCommandPlugin
Minecraft plugin that gives players a special compass item with enchantment glow. Right-clicking the compass executes a configurable command. On join, the plugin checks if the player already has the item. If the compass is not on the player for 5 minutes, all compass items are removed from everywhere. All item settings (material, name, lore, command) are configurable via Thai-language config file.
K

The compilation failed with this error:

code
Compilation failed with 5 error(s):

ERROR in src/main/java/com/compasscommand/CompassManager.java at line 21: class ComapassManager is public, should be declared in a file named ComapassManager.java
public class ComapassManager {
       ^

ERROR in src/main/java/com/compasscommand/CompassCommandPlugin.java at line 9: cannot find symbol
    private CompassManager compassManager;
            ^
  symbol: class CompassManager
  location: class CompassCommandPlugin

ERROR in src/main/java/com/compasscommand/CompassCommandPlugin.java at line 36: cannot find symbol
    public CompassManager getCompassManager() {
           ^
  symbol: class CompassManager
  location: class CompassCommandPlugin

ERROR in src/main/java/com/compasscommand/CompassCommandPlugin.java at line 17: cannot find symbol
        compassManager = new CompassManager(this);
                             ^
  symbol: class CompassManager
  location: class CompassCommandPlugin

ERROR in src/main/java/com/compasscommand/CompassManager.java at line 59: cannot find symbol
            meta.addEnchant(Enchantment.LUCK, 1, true);
                                       ^
  symbol: variable LUCK
  location: class Enchantment


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - CompassManager
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/compasscommand/CompassManager.java
  - src/main/java/com/compasscommand/CompassCommandPlugin.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJun 5 at 4:18 pm 1

Two issues: class name typo (ComapassManager vs file CompassManager.java), and Enchantment.LUCK doesn’t exist in Bukkit (needs XSeries).

Now let me check the listener and other files to ensure everything is complete.

Now let me add XSeries to the build dependencies.

All fixes applied:

  1. CompassManager.java — Fixed class name from ComapassManager → CompassManager, swapped Enchantment.LUCK for XEnchantment.matchXEnchantment("LUCK_OF_THE_SEA")

  2. PlayerListener.java — Fixed imports and field references from ComapassManager → CompassManager

  3. build.gradle — Added XSeries dependency via JitPack

K

เพิ่มคำสั่งให้ แอดมิดมอบไอเทมให้ผู้เล่น แบบรายคน และ ทั้งเซิฟ เพิ่ม หากผู้เล่นมีไอเทมเต็มตัว จะไม่ได้รับไอเทม

Kodari AI
KodariJun 5 at 4:25 pm 1

Now I’ll create the command class, update the main plugin to register it, and add Thai messages to config.

K

คำสั่ง มอบไอเทม ใช้ไม่ได้

Kodari AI
KodariJun 5 at 4:32 pm 1

Let me check the command registration and the command class.

<kodariReadFile>src/main/resources/plugin

K

แก้ไข คำสั่ง มอบไอเทม ใช้ไม่ได้้

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 284
src/main/java/com/compasscommand/CompassCommandPlugin.java
package com.compasscommand;

import com.compasscommand.listeners.PlayerListener;
import org.bukkit.plugin.java.JavaPlugin;

public class CompassCommandPlugin extends JavaPlugin {

    private static CompassCommandPlugin instance;
    private CompassManager compassManager;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();
        reloadConfig();

        compassManager = new CompassManager(this);

        getServer().getPluginManager().registerEvents(new PlayerListener(this, compassManager), this);

        getLogger().info("CompassCommandPlugin พร้อมทำงาน!");
    }

    @Override
    public void onDisable() {
        if (compassManager != null) {
            compassManager.cancelRemovalTask();
        }
        getLogger().info("CompassCommandPlugin ปิดการทำงาน!");
    }

    public static CompassCommandPlugin getInstance() {
        return instance;
    }

    public CompassManager getCompassManager() {
        return compassManager;
    }
}