jadrian kal

echo smp

📎 1 file 4,059 chars
📄
pasted-code-1794208757744.txt
txt 173 lines
▶
1. Default ECHOs
Common
 Available to every player

When a player first joins the server, they receive one random Default ECHO.

Every Default ECHO has exactly 3 abilities.
ECHO	Ability 1	Ability 2	Ability 3
🔥 Flame	Fireball	Flame Dash	Fire Ring
🌊 Tide	Water Blast	Healing Rain	Tidal Wave
🌪️ Gale	Wind Burst	Air Dash	Tornado
🪨 Terra	Rock Throw	Earth Wall	Earthquake
❄️ Frost	Ice Shard	Frost Prison	Blizzard
⚡ Volt	Lightning Strike	Electric Dash	Thunderstorm
🌿 Nature	Vine Whip	Root Trap	Nature's Blessing
🌑 Shadow	Shadow Bolt	Invisibility	Shadow Clone
☀️ Light	Flashbang	Light Beam	Radiant Shield
🐺 Beast	Predator Leap	Beast Roar	Enhanced Senses

These are the foundation of the SMP. Players can develop strategies around their abilities and combine them with other players.
2. Legendary ECHOs
Legendary
 Obtained through small server events

Legendary ECHOs cannot be obtained through normal spawning.

Instead, the server randomly triggers small events. These events give players opportunities to earn a Legendary ECHO.






















8











ECHO	Ability 1	Ability 2	Ability 3
🐉 Dragon	Dragon Breath	Dragon Wings	Dragon Roar
⏳ Time	Time Stop	Rewind	Time Acceleration
🌀 Gravity	Gravity Well	Gravity Lift	Meteor Drop
🕳️ Void	Void Rift	Void Step	Void Explosion
👻 Soul	Soul Drain	Spirit Walk	Soul Guardian
💎 Crystal	Crystal Spikes	Crystal Armor	Crystal Barrage

Legendary event examples
1. The Dragon's Treasure
- A mysterious dragon appears in a random location.
- Players must discover its lair.
- Defeating the event boss unlocks a Dragon ECHO reward.
2. The Broken Clock
- Time anomalies appear throughout the world.
- Players must complete challenges involving strange time distortions.
- The winner receives the Time ECHO.
3. The Gravity Collapse
- A floating island appears somewhere in the world.
- Players must reach its center and complete its challenge.
- The winner receives the Gravity ECHO.
Important rules:
- Small events happen periodically.
- Only one Legendary ECHO is awarded per event.
- Legendary ECHOs are permanent.
- Players can only hold one ECHO at a time.
3. Mythic ECHOs
Mythic
 Obtained through massive server events

Mythic ECHOs are on an entirely different level.

They aren't obtained through ordinary boss fights or small challenges. They require massive server-wide events that involve multiple players, teams, and potentially the entire server.






















10











Mythic 1: The Creator
The ability to create and manipulate reality.
Ability	Description
World Rewrite	Temporarily transforms the surrounding terrain.
Reality Shift	Changes the properties of the surrounding battlefield.
Creation	Summons powerful structures and constructs.

Mythic 2: The Destroyer
The ability to corrupt and dismantle reality.
Ability	Description
Annihilation	Releases a devastating energy wave.
Corruption	Temporarily corrupts the surrounding environment.
Collapse	Creates a powerful gravitational collapse.

Massive event examples
The Creator's Awakening
- Strange structures begin appearing around the world.
- Players discover fragments of an ancient creation artifact.
- The entire server must work together to collect them.
- A massive final challenge determines who receives the Creator ECHO.
The Destroyer's Arrival
- The sky changes color.
- Strange creatures begin appearing.
- Players must defend important locations.
- The final battle determines who earns the Destroyer ECHO.
4. Event Rarity Structure
Rarity	How to obtain	Event scale
Default	Random upon joining	None
Legendary	Complete special events	Small
Mythic	Complete massive events	Server-wide

5. My Additional Recommendation: ECHO Exclusivity
I think we should establish one important rule:

Each individual ECHO can only have ONE active holder at a time.

For example:
- Only one Dragon holder.
- Only one Time holder.
- Only one Creator holder.
- Only one Destroyer holder.
This makes Legendary and Mythic ECHOs genuinely special.

If someone already owns the Dragon ECHO, another player cannot simply win another Dragon ECHO.
``
Kodari AI
KodariNov 9 at 7:23 am 3
EchoAbilities
A Minecraft SMP plugin granting players unique elemental ECHOs with three abilities each. Players receive a random Default ECHO upon joining, while Legendary and Mythic ECHOs are earned through special server events. Each ECHO has exclusive active abilities like Fireball, Lightning Strike, or Time Stop, triggered via commands or hotkeys. The plugin enforces one active holder per ECHO, manages cooldowns, and integrates with a GUI system for ability selection and management.
  • Assign and save one random Default ECHO per player, with exclusive Legendary and Mythic ownership.

  • Add an ability menu, cooldowns, and periodic competitive events for rare ECHOs.

Created Echo SMP with persistent ECHO assignments, three ability commands per ECHO, cooldowns, and periodic guardian events. Rare ECHOs have one holder each; Default ECHOs can be shared.

Use /echo to see your abilities, /echo event for event status, and /echo start <echo> to start an event as an admin.

Current limitations: abilities use simplified combat effects, and all rare events use a guardian fight. The distinct challenges, constructs, terrain transformations, and other named mechanics in the spec are not yet implemented.

Kodari can make mistakes. Review important code before using.
Files
assets
src
build.gradle
pack.mcmeta
README.txt
settings.gradle
Code
223 1,289
src/main/java/com/kodari/echosmp/EchoSMP.java
package com.kodari.echosmp;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

public final class EchoSMP extends JavaPlugin implements Listener {
    private enum Echo {
        FLAME("Fireball", "Flame Dash", "Fire Ring"),
        TIDE("Water Blast", "Healing Rain", "Tidal Wave"),
        GALE("Wind Burst", "Air Dash", "Tornado"),
        TERRA("Rock Throw", "Earth Wall", "Earthquake"),
        FROST("Ice Shard", "Frost Prison", "Blizzard"),
        VOLT("Lightning Strike", "Electric Dash", "Thunderstorm"),
        NATURE("Vine Whip", "Root Trap", "Nature's Blessing"),
        SHADOW("Shadow Bolt", "Invisibility", "Shadow Clone"),
        LIGHT("Flashbang", "Light Beam", "Radiant Shield"),
        BEAST("Predator Leap", "Beast Roar", "Enhanced Senses"),
        DRAGON("Dragon Breath", "Dragon Wings", "Dragon Roar"),
        TIME("Time Stop", "Rewind", "Time Acceleration"),
        GRAVITY("Gravity Well", "Gravity Lift", "Meteor Drop"),
        VOID("Void Rift", "Void Step", "Void Explosion"),
        SOUL("Soul Drain", "Spirit Walk", "Soul Guardian"),
        CRYSTAL("Crystal Spikes", "Crystal Armor", "Crystal Barrage"),
        CREATOR("World Rewrite", "Reality Shift", "Creation"),
        DESTROYER("Annihilation", "Corruption", "Collapse");

        final String[] abilities;
        Echo(String... abilities) { this.abilities = abilities; }
        boolean rare() { return ordinal() >= DRAGON.ordinal(); }
        boolean mythic() { return ordinal() >= CREATOR.ordinal(); }
        String label() { return name().charAt(0) + name().substring(1).toLowerCase(Locale.ROOT); }
    }

    private final Map<UUID, Echo> owners = new HashMap<>();
    private final Map<UUID, long[]> cooldowns = new HashMap<>();
    private final Random random = new Random();
    private File dataFile;
    private YamlConfiguration data;
    private Echo eventEcho;
    private UUID eventBoss;
    private long eventEnds;
    private final Map<UUID, Double> eventDamage = new HashMap<>();

    @Override
    public void onEnable() {
        saveDefaultConfig();
        dataFile = new File(getDataFolder(), "players.yml");
        data = YamlConfiguration.loadConfiguration(dataFile);
        for (String key : data.getKeys(false)) {
            try {
                UUID id = UUID.fromString(key);
                Echo echo = Echo.valueOf(data.getString(key, ""));
                if (echo.rare() && owners.containsValue(echo)) {
                    getLogger().warning("Duplicate rare ECHO for " + id + "; assigning a default.");
                    echo = randomDefault();
                }
                owners.put(id, echo);
            } catch (IllegalArgumentException ex) {
                getLogger().warning("Invalid player ECHO entry: " + key);
            }
        }
        Bukkit.getPluginManager().registerEvents(this, this);
        for (Player player : Bukkit.getOnlinePlayers()) assignDefault(player);
        long interval = Math.max(1, getConfig().getLong("events.interval-minutes", 60)) * 1200L;
        Bukkit.getScheduler().runTaskTimer(this, this::startRandomEvent, interval, interval);
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            if (eventBoss != null && System.currentTimeMillis() >= eventEnds) endEvent("The ECHO event expired.");
        }, 20L, 20L);
    }

    @Override
    public void onDisable() {
        if (eventBoss != null) {
            Entity boss = Bukkit.getEntity(eventBoss);
            if (boss != null) boss.remove();
        }
        saveOwners();
    }

    private Echo randomDefault() { return Echo.values()[random.nextInt(10)]; }

    private void saveOwners() {
        for (Map.Entry<UUID, Echo> entry : owners.entrySet()) data.set(entry.getKey().toString(), entry.getValue().name());
        try { data.save(dataFile); } catch (IOException ex) { getLogger().severe("Could not save ECHO data: " + ex.getMessage()); }
    }

    private void assignDefault(Player player) {
        if (!owners.containsKey(player.getUniqueId())) {
            Echo echo = randomDefault();
            owners.put(player.getUniqueId(), echo);
            saveOwners();
            player.sendMessage(ChatColor.GOLD + "Your ECHO is " + echo.label() + "! Use /echo to view your abilities.");
        }
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent event) { assignDefault(event.getPlayer()); }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length > 0 && args[0].equalsIgnoreCase("start")) {
            if (!sender.hasPermission("echosmp.admin")) { sender.sendMessage(ChatColor.RED + "No permission."); return true; }
            if (args.length != 2) { sender.sendMessage("Usage: /echo start <legendary-or-mythic>"); return true; }
            try {
                Echo echo = Echo.valueOf(args[1].toUpperCase(Locale.ROOT));
                if (!startEvent(echo)) sender.sendMessage(ChatColor.RED + "Cannot start: ECHO is not rare, already owned, an event is active, or no players are online.");
            } catch (IllegalArgumentException ex) { sender.sendMessage(ChatColor.RED + "Unknown ECHO."); }
            return true;
        }
        if (args.length > 0 && args[0].equalsIgnoreCase("event")) {
            sender.sendMessage(eventBoss == null ? "No ECHO event is active." : "Active event: " + eventEcho.label() + " (" + Math.max(0, (eventEnds - System.currentTimeMillis()) / 1000) + "s remaining). Deal damage to the boss to compete.");
            return true;
        }
        if (!(sender instanceof Player)) { sender.sendMessage("Only players can use ECHO abilities."); return true; }
        Player player = (Player) sender;
        assignDefault(player);
        Echo echo = owners.get(player.getUniqueId());
        if (args.length == 0) {
            player.sendMessage(ChatColor.GOLD + "Your ECHO: " + echo.label());
            for (int i = 0; i < 3; i++) player.sendMessage(ChatColor.YELLOW + "/echo " + (i + 1) + ChatColor.GRAY + " - " + echo.abilities[i]);
            player.sendMessage(ChatColor.GRAY + "Use /echo event to check the current event.");
            return true;
        }
        int slot;
        try { slot = Integer.parseInt(args[0]) - 1; } catch (NumberFormatException ex) { player.sendMessage("Use /echo, /echo 1, /echo 2, or /echo 3."); return true; }
        if (slot < 0 || slot > 2) { player.sendMessage("Ability number must be 1, 2, or 3."); return true; }
        long[] times = cooldowns.computeIfAbsent(player.getUniqueId(), id -> new long[3]);
        long now = System.currentTimeMillis();
        if (times[slot] > now) { player.sendMessage(ChatColor.RED + "Cooldown: " + ((times[slot] - now + 999) / 1000) + "s."); return true; }
        times[slot] = now + Math.max(1, getConfig().getLong("abilities.cooldown-seconds", 30)) * 1000L;
        useAbility(player, echo, slot);
        player.sendMessage(ChatColor.AQUA + echo.abilities[slot] + " activated!");
        return true;
    }

    private void startRandomEvent() {
        if (eventBoss != null) return;
        boolean mythic = random.nextDouble() < Math.max(0, Math.min(1, getConfig().getDouble("events.mythic-chance", 0.15)));
        List<Echo> choices = new ArrayList<>();
        for (Echo echo : Echo.values()) if (echo.rare() && echo.mythic() == mythic && !owners.containsValue(echo)) choices.add(echo);
        if (!choices.isEmpty()) startEvent(choices.get(random.nextInt(choices.size())));
    }

    private boolean startEvent(Echo echo) {
        if (!echo.rare() || owners.containsValue(echo) || eventBoss != null || Bukkit.getOnlinePlayers().isEmpty()) return false;
        List<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
        Player anchor = players.get(random.nextInt(players.size()));
        Location location = anchor.getLocation().clone().add(8, 0, 8);
        location.setY(location.getWorld().getHighestBlockYAt(location) + 1);
        Zombie boss = location.getWorld().spawn(location, Zombie.class);
        boss.setCustomName(ChatColor.LIGHT_PURPLE + echo.label() + " ECHO Guardian");
        boss.setCustomNameVisible(true);
        boss.setRemoveWhenFarAway(false);
        double health = Math.max(1, getConfig().getDouble(echo.mythic() ? "events.mythic-health" : "events.legendary-health", echo.mythic() ? 600 : 200));
        boss.setMaxHealth(health);
        boss.setHealth(health);
        eventEcho = echo;
        eventBoss = boss.getUniqueId();
        eventDamage.clear();
        eventEnds = System.currentTimeMillis() + Math.max(1, getConfig().getLong("events.duration-minutes", 10)) * 60000L;
        Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE + (echo.mythic() ? "MYTHIC" : "LEGENDARY") + " event: Defeat the " + echo.label() + " guardian at " + location.getWorld().getName() + " " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ() + ". Highest-damage eligible player wins!");
        return true;
    }

    private void endEvent(String message) {
        Entity boss = eventBoss == null ? null : Bukkit.getEntity(eventBoss);
        if (boss != null) boss.remove();
        eventBoss = null;
        eventEcho = null;
        eventDamage.clear();