mableleave96

make a plugin you activate with /start (need op) will deop everyone and then give every player fishing rods of players (exept him self). all the fishing rods have the same name as players and when a player leaves they will disspear and will appere when player joins. the fishing rod is pulled it will give the player with the same name demage until the fishing rod is pulled again or the player dies. also please make it for 26.2 for paper

Kodari AI
KodariAug 31 at 12:42 pm 1
FishingRodAssassin
FishingRodAssassin is a Paper plugin for Minecraft 26.2 that activates with /start (OP-only). Upon activation, it deops all players and distributes custom fishing rods to every player, each rod named after another player (excluding the holder). Rods dynamically appear/disappear as players join/leave the server. When a player reels in their rod, the targeted player (whose name is on the rod) takes damage. The damage effect persists until the rod is reeled again or the target dies. The plugin manages rod inventories, tracks player connections, and handles damage application seamlessly.
  1. Create a Paper plugin project targeting the current Paper API line compatible with the requested gameplay.

  2. Implement /start with operator authorization, global de-op, rod synchronization on joins/leaves, and target metadata.

  3. Implement reel-to-toggle damage sessions that stop on the next reel, death, quit, or plugin shutdown.

Created the Paper plugin with:

  • /start, restricted to operators.

  • De-ops every online player when activated.

  • Gives each player one named fishing rod for every other online player.

  • Removes a player’s rods when that target leaves.

  • Restores rods when players join.

  • Reeling toggles damage against the named target.

  • Damage stops when reeled again, the attacker/target dies, leaves, or the plugin disables.

  • Added Gradle build files and plugin.yml.

The project currently targets Paper API 1.21.4; Paper 26.2 is not a published API coordinate available to configure reliably.

mableleave96

can you add /fishstop so it stops

Kodari AI
KodariAug 31 at 12:52 pm 1
  1. Add an operator-only /fishstop command that disables the active fishing game, stops damage sessions, and removes the custom rods.

Added /fishstop.

  • Operator-only via playerfishingrods.stop

  • Stops all active damage sessions

  • Removes all custom fishing rods

  • Disables the fishing rod system until /start is used again

mableleave96

also can you add /fishall where it gives everyone exept the player using it a fishing rod with a name of the player executing it

Kodari AI
KodariAug 31 at 12:55 pm 1
  1. Add /fishall as an active-game command usable by any player.

  2. Give every other online player a fishing rod targeting the command sender and register the command in plugin.yml.

Added /fishall.

  • Only works while the fishing rod system is active.

  • Gives every other online player a rod named after the command sender.

  • The command sender does not receive a rod.

  • Registered in plugin.yml.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 377
src/main/java/com/kodari/playerfishingrods/PlayerFishingRodsPlugin.java
package com.kodari.playerfishingrods;

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

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

public final class PlayerFishingRodsPlugin extends JavaPlugin implements Listener {

    private static final double DAMAGE_PER_HIT = 1.0D;
    private static final long DAMAGE_PERIOD_TICKS = 20L;

    private final Map<UUID, Attack> attacks = new HashMap<>();
    private NamespacedKey targetKey;
    private Material fishingRodMaterial;
    private boolean started;

    @Override
    public void onEnable() {
        targetKey = new NamespacedKey(this, "target-player");
        fishingRodMaterial = Material.matchMaterial("FISHING_ROD");
        if (fishingRodMaterial == null) {
            getLogger().severe("FISHING_ROD is not available on this server version.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getServer().getPluginManager().registerEvents(this, this);
        if (getCommand("start") != null) {
            getCommand("start").setExecutor((sender, command, label, args) -> {
                if (!(sender instanceof Player player)) {
                    sender.sendMessage(ChatColor.RED + "Only a player can use this command.");
                    return true;
                }
                if (!player.isOp()) {
                    player.sendMessage(ChatColor.RED + "You must be an operator to use this command.");
                    return true;
                }
                if (started) {
                    player.sendMessage(ChatColor.YELLOW + "The player fishing rod system is already active.");
                    return true;
                }

                started = true;
                for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
                    onlinePlayer.setOp(false);
                }
                synchronizeRods();
                player.sendMessage(ChatColor.GREEN + "Player fishing rods activated.");
                return true;
            });
        }
        if (getCommand("fishstop") != null) {
            getCommand("fishstop").setExecutor((sender, command, label, args) -> {
                if (!sender.hasPermission("playerfishingrods.stop")) {
                    sender.sendMessage(ChatColor.RED + "You must be an operator to use this command.");
                    return true;
                }
                if (!started) {
                    sender.sendMessage(ChatColor.YELLOW + "The player fishing rod system is not active.");
                    return true;
                }

                started = false;
                for (UUID attackerId : new ArrayList<>(attacks.keySet())) {
                    stopAttack(attackerId);
                }
                for (Player player : Bukkit.getOnlinePlayers()) {
                    removeAllPluginRods(player.getInventory());
                }
                sender.sendMessage(ChatColor.GREEN + "Player fishing rods stopped.");
                return true;
            });
        }
        if (getCommand("fishall") != null) {
            getCommand("fishall").setExecutor((sender, command, label, args) -> {
                if (!(sender instanceof Player player)) {
                    sender.sendMessage(ChatColor.RED + "Only a player can use this command.");
                    return true;
                }
                if (!started) {
                    player.sendMessage(ChatColor.YELLOW + "The player fishing rod system is not active.");
                    return true;
                }

                for (Player recipient : Bukkit.getOnlinePlayers()) {
                    if (!recipient.getUniqueId().equals(player.getUniqueId())) {
                        giveRod(recipient, player);
                    }
                }
                player.sendMessage(ChatColor.GREEN + "Everyone else received a fishing rod targeting you.");
                return true;
            });
        }
    }

    @Override
    public void onDisable() {
        for (Attack attack : attacks.values()) {
            if (attack.task != null) {
                attack.task.cancel();
            }
        }
        attacks.clear();
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        if (!started) {
            return;
        }

        Bukkit.getScheduler().runTask(this, this::synchronizeRods);
    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
        UUID playerId = event.getPlayer().getUniqueId();
        stopAttacksInvolving(playerId);
        if (!started) {
            return;
        }

        for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
            removeRodsFor(onlinePlayer.getInventory(), playerId);
        }
    }

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        stopAttacksInvolving(event.getEntity().getUniqueId());
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (!(event.getWhoClicked() instanceof Player player) || !started) {
            return;
        }

        Bukkit.getScheduler().runTask(this, () -> removeInvalidRods(player));
    }

    @EventHandler
    public void onPlayerFish(PlayerFishEvent event) {
        if (!started || event.getState() != PlayerFishEvent.State.REEL_IN) {
            return;
        }

        Player attacker = event.getPlayer();
        UUID attackerId = attacker.getUniqueId();
        Attack activeAttack = attacks.get(attackerId);
        if (activeAttack != null) {
            stopAttack(attackerId);
            return;
        }

        UUID targetId = getTargetId(attacker.getInventory().getItemInMainHand());
        if (targetId == null || targetId.equals(attackerId)) {
            return;
        }

        Player target = Bukkit.getPlayer(targetId);
        if (target == null || !target.isOnline() || target.isDead()) {
            return;
        }

        Attack attack = new Attack(targetId);
        attacks.put(attackerId, attack);
        target.damage(DAMAGE_PER_HIT, attacker);

        if (attacks.get(attackerId) != attack || target.isDead()) {
            stopAttack(attackerId);
            return;
        }

        attack.task = Bukkit.getScheduler().runTaskTimer(this,
                () -> applyDamage(attackerId), DAMAGE_PERIOD_TICKS, DAMAGE_PERIOD_TICKS);
    }