_iiroma

make me a mini gun plugin if the crossbow name is minigun and it's loaded with an arorr make it shoot with no colldown

Kodari AI
KodariJun 2 at 11:47 am 7
MinigunPlugin
Transforms any crossbow named "minigun" into a rapid-fire weapon. When a player right-clicks with a loaded minigun crossbow, it toggles continuous fire mode — shooting arrows every 2 ticks with no cooldown, realistic spread, and crossbow sound effects. The crossbow stays permanently loaded so firing never stops until toggled off or the item is switched.

Plan:

  • MinigunPlugin — registers listener

  • MinigunListener — toggle fire on right-click, global repeating task fires arrows every 2 ticks for all active shooters, no cooldown applied each tick


How it works:

Action
Result
Right-click with a
loaded
crossbow named
minigun
Toggles rapid fire
ON
Right-click again
Toggles rapid fire
OFF
Switch items
Auto-stops firing
  • Fires 1 arrow every 2 ticks (10 shots/sec) with slight spread for recoil feel

  • Crossbow stays visually loaded — ammo never depletes

  • Zero cooldown applied every tick so it never locks up

  • Name check is color-code insensitive — works with &6minigun, plain minigun, etc.

Kodari can make mistakes. Review important code before using.
Files
src
Code
3 149
src/main/java/com/kodari/minigun/MinigunPlugin.java
package com.kodari.minigun;

import org.bukkit.plugin.java.JavaPlugin;

public class MinigunPlugin extends JavaPlugin {

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

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