itsogplayz-create

name: CustomSuperpowers version: 1.0 main: com.myplugin.superpowers.Superpowers api-version: 1.20 author: Developer description: Custom superpowers plugin with GUIs, particles, and cool effects!

commands: fogpower: description: Opens the superpower selection menu.package com.myplugin.superpowers;

import org.bukkit.plugin.java.JavaPlugin;

public class Superpowers extends JavaPlugin {

@Override public void onEnable() { // Registering Command this.getCommand("fogpower").setExecutor(new PowerCommand());

// Registering Event Listeners getServer().getPluginManager().registerEvents(new GUIListener(), this); getServer().getPluginManager().registerEvents(new PowerListeners(), this);

getLogger().info("Custom Superpowers Plugin Enabled Successfully!"); }

@Override public void onDisable() { getLogger().info("Custom Superpowers Plugin Disabled!"); } }

Kodari AI
KodariJul 11 at 4:58 pm 1

The generation was stopped before any content could be produced.

itsogplayz-create
📎 2 files 9,581 chars
📄
pasted-code-1783789092255.txt
txt 70 lines
▶
package com.myplugin.superpowers;

import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public class GUIListener implements Listener {

    public static final NamespacedKey POWER_KEY = new NamespacedKey(JavaPlugin.getPlugin(Superpowers.class), "active_power");

    @EventHandler
    public void onMenuClick(InventoryClickEvent event) {
        if (!event.getView().getTitle().equals("§8Select Your Superpower")) return;

        event.setCancelled(true);
        if (event.getCurrentItem() == null || !event.getCurrentItem().hasItemMeta()) return;

        Player player = (Player) event.getWhoClicked();
        String selectedPower = "";
        Particle effectParticle = Particle.WITCH_MAGIC;
        Sound effectSound = Sound.ENTITY_PLAYER_LEVELUP;

        switch (event.getCurrentItem().getType()) {
            case CHORUS_FRUIT:
                selectedPower = "VOID_WALKER";
                effectParticle = Particle.PORTAL;
                effectSound = Sound.ENTITY_ENDERMAN_TELEPORT;
                break;
            case BLAZE_POWDER:
                selectedPower = "PYROMANCER";
                effectParticle = Particle.FLAME;
                effectSound = Sound.ENTITY_BLAZE_AMBIENT;
                break;
            case FEATHER:
                selectedPower = "ZEPHYR";
                effectParticle = Particle.CLOUD;
                effectSound = Sound.ENTITY_BAT_TAKEOFF;
                break;
            case PACKED_ICE:
                selectedPower = "CRYOMANCER";
                effectParticle = Particle.SNOWFLAKE;
                effectSound = Sound.BLOCK_GLASS_BREAK;
                break;
            default:
                return;
        }

        player.getPersistentDataContainer().set(POWER_KEY, PersistentDataType.STRING, selectedPower);
        player.closeInventory();
        player.sendMessage("§a[System] §fPower permanently bound to your soul!");

        // Particle Burst Effect
        Location loc = player.getLocation();
        for (double i = 0; i <= 2; i += 0.2) {
            player.getWorld().spawnParticle(effectParticle, loc.getX(), loc.getY() + i, loc.getZ(), 25, 0.3, 0.1, 0.3, 0.05);
        }
        player.getWorld().spawnParticle(Particle.EXPLOSION_EMITTER, loc.add(0, 1, 0), 1);

        // Sound Effects
        player.playSound(player.getLocation(), effectSound, 1.0f, 1.0f);
        player.playSound(player.getLocation(), Sound.UI_TOAST_CHALLENGE_COMPLETE, 0.4f, 1.1f);
    }
}
📄
pasted-code-1783789107825.txt
txt 124 lines
▶
package com.myplugin.superpowers;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.SmallFireball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;

public class PowerListeners implements Listener {

    @EventHandler
    public void onPowerUse(PlayerInteractEvent event) {
        Player player = event.getPlayer();

        // 1. Check if the main hand is empty
        if (player.getInventory().getItemInMainHand().getType() != Material.AIR) return;

        // 2. Check if the player has an active power saved
        String activePower = player.getPersistentDataContainer().get(GUIListener.POWER_KEY, PersistentDataType.STRING);
        if (activePower == null) return;

        // 3. Trigger powers on Right Click (Air or Block)
        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            
            switch (activePower) {
                case "VOID_WALKER":
                    if (!player.isSneaking()) {
                        // Rift Step (Teleport)
                        var target = player.getTargetBlockExact(15);
                        if (target != null) {
                            player.teleport(target.getLocation().add(0, 1, 0));
                            player.getWorld().spawnParticle(Particle.PORTAL, player.getLocation(), 30, 0.2, 0.5, 0.2, 0.1);
                            player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1f, 1.2f);
                        }
                    } else {
                        // Gravity Pulse
                        for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
                            if (entity instanceof LivingEntity) {
                                entity.setVelocity(new Vector(0, 1.2, 0));
                                entity.getWorld().spawnParticle(Particle.WITCH_MAGIC, entity.getLocation(), 15, 0.2, 0.2, 0.2, 0.05);
                            }
                        }
                        player.playSound(player.getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 1f, 1.5f);
                    }
                    break;

                case "PYROMANCER":
                    if (!player.isSneaking()) {
                        // Spark Shot (Fireball)
                        player.launchProjectile(SmallFireball.class);
                        player.playSound(player.getLocation(), Sound.ENTITY_BLAZE_SHOOT, 1f, 1f);
                    } else {
                        // Inferno Ring
                        Location loc = player.getLocation();
                        for (int x = -2; x <= 2; x++) {
                            for (int z = -2; z <= 2; z++) {
                                Location fireLoc = loc.clone().add(x, 0, z);
                                if (fireLoc.getBlock().getType() == Material.AIR && fireLoc.clone().subtract(0, 1, 0).getBlock().getType().isSolid()) {
                                    fireLoc.getBlock().setType(Material.FIRE);
                                }
                            }
                        }
                        player.getWorld().spawnParticle(Particle.FLAME, player.getLocation(), 40, 1.5, 0.2, 1.5, 0.05);
                        player.playSound(player.getLocation(), Sound.ITEM_FIRECHARGE_USE, 1f, 0.8f);
                    }
                    break;

                case "ZEPHYR":
                    if (!player.isSneaking()) {
                        // Wind Dash
                        Vector dash = player.getLocation().getDirection().multiply(2.2).setY(0.2);
                        player.setVelocity(dash);
                        player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 15, 0.2, 0.2, 0.2, 0.01);
                        player.playSound(player.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 1f, 0.8f);
                    } else {
                        // Sonic Boom
                        for (Entity entity : player.getNearbyEntities(6, 3, 6)) {
                            if (entity instanceof LivingEntity && entity != player) {
                                Vector push = entity.getLocation().toVector().subtract(player.getLocation().toVector()).normalize().multiply(2.2).setY(0.4);
                                entity.setVelocity(push);
                            }
                        }
                        player.getWorld().spawnParticle(Particle.GUST_EMITTER, player.getLocation(), 5);
                        player.playSound(player.getLocation(), Sound.ENTITY_WARDEN_SONIC_BOOM, 1f, 1.4f);
                    }
                    break;

                case "CRYOMANCER":
                    if (!player.isSneaking()) {
                        // Frostbite (Freeze Target)
                        for (Entity entity : player.getNearbyEntities(10, 4, 10)) {
                            if (entity instanceof LivingEntity && entity != player) {
                                LivingEntity target = (LivingEntity) entity;
                                target.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 80, 5, false, true));
                                target.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, 80, 250, false, false));
                                target.getWorld().spawnParticle(Particle.SNOWFLAKE, target.getLocation().add(0,1,0), 30, 0.3, 0.5, 0.3, 0.02);
                                player.playSound(player.getLocation(), Sound.BLOCK_GLASS_BREAK, 1f, 1.5f);
                                break; // Freezes the first valid target found
                            }
                        }
                    } else {
                        // Glacial Path (Simple Single block generator under feet)
                        Location iceLoc = player.getLocation().subtract(0, 1, 0);
                        if (iceLoc.getBlock().getType() == Material.AIR) {
                            iceLoc.getBlock().setType(Material.PACKED_ICE);
                            player.playSound(player.getLocation(), Sound.BLOCK_SNOW_PLACE, 0.5f, 1.2f);
                        }
                    }
                    break;
            }
        }
    }
}
Kodari AI
KodariJul 11 at 4:59 pm 7
CustomSuperpowers
CustomSuperpowers is a Minecraft plugin that lets players choose and activate unique elemental abilities through an interactive GUI. Players can become Void Walkers, Pyromancers, Zephyrs, or Cryomancers, each with normal and sneaking abilities such as teleportation, gravity pulses, fireballs, wind dashes, sonic blasts, freezing attacks, and glacial paths. Persistent power selection, particles, sounds, and visual feedback create an immersive superpower experience.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 483
src/main/java/com/myplugin/superpowers/Superpowers.java
package com.myplugin.superpowers;

import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

public class Superpowers extends JavaPlugin {

    private NamespacedKey powerKey;

    @Override
    public void onEnable() {
        this.powerKey = new NamespacedKey(this, "active_power");

        getCommand("fogpower").setExecutor(new PowerCommand(powerKey));
        getServer().getPluginManager().registerEvents(new GUIListener(powerKey), this);
        getServer().getPluginManager().registerEvents(new PowerListeners(powerKey), this);

        getLogger().info("Custom Superpowers Plugin Enabled Successfully!");
    }

    @Override
    public void onDisable() {
        getLogger().info("Custom Superpowers Plugin Disabled!");
    }
}