br6zy

I MEAN LUNGE LIKE WHEN U USE THE LUNG ENCHANT

Kodari AI
KodariJul 29 at 1:47 pm 3
  1. Add forward lunge movement to the spear use event.

  2. Add a configurable lunge strength, defaulting to a strong forward boost.

Added spear lunge behavior: using the spear now launches the player forward like the Lung enchant.

  • Default lunge strength: 1.5

  • Configurable in config.yml with lunge-strength

  • Lunge occurs after cooldown validation and before the use sound

br6zy

The compilation failed with this error:

code
Compilation failed with 5 error(s):

ERROR in src/main/java/com/kodari/spearcooldown/SpearManager_copy.java at line 15: class SpearManager is public, should be declared in a file named SpearManager.java
public class SpearManager {
       ^

ERROR in src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java at line 51: cannot find symbol
                getConfig().getFloat("sounds.volume", 1.0F),
                           ^
  symbol: method getFloat(String,float)
  location: class FileConfiguration

ERROR in src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java at line 52: cannot find symbol
                getConfig().getFloat("sounds.pitch", 1.0F)
                           ^
  symbol: method getFloat(String,float)
  location: class FileConfiguration

ERROR in src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java at line 64: cannot find symbol
                getConfig().getFloat("sounds.ready-volume", 1.0F),
                           ^
  symbol: method getFloat(String,float)
  location: class FileConfiguration

ERROR in src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java at line 65: cannot find symbol
                getConfig().getFloat("sounds.ready-pitch", 1.2F)
                           ^
  symbol: method getFloat(String,float)
  location: class FileConfiguration


=== COMPILATION ERROR ANALYSIS ===

MISSING METHODS:
  - getFloat(String,float)
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/spearcooldown/SpearManager_copy.java
  - src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJul 29 at 1:50 pm 2

Fixed the compilation errors:

  • Renamed the public class in SpearManager_copy.java to SpearManager_copy so it matches the filename.

  • Replaced unsupported FileConfiguration.getFloat(...) calls with getDouble(...), which Bukkit supports and playSound(...) accepts.

Files corrected:

  • src/main/java/com/kodari/spearcooldown/SpearManager_copy.java

  • src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java

br6zy

nothing works on the command make the actionbar and cooldown on lunge spears work and when i say name i dont mean the spear name i mean the player that has a lungespear in his hotbar or inv

Kodari AI
KodariJul 29 at 3:50 pm 11
  1. Fix the command so it targets the player holding or carrying a Lunge spear, not the spear’s item name.

  2. Restore the Lunge spear cooldown and action-bar feedback for each affected player.

Fixed the command and player-based handling.

Changes:

  • /speardisable <player> now targets the player, not the spear’s display name.

  • Also supports:

    • /speardisable disable <player>

    • /speardisable enable <player>

  • The player must have a configured Lunge spear in their hotbar or inventory.

  • Disabled status is stored by player UUID.

  • Cooldown and action-bar checks now respect the player’s disabled status.

  • Added player-name tab completion.

  • Added messages for missing players and missing Lunge spears.

  • Added persistent disabled-players configuration.

The action bar still displays while the Lunge spear is held, and the cooldown starts when the player uses it.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
10 719
src/main/java/com/kodari/spearcooldown/SpearCooldownPlugin.java
package com.kodari.spearcooldown;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class SpearCooldownPlugin extends JavaPlugin {
    private SpearManager spearManager;
    private CooldownManager cooldownManager;
    private ActionBarTask actionBarTask;

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

        spearManager = new SpearManager(this);
        cooldownManager = new CooldownManager();

        getServer().getPluginManager().registerEvents(
                new SpearListener(this, spearManager, cooldownManager),
                this
        );

        SpearDisableCommand command = new SpearDisableCommand(this, spearManager);
        if (getCommand("speardisable") != null) {
            getCommand("speardisable").setExecutor(command);
            getCommand("speardisable").setTabCompleter(command);
        }

        long updateTicks = Math.max(1L, getConfig().getLong("action-bar.update-ticks", 2L));
        actionBarTask = new ActionBarTask(this, spearManager, cooldownManager);
        actionBarTask.runTaskTimer(this, 0L, updateTicks);
    }

    @Override
    public void onDisable() {
        if (actionBarTask != null) {
            actionBarTask.cancel();
        }
    }

    public void playUseSound(Player player) {
        if (!getConfig().getBoolean("sounds.enabled", true)) {
            return;
        }

        playConfiguredSound(
                player,
                getConfig().getString("sounds.use", "ITEM_TRIDENT_THROW"),
                (float) getConfig().getDouble("sounds.volume", 1.0F),
                (float) getConfig().getDouble("sounds.pitch", 1.0F)
        );
    }

    public void playReadySound(Player player) {
        if (!getConfig().getBoolean("sounds.enabled", true)) {
            return;
        }

        playConfiguredSound(
                player,
                getConfig().getString("sounds.ready", "ENTITY_PLAYER_LEVELUP"),
                (float) getConfig().getDouble("sounds.ready-volume", 1.0F),
                (float) getConfig().getDouble("sounds.ready-pitch", 1.2F)
        );
    }

    private void playConfiguredSound(Player player, String sound, float volume, float pitch) {
        if (sound == null || sound.trim().isEmpty()) {
            return;
        }

        Location location = player.getLocation();
        player.playSound(location, sound, volume, pitch);
    }

    public String message(String path) {
        String message = getConfig().getString("messages." + path, "");
        return ChatColor.translateAlternateColorCodes('&', message);
    }

    public String message(String path, String placeholder, String value) {
        return message(path).replace("{" + placeholder + "}", value);
    }

    public SpearManager getSpearManager() {
        return spearManager;
    }

    public CooldownManager getCooldownManager() {
        return cooldownManager;
    }
}