frostbitevr111

make the hoplite elytra with the rocket boost but with a 2 second cooldown

Kodari AI
KodariApr 29 at 10:05 am 386 (v2)
RocketElytraPlugin
A Minecraft plugin that introduces a custom "Hoplite Elytra" item, which provides a rocket boost similar to fireworks when right-clicked while gliding. The boost includes a 2-second cooldown to prevent spamming. Players can obtain the item via a command, and it features unique lore for identification. Integrates with economy systems if desired, but focuses on core boost mechanics with cross-version compatibility.
frostbitevr111

how do i get the elytra and use it

Kodari AI
KodariApr 29 at 10:18 am 309 (v2)
  • To obtain the Hoplite Elytra, use the command /givehopliteelytra (requires rocketelytra.give permission, default for ops).

  • To use it, equip the elytra as your chestplate, start gliding by jumping and falling, then right-click while gliding to apply a rocket boost (with a 2-second cooldown between uses).

frostbitevr111

how do i activeate the command to work

Kodari AI
KodariApr 29 at 10:19 am 328 (v2)

The command /givehopliteelytra is already implemented and active in the plugin code (defined in plugin.yml and handled in RocketElytraPlugin.java). It will work automatically when the plugin is built, installed on a Minecraft server, and loaded (via /reload or server restart). To use it, ensure you have the rocketelytra.give permission (default for ops), then run the command in-game. If it’s not working, check server logs for errors or confirm the plugin is enabled.

frostbitevr111

rocketelytra.give how do i activate this

Kodari AI
KodariApr 29 at 10:20 am 100 (v2)

The rocketelytra.give permission is already defined in plugin.yml for the /givehopliteelytra command and is granted by default to server operators (ops). To “activate” it for non-op players:

  • Use a permissions plugin like LuckPerms (install it separately if not already on your server), then assign the permission via commands like /lp user <username> permission set rocketelytra.give true.

  • Alternatively, promote players to op status with /op <username> (grants all permissions, including this one).

  • If no permissions plugin is installed, only ops can use the command.

If the command still doesn’t work after granting the permission, check server console logs for errors (e.g., plugin not loaded or compilation issues).

frostbitevr111

is this for 1.21.11?

Kodari AI
KodariApr 29 at 10:26 am 333 (v2)

The build.gradle file specifies spigot-api:1.21-R0.1-SNAPSHOT, making the plugin compatible with Minecraft 1.21 (and likely 1.21.1, as the API hasn’t changed significantly); if you need support for a different version, update the dependency accordingly.

frostbitevr111

update it to 1.21.11

Kodari AI
KodariApr 29 at 10:27 am 235 (v2)

Updated the Spigot API dependency in build.gradle to 1.21.1-R0.1-SNAPSHOT for compatibility with Minecraft 1.21.1.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
4 139
src/main/java/com/example/rocketelytra/RocketElytraPlugin.java
package com.example.rocketelytra;

import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import com.cryptomorin.xseries.XMaterial;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class RocketElytraPlugin extends JavaPlugin {

    private final NamespacedKey hopliteKey = new NamespacedKey(this, "hoplite_elytra");
    private final Map<UUID, Long> cooldowns = new HashMap<>();

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new ElytraListener(this), this);
        getLogger().info("RocketElytraPlugin enabled!");
    }

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

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("givehopliteelytra") && sender instanceof Player) {
            Player player = (Player) sender;
            if (player.hasPermission("rocketelytra.give")) {
                ItemStack elytra = createHopliteElytra();
                player.getInventory().addItem(elytra);
                player.sendMessage("You have received the Hoplite Elytra!");
                return true;
            } else {
                player.sendMessage("You do not have permission to use this command.");
                return true;
            }
        }
        return false;
    }

    public ItemStack createHopliteElytra() {
        ItemStack elytra = XMaterial.matchXMaterial("ELYTRA").map(XMaterial::parseItem).orElse(null);
        if (elytra == null) return null;
        ItemMeta meta = elytra.getItemMeta();
        meta.setDisplayName("Hoplite Elytra");
        meta.getPersistentDataContainer().set(hopliteKey, PersistentDataType.BOOLEAN, true);
        elytra.setItemMeta(meta);
        return elytra;
    }

    public boolean isHopliteElytra(ItemStack item) {
        if (item == null || !item.hasItemMeta()) return false;
        return item.getItemMeta().getPersistentDataContainer().has(hopliteKey, PersistentDataType.BOOLEAN);
    }

    public boolean isOnCooldown(Player player) {
        Long lastUse = cooldowns.get(player.getUniqueId());
        return lastUse != null && System.currentTimeMillis() - lastUse < 2000; // 2 seconds
    }

    public void setCooldown(Player player) {
        cooldowns.put(player.getUniqueId(), System.currentTimeMillis());
    }
}