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.
- IMMEDIATELY apply the real Minecraft `SLOW_FALLING` potion effect to the handcuffed prisoner.
- The `SLOW_FALLING` effect MUST actually be active on the prisoner while they are handcuffed and being transported.
- Keep `SLOW_FALLING` active throughout the entire handcuff transportation/follow state.
- `SLOW_FALLING` is only for preventing fall damage during the transportation/follow system.
- When the correct Cell Guard accepts the prisoner, stop the transportation state and remove ONLY the `SLOW_FALLING` effect added by this plugin.
- 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
Example:
/zndan jail Steve 1 25m
Also:
/zndan jail info
Default sentences:
Cell 1 = 25m
Cell 2 = 40m
Cell 3 = 1h20m
Use timestamp-based sentences.
DO NOT use a timer that resets when the server restarts.
IMPORTANT:
For the normal handcuff → Cell Guard delivery flow, the sentence timestamp MUST be created at the exact moment the correct Cell Guard accepts the prisoner.
Do NOT start the 25m / 40m / 1h20m sentence at the moment of arrest.
Store:
releaseTimestamp
remainingSentenceMillis
Calculate remaining time while the prisoner is online from:
releaseTimestamp - System.currentTimeMillis()
IMPORTANT ONLINE REQUIREMENT:
After the correct Cell Guard accepts the prisoner, the prisoner MUST remain online for the sentence timer to count down and finish.
If the prisoner logs out:
- DO NOT release the prisoner.
- DO NOT reset the sentence.
- Pause the sentence countdown at the exact remaining time.
- Store the remaining sentence time.
- Do not allow the player to complete the sentence while offline.
When the prisoner reconnects:
- restore the prisoner state.
- restore the assigned cell.
- restore restrictions.
- resume the sentence countdown from the stored remaining time.
- create a new releaseTimestamp based on the remaining time.
The sentence must survive:
- logout
- reconnect
- death
- server restart
The timer must NEVER reset to the original 25m / 40m / 1h20m after logout or restart.
When the sentence reaches zero while the prisoner is ONLINE:
- release player
- clear prison data
- clear escape state
- clear parkour state
- restore SURVIVAL
- remove restrictions
- teleport to configured exit
The sentence duration must remain configurable per cell.
==================================================
6. CRITICAL DAMAGE FIX
==================================================
THIS IS VERY IMPORTANT.
PRISONERS MUST TAKE NORMAL DAMAGE.
Do NOT give prisoners God Mode.
Do NOT cancel every EntityDamageEvent for prisoners.
Prisoners MUST receive:
- PvP damage
- fall damage
- fire damage
- lava damage
- drowning
- suffocation
- mob damage
- projectile damage
- explosion damage
- void damage
- all normal Minecraft damage
Never globally cancel damage just because the player is jailed.
EXCEPTION:
During handcuff transportation only, SLOW_FALLING may be applied to prevent accidental fall damage caused by the transportation/follow movement.
Do not cancel fall damage globally.
==================================================
7. DEATH
==================================================
If a prisoner dies:
- DO NOT release them
- keep their sentence
- keep their prisoner data
- keep their cell
- keep them jailed
After respawn:
- return them to their assigned cell
- restore prison restrictions
- continue their original sentence
If they die while doing parkour and:
escape.failure-on-death = true
then:
- add the configured failure penalty
- cancel parkour
- set escaping=false
- set parkour=false
- set parkourFinished=false
- return them to their original cell
Default penalty:
5m
IMPORTANT:
Death must NEVER allow a prisoner to escape the prison.
The player's original assigned cell must be remembered.
If the prisoner dies during parkour:
Death
→ Respawn
→ Return to ORIGINAL ASSIGNED CELL
→ Continue remaining sentence
Do not reset the sentence.
Do not release the player.
==================================================
8. LOGOUT / RECONNECT
==================================================
Logout must NOT release prisoners.
When a prisoner reconnects:
- restore prisoner state
- restore Adventure mode
- restore restrictions
- teleport them to their assigned cell
- restore the exact remaining sentence time that was saved when they disconnected
- resume the timestamp-based sentence countdown
- do NOT give the player a fresh 25m / 40m / 1h20m sentence
IMPORTANT:
The prisoner must be ONLINE for the sentence timer to continue counting down.
If the prisoner logs out before the sentence ends:
- they remain jailed.
- they are NOT released.
- the sentence countdown is paused.
- the exact remaining time is saved.
- the sentence resumes only after reconnecting.
If the player was in parkour when they disconnected, they must remain a prisoner and must not be released.
A disconnected prisoner must never receive an automatic sentence-complete release while offline.
==================================================
9. PRISON RESTRICTIONS
==================================================
Prisoners cannot:
- use /spawn
- use /home
- use /tpa
- use teleport commands
- use portals
- use Ender Pearls
- use Chorus Fruit
- use beds
- use vehicles
- drop items
- pickup items
- break blocks
- place blocks
- use forbidden interactions
- manipulate inventory to bypass restrictions
- sneak
- sprint
- escape through teleport exploits
Default prisoner mode:
ADVENTURE
Players with:
prison.bypass
bypass prisoner restrictions.
==================================================
10. FOLLOW SYSTEM
==================================================
The arresting staff member must be followed during prisoner delivery.
Default:
follow.maximum-distance: 12.0
When the prisoner is handcuffed:
- Do not teleport them directly to prison.
- The prisoner must follow the arresting staff member.
- The prisoner must be kept within the configured maximum distance.
- If they move farther than the configured distance, pull/return them near the arresting staff member.
- Apply SLOW_FALLING during transportation.
- The follow system must remain active until the prisoner is successfully delivered to the correct prison guard.
- Do not automatically complete delivery when the staff member reaches the prison.
The transportation ends ONLY after the correct prison guard accepts the prisoner.
==================================================
11. CELL GUARD NPCS
==================================================
Commands:
/zndan npc villager 1
/zndan npc villager 2
/zndan npc villager 3
Names:
نگهبان سلول ۱
نگهبان سلول ۲
نگهبان سلول ۳
NPC locations must persist after restart.
The Cell Guard NPCs must actually exist in the configured PrisonWorld locations whenever the server is running.
The three Cell Guard NPCs are persistent prison infrastructure:
- نگهبان سلول ۱
- نگهبان سلول ۲
- نگهبان سلول ۳
They must be restored/recreated safely after server restart if necessary.
IMPORTANT SENTENCE ASSOCIATION:
Each guard is permanently associated with one cell:
نگهبان سلول ۱ → Cell 1 → 25 minutes
نگهبان سلول ۲ → Cell 2 → 40 minutes
نگهبان سلول ۳ → Cell 3 → 1 hour 20 minutes
The guard does NOT have a countdown of its own. The guard starts the prisoner's sentence when it accepts that prisoner.
IMPORTANT DELIVERY BEHAVIOR:
The staff member must physically bring the handcuffed prisoner to the prison.
When they reach the prison:
DO NOT automatically put the prisoner inside the cell.
The staff member MUST click the correct guard NPC to complete the delivery.
Example:
Cell 1 prisoner → نگهبان سلول ۱
Cell 2 prisoner → نگهبان سلول ۲
Cell 3 prisoner → نگهبان سلول ۳
Only after the staff member/player physically CLICKS the correct Villager Cell Guard:
- accept the prisoner
- end the follow/transportation state
- stop the handcuff transportation
- remove the `SLOW_FALLING` effect added by the plugin
- assign the prisoner to the correct cell
- teleport the prisoner to that cell
- START THE SENTENCE TIMER AT THIS EXACT MOMENT
CRITICAL: Reaching `PrisonWorld`, reaching the guard's location, or getting close to the guard MUST NOT jail the prisoner automatically.
The prisoner enters the prison ONLY when the correct Villager Cell Guard is actually clicked.
- set the sentence duration according to the assigned cell
- create releaseTimestamp = current time + configured sentence duration
- save the sentence start/release timestamp
- begin the countdown
IMPORTANT:
The guard acceptance event is the official sentence start event.
Cell 1 guard acceptance:
→ 25 minutes
Cell 2 guard acceptance:
→ 40 minutes
Cell 3 guard acceptance:
→ 1 hour 20 minutes
The timer must NOT have been counting down during handcuff transportation.
The prisoner must remain online for this timer to finish.
If the prisoner disconnects, pause the countdown and save the exact remaining time.
If the wrong guard is clicked:
- do NOT accept the prisoner
- do NOT put them in the cell
- do NOT complete delivery
- show a Persian message explaining that the prisoner must be delivered to the correct guard.
IMPORTANT:
Until the correct guard is clicked, do not advance the prison process.
Do not automatically teleport the prisoner to a cell.
Do not automatically start parkour.
Do not release the prisoner.
Do not interact with other NPC systems.
==================================================
12. HAJI MASHHADI
==================================================
Commands:
/zndan shop cell 1
/zndan shop cell 2
Create Haji Mashhadi NPCs for Cell 1 and Cell 2.
NPC name:
حاج مشهدی
Cell 3 has NO escape system.
==================================================
13. HAJI MASHHADI & HAJI REZA DIALOGUES
==================================================
The escape NPC dialogue must be fully Persian and cell-specific.
HAJI MASHHADI:
The dialogue must change depending on the prisoner's assigned cell.
------------------------------------------
CELL 1 — HAJI MASHHADI
------------------------------------------
When a Cell 1 prisoner talks to Haji Mashhadi:
§eحاج مشهدی§f: اِ اِ... تو اینجا چی کار میکنی جوون؟
§eحاج مشهدی§f: میبینم که افتادی تو سلول اول...
§eحاج مشهدی§f: ولی نگران نباش، شاید یه راه کوچیک برای فرار داشته باشم. 😉
§eحاج مشهدی§f: یه چیزی دارم به اسم §aنخ فرار§f.
§eحاج مشهدی§f: قیمتش فقط §b۲ الماس§fه.
If the player has enough diamonds:
§eحاج مشهدی§f: خب جوون، اگه §b۲ الماس§f داری معامله کنیم.
After successful purchase:
§eحاج مشهدی§f: آفرین... این نخ رو خوب نگه دار.
§eحاج مشهدی§f: نذار دست نگهبانا بیفته!
§eحاج مشهدی§f: حالا برو پیش §eحاج رضا§f.
§eحاج مشهدی§f: اون میدونه با این سوغات من باید چیکار کنه. 😏
If the player does not have enough diamonds:
§eحاج مشهدی§f: الماس کم داری جوون!
§eحاج مشهدی§f: برو §b۲ الماس§f جور کن، بعد بیا پیش خودم.
If the player already owns the valid Cell 1 escape item:
§eحاج مشهدی§f: نخ فرار رو که داری جوون!
§eحاج مشهدی§f: دیگه یکی دیگه لازم نداری، برو پیش §eحاج رضا§f.
------------------------------------------
CELL 2 — HAJI MASHHADI
------------------------------------------
When a Cell 2 prisoner talks to Haji Mashhadi:
§eحاج مشهدی§f: اوه اوه... سلول دومی؟
§eحاج مشهدی§f: اینجا دیگه کار با نخ و این چیزا راه نمیفته.
§eحاج مشهدی§f: برای این فرار، یه مقدار §fشیشه§f و §8آبسیدین§f مخصوص لازم داری.
§eحاج مشهدی§f: شیشه باید تو دست اصلیت باشه.
§eحاج مشهدی§f: آبسیدین هم باید تو دست چپت باشه.
§eحاج مشهدی§f: وقتی هر دوتاش آماده بود، باید §e۳۰ ثانیه§f صبر کنی.
§eحاج مشهدی§f: اگه وسط کار کسی مزاحمت بشه، همه چی خراب میشه!
When the player has the required Cell 2 items:
§eحاج مشهدی§f: بهبه... میبینم که وسایل رو جور کردی.
§eحاج مشهدی§f: حالا آمادهای برای شروع؟
After the Cell 2 charge successfully finishes:
§eحاج مشهدی§f: آفرین جوون! کار تموم شد.
§eحاج مشهدی§f: این بیکن رو ببر پیش §eحاج رضا§f.
§eحاج مشهدی§f: اون منتظر همین سوغات منه. 😉
If the player does not have the required items:
§eحاج مشهدی§f: هنوز وسایل کامل نیست جوون.
§eحاج مشهدی§f: اول شیشه و آبسیدین مخصوص رو جور کن.
------------------------------------------
CELL 3 — HAJI MASHHADI
------------------------------------------
Cell 3 does not have the Cell 1 or Cell 2 escape item system unless explicitly configured.
If a Cell 3 prisoner talks to Haji Mashhadi:
§eحاج مشهدی§f: سلول سومی؟!
§eحاج مشهدی§f: جوون، اینجا دیگه فرار کردن شوخیبردار نیست.
§eحاج مشهدی§f: فعلاً چیزی برای فروش بهت ندارم.
==================================================
HAJI REZA
==================================================
Haji Reza must also use Persian dialogue.
Haji Reza checks the prisoner's cell and the required escape item.
------------------------------------------
CELL 1 — HAJI REZA
------------------------------------------
If Cell 1 prisoner does NOT have the valid Cell 1 escape item:
§eحاج رضا§f: حاج مشهدی چیزی برات نفرستاده جوون.
§eحاج رضا§f: اول سوغاتش رو بیار، بعد با هم صحبت میکنیم.
Do NOT start the escape.
If Cell 1 prisoner has the valid Cell 1 escape item:
§eحاج رضا§f: هان... پس این همون چیزیه که حاج مشهدی گفت.
§eحاج رضا§f: خوبه، یعنی حاج مشهدی بهت اعتماد کرده.
§eحاج رضا§f: اینو بده به من.
The valid escape item is consumed/removed exactly once.
Then:
§eحاج رضا§f: حالا آمادهای؟
§eحاج رضا§f: §eبریم انجامش
After this message:
WAIT EXACTLY 3 SECONDS.
Then teleport the player to the configured parkour location.
Do NOT teleport immediately.
------------------------------------------
CELL 2 — HAJI REZA
------------------------------------------
If Cell 2 prisoner does NOT have the valid Cell 2 escape item/result:
§eحاج رضا§f: هنوز سوغات حاج مشهدی رو نیاوردی.
§eحاج رضا§f: بدون اون نمیتونیم کاری کنیم.
Do NOT start the escape.
If Cell 2 prisoner has the valid custom Beacon produced by the Cell 2 escape process:
§eحاج رضا§f: بهبه... پس بالاخره آماده شد.
§eحاج رضا§f: این همون چیزیه که حاج مشهدی منتظرش بود.
§eحاج رضا§f: حالا دیگه وقتشه.
Then:
§eحاج رضا§f: حواست باشه نگهبانا چیزی نفهمن!
§eحاج رضا§f: §eبریم انجامش
After this message:
WAIT EXACTLY 3 SECONDS.
Then teleport the player to the configured parkour location.
Consume/remove the valid escape item exactly once if the intended escape flow requires consumption.
------------------------------------------
INVALID / INTERRUPTED ESCAPE
------------------------------------------
If the required item becomes invalid before the action completes:
§eحاج رضا§f: وایسا جوون! یه چیزی درست نیست.
§eحاج رضا§f: فعلاً بیخیالش شو و دوباره آماده شو.
Cancel the escape operation.
If the player dies:
§eحاج رضا§f: ...
Cancel the pending action.
If the player logs out:
Cancel the pending action.
If the player is released:
Cancel the pending action.
If the player is no longer jailed:
Cancel the pending action.
==================================================
IMPORTANT DIALOGUE LOGIC
==================================================
Do not show Cell 1 dialogue to Cell 2 prisoners.
Do not show Cell 2 dialogue to Cell 1 prisoners.
Do not allow a Cell 1 item to work for Cell 2.
Do not allow a Cell 2 item to work for Cell 1.
All escape items must be validated using their PDC identifiers and cell ID.
NPC dialogue must not itself create duplicate items.
Purchasing an item must be atomic:
- check payment
- remove payment
- give item
- save state
Prevent double-click and repeated interaction from giving duplicate rewards.
Haji Reza must never start multiple 3-second teleport tasks for the same player.
There must be a maximum of ONE active delayed Haji Reza task per player.
The exact required message before the 3-second delay is:
§eحاج رضا§f: §eبریم انجامش
The teleport must happen exactly 3 seconds after that action.
==================================================
18. CELL 2 ESCAPE SHOP
==================================================
Cell 2 Haji Mashhadi uses the SAME dialogue.
After dialogue is completed, open Cell 2 shop.
Cell 2 requires TWO items.
ITEM 1:
Material:
GLASS
Name:
§aشیشه فرار
Price:
1 OBSIDIAN
Internal ID:
cell2_escape_glass
ITEM 2:
Material:
OBSIDIAN
Name:
§5آبسیدین فرار
Price:
1 DIAMOND
Internal ID:
cell2_escape_obsidian
Both items must have PDC.
Normal Glass and normal Obsidian must NOT work.
Renamed normal items must NOT work.
==================================================
19. CELL 2 HAND SYSTEM
==================================================
The player must hold the two correct Cell 2 items.
One item must be in MAIN HAND.
The other item must be in OFFHAND.
Use an exact configured requirement.
Example:
MAIN HAND:
شیشه فرار
OFFHAND:
آبسیدین فرار
The plugin must verify:
- PDC
- item ID
- cell ID
- exact hand
- player is Cell 2 prisoner
==================================================
20. CELL 2 CHARGE TIMER
==================================================
To activate Cell 2 escape charging:
Player must:
1. hold the correct two items
2. hold SHIFT
3. right-click
4. keep holding the required interaction
Start a 60-second timer.
Required time:
60 seconds
Actionbar:
§eدر حال آمادهسازی فرار... §f{remaining} ثانیه
The timer must NOT complete instantly.
The timer must reset/cancel if:
- SHIFT is released
- right-click interaction stops
- main hand item changes
- offhand item changes
- item is removed
- item is swapped
- player dies
- player logs out
- player changes escape state
- player is released
- player leaves the valid state
Do not allow exploits.
==================================================
21. CELL 2 ITEM CONVERSION
==================================================
After exactly 30 seconds:
Convert the two source items into ONE:
بیکن فرار سلول ۲
Material:
BEACON
Name:
§aبیکن فرار سلول ۲
PDC:
escape_beacon
cell=2
Remove both source items.
Give exactly ONE Beacon.
Prevent duplication.
==================================================
22. CELL 2 HAJI REZA
==================================================
Create another Haji Reza NPC for Cell 2.
When the prisoner clicks Cell 2 Haji Reza:
Open a GUI.
The player puts:
بیکن فرار سلول ۲
into the GUI.
Validate:
- PDC
- escape_beacon
- cell=2
- prisoner is Cell 2
- player is still jailed
- player has not already started parkour
If correct:
- remove Beacon
- mark escaping=true
- mark parkour=true
Then send:
§eحاج رضا§f: بریم انجامش
After this message:
WAIT EXACTLY 3 SECONDS.
After exactly 3 seconds:
- teleport to Cell 2 parkour start
- start Cell 2 parkour
DO NOT teleport immediately.
Prevent duplicate submissions and duplicate delayed tasks.
The Cell 2 Beacon must ONLY be accepted by the correct Cell 2 Haji Reza.
==================================================
23. CELL 2 PARKOUR
==================================================
Setup:
/zndan cell parkour set 2
/zndan cell parkour finish 2
Player must complete the parkour.
Cell 2 must use its own configured parkour location.
At the finish:
parkourFinished=true
Player must then click the final NPC.
Only then release.
Use:
releasePlayer(player, ReleaseReason.PARKOUR_SUCCESS)
==================================================
24. FINAL RELEASE NPC — آزادی
==================================================
Create final release NPCs for the configured cells.
The final NPC must be a Villager NPC named exactly:
آزادی
Setup commands:
/zndan npc final 1
/zndan npc final 2
The final NPC is cell-specific.
CRITICAL FINAL BEHAVIOR:
When a jailed player clicks the CORRECT `آزادی` NPC for their assigned cell:
-> RELEASE THE PLAYER IMMEDIATELY.
IMPORTANT:
Do NOT require:
- parkourFinished=true
- reaching the parkour finish
- completing the parkour
- any parkour completion flag
The correct `آزادی` NPC itself is enough to trigger the final release.
The player must still:
- be currently jailed
- match the NPC's configured cell
If the clicked `آزادی` NPC belongs to another cell:
-> DO NOT release.
Do NOT teleport.
Do NOT clear jail state.
Do NOT clear sentence state.
Do NOT call releasePlayer.
For the correct cell, immediately call:
releasePlayer(player, ReleaseReason.PARKOUR_SUCCESS)
Then:
- clear prisoner data
- clear escape state
- clear parkour state
- clear parkourFinished
- restore SURVIVAL
- remove prison restrictions
- cancel active prison/escape tasks
- remove BossBar if present
- remove plugin-added Slow Falling if present
- teleport to the configured RELEASE / EXIT location
- save data
Send:
§aآفرین مشتی! آزاد شدی.
CRITICAL:
The final NPC must NOT use `parkourFinished` as a release requirement.
==================================================
25. CENTRAL RELEASE METHOD
==================================================
There MUST be one central method:
releasePlayer(Player player, ReleaseReason reason)
Use this for ALL releases:
- sentence completed
- /zndan uncuff
- /zndan unhandcuff
- /zndan unjail
- admin release
- Cell 1 parkour success
- Cell 2 parkour success
When releasing:
1. clear prisoner data
2. arrested=false
3. escaping=false
4. parkour=false
5. parkourFinished=false
6. clear pending escape items/state
7. cancel active timers/tasks
8. restore SURVIVAL
9. remove restrictions
10. teleport to configured release location
11. save data
IMPORTANT:
The configured release location is the single location used for normal sentence completion and successful parkour release.
==================================================
26. UNCuff COMMAND
==================================================
Add:
/zndan uncuff
/zndan unhandcuff
Permission:
prison.arrest
This MUST actually release the prisoner.
It must NOT only remove a visual handcuff.
Use:
releasePlayer(player, ReleaseReason.ADMIN_UNCUFF)
After command:
- player is no longer jailed
- Survival
- restrictions removed
- escape state removed
- parkour state removed
- teleport to exit
- prisoner data cleared
==================================================
27. UNJAIL
==================================================
Keep:
/zndan unjail
Use the same centralized release method.
==================================================
28. DATA STORAGE
==================================================
Use:
plugins/ZendanMashhadi/data.yml
Persist:
UUID
name
cell
arrestTimestamp
releaseTimestamp
arrested
escaping
parkour
parkourFinished
arrestingStaffUUID
arrestingStaffName
Persist required escape state where needed to prevent exploits.
Data must survive:
- restart
- logout
- reconnect
- death
The assigned cell must always remain associated with the prisoner until release.
==================================================
29. HOLOGRAMS
==================================================
Keep dynamic prison holograms.
Add/maintain a dynamic Persian sentence timer for each occupied prison cell.
Example:
§6زندان مشهدی
§eسلول ۱
§fزمان باقیمانده: ۲۴ دقیقه
The hologram must show the REAL remaining sentence based on:
releaseTimestamp - System.currentTimeMillis()
It must update dynamically.
The timer must NOT reset after restart, logout, reconnect or death.
The displayed remaining time must be understandable in Persian.
For example:
§fزمان باقیمانده: ۲۴ دقیقه و ۱۵ ثانیه
or when appropriate:
§fزمان باقیمانده: ۱ ساعت و ۲۰ دقیقه
When the sentence ends, release the player.
==================================================
30. ANTI DUPLICATION
==================================================
Prevent:
- GUI duplication
- shift-click duplication
- drag duplication
- hopper duplication
- death duplication
- logout duplication
- restart duplication
- reconnect duplication
- item swapping during timer
- moving items while GUI is processing
- taking items out incorrectly
- giving escape item to another player
- reusing escape item after successful submission
- submitting the same Haji Reza item multiple times during the 3-second delay
- creating multiple parkour teleport tasks
Custom items MUST be PDC validated.
Never trust only:
- material
- display name
- lore
==================================================
31. PARKOUR ANTI-EXPLOIT
==================================================
A player cannot finish parkour unless they actually started the correct parkour.
IMPORTANT FINAL-NPC RULE:
A player MAY click the correct final NPC `آزادی` before reaching the parkour
finish, and the correct-cell Freedom NPC MUST release them immediately.
`parkourFinished` is NOT a requirement for the final release.
A Cell 1 player cannot use Cell 2 parkour.
A Cell 2 player cannot use Cell 1 parkour.
A released player cannot use old escape items to start parkour.
If a player dies during parkour:
- cancel the parkour attempt
- return them to their original assigned cell after respawn
- keep them jailed
- keep the remaining sentence
- apply the configured death penalty if enabled
==================================================
32. CONFIGURATION
==================================================
Create a clean config.yml:
prison-world: PrisonWorld
release-world: world
follow:
maximum-distance: 12.0
cells:
1:
sentence: 25m
2:
sentence: 40m
3:
sentence: 1h20m
escape:
failure-penalty: 5m
failure-on-death: true
keyword: فرار
cell1:
item-id: cell1_escape_thread
material: STRING
name: "§aنخ فرار"
diamond-price: 2
cell2:
charge-time: 30s
glass:
item-id: cell2_escape_glass
material: GLASS
name: "§aشیشه فرار"
obsidian-price: 1
obsidian:
item-id: cell2_escape_obsidian
material: OBSIDIAN
name: "§5آبسیدین فرار"
diamond-price: 1
beacon:
item-id: cell2_escape_beacon
material: BEACON
name: "§aبیکن فرار سلول ۲"
locations:
cells:
1: {}
2: {}
3: {}
exit: {}
parkour:
1: {}
2: {}
haji:
cell1: {}
cell2: {}
haji-reza:
cell1: {}
cell2: {}
final:
cell1: {}
cell2: {}
Do not remove existing configuration keys.
Only add required keys.
==================================================
33. NPC COMMANDS
==================================================
Keep:
/zndan npc villager 1
/zndan npc villager 2
/zndan npc villager 3
Add:
/zndan npc hajireza 1
/zndan npc hajireza 2
Add:
/zndan npc final 1
/zndan npc final 2
All NPC locations must persist.
==================================================
34. PERMISSIONS
==================================================
Keep:
prison.admin
prison.arrest
prison.cell
prison.npc
prison.shop
prison.bypass
Do not remove or rename existing permissions.
==================================================
35. TAB COMPLETION
==================================================
Implement proper tab completion for all commands.
Examples:
/zndan
/zndan cell
/zndan cell parkour
/zndan npc
/zndan shop
/zndan jail
==================================================
36. RELOAD
==================================================
Keep:
/zndan reload
Permission:
prison.admin
Reload configuration safely.
Do not destroy active prisoner data during reload.
Do not reset sentence timers during reload.
==================================================
37. RELEASE REASONS
==================================================
Create or keep:
ReleaseReason
Recommended values:
SENTENCE_COMPLETE
ADMIN_UNCUFF
ADMIN_UNJAIL
ADMIN_RELEASE
PARKOUR_SUCCESS
==================================================
38. EXISTING CODE
==================================================
Modify the existing plugin classes where appropriate.
Recommended architecture:
ir.zendanmashhadi
ZendanMashhadi.java
PrisonManager.java
PrisonerData.java
DataManager.java
LocationManager.java
NpcManager.java
HologramManager.java
HandcuffManager.java
EscapeManager.java
EscapeShopManager.java
EscapeChargeManager.java
ParkourManager.java
CommandManager.java
PrisonListener.java
ItemUtil.java
TimeUtil.java
ReleaseReason.java
Do not create unnecessary duplicated systems.
Use the existing implementation wherever possible.
==================================================
39. IMPORTANT BUG FIXES
==================================================
Fix any existing code that:
- makes prisoners immune to damage
- releases prisoners on death
- releases prisoners on logout
- resets sentence timers on restart
- allows normal renamed items
- allows Cell 1 items in Cell 2
- allows Cell 2 items in Cell 1
- duplicates escape items
- skips the 30-second timer
- releases players without completing parkour
- releases players by clicking `آزادی` without reaching the parkour finish
- allows the final release Villager click to bypass `parkourFinished=true`
- only removes a handcuff without actually releasing the prisoner
- instantly teleports a handcuffed prisoner to prison
- stops the prisoner from following the arresting staff member
- automatically puts the prisoner into a cell before the correct guard is clicked
- accepts a prisoner through the wrong guard
- teleports the prisoner to parkour immediately instead of waiting 3 seconds after Haji Reza
- allows Haji Reza's item to be submitted multiple times during the 3-second delay
- fails to return a prisoner to their assigned cell after dying during parkour
==================================================
40. FINAL GAMEPLAY FLOW — CELL 1
==================================================
Player is serving a Cell 1 sentence.
↓
Player talks to Haji Mashhadi.
↓
Use the exact Cell 1 Haji Mashhadi dialogue from Section 13.
↓
Player obtains:
نخ فرار
↓
Player clicks Haji Reza.
↓
Haji Reza opens the GUI.
↓
Player may place the valid `نخ فرار` into ANY designated input slot.
↓
The GUI must allow the item to be removed normally.
↓
The plugin validates the PDC and Cell ID.
↓
Exactly ONE item is consumed.
↓
Use the exact Cell 1 Haji Reza dialogue.
↓
EXACT message:
§eحاج رضا§f: §eبریم انجامش
↓
WAIT EXACTLY 3 SECONDS.
↓
Teleport to the configured Cell 1 PARKOUR START location.
↓
Start Cell 1 parkour state.
↓
Player may continue the parkour.
↓
If the player clicks the CORRECT Cell 1 `آزادی` NPC:
IMMEDIATELY RELEASE.
Parkour completion is NOT required for this release.
↓
Teleport to configured release/exit location.
==================================================
41. FINAL GAMEPLAY FLOW — CELL 2
==================================================
Player is serving a Cell 2 sentence.
↓
Player talks to Haji Mashhadi.
↓
Use the exact Cell 2 Haji Mashhadi dialogue from Section 13.
↓
Player buys:
شیشه فرار
for:
1 Obsidian
↓
Player buys:
آبسیدین فرار
for:
1 Diamond
↓
Player holds:
MAIN HAND:
شیشه فرار
OFFHAND:
آبسیدین فرار
↓
Player holds SHIFT and right-clicks.
↓
30 second timer starts.
↓
Actionbar:
§eدر حال آمادهسازی فرار... §f{remaining} ثانیه
↓
After exactly 30 seconds:
The two source items are consumed.
↓
ONE valid custom item appears:
بیکن فرار سلول ۲
↓
Player clicks Haji Reza.
↓
GUI opens.
↓
Player may place the valid custom Beacon into ANY designated input slot.
↓
The GUI must allow the item to be removed normally before submission.
↓
Plugin validates the Beacon PDC and Cell ID.
↓
Exactly ONE Beacon is consumed.
↓
Use the exact Cell 2 Haji Reza dialogue.
↓
EXACT:
§eحاج رضا§f: §eبریم انجامش
↓
WAIT EXACTLY 3 SECONDS.
↓
Teleport to the configured Cell 2 PARKOUR START location.
↓
Start Cell 2 parkour state.
↓
If the player clicks the CORRECT Cell 2 `آزادی` NPC:
IMMEDIATELY RELEASE.
Parkour completion is NOT required for this final release click.
↓
Teleport to configured release/exit location.
==================================================
IMPORTANT FINAL PRIORITY RULE
==================================================
The latest user requirements override any older wording in this document.
In particular:
1. `/zndan cell setexit` is ONLY the final release/exit location.
2. `/zndan cell set 1/2/3` are the actual prison cell locations used by the
corresponding Cell Guards.
3. Haji Reza MUST open the GUI; it must not auto-start by clicking the NPC.
4. Any designated Haji Reza input slot may be used.
5. The submitted item must be removable before successful submission.
6. Only ONE item may be in the Haji Reza input area at a time.
7. After valid submission, use the exact Haji Reza dialogue and wait exactly
3 seconds before teleporting to the correct cell's parkour START location.
8. The correct `آزادی` NPC releases the prisoner IMMEDIATELY, regardless of
`parkourFinished`.
9. Wrong-cell `آزادی` NPC never releases the prisoner.
10. Do not change unrelated systems.
==================================================
42. FINAL REQUIREMENTS
==================================================
The plugin must be fully functional.
Do not provide:
- TODO
- placeholder methods
- fake NPC systems
- fake timers
- fake parkour
- fake shops
- incomplete handlers
- commented-out implementations
- simplified demo behavior
Everything must actually work.
Build with:
mvn clean package
The final output MUST be:
target/ZendanMashhadi.jar
The plugin must work on:
Paper/Purpur 1.21.11
Java 21
Most important:
1. Prison timer MUST persist.
2. Prisoners MUST take normal damage.
3. Death MUST NOT release prisoners.
4. Logout MUST NOT release prisoners.
5. Restart MUST NOT reset sentences.
6. /zndan uncuff MUST actually release.
7. Haji Mashhadi dialogue MUST be Persian chat dialogue.
8. Cell 1 must use the green "نخ فرار" for 2 Diamonds.
9. Cell 2 must use Glass + Obsidian.
10. Cell 2 requires exactly 30 seconds of valid charging.
11. Cell 2 produces ONE Beacon.
12. Haji Reza must receive the correct item.
13. After giving the correct item to Haji Reza, send "حاج رضا: بریم انجامش" and wait exactly 3 seconds before teleporting to parkour.
14. Parkour completion is optional for the final `آزادی` NPC release.
15. The correct final NPC `آزادی` must release the prisoner immediately;
parkour completion is NOT required for the final release.
16. All escape items must use PDC.
17. Prevent all known duplication and escape exploits.
18. All player-facing text MUST be Persian.
19. Preserve existing prison functionality.
20. Do not simplify the system.
21. A handcuffed prisoner MUST follow the arresting staff member instead of being instantly teleported.
22. SLOW_FALLING must be used during handcuff transportation to prevent fall damage.
23. The prisoner MUST NOT enter the cell until the staff member clicks the correct prison guard.
24. The correct guard must match the prisoner's assigned cell.
25. If a prisoner dies during parkour, they MUST return to their original assigned cell after respawn and remain jailed.
26. The release location must be configurable and used when the sentence ends or parkour is successfully completed.
27. Each cell must have its own configurable parkour location.
28. Each prison cell must have a Persian dynamic sentence timer/hologram showing the real remaining time.
29. The sentence times must remain timestamp-based and configurable: Cell 1 = 25m, Cell 2 = 40m, Cell 3 = 1h20m.
30. The sentence timer for handcuffed prisoners MUST start only when the correct Cell Guard accepts them.
31. Applying the valid handcuff MUST immediately give the prisoner the real `SLOW_FALLING` potion effect during transportation.
32. The prisoner MUST enter the prison only after the correct Villager Cell Guard is physically clicked.
33. The correct final Villager `آزادی` MUST release the prisoner immediately
when it matches the prisoner's assigned cell. `parkourFinished=true` is NOT
required for release.
31. Cell 1 guard acceptance MUST start exactly 25 minutes.
32. Cell 2 guard acceptance MUST start exactly 40 minutes.
33. Cell 3 guard acceptance MUST start exactly 1 hour and 20 minutes.
34. The prisoner must be online for the sentence timer to continue counting down.
35. If the prisoner disconnects, the sentence must pause at the exact remaining time and resume on reconnect without resetting.
36. The Cell Guard NPCs must persist and be available in the server throughout the prison system.
37. The correct Cell Guard must be the official event that changes the prisoner from transport state into active sentenced-cell state.
38. Return a complete compilable Maven project and build the final JAR.
FINAL RULE:
Do not change anything that was not requested in this prompt.
The goal is to MODIFY THE EXISTING ZendanMashhadi plugin while preserving its original behavior, and ONLY add/fix the specific requirements described above.
### CRITICAL DEATH / INVENTORY REQUIREMENT DURING SENTENCE
While a player is serving an active prison sentence, if the prisoner dies:
1. The prisoner MUST NOT lose their inventory items.
2. The prison system must preserve the prisoner's complete inventory and equipped items exactly as they were at the moment of death.
3. Items in the MAIN HAND and OFFHAND must remain associated with the prisoner and must NOT be dropped or lost.
4. The player's inventory must NOT be cleared because of death.
5. After respawn, the prisoner MUST be returned to their assigned prison cell in `PrisonWorld`.
6. The prisoner remains jailed and their sentence continues with the exact remaining time.
7. Death MUST NOT release the prisoner or reset the sentence.
8. If Minecraft/Paper's normal death-drop behavior would drop the items, the plugin MUST prevent those drops for jailed prisoners.
9. This protection applies ONLY while the player is actively serving a prison sentence; do not globally disable item drops for non-prisoners.
10. The implementation must preserve all existing anti-exploit and prison restrictions while ensuring the prisoner keeps their items after death.
============================================================
FINAL USER CORRECTIONS — HIGHEST PRIORITY
============================================================
The following requirements are the latest explicit user instructions.
If ANY earlier section of this prompt conflicts with these rules, THESE RULES
TAKE PRIORITY.
------------------------------------------------------------
A. CELL GUARD ACCEPTANCE
------------------------------------------------------------
When a prisoner has been handcuffed and transported to the prison:
The prisoner must NOT be automatically teleported into a cell merely because
they reached PrisonWorld or reached the guard.
The arresting staff member must click the Villager Guard belonging to the
prisoner's assigned cell.
When the CORRECT guard is clicked:
Cell 1:
-> teleport to the exact location configured by `/zndan cell set 1`
Cell 2:
-> teleport to the exact location configured by `/zndan cell set 2`
Cell 3:
-> teleport to the exact location configured by `/zndan cell set 3`
Then:
- stop follow/transport
- remove handcuff/transport state
- remove ONLY the plugin-added Slow Falling
- restore previous Slow Falling if necessary
- remove arrest BossBar
- start the sentence timer at this exact moment
- save data
Wrong guard:
-> do nothing except the Persian wrong-guard message.
`/zndan cell setexit` is NEVER the cell location.
------------------------------------------------------------
B. SETEXIT VS PARKOUR START
------------------------------------------------------------
These locations are completely separate.
`/zndan cell set 1`
= Cell 1 prison location.
`/zndan cell set 2`
= Cell 2 prison location.
`/zndan cell set 3`
= Cell 3 prison location.
`/zndan cell setexit`
= final release/exit location ONLY.
Cell 1 parkour start
= separate configured location.
Cell 2 parkour start
= separate configured location.
Haji Reza MUST teleport to the correct PARKOUR START location after
the exact 3-second delay.
Haji Reza MUST NEVER use `setexit` as the parkour start.
------------------------------------------------------------
C. HAJI REZA GUI — FINAL EXACT BEHAVIOR
------------------------------------------------------------
Clicking Haji Reza MUST open the GUI.
It must NOT immediately start a 3-second timer.
GUI title:
سوغات حاج مشهدی رو بده
The GUI must have a designated input area with MULTIPLE valid input slots.
The player may place the required souvenir item into ANY ONE of those
input slots.
There is NO single mandatory slot.
Every designated input slot must work.
The player must be able to PICK THE ITEM BACK UP normally.
The item must never become visually or logically stuck.
The player must be able to:
- place the item
- remove the item
- move the item between valid input slots
- close the GUI
Only ONE item may exist in the entire Haji Reza input area at a time.
Do not allow multiple simultaneous input items.
Handle safely:
- normal click
- shift-click
- drag
- double-click
- number-key swap
- hotbar swap
- offhand swap
- cursor movement
Prevent duplication.
If the GUI is closed before successful submission:
- return the item safely
- do not consume it
- do not start escape
- do not start parkour
- do not start the 3-second delay
If inventory is full:
- safely return/drop the item without loss or duplication.
------------------------------------------------------------
D. CELL 1 HAJI REZA GUI
------------------------------------------------------------
Required item:
§aنخ فرار
PDC:
cell1_escape_thread
Cell:
1
The item must be accepted from ANY valid Haji Reza input slot.
Validate:
- jailed
- Cell 1
- correct PDC
- correct item ID
- correct Cell ID
- not already in an active escape/parkour process
When accepted:
- consume EXACTLY ONE item
- set escaping=true
- set parkour=true
- close GUI
- prevent duplicate submission
Use the exact dialogue supplied in Section 13.
The final line before the delay MUST be:
§eحاج رضا§f: §eبریم انجامش
Then:
WAIT EXACTLY 3 SECONDS = 60 SERVER TICKS
Then:
Teleport to Cell 1 PARKOUR START.
------------------------------------------------------------
E. CELL 2 HAJI REZA GUI
------------------------------------------------------------
Required item:
§aبیکن فرار سلول ۲
Material:
BEACON
PDC:
cell2_escape_beacon
Cell:
2
The item must be accepted from ANY valid Haji Reza input slot.
Validate:
- jailed
- Cell 2
- correct PDC
- correct item ID
- correct Cell ID
- legitimate result of Cell 2 preparation
Normal Beacon MUST NOT work.
Renamed Beacon MUST NOT work.
When accepted:
- consume EXACTLY ONE Beacon
- set escaping=true
- set parkour=true
- close GUI
- prevent duplicate submission
Use the exact Cell 2 Haji Reza dialogue supplied in Section 13.
The final line before the delay MUST be:
§eحاج رضا§f: §eبریم انجامش
Then:
WAIT EXACTLY 3 SECONDS = 60 SERVER TICKS
Then:
Teleport to Cell 2 PARKOUR START.
------------------------------------------------------------
F. HAJI REZA DELAY CANCELLATION
------------------------------------------------------------
There must be at most ONE pending Haji Reza delayed task per player.
Cancel it if:
- player dies
- player disconnects
- player is released
- player is unjailed
- player is uncuffed
- player is no longer jailed
- escape is cancelled
- player becomes invalid
If cancelled:
- do NOT teleport
- do NOT start parkour
------------------------------------------------------------
G. FREEDOM NPC — LATEST USER REQUIREMENT
------------------------------------------------------------
NPC:
آزادی
The CORRECT Freedom NPC must release the player IMMEDIATELY.
DO NOT require:
parkourFinished=true
DO NOT require:
- reaching parkour finish
- completing parkour
- any parkour completion flag
The player only needs to be:
- currently jailed
- clicking the Freedom NPC assigned to their own cell
Then immediately:
releasePlayer(player, ReleaseReason.PARKOUR_SUCCESS)
Wrong-cell Freedom NPC:
-> no release.
------------------------------------------------------------
H. KEEP EVERYTHING ELSE UNCHANGED
------------------------------------------------------------
Do NOT change unrelated systems.
Keep:
- handcuffs
- real Slow Falling
- follow/drag
- 12-block maximum distance
- BossBar
- correct guard delivery
- sentence system
- online-only countdown
- logout pause
- reconnect resume
- death persistence
- full inventory preservation
- death escape penalty
- Haji Mashhadi shop
- exact Haji Mashhadi dialogues
- Cell 1 thread
- Cell 2 Glass
- Cell 2 Obsidian
- exact hand requirements
- 60-second Cell 2 charge
- custom Cell 2 Beacon
- exact Haji Reza dialogues
- Haji Reza GUI
- exact 3-second delay
- separate parkour starts
- release/exit location
- holograms
- OP bypass
- Click Mobs prisoner Villager protection
- prison NPC interactions
- all existing valid commands and permissions
============================================================
END OF FINAL USER CORRECTIONS
============================================================
######################################################################
# EXTENDED IMPLEMENTATION SPECIFICATION — DO NOT OMIT ANY SECTION
######################################################################
IMPORTANT:
This is a production-ready modification specification for the existing
ZendanMashhadi Paper plugin.
The developer/AI must MODIFY THE EXISTING PLUGIN, not create a simplified
demo and not remove working systems.
The goal is to keep all existing prison systems while fixing the specified
behavior and making every state persistent, safe, cell-specific, and
duplication-proof.
Every requirement below is mandatory unless it is explicitly marked optional.
======================================================================
1. GENERAL DEVELOPMENT RULES
======================================================================
1.1 Platform
Target:
- Paper/Purpur
- Minecraft 1.21.11
- Java 21
Compile the final plugin for Java 21.
Do not compile the final JAR with an older Java target.
1.2 Existing plugin
The existing plugin is:
ZendanMashhadi
Main package currently:
ir.zendanmashhadi
Preserve the existing plugin identity, commands, configuration concept,
NPC system, prison data, and working features.
Do not rename the plugin.
Do not replace the plugin with a completely unrelated implementation.
1.3 Modification philosophy
Before changing a feature:
- understand its current implementation
- preserve working behavior
- modify only what is required
- avoid duplicate managers for the same state
- avoid multiple repeating tasks doing the same job
- centralize prisoner state where possible
- use UUIDs for player identity
- use PDC for custom items and NPC identity
1.4 No fake behavior
Do not simulate:
- Slow Falling with a visual-only effect
- handcuffs with a renamed item
- prison state with only a scoreboard
- item identity with only name/lore
- NPC identity with only the Villager name
Use real Bukkit/Paper APIs and persistent data.
======================================================================
2. PRISONER DATA MODEL
======================================================================
Every prisoner must have a persistent data record keyed by player UUID.
The record must be able to represent at least:
- player UUID
- player name
- jailed
- assigned cell
- sentence duration
- remaining sentence
- sentence active
- arresting officer UUID
- arresting officer name
- handcuffed
- transporting
- escaping
- parkour active
- parkour finished
- current escape state
- timestamps/state needed for safe restart recovery
- previous Slow Falling information when applicable
Do not use player names as the primary identifier.
Names may change.
UUID is authoritative.
======================================================================
3. HANDCUFF ITEM
======================================================================
Command:
/zndan handcuffs
Alias:
/zndan handcuff
The command gives the authorized player the exact custom prison handcuff item.
The handcuff must be an Iron Bars item.
Its identity MUST be stored using PersistentDataContainer.
Required logical ID:
prison_handcuff
Cell ID for the handcuff:
0
A normal Iron Bars item must NOT work.
A renamed Iron Bars item must NOT work.
A player must not be able to create a valid handcuff simply by changing:
- name
- lore
- material
Validation must use PDC.
The command must not duplicate handcuffs through repeated clicks or repeated
command execution if the plugin's intended policy is one active handcuff.
======================================================================
4. ARREST / HANDCUFF FLOW
======================================================================
When an authorized officer right-clicks a player with the valid prison
handcuff:
1. Verify the item using PDC.
2. Verify the target is a valid player.
3. Verify the target is not already jailed/transported.
4. Assign the first genuinely free prison cell.
5. If all configured cells are occupied, DO NOT silently assign Cell 3.
6. Show an appropriate Persian message when no cell is available.
7. Store the officer UUID and officer name.
8. Set:
handcuffed=true
transporting=true
jailed=true
sentenceActive=false
9. Do not start the sentence countdown yet.
10. Do not instantly teleport the prisoner to the prison cell.
11. Start the follow/transport system.
12. Apply real Bukkit/Paper Slow Falling.
13. Show the arrest BossBar.
14. Persist the state immediately.
The arresting officer is the owner of this transport operation.
======================================================================
5. FOLLOW / DRAG SYSTEM
======================================================================
This is one of the most important systems.
The prisoner must ACTUALLY follow the arresting officer.
Do not only change the player's location once.
Do not freeze the prisoner.
Do not set walk speed to 0.
Do not teleport the prisoner into the cell during transport.
The prisoner should remain physically in the world and be dragged/followed.
Target position:
approximately 2–3 blocks behind the arresting officer.
Maximum transport distance:
12 blocks.
If distance is small:
- allow normal movement/follow behavior.
If distance becomes too large:
- smoothly pull the prisoner toward the officer.
If distance exceeds the maximum:
- ensure the prisoner cannot remain stranded.
The system must have exactly ONE active follow task per prisoner.
Starting transport twice must cancel/reuse the previous task rather than creating
two repeating tasks.
When transport ends:
- cancel the follow task
- remove transport state
- do not leave orphan tasks
The officer disconnecting must NOT automatically release the prisoner.
The prisoner remains arrested/transporting until the correct guard accepts.
======================================================================
6. SLOW FALLING
======================================================================
Use the real PotionEffectType.SLOW_FALLING.
This is a safety effect during transport.
It is NOT:
- invulnerability
- damage immunity
- a global damage cancellation
Do not cancel all damage events for prisoners.
Only the intended Slow Falling effect should be managed.
IMPORTANT:
If the player already had Slow Falling before arrest:
- save its amplifier
- save its remaining duration
- mark that it existed before the plugin
When transport ends:
- remove only the plugin's temporary transport effect
- restore the previous effect if it was still supposed to exist
If the player did not have Slow Falling before arrest:
- remove the plugin-added effect when transport ends.
Never remove a player's unrelated permanent/pre-existing Slow Falling.
======================================================================
7. BOSSBAR
======================================================================
During transport display:
شما توسط دستگیر شدهاید
The staff name must come from the arresting officer.
The BossBar is associated with the prisoner.
Remove it when:
- correct guard accepts
- player is released
- player is uncuffed
- prison state is cleared
Do not leave BossBars after restart/reconnect.
If a prisoner reconnects while still transported:
- reconstruct the BossBar from saved data if the system supports it
- never lose the arresting officer information
======================================================================
8. CELL ASSIGNMENT
======================================================================
Three cells exist.
Cell 1:
25m
Cell 2:
40m
Cell 3:
1h20m
The first genuinely free cell must be selected.
CRITICAL BUG PREVENTION:
If Cell 1, Cell 2 and Cell 3 are all occupied:
- do NOT assign Cell 3
- do NOT overwrite another prisoner
- do NOT silently continue
Return an error/message and leave the target unassigned until a valid cell
becomes available.
Cell occupancy must be based on active prisoner records, not only online
players.
======================================================================
9. CORRECT GUARD ACCEPTANCE
======================================================================
There is a guard Villager for each cell.
When the arresting staff brings the prisoner to the prison:
The staff member clicks the guard Villager belonging to the assigned cell.
ONLY THE CORRECT CELL GUARD accepts.
Example:
Prisoner assigned to Cell 1:
- Cell 1 guard = accept
- Cell 2 guard = reject
- Cell 3 guard = reject
Prisoner assigned to Cell 2:
- Cell 2 guard = accept
- Cell 1/3 = reject
Prisoner assigned to Cell 3:
- Cell 3 guard = accept
- Cell 1/2 = reject
Wrong guard:
- do not start sentence
- do not teleport
- do not clear handcuffs
- do not release
- do not change cell
Show only the intended Persian wrong-guard message.
Correct guard:
- stop transport
- clear handcuffed/transporting
- remove plugin-added Slow Falling
- restore pre-existing Slow Falling if necessary
- remove arrest BossBar
- teleport to the EXACT configured cell location
- start the sentence timer
- save prisoner state
The sentence starts at guard acceptance.
======================================================================
10. CELL LOCATION COMMANDS
======================================================================
These are prison-cell locations:
/zndan cell set 1
/zndan cell set 2
/zndan cell set 3
Command:
Cell durations:
1
|