strafe ify

make me a plugin called perkSMP for 1.21.11 paper so the plugin is about 9 diffrent perks that give you abilitys perk one is regen so if you use the ability by clicking a keybind that you set with /keybind you cna set the keybind to activate them anyway the regen perk makes you auto heal your hp to max hunger and health 2 minute cd the nexet one is magma the ability makes you set others on fire for 10 seconds and it goes through fire resistance and it will do half a heartt no matter waht you have it does half a heart of true damage every tick cd one minute and 30 seconds the next ability is blur the ability freezes the nearest player for 5 seconds 2 minute cooldown the next perk will be called blizzard that will make the nearest player have frost effect for 10 seconds half a heart of true damage as well one minute and 30 second cooldown the next perk will be nature this perk will make you be able to shoot a vine that pulls you toward what ever you shot so if you shoot a vine at a wall you will get pulled to it and if you shoot it at a player you will drag them to you 30 second cd next perk is refill the ability makes it so when you activate the ability it will make whatever you use for the next 10 seconds not lose anything so if you gap it will stay in your inventory and not dissapear/ be used for that time 2 minute cd the next one is ward the ability will give the nearest player darkness and slowness for 10 seconds cooldown is 1 minute the next one is joker the ability scrables the nearest players hotbar the cd is 3 minutes the next perk is called portal it will make it so where ever you are looking iwht in a 20 block radius you will teleport there now there will be three mythic perks the first mythic is reaper every hit you do to a enity /mod /player will give you half a hear of regen back thats a passive no ability so theres no cd the next mythic perk is called immortal the ability makes it so you take no damage for 10 seconds cd is 2 minutes the next perk is domain the ability summoms a doamin around you and if a player is in there all there effects get cleared and they go down to 9 hearts for the time being in there and they get blindness while in theres but you player who did the domain doesnt get any of those effects now make a admion command thats /perk then /perkgive (player) (perk) and they will get that perk and now make a /perkcd (player) that makes it so the cds get reset for that player and add a gui in the bottom left of your screen that shows the icon of your perk that you have and make it show the cooldown count down in above your xp bar

Kodari AI
KodariNov 2 at 10:10 pm 2
PerkSMP
PerkSMP is a Minecraft Paper 1.21.11 plugin introducing 9 distinct perks with unique abilities. Perks include Regen (auto-heal), Magma (fire damage through resistance), Blur (freeze player), Blizzard (frost damage), Nature (vine grappling hook), Refill (item duplication), Ward (darkness/slowness), Joker (hotbar scramble), and Portal (teleport). Three mythic perks: Reaper (passive lifesteal), Immortal (damage immunity), Domain (debuff aura). Features custom keybind system via /keybind, admin commands /perk, /perkgive, /perkcd, GUI showing perk icon in corner, and cooldown display above XP bar.
  1. Create the Paper 1.21.11 plugin setup and persistent perk/keybind storage.

  2. Implement all 12 perks, cooldowns, admin commands, and supported server-side activation binds.

  3. Add the on-screen perk/cooldown HUD and register its event handling.

Created perkSMP with all nine regular perks and three mythic perks, persistent perk assignments and keybinds, /perk give and /perkgive, /perkcd, cooldown tracking, and a perk icon/cooldown actionbar HUD.

Two plugin limitations: Bukkit plugins can’t detect arbitrary client key presses, so /keybind supports server-detectable actions: swap, drop, or rightclick. A server plugin also can’t position a custom overlay in the bottom-left corner, so the HUD is shown in the actionbar above the hotbar instead.

I set Portal’s cooldown to 30 seconds. Domain uses a 15-second duration, 8-block radius, and 3-minute cooldown since those values weren’t specified.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 789
src/main/java/com/kodari/perksmp/PerkSMP.java
package com.kodari.perksmp;

import com.cryptomorin.xseries.XPotion;
import com.cryptomorin.xseries.particles.XParticle;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
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.Arrow;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Trident;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerItemDamageEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public final class PerkSMP extends JavaPlugin implements Listener {
    private static final double TARGET_RANGE = 20.0;
    private static final double DOMAIN_RADIUS = 8.0;
    private static final long DOMAIN_DURATION_MILLIS = 15_000L;

    private final Map<UUID, Perk> perks = new HashMap<>();
    private final Map<UUID, Trigger> triggers = new HashMap<>();
    private final Map<UUID, EnumMap<Perk, Long>> cooldowns = new HashMap<>();
    private final Map<UUID, Long> frozenUntil = new HashMap<>();
    private final Map<UUID, Long> refillUntil = new HashMap<>();
    private final Map<UUID, Long> immortalUntil = new HashMap<>();
    private final Map<UUID, DomainField> domains = new HashMap<>();
    private File playerDataFile;

    @Override
    public void onEnable() {
        playerDataFile = new File(getDataFolder(), "players.yml");
        loadPlayerData();
        Bukkit.getPluginManager().registerEvents(this, this);
        getCommand("perk").setExecutor(this::onPerkCommand);
        getCommand("perkgive").setExecutor(this::onPerkGiveCommand);
        getCommand("perkcd").setExecutor(this::onPerkCooldownCommand);
        getCommand("keybind").setExecutor(this::onKeybindCommand);
        Bukkit.getScheduler().runTaskTimer(this, this::updateHud, 0L, 10L);
        Bukkit.getScheduler().runTaskTimer(this, this::updateDomains, 5L, 5L);
    }

    @Override
    public void onDisable() {
        savePlayerData();
        for (DomainField domain : domains.values()) {
            endDomain(domain);
        }
        domains.clear();
    }

    private boolean onPerkCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 3 && args[0].equalsIgnoreCase("give")) {
            return givePerk(sender, args[1], args[2]);
        }
        if (args.length == 0) {
            sender.sendMessage("§bperkSMP perks: §fRegen, Magma, Blur, Blizzard, Nature, Refill, Ward, Joker, Portal, Reaper, Immortal, Domain");
            sender.sendMessage("§7Use §f/perk give <player> <perk> §7or §f/perkgive <player> <perk>§7.");
            return true;
        }
        sender.sendMessage("§cUsage: /perk give <player> <perk>");
        return true;
    }

    private boolean onPerkGiveCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length != 2) {
            sender.sendMessage("§cUsage: /perkgive <player> <perk>");
            return true;
        }
        return givePerk(sender, args[0], args[1]);
    }

    private boolean givePerk(CommandSender sender, String playerName, String perkName) {
        Player target = Bukkit.getPlayerExact(playerName);
        if (target == null) {
            sender.sendMessage("§cThat player must be online.");
            return true;
        }
        Perk perk = Perk.parse(perkName);
        if (perk == null) {
            sender.sendMessage("§cUnknown perk. Use /perk to see the perk list.");
            return true;
        }
        perks.put(target.getUniqueId(), perk);
        savePlayerData();
        sender.sendMessage("§aGave §f" + perk.label + " §ato §f" + target.getName() + "§a.");
        target.sendMessage("§aYou received the §f" + perk.label + " §aperk!");
        return true;
    }

    private boolean onPerkCooldownCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length != 1) {
            sender.sendMessage("§cUsage: /perkcd <player>");
            return true;
        }
        Player target = Bukkit.getPlayerExact(args[0]);
        if (target == null) {
            sender.sendMessage("§cThat player must be online.");
            return true;
        }
        cooldowns.remove(target.getUniqueId());
        sender.sendMessage("§aReset all perk cooldowns for §f" + target.getName() + "§a.");
        target.sendMessage("§aYour perk cooldowns have been reset.");
        return true;
    }

    private boolean onKeybindCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("§cOnly players can set a perk keybind.");
            return true;
        }
        if (args.length != 1) {
            player.sendMessage("§bChoose an activation input: §f/keybind swap§7 (swap-hands key), §f/keybind drop§7 (drop key), or §f/keybind rightclick§7.");
            player.sendMessage("§7The server can detect these actions, but plugins cannot read arbitrary client key presses.");
            return true;
        }
        Trigger trigger = Trigger.parse(args[0]);
        if (trigger == null) {
            player.sendMessage("§cUse /keybind swap, /keybind drop, or /keybind rightclick.");
            return true;
        }
        triggers.put(player.getUniqueId(), trigger);
        savePlayerData();
        player.sendMessage("§aYour perk activates with: §f" + trigger.label + "§a.");
        return true;
    }

    @EventHandler
    public void onSwapHands(PlayerSwapHandItemsEvent event) {
        if (getTrigger(event.getPlayer()) == Trigger.SWAP) {
            event.setCancelled(true);
            activate(event.getPlayer());
        }
    }

    @EventHandler
    public void onDrop(PlayerDropItemEvent event) {
        if (getTrigger(event.getPlayer()) == Trigger.DROP) {
            event.setCancelled(true);
            activate(event.getPlayer());
        }
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || !event.getAction().isRightClick()) {
            return;
        }
        if (getTrigger(event.getPlayer()) == Trigger.RIGHT_CLICK) {
            event.setCancelled(true);
            activate(event.getPlayer());
        }
    }

    @EventHandler
    public void onFrozenMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        if (frozenUntil.getOrDefault(player.getUniqueId(), 0L) <= System.currentTimeMillis()) {
            frozenUntil.remove(player.getUniqueId());
            return;
        }
        Location from = event.getFrom();
        Location to = event.getTo();