fishikxd
  1. Podczas pvp gracz może mieć w eq maksymalnie 2 totemy w 10 enchanted golden apple 64 golden apple i 16 ender pearl a jak ktoś ma więcej to usuwa mu się
Kodari AI
KodariJul 6 at 2:16 pm 3
PvPItemLimiter
A PvP item restriction plugin that limits the number of specific items players can carry during combat. Automatically removes excess Totems of Undying, Enchanted Golden Apples, Golden Apples, and Ender Pearls from player inventories during PvP. Features configurable limits, combat duration tracking, and periodic inventory checks for players engaged in combat.

Creating the project structure now

Now I’ll create all project files. Let me plan the architecture:

  1. Main plugin - Load config, register listeners, schedule task

  2. CombatManager - Track combat state (UUID → expiry time), cleanup expired

  3. ItemLimiter - Check/remove excess items using XMaterial

  4. CombatListener - Mark players in combat on PvP damage

  5. InventoryCheckTask - Periodic check of combat players’ inventories

Creating everything now:

PvPItemLimiter
A PvP item restriction plugin that limits Totems of Undying, Enchanted Golden Apples, Golden Apples, and Ender Pearls during combat. Uses configurable limits and periodic inventory checks to automatically remove excess items from players engaged in PvP. Built with XSeries for cross-version compatibility.
fishikxd

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/darkkronicle/pvpitemlimiter/PvPItemLimiter.java at line 24: incompatible types: possible lossy conversion from long to int
        task.runTaskTimer(this, 0L, getConfig().getInt("check-interval", 20L));
                                                                         ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: possible lossy conversion from long to int
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/darkkronicle/pvpitemlimiter/PvPItemLimiter.java

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

Kodari AI
KodariJul 6 at 2:32 pm 1

Changed 20L → 20 — getInt() expects int, not long.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 268
src/main/java/com/darkkronicle/pvpitemlimiter/PvPItemLimiter.java
package com.darkkronicle.pvpitemlimiter;

import com.darkkronicle.pvpitemlimiter.listeners.CombatListener;
import com.darkkronicle.pvpitemlimiter.managers.CombatManager;
import com.darkkronicle.pvpitemlimiter.tasks.InventoryCheckTask;
import org.bukkit.plugin.java.JavaPlugin;

public final class PvPItemLimiter extends JavaPlugin {

    private CombatManager combatManager;
    private ItemLimiter itemLimiter;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        reloadConfig();

        this.combatManager = new CombatManager();
        this.itemLimiter = new ItemLimiter(this);

        getServer().getPluginManager().registerEvents(new CombatListener(this), this);

        InventoryCheckTask task = new InventoryCheckTask(this);
        task.runTaskTimer(this, 0L, getConfig().getInt("check-interval", 20));
    }

    public CombatManager getCombatManager() {
        return combatManager;
    }

    public ItemLimiter getItemLimiter() {
        return itemLimiter;
    }
}