aayush_555

Custom Items: Create 5 crystals (Vanguard, Glacier, Gale, Vitality, Abyssal) using specific materials (e.g., Amethyst Shards with CustomModelData or Enchantment Glow).

Offhand Logic: Use a BukkitRunnable that checks every 40 ticks if a player is holding a crystal in their OFF_HAND. If they are, apply the corresponding PotionEffects. Remove effects if the item is unequipped.

Active Skills: Implement PlayerInteractEvent. Right-clicking while holding a crystal triggers a unique skill with a cooldown (stored in a HashMap<UUID, Long>).

The Unmite: A 'Superior Crystal' crafted by combining all 5 crystals + a Nether Star. It grants 5 permanent buffs while held.

Optimization: Do not use PlayerMoveEvent. Ensure the plugin uses PersistentDataContainer to identify crystals rather than just checking item names to prevent players from cheesing the system with anvils.

Commands: /crystals give <type> for admins."

Kodari AI
KodariFeb 25 at 7:42 am 13,771 (v2)

I’ll create a crystal-based ability system with offhand passive effects and active skills.

CrystalPowers
A crystal-based ability system featuring 5 unique crystals with passive offhand effects and active right-click skills. Includes The Unmite superior crystal crafted from all crystals plus a Nether Star. Uses PersistentDataContainer for secure item identification and optimized tick-based effect application.

Created a complete crystal power system with 5 unique crystals plus The Unmite superior crystal. Features include:

  • 5 Crystals: Vanguard (Resistance), Glacier (Fire Res), Gale (Speed), Vitality (Regen), Abyssal (Night Vision)

  • Offhand passive effects: BukkitRunnable checks every 40 ticks (2 seconds) for crystals in offhand

  • Active skills: Right-click to activate unique abilities with cooldowns (Shield Bash, Frost Nova, Wind Burst, Healing Wave, Shadow Step)

  • The Unmite: Superior crystal granting all 5 buffs simultaneously, crafted from base materials + Nether Star

  • PersistentDataContainer: Secure item identification preventing anvil abuse

  • Admin command: /crystals give <type> [player] to distribute crystals

All crystals use CustomModelData for texture pack compatibility and enchantment glow for visual appeal.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 620
src/main/java/com/crystalpowers/CrystalPowers.java
package com.crystalpowers;

import com.crystalpowers.command.CrystalCommand;
import com.crystalpowers.crystal.CrystalManager;
import com.crystalpowers.listener.CrystalSkillListener;
import com.crystalpowers.recipe.CrystalRecipe;
import com.crystalpowers.task.CrystalEffectTask;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CrystalPowers extends JavaPlugin {
    private CrystalManager crystalManager;
    private CrystalEffectTask effectTask;
    
    @Override
    public void onEnable() {
        this.crystalManager = new CrystalManager(this);
        
        Bukkit.getPluginManager().registerEvents(new CrystalSkillListener(this), this);
        
        this.getCommand("crystals").setExecutor(new CrystalCommand(this));
        
        CrystalRecipe.registerRecipes(this);
        
        this.effectTask = new CrystalEffectTask(this);
        this.effectTask.runTaskTimer(this, 40L, 40L);
        
        getLogger().info("CrystalPowers has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (this.effectTask != null) {
            this.effectTask.cancel();
        }
        getLogger().info("CrystalPowers has been disabled!");
    }
}