ziemniak0378

Project: Persistent Fishing Hook Plugin for Minecraft 1.21.11 (PaperMC)

"I need a Java plugin for a PaperMC server running version 1.21.11. The goal is to make a 'Fishing Rod Stasis' work, where the fishing hook stays on a pressure plate even when the player changes dimensions (Overworld to Nether/End) or disconnects.

Requirements for the AI:

Target API: Use Paper-API for version 1.21.11.

Core Logic: - Intercept the EntityRemoveEvent or ProjectileHitEvent.

If the entity is a FishingBobber, prevent it from being removed when its owner (the player) changes worlds or logs out.

Set the Fishing Hook to be persistent: entity.setPersistent(true) and entity.setRemoveWhenFarAway(false).

Chunk Loading Support: Ensure the hook doesn't glitch out when the chunk is ticked by a Chunk Loader.

Metadata: Tag the hook so the server knows it's a 'Stasis Hook' and shouldn't be cleaned up by Paper's optimization tasks.

Output: Provide the full Main.java code and a plugin.yml file."

Kodari AI
KodariMar 30 at 4:38 pm 11,600 (v2)

I’ll create a fishing rod stasis plugin that keeps fishing hooks persistent across dimension changes and player disconnects.

FishingStasis
A PaperMC plugin that makes fishing hooks persistent across dimension changes and player disconnects. When a fishing hook lands on a pressure plate, it becomes a stasis hook that won't be removed when the player changes worlds or logs out, enabling fishing rod stasis mechanics and redstone contraptions.

Plugin Created Successfully!

I’ve created a complete fishing rod stasis plugin for PaperMC 1.21.11 with the following features:

Core Functionality:

  • Fishing hooks become “stasis hooks” when they hit a pressure plate

  • Stasis hooks persist when players change dimensions (Overworld ↔ Nether/End)

  • Hooks remain when players disconnect

  • Uses setPersistent(true) and setRemoveWhenFarAway(false)

  • Tagged with PersistentDataContainer metadata

  • Cancels EntityRemoveEvent to prevent Paper’s cleanup

Configuration Options (config.yml):

  • require-pressure-plate: true/false - hooks must hit pressure plate to become stasis hooks

  • auto-persist-all-hooks: false/true - automatically persist all fishing hooks

  • max-stasis-hooks-per-player: 5 - limit hooks per player

  • enable-chunk-loading-protection: true - validates hooks when chunks load

  • debug-mode: false - enable detailed logging

Commands:

  • /fishingstasis - Show plugin info and active hook count

  • /fishingstasis reload - Reload configuration

Permissions:

  • fishingstasis.use - Create stasis hooks (default: true)

  • fishingstasis.admin - Use admin commands (default: op)

How It Works:

  1. Player casts fishing rod

  2. Hook lands on any pressure plate (stone, wood, weighted)

  3. Hook becomes persistent with confirmation message

  4. Player can change dimensions or disconnect

  5. Hook remains in the world on the pressure plate

  6. Works with chunk loaders - hooks stay valid when chunks reload

The plugin uses Paper’s EntityRemoveEvent to prevent automatic cleanup and XSeries for cross-version material compatibility.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
6 335
src/main/java/com/fishingstasis/FishingStasisPlugin.java
package com.fishingstasis;

import com.fishingstasis.listener.FishingHookListener;
import com.fishingstasis.manager.HookManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class FishingStasisPlugin extends JavaPlugin {
    private HookManager hookManager;
    private NamespacedKey stasisKey;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.stasisKey = new NamespacedKey(this, "stasis_hook");
        this.hookManager = new HookManager(this);
        
        Bukkit.getPluginManager().registerEvents(new FishingHookListener(this), this);
        
        getLogger().info("FishingStasis enabled! Persistent hooks are now active.");
    }
    
    @Override
    public void onDisable() {
        if (hookManager != null) {
            hookManager.cleanup();
        }
        getLogger().info("FishingStasis disabled.");
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("fishingstasis")) {
            if (!sender.hasPermission("fishingstasis.admin")) {
                sender.sendMessage("§cYou don't have permission to use this command.");
                return true;
            }
            
            if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
                reloadConfig();
                sender.sendMessage("§aFishingStasis configuration reloaded!");
                return true;
            }
            
            sender.sendMessage("§e=== FishingStasis ===");
            sender.sendMessage("§7/fishingstasis reload - Reload configuration");
            sender.sendMessage("§7Active stasis hooks: §e" + hookManager.getActiveHookCount());
            return true;
        }
        return false;
    }
    
    public boolean isDebugMode() {
        return getConfig().getBoolean("debug-mode", false);
    }
    
    public void debug(String message) {
        if (isDebugMode()) {
            getLogger().info("[DEBUG] " + message);
        }
    }
}