Manoj kumar Sahni
📎 1 file 4,489 chars
📄
pasted-code-1790820976075.txt
txt 125 lines
▶
Build a complete Minecraft Paper plugin named **TokenByAngel**.

Create a unique collectible token system with **30 different tokens**, each having its own special power, ability, rarity, effects, and custom texture.

### 1. Claim System

* Each player can claim each token only once per account.
* Store claimed tokens using player UUID and persistent database storage.
* Prevent duplicate claims through reconnects, server restarts, commands, or exploits.
* Tokens must NEVER drop on player death.
* Tokens must be protected from accidental item loss, but allow intentional use if configured.
* Add a GUI to view claimed and unclaimed tokens.

### 2. 30 Unique Tokens

Create 30 unique tokens with different abilities, including:

Fire Token, Lightning Token, Golden Token, Strength Token, Healing Token, Love Token, Ice Token, Water Token, Wind Token, Earth Token, Shadow Token, Angel Token, Demon Token, Phoenix Token, Dragon Token, Speed Token, Invisibility Token, Vampire Token, Guardian Token, Nether Token, Ender Token, Explosion Token, Toxic Token, Lucky Token, Gravity Token, Soul Token, Time Token, Titan Token, Ocean Token, and Celestial Token.

Every token must have its own genuinely unique ability—not just a renamed potion effect.

Examples:

* Fire: fire abilities and fire resistance.
* Lightning: summon lightning attacks.
* Golden: gold-related powers and defensive effects.
* Strength: enhanced combat damage.
* Healing: healing and regeneration abilities.
* Ice: freeze or slow enemies.
* Shadow: temporary invisibility and shadow movement.
* Phoenix: revive once after death with a cooldown.
* Time: temporarily slow nearby enemies.
* Dragon: powerful fire-based attack.

### 3. Love Token — Extremely Powerful

Make the Love Token a special, overpowered legendary token with unique abilities:

* Powerful healing and regeneration.
* Protection from lethal damage with a cooldown.
* Temporary damage resistance.
* A special heart-themed area ability that protects nearby allies.
* Unique visual effects, sounds, particles, and activation animation.

Make its abilities configurable.

### 4. Rarity System

Add configurable rarity tiers:

* Common
* Uncommon
* Rare
* Epic
* Legendary
* Mythic

Each token should have its own rarity, display name, lore, cooldown, and ability settings.

### 5. Custom Textures / Resource Pack

Every token must have its own custom texture.

Do NOT use ordinary Minecraft default item appearances as the final token design.

Create a custom Minecraft resource pack with unique icons/textures for all 30 tokens. Use CustomModelData or the appropriate modern item-model system for the target Minecraft version.

Include:

* Resource pack source files
* Correct model definitions
* Unique token textures
* Installation instructions
* Optional server resource-pack configuration

Do not claim custom textures are implemented if only item names or lore were changed.

### 6. Commands

Player commands:

* `/tokens` — open token collection GUI.
* `/token claim ` — claim an available token once.
* `/token abilities` — view token powers.
* `/token info ` — view token details.

Admin commands:

* `/token give  `
* `/token giveall `
* `/token reload`
* `/token reset  `
* `/token list`

Add permissions and tab completion.

Admin-given tokens must not bypass one-time claim protection or create duplicates unless explicitly configured.

### 7. GUI and Effects

Create a modern inventory GUI showing:

* Token icon and custom texture
* Name and rarity
* Ability description
* Claimed/unclaimed status
* Cooldown
* Activation instructions

Use unique particles, sounds, animations, and messages for each token.

### 8. Technical Requirements

* Use UUID-based persistent storage.
* Support server restarts safely.
* Prevent duplication and item exploits.
* Handle cooldowns reliably.
* Use configurable messages and abilities.
* Optimize event handling and scheduled tasks.
* Support modern Paper servers.
* Provide complete Java source code, build files, plugin metadata, configuration, resource pack, permissions, and installation instructions.
* Do not return pseudocode or incomplete methods.

**Critical:** Each player can claim each token only once, tokens never drop on death, and all 30 tokens must have distinct working abilities and unique custom textures.
Kodari AI
KodariOct 1 at 2:20 am 2
TokenByAngel
A comprehensive Paper plugin implementing a collectible token system with 30 unique tokens, each featuring distinct abilities, rarity tiers, custom textures via resource pack, and UUID-based persistent claim storage. Includes claim protection preventing duplicates and death drops, a modern GUI for viewing claimed/unclaimed tokens, configurable Love Token with overpowered legendary abilities, full command suite with permissions and tab completion, and MiniMessage-based color formatting throughout.
  1. Build the Paper plugin core: UUID-owned token items, SQLite claims/cooldowns, commands, GUI, and loss protection.

  2. Implement 30 distinct abilities, with configurable rarity, descriptions, cooldowns, and Love Token effects.

  3. Add a resource-pack generator for 30 custom token textures and document setup.

  4. Add Gradle, plugin metadata, permissions, and default configuration.

Created TokenByAngel for Paper 1.21.4 / Java 21, including all 30 token definitions and abilities, UUID-based SQLite claims and cooldowns, commands, tab completion, a collection GUI, configurable settings, and protected-token handling.

The resource-pack generator creates the 30 PNG textures and CustomModelData models. Run python3 resource-pack/generate.py, then zip the contents of resource-pack/ and install that pack on your server. Build the plugin with gradle build; I haven’t run the build here.

Manoj kumar Sahni

make its all 30 token workable and quine and add we can arjust in which word this plugin work or we amke group

Kodari AI
KodariOct 1 at 2:46 am 2
  1. Make all 30 token abilities distinct and functional.

  2. Add configuration to restrict the plugin by world or group.

  1. Token abilities: replaced Dragon’s stronger duplicate fireball with configurable area dragon-breath damage; Angel now lifts nearby allies; Soul no longer consumes cooldown with no charges; corrected Vampire’s timed-effect description.

  2. World/group scope: trace token activation, claiming, commands, and group support, then add configurable world and group restrictions.

  1. Abilities: All 30 tokens have activation handlers. Dragon now has a configurable area breath attack distinct from Fire’s fireball; Angel lifts nearby allies, and Soul won’t start its cooldown when it has no charges. I also corrected Vampire’s description to match its timed effect.

  2. World and group restrictions: Added settings.allowed-worlds and settings.required-permission. Restrictions apply to claiming, the collection GUI, ability use, and passive token effects. Pending protected tokens are delivered when a player enters an allowed world.

Example configuration:

YAML
settings:
  allowed-worlds:
    - world
    - world_nether
  required-permission: tokenbyangel.group.tokens

Grant tokenbyangel.group.tokens to the desired group using your permissions plugin. Leave allowed-worlds empty and required-permission blank to allow everyone in every world. I haven’t run a build or server test.

Manoj kumar Sahni

we cant blacklist this plugin on other wolrd and whitelist so add thsie or valut give error forge or expried so fix it and then make thes wolrd are whitelist as defult - survivallobby - survival - survival_nether - survival_the_end and other is blacklisted , enche ecerything 100 x

Kodari AI
KodariOct 1 at 3:08 am 1
  1. Add explicit world whitelist/blacklist modes, defaulting to survivallobby, survival, survival_nether, and survival_the_end.

  2. Trace and fix the Vault-related error once I can identify its exact cause in the code.

  3. Review what “enhance everything 100x” should mean after those fixes; I’ll keep changes focused on concrete improvements.

  1. World filtering: Added whitelist/blacklist modes. The default whitelist is survivallobby, survival, survival_nether, and survival_the_end; existing configs without a mode are migrated to those defaults. Restricted-world and group messages are now configurable.

  2. I’m checking the Vault error against the project’s actual dependency and API usage before changing it.World filtering now supports whitelist and blacklist modes. The default whitelist is survivallobby, survival, survival_nether, and survival_the_end; older configs are migrated to those defaults.

I couldn’t fix the Vault error because this project has no Vault dependency or Vault API calls. Please share the exact error message and the relevant server log so I can identify which plugin is producing it.

I also left “enhance everything 100x” unchanged because it’s unclear whether you mean stronger token abilities, enchantments, or something else.

Manoj kumar Sahni

hmm make sure token is not carck power and player get randome token not chose higher token less chance and same token get other player and make sure and shift+right click lauch specal power , and left clik giver errors so nothing can show after left click amkethat

Kodari AI
KodariOct 1 at 3:18 am 2
  1. Inspect token assignment and interaction handling; make token rewards random with lower odds for stronger tokens, while allowing duplicates across players.

  2. Require sneak + right-click to activate abilities; make left-click safely do nothing, and review balance tuning.

  • /token claim and the GUI’s Random Token button now give a random enabled token. Higher rarities have lower relative odds; adjust them under settings.rarity-weights (uncommon: 50, rare: 30, epic: 15, legendary: 4, mythic: 1).

  • The same token type can be awarded to different players. Each player can claim each token type once, and the GUI no longer lets players choose a specific token.

  • Abilities activate only with sneak + right-click. Left-clicks and ordinary right-clicks are ignored without activating or showing a message; item lore reflects the new control.

  • Tuned down several stronger effects, including Strength, Love, Dragon, and Celestial.

I haven’t tested this on a live server.

Kodari can make mistakes. Review important code before using.
Files
resource-pack
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
16 1,805
src/main/java/com/angel/tokenbyangel/TokenByAngelPlugin.java
package com.angel.tokenbyangel;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.sql.SQLException;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ThreadLocalRandom;
import java.util.UUID;
import java.util.stream.Collectors;

public final class TokenByAngelPlugin extends JavaPlugin {
    private TokenDatabase database;
    private TokenItemFactory items;
    private TokenGui gui;
    private AbilityManager abilities;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        if (!getConfig().contains("settings.world-mode")) {
            getConfig().set("settings.world-mode", "whitelist");
            if (getConfig().getStringList("settings.allowed-worlds").isEmpty()) {
                getConfig().set("settings.allowed-worlds", List.of("survivallobby", "survival", "survival_nether", "survival_the_end"));
            }
            saveConfig();
        }
        try {
            database = new TokenDatabase(this);
        } catch (SQLException exception) {
            getLogger().severe("Could not open token database: " + exception.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        items = new TokenItemFactory(this);
        gui = new TokenGui(this);
        abilities = new AbilityManager(this);
        TokenCommand command = new TokenCommand(this);
        getCommand("token").setExecutor(command);
        getCommand("token").setTabCompleter(command);
        Bukkit.getPluginManager().registerEvents(gui, this);
        Bukkit.getPluginManager().registerEvents(new TokenListener(this), this);
        Bukkit.getOnlinePlayers().forEach(this::deliverPending);
    }

    @Override
    public void onDisable() {
        if (database != null) {
            try { database.close(); }
            catch (SQLException exception) { getLogger().warning("Could not close token database: " + exception.getMessage()); }
        }
    }

    public boolean grant(Player player, Token token, boolean notify) {
        if (!requireAccess(player)) return false;
        if (database.isClaimed(player.getUniqueId(), token)) {
            if (notify) send(player, "already-claimed", token, null);
            return false;
        }
        if (player.getInventory().firstEmpty() == -1) {
            if (notify) send(player, "inventory-full", token, null);
            return false;
        }
        if (!database.claim(player.getUniqueId(), token)) {
            if (notify) send(player, "already-claimed", token, null);
            return false;
        }
        player.getInventory().addItem(items.create(token, player.getUniqueId()));
        if (notify) send(player, "claimed", token, null);
        return true;
    }

    public boolean grantRandom(Player player, boolean notify) {
        if (!requireAccess(player)) return false;
        List<Token> available = java.util.Arrays.stream(Token.values())
                .filter(token -> getConfig().getBoolean("tokens." + token.key() + ".enabled", true))
                .filter(token -> !database.isClaimed(player.getUniqueId(), token))
                .collect(Collectors.toList());
        if (available.isEmpty()) {
            if (notify) send(player, "all-claimed", null, null);
            return false;
        }
        if (player.getInventory().firstEmpty() == -1) {
            if (notify) send(player, "inventory-full", null, null);
            return false;
        }

        double totalWeight = available.stream().mapToDouble(this::rarityWeight).sum();
        double roll = ThreadLocalRandom.current().nextDouble(Math.max(totalWeight, 1.0));
        Token selected = available.get(available.size() - 1);
        if (totalWeight > 0) {
            for (Token token : available) {
                roll -= rarityWeight(token);
                if (roll < 0) {
                    selected = token;
                    break;
                }
            }
        } else {
            selected = available.get(ThreadLocalRandom.current().nextInt(available.size()));
        }

        if (!database.claim(player.getUniqueId(), selected)) {
            if (notify) send(player, "all-claimed", null, null);
            return false;
        }
        player.getInventory().addItem(items.create(selected, player.getUniqueId()));
        if (notify) send(player, "random-claimed", selected, null);
        return true;
    }

    private double rarityWeight(Token token) {
        String rarity = items.rarity(token).toLowerCase(Locale.ROOT);
        int defaultWeight = switch (rarity) {
            case "uncommon" -> 50;
            case "rare" -> 30;
            case "epic" -> 15;
            case "legendary" -> 4;
            case "mythic" -> 1;
            default -> 20;
        };
        return Math.max(0, getConfig().getDouble("settings.rarity-weights." + rarity, defaultWeight));
    }

    public void deliverPending(Player player) {
        if (!isAllowed(player)) return;
        for (Token token : database.pending(player.getUniqueId())) {
            if (!database.isClaimed(player.getUniqueId(), token)) {
                database.removePending(player.getUniqueId(), token);
                continue;
            }
            if (player.getInventory().firstEmpty() == -1) return;
            player.getInventory().addItem(items.create(token, player.getUniqueId()));
            database.removePending(player.getUniqueId(), token);
            send(player, "pending", token, null);
        }
    }

    public void removeToken(Player player, Token token) {
        for (int slot = 0; slot < player.getInventory().getSize(); slot++) {
            ItemStack item = player.getInventory().getItem(slot);
            if (items.tokenOf(item) == token && player.getUniqueId().equals(items.ownerOf(item))) player.getInventory().setItem(slot, null);
        }
    }

    public boolean ownsToken(Player player, Token token) {
        if (!database.isClaimed(player.getUniqueId(), token)) return false;
        for (ItemStack item : player.getInventory().getContents()) {
            if (items.tokenOf(item) == token && player.getUniqueId().equals(items.ownerOf(item))) return true;
        }
        return false;
    }

    public boolean isAllowed(Player player) {
        if (!isWorldAllowed(player)) return false;
        String permission = getConfig().getString("settings.required-permission", "").trim();
        return permission.isEmpty() || player.hasPermission(permission);
    }

    public boolean requireAccess(Player player) {
        if (!isWorldAllowed(player)) {
            send(player, "world-disabled", null, null);
            return false;
        }
        String permission = getConfig().getString("settings.required-permission", "").trim();
        if (!permission.isEmpty() && !player.hasPermission(permission)) {
            send(player, "group-disabled", null, null);
            return false;
        }
        return true;
    }

    private boolean isWorldAllowed(Player player) {
        List<String> worlds = getConfig().getStringList("settings.allowed-worlds");
        boolean listed = worlds.stream().anyMatch(world -> world.equalsIgnoreCase(player.getWorld().getName()));
        String mode = getConfig().getString("settings.world-mode", "whitelist");
        return mode.equalsIgnoreCase("blacklist") ? !listed : listed;
    }

    public void send(org.bukkit.command.CommandSender sender, String messageKey, Token token, String playerName) {
        String message = getConfig().getString("messages." + messageKey, "");
        if (message.isEmpty()) return;
        message = message.replace("%token%", token == null ? "" : items.displayName(token))
                .replace("%rarity%", token == null ? "" : items.rarity(token))
                .replace("%description%", token == null ? "" : items.description(token))
                .replace("%cooldown%", token == null ? "" : Integer.toString(items.cooldown(token)))
                .replace("%player%", playerName == null ? "" : playerName);
        String prefix = getConfig().getString("messages.prefix", "");
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + message));
    }

    public void sendCooldown(Player player, long seconds) {
        String prefix = getConfig().getString("messages.prefix", "");
        String message = getConfig().getString("messages.cooldown", "&eRecharging: %seconds%s")
                .replace("%seconds%", Long.toString(seconds));
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + message));