prostofilip

Make a plugin so now i can /give myself something called minecraft:regear_shulker, it has a cooldown of 5 minutes after use, it resets the crystals obsidian, anchors, ender pearls, golden apples glowstode, back to 16/64

Kodari AI
KodariJul 24 at 6:54 pm 5
RegearShulker
A Minecraft plugin that adds a custom regear shulker item obtainable through the give command. When used, it replenishes end crystals, obsidian, respawn anchors, ender pearls, golden apples, and glowstone to configured combat quantities of 16 or 64. The item is consumed on use and enforces a persistent five-minute cooldown per player, with clear feedback for successful uses and remaining cooldown time.
prostofilip

make it so i can give myself the shulker with /regear, my version is paper 26.2

Kodari AI
KodariJul 24 at 7:04 pm 3
  1. Register /regear as a plugin command.

  2. Make it give the executing player one tagged Regear Shulker, using the existing item and inventory behavior.

Added /regear.

  • Players with regearshulker.give permission can use it.

  • Default permission is operator-only.

  • It gives one tagged Regear Shulker directly to the player.

  • If the inventory is full, it drops the item at the player’s location.

  • Existing /give ... minecraft:regear_shulker support remains available.

prostofilip

OKAY LEMME DOWNLOAD IT NOW

Kodari AI
KodariJul 24 at 7:15 pm 1

The plugin project is ready to download. Build or download the generated project, then place the resulting .jar in your Paper server’s plugins folder and restart the server. Use:

Plain Text
/regear

Paper 26.2 is supported by the updated command registration.

prostofilip

make it so it just resets the items instead of giving new ones

Kodari AI
KodariJul 24 at 7:30 pm 3

Updated. Using the Regear Shulker now resets matching items already in your inventory instead of removing them and giving new items.

It sets:

  • End Crystals: 16

  • Obsidian: 64

  • Respawn Anchors: 16

  • Ender Pearls: 16

  • Golden Apples: 16

  • Glowstone: 64

Items not currently in your inventory will not be added. The 5-minute cooldown and shulker consumption remain unchanged.

prostofilip

they might have multiple stacks of those items so make sure it doesn't lag if they do\

Kodari AI
KodariJul 24 at 7:39 pm 2
  1. Keep the reset to a single bounded inventory scan.

  2. Skip stacks already at the correct amount and avoid unnecessary inventory writes.

Updated the reset logic to safely handle multiple stacks:

  • Scans the inventory once.

  • Resets every matching stack.

  • Skips empty slots.

  • Avoids unnecessary inventory writes when a stack is already at the target amount.

  • Does not create, split, merge, or loop through individual items, so multiple stacks won’t cause lag.

prostofilip

I need to make a queue type of thing like this so make a /queue command and make it so i can set a spawn and people can open their stats their stats are gonna be so it says their win rate, deaths, kills, wins , and they can search for people to pvp, also make a menu for op only so they can add kits, make it so they can add them with /kit add (NAME) (Item like a crystal to be shown) example /kit add Crystal END_CRYSTAL

for 26.2 paper

2 images attached
Kodari AI
KodariJul 24 at 8:40 pm 47
  1. Add the /queue system with a queue GUI, configurable spawn, kit selection, and PvP search entry point.

  2. Add persistent player stats and stats lookup for win rate, deaths, kills, and wins.

  3. Add operator-only kit management, including /kit add <name> <material> and an admin menu.

  1. Queue core: adding the queue menu, persistent spawn location, kit-aware search queue, matching, and /queue setspawn/leave.

  2. Stats: adding persistent kills, deaths, wins, and win-rate display plus player lookup.

  3. Kits: adding /kit add, kit persistence, kit icons in the queue menu, and the operator kit-management menu.

Implemented the PvP queue system for the plugin.

Commands:

Plain Text
/queue

Op/admin commands:

Plain Text
/queue setspawn
/queue leave
/kit add Crystal END_CRYSTAL
/kit menu

Stats:

Plain Text
/stats
/stats <online-player>

Features added:

  • Queue GUI with kit selection.

  • Players are matched with others searching for the same kit.

  • Matches teleport players a few blocks apart at the configured queue spawn.

  • Persistent kills, deaths, wins, and win-rate statistics.

  • Stats button inside the queue menu.

  • Persistent kit storage using the configured icon material.

  • Operator-only kit management.

  • Player quit automatically removes them from the queue.

  • Existing Regear Shulker functionality remains intact.

  • Configuration is saved in plugins/RegearShulker/config.yml.

The kit material is currently used as the displayed kit icon and queue category. The actual combat loadout contents are not changed by the kit system.

prostofilip

make it so when they queue it teleports them to random cords from 100k to 30 million coordinates, make sure it clears all the trees and MAKE sure it makes it so there is no trees and its a flat terrain, also make it so instead of you typing the queue command it makes it so you have an unenchanted diamond sword in ur hotbar that when you right click opens the INVENTORY GUI, also make it so if u wanna leave queue there just press a barrier block in ur inv, also make sure the diamond sword is called "Queues" and its name is blue colorish, also the barrier is gonna be red color, also make it so i can set a spawn where players cant break with setpvpspawn.

Kodari AI
KodariJul 24 at 8:56 pm 22
  1. Update queue matching to teleport players to safe random arenas between 100k and 30M, with flat treeless terrain preparation.

  2. Replace command-based opening with the hotbar “Queues” sword and add a red barrier button to leave the queue.

  3. Add /setpvpspawn and protect the configured PvP spawn from block breaking.

  1. Random arenas: queue matches will use the configured PvP/queue world, select coordinates from ±100,000 to ±30,000,000, and prepare a 33×33 flat, treeless arena over several ticks before teleporting.

  2. Queue GUI item: add the hotbar sword opener and red barrier leave action.

  3. PvP spawn: add /setpvpspawn storage and block-break protection around that spawn.

Implemented:

  • Players receive an unenchanted diamond sword named blue “Queues” in their hotbar.

  • Right-clicking it opens the queue GUI.

  • The red barrier button leaves the queue.

  • Queue matches now use random X/Z coordinates from 100,000 to 30,000,000 in either direction.

  • Each arena is prepared as a flat, treeless 33×33 PvP area before teleporting players.

  • Arena preparation is spread over multiple server ticks to reduce lag.

  • Added:

Plain Text
/setpvpspawn
  • /setpvpspawn is operator/admin-only.

  • The configured PvP spawn determines the world used for random arenas.

  • Blocks within 16 blocks of the PvP spawn cannot be broken.

  • The queue now requires /setpvpspawn to be configured first.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 979
src/main/java/com/kodari/regearshulker/RegearShulkerPlugin.java
package com.kodari.regearshulker;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;

public final class RegearShulkerPlugin extends JavaPlugin implements Listener, CommandExecutor {
    private static final long COOLDOWN_MILLIS = 5L * 60L * 1000L;
    private static final String REGEAR_ITEM_ID = "regear_shulker";

    private final Map<String, Integer> regearContents = new LinkedHashMap<>();
    private NamespacedKey itemKey;
    private NamespacedKey cooldownKey;
    private QueueManager queueManager;
    private FileConfiguration queueConfig;

    @Override
    public void onEnable() {
        itemKey = new NamespacedKey(this, REGEAR_ITEM_ID);
        cooldownKey = new NamespacedKey(this, "last_use");
        saveDefaultConfig();
        queueConfig = getConfig();

        regearContents.put("END_CRYSTAL", 16);
        regearContents.put("OBSIDIAN", 64);
        regearContents.put("RESPAWN_ANCHOR", 16);
        regearContents.put("ENDER_PEARL", 16);
        regearContents.put("GOLDEN_APPLE", 16);
        regearContents.put("GLOWSTONE", 64);

        getServer().getPluginManager().registerEvents(this, this);
        getCommand("regear").setExecutor(this);

        queueManager = new QueueManager(this);
        getServer().getPluginManager().registerEvents(queueManager, this);
        getCommand("queue").setExecutor(new QueueCommand(queueManager));
        getCommand("kit").setExecutor(new KitCommand(queueManager));
        getCommand("setpvpspawn").setExecutor(new QueueCommand(queueManager));
        getCommand("stats").setExecutor(new StatsCommand(queueManager));
        for (Player player : Bukkit.getOnlinePlayers()) {
            giveQueueItem(player);
        }
    }

    @Override
    public void onDisable() {
        if (queueManager != null) {
            queueManager.shutdown();
        }
    }

    public QueueManager getQueueManager() {
        return queueManager;
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Bukkit.getScheduler().runTask(this, () -> giveQueueItem(event.getPlayer()));
    }

    private void giveQueueItem(Player player) {
        for (ItemStack item : player.getInventory().getContents()) {
            if (isQueueItem(item)) {
                return;
            }
        }

        PlayerInventory inventory = player.getInventory();
        for (int slot = 0; slot < 9; slot++) {
            if (inventory.getItem(slot) == null) {
                inventory.setItem(slot, createQueueItem());
                return;
            }
        }

        Map<Integer, ItemStack> leftovers = inventory.addItem(createQueueItem());
        for (ItemStack leftover : leftovers.values()) {
            player.getWorld().dropItemNaturally(player.getLocation(), leftover);
        }
    }

    private ItemStack createQueueItem() {
        ItemStack item = new ItemStack(resolveMaterial("DIAMOND_SWORD"));
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.BLUE + "Queues");
        item.setItemMeta(meta);
        return item;
    }

    private boolean isQueueItem(ItemStack item) {
        return item != null && item.getType() == resolveMaterial("DIAMOND_SWORD")
                && item.hasItemMeta() && item.getItemMeta().hasDisplayName()
                && ChatColor.stripColor(item.getItemMeta().getDisplayName()).equals("Queues");
    }

    @EventHandler
    public void onQueueItemInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || event.getItem() == null
                || event.getItem().getType() != resolveMaterial("DIAMOND_SWORD")
                || !event.getItem().hasItemMeta()
                || !ChatColor.stripColor(event.getItem().getItemMeta().getDisplayName()).equals("Queues")) {
            return;
        }

        Action action = event.getAction();
        if (action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) {
            return;
        }

        event.setCancelled(true);
        queueManager.openQueueMenu(event.getPlayer());
    }

    public FileConfiguration getQueueConfig() {
        return queueConfig;
    }

    public void saveQueueConfig() {
        saveConfig();
    }

    public Map<String, Integer> getRegearContents() {
        return regearContents;
    }

    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("regear")) {
            return handleRegearCommand(sender);
        }

        return false;
    }

    private boolean handleRegearCommand(CommandSender sender) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "Only players can use this command.");
            return true;
        }

        Player player = (Player) sender;
        Map<Integer, ItemStack> leftovers = player.getInventory().addItem(createRegearShulker());
        for (ItemStack leftover : leftovers.values()) {
            player.getWorld().dropItemNaturally(player.getLocation(), leftover);
        }

        player.sendMessage(ChatColor.GREEN + "You received a Regear Shulker.");
        return true;
    }

    @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
    public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
        String message = event.getMessage().trim();
        if (!message.startsWith("/")) {
            return;
        }

        String[] arguments = message.substring(1).split("\\s+");
        if (arguments.length < 3) {
            return;
        }

        String command = arguments[0].toLowerCase(Locale.ROOT);
        if (!command.equals("give") && !command.equals("minecraft:give")) {
            return;
        }