dasdfdsd
📎 1 file 35,136 chars
📄
ZendanMashhadi_EDITED_PROMPT.md
md 1874 lines
▶
You are an expert Minecraft Paper/Purpur plugin developer.

I have an existing Minecraft prison plugin named ZendanMashhadi. I want you to MODIFY AND COMPLETE the existing plugin, not create a simplified demo.

TARGET:
- Minecraft: Paper/Purpur 1.21.11
- Java: 21
- Maven
- Plugin name: ZendanMashhadi
- Main class: ir.zendanmashhadi.ZendanMashhadi
- Final JAR: ZendanMashhadi.jar
- Build command: mvn clean package

IMPORTANT:
Preserve all existing working prison functionality, but fix bugs and implement every feature below.

DO NOT REMOVE OR CHANGE ANY EXISTING FEATURE THAT IS NOT EXPLICITLY REQUESTED TO BE CHANGED BELOW.

==================================================
1. LANGUAGE
==================================================

EVERYTHING VISIBLE TO PLAYERS MUST BE IN PERSIAN.

This includes:
- NPC names
- NPC dialogue
- chat messages
- GUI titles
- item names
- item lore
- holograms
- actionbars
- bossbars
- titles
- subtitles
- error messages
- success messages
- prison messages
- escape messages
- sentence timer messages

Commands, Java class names, permissions, internal IDs and PDC keys may remain English.

Never show English NPC dialogue to players.

==================================================
2. PRISON WORLD
==================================================

Default:

prison-world: PrisonWorld
release-world: world

There are 3 cells:

Cell 1
Cell 2
Cell 3

All cells are inside PrisonWorld.

==================================================
3. CELL COMMANDS
==================================================

Keep:

/zndan cell set 1
/zndan cell set 2
/zndan cell set 3
/zndan cell setexit

Parkour setup:

/zndan cell parkour set 1
/zndan cell parkour set 2

/zndan cell parkour finish 1
/zndan cell parkour finish 2

Cell 3 has no escape parkour.

Aliases:

/zendan
/zindan

The existing commands must continue working exactly as before.

==================================================
4. HANDCUFFS
==================================================

Commands:

/zndan handcuffs
/zndan handcuff

Permission:

prison.arrest

Give exactly one custom handcuff.

Material:

IRON_BARS

Name:

§cدستبند زندان

Use a unique PersistentDataContainer ID.

Normal renamed Iron Bars must NOT work.

Only the real custom handcuff can arrest players.

Right-clicking a player with the valid handcuff arrests them.

Store:

- prisoner UUID
- prisoner name
- arresting staff UUID
- arresting staff name
- cell
- arrest timestamp
- release timestamp (ONLY starts when the correct cell guard accepts the prisoner)
- remaining sentence time
- arrested state
- handcuffed/transport state
- escaping state
- parkour state

IMPORTANT HANDCUFF DELIVERY BEHAVIOR:

When a staff member arrests a player with the valid handcuff:

- DO NOT instantly teleport the prisoner to the prison.
- The prisoner must remain connected to/follow the arresting staff member.
- The prisoner must be pulled/dragged along with the staff member during transportation.
- If the prisoner gets too far from the staff member, pull the prisoner back close to the staff member.
- The prisoner must receive the SLOW_FALLING effect while being transported.
- SLOW_FALLING is only for preventing fall damage during the transportation/follow system.
- Do NOT make the prisoner invulnerable.
- Do NOT cancel normal damage.
- Do NOT change the normal Minecraft damage system.

The prisoner must stay in this transportation state until the staff member delivers them to the correct prison guard.

==================================================
5. JAIL COMMAND
==================================================

Command:

/zndan jail   
Kodari AI
KodariSep 9 at 9:13 am 4
ZendanMashhadi
ZendanMashhadi is a comprehensive Persian-language prison management plugin for Paper/Purpur 1.21.11, featuring a persistent timestamp-based sentence system across logout, reconnect, death, and server restarts. The plugin includes a cell system with configurable sentence durations (cell 1: 25m, cell 2: 40m, cell 3: 1h20m), a handcuff arrest system where prisoners follow the arresting staff (with SLOW_FALLING during transport), and NPC guard interaction that officially starts the sentence timer. Prisoners take normal damage and die without being released. A full escape mechanic uses Persian dialogue with NPC Haji Mashhadi for a chat-driven shop, custom PDC-validated escape items (Cell 1: STRING, Cell 2: Glass+Obsidian → 60s charge → BEACON), 3-second delayed parkour teleportation, actual parkour, and final NPC releases. Centralized release method handles all outcomes, while holograms show dynamic Persian sentence timers. Anti-duplication safeguards and configurable escape settings are included.
  1. Create the Maven/Paper project metadata and Persian default configuration.

  2. Add persistent prisoner data, time/item utilities, and release reasons.

  3. Implement prison transport, timestamp-based sentences, restrictions, death/logout handling, NPCs, holograms, and commands.

  4. Implement both escape shops, PDC validation, charge timer, delayed parkour starts, parkour completion, and centralized releases.

The core project is created. I’m applying the remaining correctness fixes for guard delivery, parkour finish coordinates, safe offer-inventory handling, and prisoner restriction events.

  1. ایجاد پروژه Maven کامل برای Paper/Purpur 1.21.11 با Java 21 و خروجی ZendanMashhadi.jar.

  2. پیاده‌سازی سیستم زندان، سلول‌ها، انتقال با دستبند، دنبال‌کردن مأمور، SLOW_FALLING و تحویل فقط به نگهبان سلول صحیح.

  3. پیاده‌سازی ذخیره‌سازی data.yml، تایمر timestamp-based، توقف تایمر هنگام خروج، ادامه پس از اتصال مجدد، مرگ و ری‌استارت.

  4. پیاده‌سازی NPCهای فارسی، دیالوگ حاج مشهدی، فروشگاه سلول ۱ و ۲، آیتم‌های دارای PDC و جلوگیری از آیتم‌های جعلی.

  5. پیاده‌سازی شارژ دقیق ۶۰ ثانیه‌ای سلول ۲، ساخت یک Beacon، تأخیر ۳ ثانیه‌ای حاج رضا و سیستم پارکور.

  6. پیاده‌سازی NPC آزادی، آزادسازی مرکزی با releasePlayer(...)، دستورات uncuff و unjail، محدودیت‌های زندانی و هولوگرام تایمر فارسی.

  7. ایجاد plugin.yml و config.yml با مجوزها، aliasها، مکان‌ها و تنظیمات موردنیاز.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
15 1,261
src/main/java/ir/zendanmashhadi/ZendanMashhadi.java
package ir.zendanmashhadi;

import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class ZendanMashhadi extends JavaPlugin {
    private DataStore dataStore;
    private PrisonManager prisonManager;
    private EscapeManager escapeManager;
    private NpcManager npcManager;
    private HologramManager hologramManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        dataStore = new DataStore(this);
        dataStore.load();
        prisonManager = new PrisonManager(this);
        escapeManager = new EscapeManager(this);
        npcManager = new NpcManager(this);
        hologramManager = new HologramManager(this);
        getCommand("zndan").setExecutor(new CommandManager(this));
        getCommand("zndan").setTabCompleter(new CommandManager(this));
        Bukkit.getPluginManager().registerEvents(new PrisonListener(this), this);
        npcManager.restore();
        hologramManager.restore();
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            prisonManager.tick();
            hologramManager.update();
        }, 20L, 20L);
        for (Player player : Bukkit.getOnlinePlayers()) prisonManager.restore(player);
    }

    @Override
    public void onDisable() {
        if (prisonManager != null) prisonManager.pauseAll();
        if (escapeManager != null) escapeManager.shutdown();
        if (dataStore != null) dataStore.save();
    }

    public DataStore data() { return dataStore; }
    public PrisonManager prison() { return prisonManager; }
    public EscapeManager escape() { return escapeManager; }
    public NpcManager npcs() { return npcManager; }

    public void releasePlayer(Player player, ReleaseReason reason) {
        PrisonerData data = dataStore.get(player.getUniqueId());
        if (data == null || !data.isArrested()) return;
        escapeManager.cancel(player);
        dataStore.remove(player.getUniqueId());
        player.removePotionEffect(org.bukkit.potion.PotionEffectType.getByName("SLOW_FALLING"));
        player.setGameMode(GameMode.SURVIVAL);
        Location exit = location("locations.exit");
        if (exit != null) player.teleport(exit);
        dataStore.save();
        if (reason == ReleaseReason.PARKOUR_SUCCESS) {
            player.sendMessage("§aآفرین مشتی! آزاد شدی.");
        } else if (reason == ReleaseReason.SENTENCE_COMPLETE) {
            player.sendMessage("§aمدت محکومیتت تمام شد و آزاد شدی.");
        } else {
            player.sendMessage("§aاز زندان آزاد شدی.");
        }
    }

    public Location location(String path) {
        ConfigurationSection section = getConfig().getConfigurationSection(path);
        if (section == null || !section.contains("world")) return null;
        World world = Bukkit.getWorld(section.getString("world", ""));
        if (world == null) return null;
        return new Location(world, section.getDouble("x"), section.getDouble("y"), section.getDouble("z"),
                (float) section.getDouble("yaw"), (float) section.getDouble("pitch"));
    }

    public void setLocation(String path, Location location) {
        getConfig().set(path + ".world", location.getWorld().getName());
        getConfig().set(path + ".x", location.getX());
        getConfig().set(path + ".y", location.getY());
        getConfig().set(path + ".z", location.getZ());
        getConfig().set(path + ".yaw", location.getYaw());
        getConfig().set(path + ".pitch", location.getPitch());
        saveConfig();
    }
}