gaming_aditya_

Minecraft Paper Plugin — Global Player Kill Wither Sound

Create a production-ready Minecraft Paper plugin for Paper 26.2 (latest compatible build).

The plugin's purpose is simple:

«Whenever a player kills another player, play the vanilla Wither Spawn sound globally to every online player, regardless of their location or dimension.»

  1. Player Kill Detection

The sound must trigger ONLY when a player kills another player.

The condition must be:

Victim = Player Killer = Player

Use the proper modern Paper/Bukkit player death event API.

Do NOT trigger the sound for:

  • A player hitting/damaging another player.
  • A player being hit but surviving.
  • Fall damage.
  • Void damage.
  • Lava damage.
  • Fire damage.
  • Drowning.
  • Suffocation.
  • Mob attacks.
  • TNT/explosions.
  • Environmental damage.
  • Any other non-player cause of death.
  • A player dying without a player as the killer.

The sound should trigger once per valid player kill.

---

  1. 🌍 GLOBAL SOUND

The most important requirement is that the sound is server-wide/global.

When Player A kills Player B:

  • Every currently online player must hear the sound.
  • Players can be anywhere on the server.
  • Distance does not matter.
  • Players do NOT need to be in the same world.
  • Players do NOT need to be in the same dimension.

The sound must work across:

  • Overworld
  • Nether
  • The End
  • Any custom worlds/dimensions supported by the server

Important implementation requirement

Do NOT simply play the sound at the victim's location with a huge radius.

Instead, send/play the sound directly to every online player, so Minecraft's normal distance-based sound attenuation does not prevent players in other locations or dimensions from hearing it.

Conceptually:

for (Player player : Bukkit.getOnlinePlayers()) { player.playSound(...); }

Use the appropriate modern Paper/Bukkit API for Paper 26.2.

---

  1. 🔊 Sound

Use the vanilla Minecraft sound:

ENTITY_WITHER_SPAWN

Make the following configurable through "config.yml":

enabled: true

sound: type: ENTITY_WITHER_SPAWN volume: 1.0 pitch: 1.0

The plugin should safely handle invalid configuration values.

---

  1. 🔄 Reload Command

Add:

/withersound reload

Permission:

withersound.admin

The command should:

  • Reload "config.yml".
  • Apply the new settings immediately.
  • Not require a server restart.

Only users with "withersound.admin" should be able to use the reload command.

---

  1. ⚙️ Performance

The plugin must be lightweight and optimized.

Requirements:

  • No repeating tasks.
  • No unnecessary scheduled tasks.
  • No world scanning.
  • No location scanning.
  • No unnecessary database.
  • No packet manipulation unless genuinely required.
  • Trigger the sound only when a valid player kill occurs.
  • Iterating through "Bukkit.getOnlinePlayers()" when a kill occurs is acceptable and expected.
  • The plugin should have negligible impact on server performance.

---

  1. 🛡️ Reliability

Make sure:

  • The plugin does not crash if the configuration contains invalid values.
  • The plugin handles missing configuration values safely.
  • The sound is played exactly once per valid kill.
  • Reloading the configuration works correctly.
  • No memory leaks are introduced.
  • No unnecessary listeners or tasks are created.

---

  1. 📦 Plugin Project

Provide the complete buildable plugin project, including:

PluginProject/ ├── build.gradle / pom.xml ├── settings.gradle (if using Gradle) └── src/ └── main/ ├── java/ │ └── .../ │ └── MainPluginClass.java └── resources/ ├── plugin.yml └── config.yml

Use the correct plugin metadata format required for the target Paper 26.2 version.

Use the correct Java version required by the target Paper version.

---

  1. 📋 Final Output

Provide:

  1. Complete source code for every file.
  2. Complete "config.yml".
  3. Correct Paper plugin metadata.
  4. Gradle or Maven configuration.
  5. Complete project structure.
  6. Exact command to build the plugin.
  7. Exact location of the generated ".jar".
  8. Installation instructions.
  9. Example configuration.
  10. Brief explanation of how the global sound system works.

Critical Requirement

The final plugin must be fully functional, production-ready, and directly buildable into a ".jar".

Do NOT provide pseudocode, placeholders, incomplete classes, or theoretical examples.

The finished ".jar" must be ready to place inside:

server/plugins/

and run on Paper 26.2.

Kodari AI
KodariAug 9 at 12:31 pm 1
GlobalWitherKillSound
Listens for player kills and plays the vanilla wither spawn sound globally to every online player across all dimensions. Configurable sound type, volume, and pitch via config.yml. Includes a reload command with withersound.admin permission. Lightweight event-driven design with no scheduled tasks or world scanning.
  1. Create the Gradle Paper 26.2 project and Java 25 build configuration.

  2. Add the plugin entrypoint, validated reloadable settings, global player-death sound listener, and reload command.

  3. Add plugin.yml and default config.yml with permission and sound settings.

  1. Created the complete Gradle project targeting Paper 26.2 and Java 25.

  2. Added player-kill detection using PlayerDeathEvent, requiring a player killer.

  3. Added direct global sound delivery to every online player, including players in other worlds and dimensions.

  4. Added safe configuration parsing and /withersound reload with withersound.admin.

  5. Added plugin metadata and default configuration.

Project structure

Plain Text
WitherSound/
├── build.gradle
├── settings.gradle
└── src/
    └── main/
        ├── java/
        │   └── com/
        │       └── kodari/
        │           └── withersound/
        │               ├── WitherSoundCommand.java
        │               └── WitherSoundPlugin.java
        └── resources/
            ├── config.yml
            └── plugin.yml

Build

From the project root:

Shell
gradle build

Generated plugin JAR:

Plain Text
build/libs/WitherSound-1.0.0.jar

Installation

  1. Build the project.

  2. Copy build/libs/WitherSound-1.0.0.jar into:

Plain Text
server/plugins/
  1. Start or restart the Paper 26.2 server.

  2. Reload configuration with:

Plain Text
/withersound reload

The reload command requires:

Plain Text
withersound.admin

Default configuration

YAML
enabled: true

sound:
  type: ENTITY_WITHER_SPAWN
  volume: 1.0
  pitch: 1.0

The listener only reacts when PlayerDeathEvent#getEntity().getKiller() returns a player. The sound is then sent individually with player.playSound(...) to every currently online player, avoiding location-based attenuation and supporting different worlds and dimensions.

gaming_aditya_

Can you make it for 1.21.11 version of minecraft

Kodari AI
KodariOct 19 at 1:36 pm 1

Updated the project for Minecraft/Paper 1.21.11: the Paper API dependency and plugin api-version now target 1.21.11, and the Java toolchain is set to Java 21. The sound behavior and reload command are unchanged.

Build with gradle build. The JAR will be at build/libs/WitherSound-1.0.0.jar; copy it into the server’s plugins/ folder.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 204
src/main/java/com/kodari/withersound/WitherSoundPlugin.java
package com.kodari.withersound;

import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Locale;

public final class WitherSoundPlugin extends JavaPlugin implements Listener {
    private static final String DEFAULT_SOUND = "minecraft:entity.wither.spawn";

    private boolean enabled;
    private String soundKey;
    private float volume;
    private float pitch;

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

        Bukkit.getPluginManager().registerEvents(this, this);

        PluginCommand command = getCommand("withersound");
        if (command == null) {
            getLogger().severe("The withersound command is missing from plugin.yml.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        WitherSoundCommand commandHandler = new WitherSoundCommand(this);
        command.setExecutor(commandHandler);
        command.setTabCompleter(commandHandler);
    }

    public void reloadSettings() {
        reloadConfig();

        enabled = getConfig().getBoolean("enabled", true);
        soundKey = resolveSoundKey(getConfig().getString("sound.type", "ENTITY_WITHER_SPAWN"));
        volume = readSoundValue("sound.volume", 1.0f, true);
        pitch = readSoundValue("sound.pitch", 1.0f, false);
    }

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        if (!enabled || event.getEntity().getKiller() == null) {
            return;
        }

        for (Player player : Bukkit.getOnlinePlayers()) {
            player.playSound(player.getLocation(), soundKey, volume, pitch);
        }
    }

    private String resolveSoundKey(String configuredSound) {
        if (configuredSound == null || configuredSound.isBlank()) {
            getLogger().warning("Invalid sound.type; using ENTITY_WITHER_SPAWN.");
            return DEFAULT_SOUND;
        }

        String normalized = configuredSound.trim().toLowerCase(Locale.ROOT);
        if (!normalized.contains(":")) {
            normalized = normalized.replace('_', '.');
        }

        NamespacedKey key = NamespacedKey.fromString(normalized);
        if (key == null || Registry.SOUNDS.get(key) == null) {
            getLogger().warning("Unknown sound.type '" + configuredSound + "'; using ENTITY_WITHER_SPAWN.");
            return DEFAULT_SOUND;
        }

        return key.toString();
    }

    private float readSoundValue(String path, float defaultValue, boolean allowZero) {
        double value = getConfig().getDouble(path, Double.NaN);
        boolean invalid = !Double.isFinite(value)
                || value > Float.MAX_VALUE
                || value < 0.0
                || (!allowZero && value == 0.0);

        if (invalid) {
            getLogger().warning("Invalid " + path + "; using " + defaultValue + ".");
            return defaultValue;
        }

        return (float) value;
    }
}