Drymatic
📎 1 file 2,606 chars
📄
pasted-code-1790616971668.txt
txt 39 lines
▶
Act as an expert Minecraft Spigot/Paper plugin developer (Java, Paper API for Minecraft 1.20+). 

Create a custom Spigot/Paper SMP plugin inspired by "Psychis SMP" featuring custom ability classes/gems, active abilities, passive traits, and combat integration.

---

### Key Requirements & Features:

#### 1. Core Mechanics & Classes / Gems
Implement a class system where players can select or be assigned one of the following unique "Psychis" abilities/gems:

*   **Glitch / Teleportation Class:**
    *   **Active Ability (Right-click item / Command):** Instant short-range teleport forward (dash through blocks/walls up to 8 blocks). Leaves behind a visual ender particle trail and plays a enderman teleport sound.
    *   **Passive:** Chance on taking hit to "glitch" out of combat, taking 50% reduced damage for 2 seconds (10s cooldown).

*   **Infuse / Strength Class:**
    *   **Active Ability:** Grants Strength II, Speed I, and Resistance I to the player for 10 seconds. Creates flame/crit particle aura around the user.
    *   **Passive:** Deals +15% extra melee damage to unarmored or lower-tier armored opponents.

*   **Bliss / Regeneration Class:**
    *   **Active Ability:** Spawns a healing aura/zone (3-block radius) at the player's location for 6 seconds. Heals the owner and nearby allies while granting Regeneration II.
    *   **Passive:** Natural health regeneration rate is 25% faster.

#### 2. Commands & Permissions
*   `/psychis set  ` - Assign a Psychis class to a player (`psychis.admin`).
*   `/psychis remove ` - Remove a player's class (`psychis.admin`).
*   `/psychis menu` - Opens a clean Inventory GUI for players to view their active class, abilities, and cooldowns.
*   `/psychis reload` - Reloads the configuration file (`psychis.admin`).

#### 3. Cooldowns & Balancing
*   Implement strict cooldown timers for all active abilities (default: 30 seconds).
*   Display active cooldowns above the action bar (`sendActionBar`) or in the `V` / ability key notification.
*   Store player class data persistently in `PlayerData.yml` or SQLite/Json so it persists across server restarts.

#### 4. Config & Visuals
*   Provide a fully customizable `config.yml` allowing server owners to tweak damage values, cooldown durations, particle effects, and sound effects for each class.
*   Use standard Spigot Particle and Sound APIs for smooth visual feedback during ability activations.

Please write clean, well-commented, production-ready Java code for paper-api 1.20+ using Bukkit/Spigot events and scheduler tasks.
Kodari AI
KodariSep 28 at 5:38 pm 1
PsychisSMP
A custom SMP plugin implementing a class-based ability system with three unique Psychis gems: Glitch (teleportation), Infuse (strength), and Bliss (regeneration). Features active abilities triggered via right-click or commands with particle effects and sounds, passive traits for combat enhancement, persistent player data storage, configurable cooldowns and effects, admin commands for class assignment, and an inventory GUI for viewing class information and ability status. Includes full configuration customization for damage values, cooldown durations, and visual effects.
  1. Set up the Paper 1.20+ Gradle plugin and configurable defaults.

  2. Implement persistent class assignment, abilities, passives, cooldowns, and the ability item.

  3. Add /psychis commands and a class/status inventory menu.

Created the Psychis SMP plugin with Glitch, Infuse, and Bliss abilities and passives; persistent class assignments; configurable cooldowns and effects; a right-click ability item; /psychis commands; and a class/status menu. I haven’t verified it with a build.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
11 838
src/main/java/com/kodari/psychis/PsychisPlugin.java
package com.kodari.psychis;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Arrays;

public final class PsychisPlugin extends JavaPlugin {
    private ClassManager classManager;
    private AbilityManager abilityManager;
    private NamespacedKey abilityItemKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        classManager = new ClassManager(this);
        abilityManager = new AbilityManager(this, classManager);
        abilityItemKey = new NamespacedKey(this, "ability_item");

        Bukkit.getPluginManager().registerEvents(new PsychisListener(this), this);
        PsychisCommand command = new PsychisCommand(this);
        getCommand("psychis").setExecutor(command);
        getCommand("psychis").setTabCompleter(command);

        Bukkit.getScheduler().runTaskTimer(this, abilityManager::updateCooldownActionBars, 0L, 10L);
        for (Player player : Bukkit.getOnlinePlayers()) {
            giveAbilityItem(player);
        }
    }

    public ClassManager getClassManager() {
        return classManager;
    }

    public AbilityManager getAbilityManager() {
        return abilityManager;
    }

    public void giveAbilityItem(Player player) {
        if (classManager.getClass(player.getUniqueId()).isEmpty() || hasAbilityItem(player)) {
            return;
        }
        ItemStack item = XMaterial.matchXMaterial("AMETHYST_SHARD").map(XMaterial::parseItem).orElse(null);
        if (item == null) {
            return;
        }
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.LIGHT_PURPLE + "Psychis Ability");
        meta.setLore(Arrays.asList(ChatColor.GRAY + "Right-click to activate your class ability."));
        meta.getPersistentDataContainer().set(abilityItemKey, PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        if (player.getInventory().addItem(item).isEmpty()) {
            return;
        }
        player.getWorld().dropItemNaturally(player.getLocation(), item);
    }

    public void removeAbilityItems(Player player) {
        ItemStack[] contents = player.getInventory().getContents();
        for (int slot = 0; slot < contents.length; slot++) {
            if (isAbilityItem(contents[slot])) {
                player.getInventory().setItem(slot, null);
            }
        }
    }

    public boolean isAbilityItem(ItemStack item) {
        if (item == null || !item.hasItemMeta()) {
            return false;
        }
        Byte marker = item.getItemMeta().getPersistentDataContainer().get(abilityItemKey, PersistentDataType.BYTE);
        return marker != null && marker == (byte) 1;
    }

    private boolean hasAbilityItem(Player player) {
        for (ItemStack item : player.getInventory().getContents()) {
            if (isAbilityItem(item)) {
                return true;
            }
        }
        return false;
    }
}