pandagames7779

name: GreekGods version: 1.0 main: me.greekgods.GreekGods api-version: 1.21

commands: team: godcraft:

📎 2 files 10,278 chars
📄
pasted-code-1779018201819.txt
txt 119 lines
▶
package me.greekgods.gods;

import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.potion.*;

import java.util.Random;

public enum GodType {

    ARES(Material.WOODEN_SWORD),
    ZEUS(Material.LIGHTNING_ROD),
    POSEIDON(Material.TRIDENT),
    HADES(Material.BONE),
    THOR(Material.WOODEN_AXE),
    LOKI(Material.BLAZE_ROD),
    HERMES(Material.FEATHER),
    ARTEMIS(Material.BOW),
    DEMETER(Material.WHEAT),
    HEFESTUS(Material.IRON_INGOT),
    ODIN(Material.TOTEM_OF_UNDYING),
    CHAOS(Material.NETHER_STAR);

    private final Material mat;

    GodType(Material mat) {
        this.mat = mat;
    }

    public Material getMaterial() {
        return mat;
    }

    public String display() {
        return "§6" + name();
    }

    // ================= SKILL =================

    public void skill(Player p) {

        switch (this) {

            case ZEUS -> p.getWorld().strikeLightning(p.getLocation());

            case POSEIDON -> p.addPotionEffect(new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 200, 1));

            case ARES -> p.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 200, 1));

            case HADES -> p.getWorld().spawn(p.getLocation(), Zombie.class);

            case THOR -> p.getWorld().strikeLightning(p.getLocation());

            case LOKI -> p.teleport(p.getLocation().add(new Random().nextInt(4)-2,0,new Random().nextInt(4)-2));

            case HERMES -> p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 3));

            case ARTEMIS -> p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 2));

            case DEMETER -> p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 1));

            case HEFESTUS -> p.addPotionEffect(new PotionEffect(PotionEffectType.RESISTANCE, 200, 1));

            case ODIN -> p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 200, 2));

            case CHAOS -> p.getWorld().createExplosion(p.getLocation(), 2F);
        }
    }

    // ================= ULT =================

    public void ultimate(Player p) {

        switch (this) {

            case ZEUS -> {
                for (int i = 0; i < 5; i++)
                    p.getWorld().strikeLightning(p.getLocation().add(i,0,i));
            }

            case POSEIDON -> p.getWorld().spawnParticle(Particle.WATER_SPLASH, p.getLocation(), 200);

            case ARES -> {
                p.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 400, 2));
                p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 400, 1));
            }

            case HADES -> {
                for (int i = 0; i < 4; i++)
                    p.getWorld().spawn(p.getLocation(), WitherSkeleton.class);
            }

            case THOR -> {
                for (int i = 0; i < 6; i++)
                    p.getWorld().strikeLightning(p.getLocation().add(new Random().nextInt(5),0,new Random().nextInt(5)));
            }

            case LOKI -> {
                p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 200, 0));
                p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 2));
            }

            case HERMES -> p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, 400, 2));

            case ARTEMIS -> p.getWorld().spawnParticle(Particle.FLAME, p.getLocation(), 100);

            case DEMETER -> p.getWorld().spawnParticle(Particle.HAPPY_VILLAGER, p.getLocation(), 150);

            case HEFESTUS -> p.getWorld().createExplosion(p.getLocation(), 1F);

            case ODIN -> p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 400, 2));

            case CHAOS -> {
                for (int i = 0; i < 4; i++)
                    p.getWorld().strikeLightning(p.getLocation());
            }
        }
    }
}
📄
pasted-code-1779018212222.txt
txt 247 lines
▶
package me.greekgods;

import me.greekgods.gods.GodType;
import org.bukkit.*;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.*;

public class GreekGods extends JavaPlugin implements Listener, CommandExecutor {

    private final Map gods = new HashMap<>();
    private final Map cooldown = new HashMap<>();

    private NamespacedKey key;

    @Override
    public void onEnable() {

        Bukkit.getPluginManager().registerEvents(this, this);

        getCommand("team").setExecutor(this);
        getCommand("godcraft").setExecutor(this);

        key = new NamespacedKey(this, "relic");
    }

    // ================= JOIN =================

    @EventHandler
    public void join(PlayerJoinEvent e) {

        Player p = e.getPlayer();

        if (!gods.containsKey(p.getUniqueId())) {
            Bukkit.getScheduler().runTaskLater(this, () -> openRoll(p), 20L);
        }
    }

    // ================= ROLL INVENTORY GUI =================

    private void openRoll(Player p) {

        Inventory inv = Bukkit.createInventory(null, 27, "§6Losuj Boga");

        for (int i = 0; i < 27; i++)
            inv.setItem(i, new ItemStack(Material.GRAY_STAINED_GLASS_PANE));

        ItemStack roll = new ItemStack(Material.NETHER_STAR);
        ItemMeta m = roll.getItemMeta();
        m.setDisplayName("§eLOSUJ");
        roll.setItemMeta(m);

        inv.setItem(13, roll);

        p.openInventory(inv);
    }

    @EventHandler
    public void roll(InventoryClickEvent e) {

        if (!e.getView().getTitle().equals("§6Losuj Boga")) return;

        e.setCancelled(true);

        Player p = (Player) e.getWhoClicked();

        if (e.getCurrentItem() == null) return;

        if (e.getCurrentItem().getType() == Material.NETHER_STAR) {

            GodType g = GodType.values()[new Random().nextInt(GodType.values().length)];

            gods.put(p.getUniqueId(), g);

            p.getInventory().addItem(createRelic(g));

            p.sendMessage("§6Dostałeś: " + g.display());

            p.closeInventory();
        }
    }

    // ================= RELIC =================

    private ItemStack createRelic(GodType g) {

        ItemStack item = new ItemStack(g.getMaterial());
        ItemMeta m = item.getItemMeta();

        m.setDisplayName("§6" + g.name() + " Relic T1");

        m.getPersistentDataContainer().set(key, PersistentDataType.STRING, g.name() + "_T1");

        m.setLore(List.of("§7Tier 1", "§8/godcraft aby ulepszyć"));

        item.setItemMeta(m);
        return item;
    }

    // ================= SKILLS =================

    @EventHandler
    public void use(PlayerInteractEvent e) {

        Player p = e.getPlayer();

        GodType g = gods.get(p.getUniqueId());
        if (g == null) return;

        if (cooldown.containsKey(p.getUniqueId())
                && System.currentTimeMillis() - cooldown.get(p.getUniqueId()) < 3000) return;

        if (e.getAction().toString().contains("RIGHT")) g.skill(p);
        if (e.getAction().toString().contains("LEFT")) g.ultimate(p);

        cooldown.put(p.getUniqueId(), System.currentTimeMillis());
    }

    // ================= COMMANDS =================

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        Player p = (Player) sender;

        if (cmd.getName().equalsIgnoreCase("team")) {

            GodType g = gods.get(p.getUniqueId());

            p.sendMessage(g == null ? "§cBrak boga" : "§6Bóg: " + g.display());

            return true;
        }

        if (cmd.getName().equalsIgnoreCase("godcraft")) {

            openCraft(p);
            return true;
        }

        return false;
    }

    // ================= CRAFT INVENTORY GUI =================

    private void openCraft(Player p) {

        Inventory inv = Bukkit.createInventory(null, 27, "§6God Craft");

        for (int i = 0; i < 27; i++)
            inv.setItem(i, new ItemStack(Material.GRAY_STAINED_GLASS_PANE));

        ItemStack info = new ItemStack(Material.BOOK);
        ItemMeta m = info.getItemMeta();

        m.setDisplayName("§aUpgrade");

        m.setLore(List.of(
                "§7Wymagania:",
                "§7- 8 iron / diamond / blaze rod",
                "§7- relikt T1",
                "",
                "§aKliknij aby ulepszyć"
        ));

        info.setItemMeta(m);

        inv.setItem(13, info);

        p.openInventory(inv);
    }

    // ================= UPGRADE CLICK =================

    @EventHandler
    public void craftClick(InventoryClickEvent e) {

        if (!e.getView().getTitle().equals("§6God Craft")) return;

        e.setCancelled(true);

        if (e.getCurrentItem() == null) return;

        if (e.getCurrentItem().getType() != Material.BOOK) return;

        Player p = (Player) e.getWhoClicked();

        upgrade(p);
    }

    // ================= UPGRADE SYSTEM =================

    private void upgrade(Player p) {

        Inventory inv = p.getInventory();

        boolean hasIron = inv.contains(Material.IRON_INGOT, 8);
        boolean hasBlaze = inv.contains(Material.BLAZE_ROD, 1);

        if (!hasIron || !hasBlaze) {
            p.sendMessage("§cBrakuje itemów!");
            return;
        }

        remove(inv, Material.IRON_INGOT, 8);
        remove(inv, Material.BLAZE_ROD, 1);

        GodType g = gods.get(p.getUniqueId());

        ItemStack upgraded = new ItemStack(Material.DIAMOND_SWORD);
        ItemMeta m = upgraded.getItemMeta();
        m.setDisplayName("§6" + g.name() + " RELIC T2");
        upgraded.setItemMeta(m);

        inv.addItem(upgraded);

        p.sendMessage("§aUpgrade udany!");
    }

    private void remove(Inventory inv, Material mat, int amt) {

        for (int i = 0; i < inv.getSize(); i++) {

            ItemStack it = inv.getItem(i);

            if (it == null) continue;

            if (it.getType() == mat) {

                int a = it.getAmount() - amt;

                if (a <= 0) inv.setItem(i, null);
                else it.setAmount(a);

                return;
            }
        }
    }
}
Kodari AI
KodariMay 17 at 11:49 am 19,953 (v2)

I’ll create a mythology-based ability plugin with proper structure, GUI framework, and cross-version compatibility.

GreekGods
A mythology-based ability system where players choose a Greek or Norse god upon joining. Each god has unique skills and ultimate abilities activated by clicking. Players receive god-specific relics that can be upgraded through a crafting system. Features cooldown management, persistent god selection, and tier-based equipment progression.

Plan

  • Refactor into proper manager/command/listener structure

  • Use XSeries for cross-version compatibility (Material, Particle, PotionEffectType)

  • Implement the GUI framework from documentation for both selection and crafting

  • Add cooldown manager with god assignments

  • Create config for messages and settings

All core files created. The plugin now features proper architecture with managers, GUI framework, XSeries compatibility, and clean separation of concerns.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
20 941
src/main/java/me/greekgods/GreekGods.java
package me.greekgods;

import lombok.Getter;
import me.greekgods.command.GodCraftCommand;
import me.greekgods.command.TeamCommand;
import me.greekgods.inventory.gui.GUIListener;
import me.greekgods.inventory.gui.GUIManager;
import me.greekgods.listener.AbilityListener;
import me.greekgods.listener.JoinListener;
import me.greekgods.manager.GodManager;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

public class GreekGods extends JavaPlugin {

    @Getter
    private GodManager godManager;
    @Getter
    private GUIManager guiManager;
    @Getter
    private NamespacedKey relicKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.relicKey = new NamespacedKey(this, "relic");
        this.godManager = new GodManager(this);
        this.guiManager = new GUIManager();

        Bukkit.getPluginManager().registerEvents(new JoinListener(this), this);
        Bukkit.getPluginManager().registerEvents(new AbilityListener(this), this);
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);

        getCommand("team").setExecutor(new TeamCommand(this));
        getCommand("godcraft").setExecutor(new GodCraftCommand(this));

        getLogger().info("GreekGods has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("GreekGods has been disabled!");
    }
}