dexfvv

add an axe that when you sneak+ right click oponents cant hit or punch you for 6 seconds

so whenever i shift and right click oponents cannot punch me for 6 seconds it should activate whenever i press shift and right click and it should always protect me from all enemies for 6 seconds when used

/protectionaxe give /protectionaxe reload

Only server operators should be able to obtain the axe through the give command by default, but this should be configurable in config.yml. The axe should not be obtainable through normal plugin commands by non-OP players unless configured otherwise.

add a 45 second cooldown that is displayed in the action bar when the axe is in hand make the cooldown prefix and editable in the config so i can edit colours and more messages

Generate all necessary files including:

Main plugin class Command classes Listener classes Cooldown manager Item manager Utility classes plugin.yml config.yml

Kodari AI
KodariAug 16 at 2:01 am 8
ProtectionAxe
A Minecraft plugin that adds a special axe granting temporary invulnerability. When a player sneaks and right-clicks with the axe, they become immune to all melee attacks for 6 seconds. Features a 45-second cooldown displayed in the action bar with configurable messages and colors. Includes admin commands for giving the axe and reloading config, with permission-based access control configurable in config.yml. Cooldown tracking persists per player with visual feedback.
  • Core plugin bootstrap, configuration, and command registration.

  • Custom axe identity and configurable item delivery.

  • Sneak-right-click activation, six-second combat protection, and 45-second cooldown.

  • Action-bar cooldown display plus configurable messages and access control.

Created the Protection Axe plugin with configurable axe item, OP-controlled /protectionaxe give, /protectionaxe reload, six-second sneak-right-click damage protection, 45-second cooldown, and configurable action-bar/messages.

dexfvv

the configured axe material is invalid checkconfig yml fix this issue

Kodari AI
KodariAug 16 at 2:04 am 2

The configured DIAMOND_AXE is valid; the item creation path is incorrectly treating an item-stack parse failure as a material validation error. I’ll resolve the material first and build the stack directly.

  • Resolve the configured XSeries material into a Bukkit material.

  • Create the item stack from that material instead of using XSeries’ item parser.

  • Preserve the configurable item metadata and invalid-material fallback.

Fixed the invalid material error. DIAMOND_AXE is now resolved to a Bukkit material before building the axe item, so the default config works correctly.

dexfvv

the axe doesnt work when i hit someone while im protected make it work

Kodari AI
KodariAug 16 at 2:10 am 2
  • Protect the axe user through Bukkit’s base damage event, not only direct entity-hit events.

  • Cancel every incoming damage type while the six-second protection is active, including damage attributed through combat plugins.

Fixed protection so it now cancels all incoming damage, including punches, melee hits, projectiles, and damage applied by combat plugins, for the active six seconds.

dexfvv

make the axe work in combat

Kodari AI
KodariAug 16 at 4:11 am 4
  • Process axe activation after standard combat listeners.

  • Cancel protected-player damage at the highest Bukkit event priority so active combat cannot override it.

Made the Protection Axe work reliably during combat: activation and incoming-damage protection now run at Bukkit’s highest event priority, preventing combat plugins or other listeners from overriding the six-second protection.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
11 519
src/main/java/com/kodari/protectionaxe/ProtectionAxePlugin.java
package com.kodari.protectionaxe;

import com.kodari.protectionaxe.command.ProtectionAxeCommand;
import com.kodari.protectionaxe.listener.ProtectionAxeListener;
import com.kodari.protectionaxe.manager.CooldownManager;
import com.kodari.protectionaxe.manager.ItemManager;
import com.kodari.protectionaxe.task.CooldownDisplayTask;
import com.kodari.protectionaxe.util.MessageUtil;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class ProtectionAxePlugin extends JavaPlugin {

    private CooldownManager cooldownManager;
    private ItemManager itemManager;
    private MessageUtil messages;

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

        this.cooldownManager = new CooldownManager(this);
        this.itemManager = new ItemManager(this);
        this.messages = new MessageUtil(this);

        ProtectionAxeCommand commandExecutor = new ProtectionAxeCommand(this);
        PluginCommand command = getCommand("protectionaxe");
        if (command != null) {
            command.setExecutor(commandExecutor);
            command.setTabCompleter(commandExecutor);
        }

        getServer().getPluginManager().registerEvents(new ProtectionAxeListener(this), this);
        getServer().getScheduler().runTaskTimer(this, new CooldownDisplayTask(this), 0L, 20L);
    }

    @Override
    public void onDisable() {
        if (cooldownManager != null) {
            cooldownManager.clear();
        }
    }

    public CooldownManager getCooldownManager() {
        return cooldownManager;
    }

    public ItemManager getItemManager() {
        return itemManager;
    }

    public MessageUtil getMessages() {
        return messages;
    }
}