yousef sharabaty
📎 1 file 4,350 chars
📄
pasted-code-1793480566350.txt
txt 74 lines
▶
Build a full Minecraft server plugin for Paper 1.21.11 called "PowersPlugin".

### Core System Rules:
1. No Give Commands: Do NOT create commands that let players give or pick superpowers. Every player MUST automatically get 1 random superpower when they first join the server. Save player powers so they stay across restarts and deaths.
2. Core Upgrader & Max Level: 
   - Maximum level is Level 4.
   - Upgrading is done using a custom-crafted item called "Core Upgrader".
   - Crafting Recipe for Core Upgrader:
     - Top row: Diamond, Nether Star, Diamond
     - Middle row: Gold Ingot, Netherite Ingot, Gold Ingot
     - Bottom row: Diamond, Nether Star, Diamond
   - Right-clicking while holding the Core Upgrader opens a GUI menu to upgrade the player's active power level up to Level 4.
3. Passives & Upgrade System:
   - Each power has 1 main passive effect. Upgrading the power level (Level 1 to 4) adds an extra passive buff to that power.
4. Heavy Particles & Sounds:
   - Every single ability must spawn heavy, bright particle effects (Flame, Sonic Boom, Dragon Breath, Lava, End Rod, Sculk, Large Smoke) and distinct sound effects so the moves look visual and feel powerful.
5. Resource Pack Integration:
   - Automatically request the player to accept/download the server resource pack on join (`PlayerResourcePackSendEvent`).

---

### Admin Event Commands:
Create admin commands to manage server-wide events (No personal power selection commands!):
- `/powerevent start ` — Starts a server-wide power event (Types: double_xp, cooldown_reset, overcharge).
- `/powerevent stop` — Ends the active event.
- `/powerevent rerollall` — Force rerolls everyone's superpower on the server for special events.

---

### The 4 Superpowers:

1. FIRE
- Passive (Upgradable):
  - Level 1: Full Fire Immunity.
  - Level 2: Fire Aura (Burns nearby mobs/players within 4 blocks).
  - Level 3: Speed II while standing on fire, magma, or netherrack.
  - Level 4: Explosion Immunity + 20% Life Steal on fire damage.
- Ability 1 (Dash): Launches player forward leaving a thick flame particle trail.
- Ability 2 (Fireball): Shoots an explosive particle fireball in the target direction.
- Ability 3 (Shield): Spawns a ring of lava particles absorbing 50% damage for 5 seconds.
- Ability 4 (Meteor): Drops an explosive shower of fire and particle explosions on targeted location.

2. WIND
- Passive (Upgradable):
  - Level 1: No Fall Damage + Permanent Speed I.
  - Level 2: Speed II + Double Jump.
  - Level 3: Knockback Immunity while airborne.
  - Level 4: Triple Jump + Slow falling automatically before hitting the ground.
- Ability 1 (Blast): Knocks back all nearby enemies with a huge cloud particle burst.
- Ability 2 (Updraft): Launches the player high into the air with heavy squall particles and wind sounds.
- Ability 3 (Wave): Shoots a piercing wind projectile using sonic boom particles.
- Ability 4 (Vortex): Creates a swirling particle ring pulling all enemies to the center point.

3. EARTH
- Passive (Upgradable):
  - Level 1: Permanent Resistance I.
  - Level 2: Knockback Resistance + 2 Extra Hearts.
  - Level 3: Resistance II when below Y level 50.
  - Level 4: 4 Extra Hearts + Haste II when holding any pickaxe.
- Ability 1 (Spikes): Creates a line of rising stone blocks and explosion particles along the ground.
- Ability 2 (Boulder): Throws a heavy stone block projectile that explodes into particles on impact.
- Ability 3 (Wall): Creates a 3x3 temporary cobblestone wall with heavy dust particles.
- Ability 4 (Slam): Slams the ground, stunning and damaging nearby enemies in a shockwave ring.

4. SHADOW
- Passive (Upgradable):
  - Level 1: Permanent Night Vision.
  - Level 2: Strength I when in light levels lower than 7.
  - Level 3: Speed I + Invisibility when crouching in darkness.
  - Level 4: Invisibility + Strength II in dark areas + 25% Health Drain on hit.
- Ability 1 (Teleport): Teleports up to 15 blocks to target block with sculk and portal particles.
- Ability 2 (Smoke): Creates a thick blinding cloud of large smoke particles.
- Ability 3 (Drain): Beam particle effect connected to target, stealing health over 3 seconds.
- Ability 4 (Decoy): Spawns a particle shadow decoy while making the player invisible for 3 seconds.
Kodari AI
KodariOct 31 at 9:07 pm 3
PowersPlugin
A Paper 1.21.11 superpower plugin granting every player one random power on first join, persisted across restarts. Four powers (Fire, Wind, Earth, Shadow) each feature four abilities with heavy particle effects and sounds, plus a passive system upgradeable to Level 4 via a custom-crafted Core Upgrader item that opens an upgrade GUI on right-click. Includes admin event commands for server-wide events like double XP, cooldown resets, overcharge, and power rerolls, alongside automatic resource pack requests on join.
  1. Create the Paper 1.21.11 plugin scaffold and persistent random power assignments.

  2. Implement the four powers, passives, abilities, cooldowns, and temporary effects.

  3. Add the Core Upgrader recipe/GUI, player commands, admin events, and configurable join resource-pack request.

Created PowersPlugin with persistent random powers, Level 1–4 passive upgrades, all four powers’ abilities, and the crafted Core Upgrader GUI. Players can check their power or use abilities with /power and /power ability <1-4>; there are no power-giving or power-selection commands. Admins can use /powerevent start, /powerevent stop, and /powerevent rerollall—which rerolls saved offline players too.

Set resource-pack-url in config.yml to your pack’s ZIP URL to send the resource-pack request on join.

yousef sharabaty

now make the recorspack

Kodari AI
KodariOct 31 at 9:12 pm 1

Resource-pack generation is disabled for this project. Enable it in Settings → Generation, then I can create the pack. To have the plugin send it to players, the pack also needs a publicly reachable ZIP URL set as resource-pack-url in config.yml.

yousef sharabaty

now make the recorspack

Kodari AI
KodariOct 31 at 9:14 pm 3

Plan: add the Core Upgrader texture to a 1.21.11 resource-pack folder, define its item model, and connect the plugin item to that model.

Created the resource pack in resource-pack/ with a custom Core Upgrader texture and model, and connected the crafted item to it.

To send it to players on join, zip the contents of resource-pack/, host the ZIP at a direct URL, and set that URL as resource-pack-url in config.yml.

yousef sharabaty

give me the .jar file

Kodari AI
KodariOct 31 at 9:21 pm 1
  1. Click Compile in the top bar (on phone: ⋮ → Compile Project).

  2. In the build window, click Compile.

  3. When it succeeds, click Download on the build or Download PowersPlugin.jar in the chat.

yousef sharabaty

i want the resource pack

Kodari AI
KodariOct 31 at 9:42 pm 1

The resource pack is in the project’s resource-pack/ folder, separate from the plugin .jar. It contains the pack metadata and the Core Upgrader texture and model. To use it in Minecraft, download that folder and place it in your resourcepacks folder; to distribute it through the plugin, zip the contents of resource-pack/, host the ZIP, and set its URL as resource-pack-url in config.yml.

yousef sharabaty

give the resource pack alone and the .jar file alon

Kodari AI
KodariOct 31 at 9:45 pm 1
  • Plugin .jar: Click Compile in the top bar (on phone: ⋮ → Compile Project), then Compile. Download the jar from the successful build.

  • Resource pack: It’s separate from the jar in the project’s resource-pack/ folder. Download that folder’s contents as the pack; don’t include the plugin jar.

yousef sharabaty

how to use the powers and make the recource pack useable andd add more events

Kodari AI
KodariOct 31 at 10:01 pm 1
  1. Check the actual player commands and explain how to use each power.

  2. Make the resource pack usable with the plugin and clarify the required pack delivery setup.

  3. Add several server-wide event types alongside the existing ones.

Use /power to see your assigned power and level. Activate abilities with /power ability 1 through /power ability 4—the numbers map to each power’s listed abilities (Fire: Dash/Fireball/Shield/Meteor; Wind: Blast/Updraft/Wave/Vortex; Earth: Spikes/Boulder/Wall/Slam; Shadow: Teleport/Smoke/Drain/Decoy). Abilities have an 8-second cooldown. Right-click a Core Upgrader and click the GUI item to spend it and upgrade; powers persist through death and restarts.

I’m checking the pack wiring next; the plugin can request a hosted ZIP, but it can’t deliver a local folder to clients by itself.

The pack files and Core Upgrader item model already line up; the missing piece is a public direct HTTPS ZIP URL. The plugin requests that URL when players join if resource-pack-url is set. Zip the contents of resource-pack/ so pack.mcmeta is at the ZIP root, upload it, put its direct download URL in src/main/resources/config.yml, then restart and accept the prompt in-game. I’ll extend the event options now.

  1. Use your power: /power shows your assigned power and level. Use /power ability 1 through /power ability 4 to activate its abilities. Each ability has an 8-second cooldown. Right-click a Core Upgrader, then click the upgrade button in the GUI; it consumes one upgrader. Powers persist through deaths and restarts.

  2. Use the resource pack: The pack files are in resource-pack/, and the Core Upgrader is already linked to its custom model. To have the plugin send it on join, zip the contents of that folder so pack.mcmeta is at the ZIP root, put the ZIP at a publicly reachable HTTPS URL, and set that URL as resource-pack-url in src/main/resources/config.yml. Players then accept the prompt when they join. If you need a hosted URL, a Discord bot project on Kodari can serve the pack publicly.

  3. More events added: /powerevent start now supports double_drops (doubles mob drops), speed_surge (Speed II), and healing_surge (Regeneration I), alongside double_xp, cooldown_reset, and overcharge. Events run until an admin uses /powerevent stop.

yousef sharabaty

there is some errors fixe them

Kodari AI
KodariOct 31 at 10:05 pm 1

Plan:

  1. Check the project’s API/dependency versions against the recent event and resource-pack code.

  2. Fix only the concrete build errors found.

  3. Let the project verifier report whether any compile errors remain.

Found a concrete build blocker: the Java files import XSeries, but build.gradle only declares Paper API. I’m adding the missing compile dependency so those imports resolve.

Fixed the build blocker: PowerManager and PowersPlugin import XSeries, but build.gradle didn’t include it. I added the XSeries dependency and its repository. If the build still reports errors, send me the exact error output.

Kodari can make mistakes. Review important code before using.
Files
resource-pack
src
build.gradle
Code
14 1,315
src/main/java/com/kodari/powers/PowersPlugin.java
package com.kodari.powers;

import com.kodari.powers.command.PowerCommand;
import com.kodari.powers.command.PowerEventCommand;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;

import com.cryptomorin.xseries.XMaterial;

public final class PowersPlugin extends JavaPlugin {
    private PowerStorage storage;
    private PowerManager powerManager;
    private NamespacedKey coreUpgraderKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        coreUpgraderKey = new NamespacedKey(this, "core_upgrader");
        storage = new PowerStorage(this);
        powerManager = new PowerManager(this, storage);
        powerManager.registerListeners();
        registerCoreUpgraderRecipe();

        PowerCommand powerCommand = new PowerCommand(powerManager);
        getCommand("power").setExecutor(powerCommand);
        getCommand("power").setTabCompleter(powerCommand);
        PowerEventCommand eventCommand = new PowerEventCommand(powerManager);
        getCommand("powerevent").setExecutor(eventCommand);
        getCommand("powerevent").setTabCompleter(eventCommand);
    }

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

    public NamespacedKey getCoreUpgraderKey() {
        return coreUpgraderKey;
    }

    public ItemStack createCoreUpgrader() {
        ItemStack item = XMaterial.matchXMaterial("NETHER_STAR").map(XMaterial::parseItem).orElse(null);
        if (item == null || !item.hasItemMeta()) {
            return item;
        }
        var meta = item.getItemMeta();
        meta.setDisplayName("§6§lCore Upgrader");
        meta.setLore(java.util.List.of("§7Right-click to upgrade your power."));
        meta.setItemModel(coreUpgraderKey);
        meta.getPersistentDataContainer().set(coreUpgraderKey, org.bukkit.persistence.PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        return item;
    }

    private void registerCoreUpgraderRecipe() {
        ItemStack result = createCoreUpgrader();
        if (result == null) {
            getLogger().severe("Could not create the Core Upgrader item.");
            return;
        }
        ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "core_upgrader_recipe"), result);
        recipe.shape("DND", "GIG", "DND");
        recipe.setIngredient('D', XMaterial.matchXMaterial("DIAMOND").orElseThrow().parseMaterial());
        recipe.setIngredient('N', XMaterial.matchXMaterial("NETHER_STAR").orElseThrow().parseMaterial());
        recipe.setIngredient('G', XMaterial.matchXMaterial("GOLD_INGOT").orElseThrow().parseMaterial());
        recipe.setIngredient('I', XMaterial.matchXMaterial("NETHERITE_INGOT").orElseThrow().parseMaterial());
        Bukkit.addRecipe(recipe);
    }
}