eloyaltyx

Do Max You Can But In Credit not out of balance

📎 1 file 37,939 chars
📄
FakeBorder — Master AI Plugin Generator Prompt.md
md 2453 lines
▶
# FAKEBORDER
## MASTER AI PLUGIN GENERATOR PROMPT
### Premium Visual Border & Border-Aware Rendering System for Minecraft Paper

---

# 0. YOUR ROLE

You are an elite Minecraft plugin development team consisting of:

- Senior Java Engineer
- Paper API Specialist
- Minecraft Network/Protocol Engineer
- Client-Server Rendering Specialist
- Performance Engineer
- Plugin API Architect
- Configuration Designer
- UX/Command Designer
- QA Engineer
- Security Engineer
- Technical Documentation Writer
- Premium Minecraft Marketplace Product Developer

Your task is to independently design and implement a **production-ready premium Minecraft plugin called `FakeBorder`**.

FakeBorder must be engineered as a plugin that could realistically be released as a polished commercial product on marketplaces such as BuiltByBit.

Do not produce a toy plugin.

Do not produce a proof of concept.

Do not produce fake implementations.

Do not create commands that merely print success messages.

Every advertised feature must have a real implementation.

---

# 1. PRODUCT NAME

Plugin name:

**FakeBorder**

Suggested description:

> A powerful player-specific visual border system for Paper servers. Create unlimited borders across multiple worlds, control player escape behavior, optimize border-aware chunk rendering, manage border assignments, and expose everything through a clean API and PlaceholderAPI integration.

Brand identity:

- Name: FakeBorder
- Short name: FB
- Command: `/fakeborder`
- Alias: `/fb`
- Main permission: `fakeborder.admin`
- API package: `com.fakealt.fakeborder`

Do not use copyrighted code from another plugin.

The implementation must be independently written.

---

# 2. CORE CONCEPT

FakeBorder is a **player-facing border system**.

A FakeBorder can visually behave like a Minecraft WorldBorder while allowing the administrator to separately control:

1. Visual border
2. Movement restriction
3. Teleport behavior
4. Ender Pearl escape
5. Border damage
6. Border-only server behavior
7. Border-aware rendering/chunk optimization
8. Player assignment
9. Multiple borders
10. Multi-world support

These systems MUST NOT be unnecessarily coupled.

For example:

A border can be:

- visually displayed
- movement-blocking
- non-damaging
- teleportable
- ender-pearl restricted
- render-limited

all at the same time.

---

# 3. CRITICAL TECHNICAL REQUIREMENT

Do NOT falsely claim:

> "The Minecraft client will absolutely never receive or render any block outside the mathematical border."

Minecraft client rendering and chunk delivery are controlled by multiple server/client systems.

Therefore FakeBorder must implement the strongest **safe and technically achievable** border-aware rendering system for the supported Paper version.

The implementation should use:

- Paper APIs where possible
- per-player view distance controls where supported
- chunk tracking controls where safely possible
- packet-level control only where required
- ProtocolLib integration when appropriate
- safe chunk unloading
- border-aware chunk loading
- configurable render buffer
- protection against chunk-generation storms

The plugin must NEVER corrupt client chunk state simply to achieve a visual effect.

If a specific Minecraft/Paper version makes a particular optimization impossible, gracefully fall back to the safest supported implementation.

Document technical limitations honestly.

---

# 4. MAIN FEATURE

The core feature is:

## Player-Specific Fake WorldBorder

A player can be assigned to a FakeBorder.

That player sees their assigned border.

The border can have:

- custom size
- custom center
- custom world
- enabled/disabled state
- movement restrictions
- escape settings
- ender pearl rules
- damage rules
- render restrictions
- priority
- assignment rules

Different players may see different borders.

Example:

Player A:

`Arena-1`

Player B:

`Arena-2`

Player C:

`SurvivalBorder`

Player D:

No FakeBorder.

All can exist simultaneously.

---

# 5. MULTIPLE BORDER SUPPORT

Unlimited named borders should be supported, subject to server resources.

Support:

- multiple borders in one world
- multiple worlds
- overlapping borders
- nested borders
- different sizes
- different centers
- different configurations
- player-specific assignments

Every border must have a unique ID.

Border IDs:

- case-insensitive for lookup
- safely validated
- configurable maximum length
- no dangerous path characters
- no YAML-breaking identifiers

Example:

```text
/fakeborder create Spawn 500
/fakeborder create Arena-1 200
/fakeborder create Arena-2 300
/fakeborder create Event 1000
```

---

# 6. PROFESSIONAL COMMAND SYSTEM

Use a professional command tree.

Primary:

```text
/fakeborder
```

Alias:

```text
/fb
```

Commands:

```text
/fakeborder help
/fakeborder create  
/fakeborder create     
/fakeborder create  --selection
/fakeborder delete 
/fakeborder list
/fakeborder info 
/fakeborder center 
/fakeborder center   
/fakeborder resize  
/fakeborder resize   
/fakeborder pos1
/fakeborder pos2
/fakeborder enable 
/fakeborder disable 
/fakeborder fix 
/fakeborder reload
/fakeborder resetall
/fakeborder resetall confirm
/fakeborder assign  
/fakeborder unassign 
/fakeborder limitrender 
/fakeborder limitrender  
/fakeborder escapable  
/fakeborder enderpearl  
/fakeborder mode  
/fakeborder borderonly 
/fakeborder status
```

Provide tab completion for EVERY command.

---

# 7. COMMAND DETAILS

## CREATE

```text
/fakeborder create  
```

When executed by a player:

- use player's current world
- use player's current X/Z as center
- create the border
- enable it by default according to config

Console version:

```text
/fakeborder create     
```

Do not allow console to use player-only functionality.

---

# 8. CENTER

```text
/fakeborder center 
```

Moves the border center to the command sender's current X/Z.

Also support:

```text
/fakeborder center   
```

Center changes must:

- update runtime state
- update visual state
- update movement calculations
- update render calculations
- persist changes

---

# 9. RESIZE

Basic:

```text
/fakeborder resize  
```

Optional animated resize:

```text
/fakeborder resize   
```

Examples:

```text
/fakeborder resize Arena 500
/fakeborder resize Arena 1000 10s
```

Support configurable animations if technically appropriate.

Do not block the main server thread during animation.

---

# 10. DELETE

```text
/fakeborder delete 
```

Before deletion:

- remove player visual state
- remove assignments
- stop border tasks
- clear render state
- clear movement cache
- safely restore client state
- remove persisted data

If players are assigned to the border, gracefully move them to the no-border state.

---

# 11. POS1 / POS2 SELECTION

Provide a professional selection system.

Commands:

```text
/fakeborder pos1
/fakeborder pos2
```

Optional coordinate versions:

```text
/fakeborder pos1  
/fakeborder pos2  
```

The selection represents opposite corners of a rectangular border.

From the selection:

```text
/fakeborder create  --selection
```

Calculate:

- minimum X
- maximum X
- minimum Z
- maximum Z
- center
- width
- depth
- resulting size

Selection must be:

- player-specific
- temporary
- world-aware
- permission-protected
- safely cleared after use

Do not require WorldEdit.

Optional selection visualization:

- particles
- temporary lines
- configurable update interval

---

# 12. ENABLE / DISABLE

Professional syntax:

```text
/fakeborder enable 
/fakeborder disable 
```

Do not use ambiguous:

```text
/fakeborder enable
```

unless it is explicitly defined as global functionality.

Border disable must:

- remove visual border
- stop enforcement
- stop border-aware render restrictions
- preserve configuration
- preserve border definition

Re-enable must restore the previous configuration.

---

# 13. FIX SYSTEM

Command:

```text
/fakeborder fix 
```

This is a recovery command.

It must recalculate:

- border geometry
- player assignments
- player detection
- visual border state
- movement state
- render state
- chunk state
- scheduled tasks
- cached values
- stale player sessions

It must be safe to run repeatedly.

Never implement `/fix` as a fake command.

---

# 14. ESCAPABLE SYSTEM

Use professional spelling:

```text
/fakeborder escapable  
```

Also optionally support the user's original spelling:

```text
/fakeborder escapeable  
```

`escapable: false`

means:

> Players cannot physically cross the border through ordinary movement.

`escapable: true`

means:

> The border is visual and does not prevent ordinary movement.

Important:

Teleportation must remain independently configurable.

---

# 15. TELEPORT POLICY

A player should normally be able to leave a border through a legitimate teleport.

Examples:

- `/tp`
- `/minecraft:teleport`
- plugin teleport
- admin teleport
- server systems
- portal systems where allowed

Default configuration:

```yaml
teleport:
  allow-command: true
  allow-plugin: true
  allow-admin: true
  enforce-boundary-on-teleport: false
```

This prevents administrators from accidentally trapping players.

---

# 16. ENDER PEARL CONTROL

Professional command:

```text
/fakeborder enderpearl  
```

Optional compatibility alias:

```text
/fakeborder enderpearlleave  
```

Behavior:

`allow`

- Ender Pearls can cross the border.

`deny`

- Ender Pearl travel cannot be used to escape.

Only deny pearls that would actually cross the border.

Do not break normal pearls that land inside the border.

Handle:

- projectile movement
- landing
- cancelled projectiles
- player teleport
- border changes during projectile flight

---

# 17. LIMITRENDER SYSTEM

Command:

```text
/fakeborder limitrender 
```

This should act as the global default.

Also support:

```text
/fakeborder limitrender  
```

for per-border control.

Meaning:

```text
true
```

= enable border-aware rendering/chunk limitation.

```text
false
```

= normal server rendering behavior.

Recommended configuration:

```yaml
render:
  enabled: true
  default-limit-render: true
  strategy: AUTO
  buffer-chunks: 1
  prevent-generation-outside-border: false
  unload-outside-border: true
  minimum-view-distance: 2
  maximum-view-distance: 32
```

---

# 18. BORDER-AWARE RENDERING ENGINE

Create a dedicated service:

```text
BorderRenderService
```

Do not put rendering logic inside the command class.

Responsibilities:

- determine relevant border
- calculate allowed render area
- calculate chunk radius
- determine chunks outside allowed area
- safely manage player chunk state
- prevent excessive chunk generation
- recover after teleports
- recover after world changes
- recover after border resizing
- recover after reconnect
- recover after plugin reload

Use a strategy interface:

```text
RenderStrategy
```

Possible implementations:

```text
VANILLA
BORDER_AWARE
PACKET_OPTIMIZED
AUTO
```

`AUTO` chooses the safest available implementation.

---

# 19. CHUNK SAFETY

This system must prioritize server stability.

Never:

- unload thousands of chunks every tick
- repeatedly load/unload the same chunks
- generate terrain unnecessarily
- run massive synchronous scans
- cause chunk-generation explosions
- freeze the server
- create memory leaks
- create permanent invisible chunks

Use:

- caches
- dirty-state tracking
- throttling
- batching
- distance checks
- scheduled updates
- async calculations where safe
- main-thread operations only where required by Bukkit/Paper

---

# 20. MOVEMENT BOUNDARY ENGINE

Create:

```text
BorderEnforcementService
```

It must calculate:

```text
minX
maxX
minZ
maxZ
```

from:

```text
centerX
centerZ
size
```

Movement checks should be efficient.

Handle:

- normal walking
- sprinting
- jumping
- flying
- elytra
- vehicles
- mounts
- knockback
- explosions
- velocity
- piston movement where relevant
- plugin movement
- teleport events

Avoid rubber-banding.

When preventing escape:

- calculate a safe destination
- preserve Y where possible
- avoid suffocating the player
- avoid teleport loops
- avoid repeated event cancellation

---

# 21. BORDER MODES

Create professional enforcement modes.

```text
NONE
VISUAL_ONLY
BLOCK_MOVEMENT
DAMAGE_OUTSIDE
INSTANT_KILL_OUTSIDE
FULL
```

Meaning:

### NONE

No enforcement.

### VISUAL_ONLY

Only visual border.

### BLOCK_MOVEMENT

Physical movement outside is prevented.

### DAMAGE_OUTSIDE

Players outside receive configured damage.

### INSTANT_KILL_OUTSIDE

Players outside are killed.

### FULL

Combines configured visual, movement, damage, and escape rules.

Default should be safe:

```yaml
mode: VISUAL_ONLY
```

---

# 22. BORDERONLY

Command:

```text
/fakeborder borderonly 
```

This is a GLOBAL server setting.

When enabled:

- players inside a valid active FakeBorder are handled by that border
- players who are not inside any active FakeBorder are handled according to the configured outside policy

Configuration:

```yaml
border-only:
  enabled: false
  outside-mode: NONE
  damage-per-second: 2.0
  warning-time: 5
```

Never default to killing everyone outside a border.

Provide:

```text
NONE
DAMAGE
INSTANT_KILL
```

as outside modes.

---

# 23. BORDER DETECTION

Create:

```text
BorderResolver
```

It determines which border applies to a player.

Priority order should be deterministic:

1. Explicit player assignment
2. Highest-priority containing border
3. Smallest containing border
4. Configured fallback
5. No border

Make this configurable.

Do not randomly choose overlapping borders.

---

# 24. PLAYER ASSIGNMENT

Commands:

```text
/fakeborder assign  
/fakeborder unassign 
```

Assignment service:

```text
BorderAssignmentService
```

Support:

- temporary assignments
- persistent assignments
- automatic assignment
- reconnect restoration
- world-change handling
- border deletion handling

---

# 25. PLACEHOLDERAPI

PlaceholderAPI must be optional.

Required placeholders:

```text
%fakeborder_playercount_%
```

Returns:

> Number of players currently inside that border.

Required:

```text
%fakeborder_border%
```

Returns:

> The border currently affecting the player.

If no border:

```text
none
```

Configurable fallback.

---

# 26. ADDITIONAL PROFESSIONAL PLACEHOLDERS

Implement:

```text
%fakeborder_hasborder%
%fakeborder_border_name%
%fakeborder_border_size%
%fakeborder_border_center_x%
%fakeborder_border_center_z%
%fakeborder_border_min_x%
%fakeborder_border_max_x%
%fakeborder_border_min_z%
%fakeborder_border_max_z%
%fakeborder_border_distance%
%fakeborder_border_mode%
%fakeborder_border_escapable%
%fakeborder_border_enderpearl%
%fakeborder_border_playercount%
%fakeborder_limitrender%
```

Also:

```text
%fakeborder_playercount_%
```

Border names must be parsed safely.

Never allow placeholder parsing to cause exceptions.

---

# 27. CONFIGURATION FILES

At minimum generate:

```text
config.yml
messages.yml
borders.yml
```

Optional:

```text
menus.yml
```

---

# 28. CONFIG.YML DESIGN

Create a premium, extremely well-commented configuration.

Example architecture:

```yaml
plugin:
  debug: false
  metrics: true
  update-check: true

storage:
  type: yaml
  autosave-seconds: 30

defaults:
  enabled: true
  size: 100.0
  mode: VISUAL_ONLY
  escapable: false
  ender-pearl: deny
  priority: 0

render:
  enabled: true
  default-limit-render: true
  strategy: AUTO
  buffer-chunks: 1
  unload-outside-border: true
  prevent-generation-outside-border: false
  minimum-view-distance: 2
  maximum-view-distance: 32
  update-interval-ticks: 10

movement:
  enabled: true
  correction-distance: 0.25
  vehicles: true
  flying: true
  elytra: true

damage:
  enabled: false
  amount-per-second: 2.0
  interval-ticks: 20
  warning-distance: 5.0
  grace-seconds: 1

border-only:
  enabled: false
  outside-mode: NONE
  damage-per-second: 2.0

teleport:
  allow-command: true
  allow-plugin: true
  allow-admin: true
  enforce-boundary-on-teleport: false

performance:
  cache-border-lookups: true
  async-calculations: true
  player-update-interval-ticks: 2
  chunk-update-interval-ticks: 10
  max-chunk-operations-per-tick: 50

permissions:
  admin: fakeborder.admin
  bypass: fakeborder.bypass
```

Do not hard-code configuration values into Java.

---

# 29. BORDERS.YML

Example:

```yaml
borders:

  spawn:
    world: world

    center:
      x: 0.0
      z: 0.0

    size: 500.0

    enabled: true

    priority: 10

    mode: VISUAL_ONLY

    escapable: false

    ender-pearl: deny

    limit-render: true

    render-buffer-chunks: 1
```

Support unlimited border entries.

Validate everything when loading.

If one border is corrupted, do not necessarily destroy all other border data.

Report the problematic border clearly.

---

# 30. MESSAGES.YML

Create premium messages.

Use MiniMessage formatting.

Every user-facing message must come from `messages.yml`.

Never hard-code messages.

Include:

```yaml
prefix:
no-permission:
player-only:
invalid-border:
border-created:
border-deleted:
border-resized:
border-centered:
border-enabled:
border-disabled:
border-fixed:
border-assigned:
border-unassigned:
enderpearl-updated:
escapable-updated:
limit-render-updated:
borderonly-updated:
reload-success:
resetall-warning:
resetall-complete:
invalid-size:
invalid-world:
player-not-found:
invalid-mode:
selection-pos1:
selection-pos2:
selection-invalid:
unknown-command:
usage:
help:
status:
```

Messages should look premium, concise, and professional.

Avoid ugly spammy formatting.

---

# 31. PERMISSIONS

Create a complete permission system.

Base:

```text
fakeborder.admin
```

Commands:

```text
fakeborder.create
fakeborder.delete
fakeborder.center
fakeborder.resize
fakeborder.selection
fakeborder.enable
fakeborder.disable
fakeborder.fix
fakeborder.reload
fakeborder.resetall
fakeborder.assign
fakeborder.unassign
fakeborder.render
fakeborder.borderonly
fakeborder.bypass
```

Bypass permissions:

```text
fakeborder.bypass
fakeborder.bypass.movement
fakeborder.bypass.damage
fakeborder.bypass.render
fakeborder.bypass.enderpearl
```

Default sensible permissions through `plugin.yml` or Paper-supported permission configuration.

---

# 32. API

FakeBorder must provide a public API.

Create a separate API module.

Example:

```java
FakeBorderAPI
FakeBorderManager
FakeBorder
BorderManager
BorderAssignmentService
BorderRenderService
BorderEnforcementService
BorderResolver
```

Expose safe methods such as:

```java
Optional getBorder(String name);

Collection getBorders();

Optional getPlayerBorder(Player player);

boolean isInside(FakeBorder border, Location location);

double getDistanceToBorder(FakeBorder border, Location location);

void assign(Player player, FakeBorder border);

void unassign(Player player);

void createBorder(...);

void deleteBorder(String name);
```

Do not expose internal mutable collections.

---

# 33. EVENTS

Create Bukkit/Paper events where appropriate.

Examples:

```text
FakeBorderCreateEvent
FakeBorderDeleteEvent
FakeBorderResizeEvent
FakeBorderCenterChangeEvent
FakeBorderEnableEvent
FakeBorderDisableEvent
FakeBorderPlayerEnterEvent
FakeBorderPlayerLeaveEvent
FakeBorderEscapeAttemptEvent
FakeBorderAssignmentEvent
```

Escape event should allow addons to:

- inspect
- cancel
- modify behavior where appropriate

Events must not create dangerous recursion.

---

# 34. ADDON ARCHITECTURE

Design FakeBorder so third-party developers can build addons.

Potential addons:

- Combat arena integration
- SkyWars integration
- BedWars integration
- Practice integration
- Queue integration
- Placeholder expansion
- Discord integration
- Region integration
- WorldGuard integration
- FFA integration
- Event integration

Do not require these addons for the core plugin.

Create clear hooks.

---

# 35. WORLDGUARD COMPATIBILITY

WorldGuard should be optional.

Do not require WorldGuard.

If installed, optionally expose hooks to:

- detect regions
- prevent conflicts
- resolve border priority
- allow administrators to configure region-based borders

Never make FakeBorder depend on WorldGuard unless explicitly configured.

---

# 36. VANILLA WORLDBORDER COMPATIBILITY

FakeBorder should avoid blindly overwriting another plugin's vanilla WorldBorder.

Maintain per-player FakeBorder state.

When FakeBorder stops controlling a player:

- restore appropriate state
- avoid permanent client corruption
- document unavoidable client limitations

If another plugin controls the same player-specific border state, provide a configurable conflict strategy:

```yaml
conflicts:
  worldborder:
    strategy: FAKEBORDER_WINS
```

Possible strategies:

```text
FAKEBORDER_WINS
VANILLA_WINS
DISABLE_VISUAL
```

---

# 37. WORLD SUPPORT

Support:

- overworld
- Nether
- End
- custom worlds
- Multiverse worlds

Never assume world name is `world`.

Store world UUID where appropriate and retain a human-readable world name for diagnostics.

If a configured world no longer exists:

- do not crash
- disable affected runtime behavior
- log a clear warning
- restore automatically when the world becomes available

---

# 38. PERFORMANCE REQUIREMENTS

FakeBorder is intended for large servers.

Never perform expensive operations every tick for every player without caching.

Use:

- spatial indexing
- border bounding boxes
- cached border resolution
- dirty flags
- throttled updates
- batch processing
- efficient collections
- minimal allocations
- asynchronous storage
- asynchronous calculations only where Bukkit safety permits

Do not access Bukkit API asynchronously unless the API explicitly permits it.

---

# 39. LARGE-SERVER REQUIREMENTS

Design for:

- 10 players
- 50 players
- 100 players
- 250 players
- 500+ players

The plugin must degrade gracefully.

Add configurable limits:

```yaml
performance:
  max-chunk-operations-per-tick: 50
  max-border-checks-per-cycle: 500
```

Do not promise a specific player count unless benchmarked.

---

# 40. MEMORY SAFETY

Prevent:

- Player object leaks
- task leaks
- stale UUID maps
- stale packet handlers
- border cache leaks
- chunk-state leaks
- duplicate listeners
- duplicate schedulers

On:

```text
PlayerQuitEvent
WorldUnloadEvent
PluginDisableEvent
```

clean up relevant resources.

---

# 41. RELOAD SAFETY

`/fakeborder reload` must NOT behave like a dangerous full plugin reload.

Reload:

- configuration
- messages
- borders
- runtime settings

Safely rebuild required caches.

Do not reload the plugin classloader.

Avoid memory leaks.

---

# 42. RESETALL SAFETY

Never let:

```text
/fakeborder resetall
```

immediately destroy everything without confirmation.

Use:

```text
/fakeborder resetall
```

to display:

> This will remove all FakeBorder definitions and active assignments. Use `/fakeborder resetall confirm` to continue.

Then:

```text
/fakeborder resetall confirm
```

performs the operation.

Support configurable backup behavior.

---

# 43. FIX COMMAND SAFETY

`fix` must never delete border data.

It only repairs runtime state.

Example:

```text
/fakeborder fix Arena
```

should repair:

- visualization
- player state
- border calculations
- render state
- tasks
- caches

---

# 44. LOGGING

Create professional logging.

Normal startup:

```text
[FakeBorder] FakeBorder v1.x.x enabled.
[FakeBorder] Loaded 12 borders.
[FakeBorder] Loaded 3 player assignments.
[FakeBorder] PlaceholderAPI hooked.
[FakeBorder] Protocol integration enabled.
```

Do not spam:

```text
Player moved
Player checked
Chunk checked
```

every tick.

Debug mode may provide detailed diagnostics.

---

# 45. ERROR HANDLING

Never allow a malformed border to crash the server.

Validate:

- size
- world
- coordinates
- border ID
- YAML types
- enum values
- booleans
- durations
- player UUIDs

Use clear messages.

Example:

```text
[FakeBorder] Failed to load border 'Arena-1': invalid size.
```

Continue loading other valid borders.

---

# 46. SECURITY

Prevent:

- command injection
- path traversal
- malicious border names
- YAML manipulation
- unsafe reflection
- unbounded user-created borders
- packet abuse
- excessive chunk requests

Do not let normal players create unlimited borders unless explicitly granted permission.

---

# 47. TAB COMPLETION

Every command must have context-aware completion.

Example:

```text
/fakeborder 
```

shows:

```text
create
delete
list
info
center
resize
pos1
pos2
enable
disable
fix
assign
unassign
limitrender
escapable
enderpearl
mode
borderonly
reload
resetall
status
help
```

For:

```text
/fakeborder delete 
```

show border names.

For:

```text
/fakeborder assign Player 
```

show border names.

Never suggest invalid commands.

---

# 48. HELP MENU

Make help attractive.

Example style:

```text
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        FakeBorder
   Visual Border Management
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

/fb create  
/fb delete 
/fb resize  
/fb center 
/fb pos1
/fb pos2
/fb enable 
/fb disable 
/fb assign  
/fb limitrender 
/fb mode  
/fb fix 
/fb reload

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

Make it configurable.

---

# 49. STATUS COMMAND

Implement:

```text
/fakeborder status
```

Display:

- plugin version
- enabled state
- number of borders
- number of active players
- render system
- ProtocolLib status
- PlaceholderAPI status
- storage type
- border-only status
- performance statistics

Example:

```text
FakeBorder Status

Version: 1.0.0
Borders: 14
Players Assigned: 37
Render Strategy: BORDER_AWARE
PlaceholderAPI: Enabled
ProtocolLib: Enabled
Storage: YAML
BorderOnly: Disabled
```

---

# 50. BORDER INFO

Implement:

```text
/fakeborder info 
```

Show:

```text
Border: Arena
World: world
Center: 0.0, 0.0
Size: 500
Min X: -250
Max X: 250
Min Z: -250
Max Z: 250
Mode: BLOCK_MOVEMENT
Escapable: false
Ender Pearl: deny
Limit Render: true
Players: 24
Enabled: true
```

---

# 51. BORDER PLAYER COUNT

The player count must be accurate.

Do not count players merely because they are assigned if the placeholder explicitly means "players currently inside".

Define:

```text
playercount
```

as the number of online players currently physically inside the border.

Make an additional internal concept for assigned players if needed.

---

# 52. PLAYER BORDER PLACEHOLDER

`%fakeborder_border%`

must return only the border affecting the current player.

It must NOT return:

- global border count
- all borders
- another player's border
- server-wide border count

Example:

Player is in:

```text
Arena-1
```

returns:

```text
Arena-1
```

No border:

```text
none
```

---

# 53. DATABASE EXTENSIBILITY

Core YAML storage must work without database dependencies.

Optional:

```text
SQLite
MySQL
MariaDB
```

Create:

```text
StorageProvider
```

and implementations.

Storage operations must not block the server thread.

---

# 54. METRICS

Optional metrics.

Track only anonymous technical statistics where appropriate.

Example:

- plugin version
- server implementation/version
- enabled integrations
- border count range

Never collect player chat, messages, IP addresses, or unnecessary personal information.

Make metrics configurable.

---

# 55. UPDATE CHECKER

Optional update checker.

Configuration:

```yaml
plugin:
  update-check: true
```

It must:

- fail silently if unavailable
- never block startup
- never spam players
- notify only authorized administrators

---

# 56. DOCUMENTATION

Generate complete documentation.

Include:

```text
README.md
INSTALLATION.md
CONFIGURATION.md
COMMANDS.md
PERMISSIONS.md
PLACEHOLDERS.md
API.md
ADDON_DEVELOPMENT.md
TROUBLESHOOTING.md
PERFORMANCE.md
COMPATIBILITY.md
```

Documentation must explain the difference between:

- visual border
- movement restriction
- render limiting
- chunk optimization
- damage
- teleport escape

---

# 57. MARKETPLACE QUALITY

The plugin must feel like a premium commercial product.

Do not make the configuration look autogenerated.

Use:

- clean naming
- consistent indentation
- meaningful comments
- polished messages
- professional command syntax
- logical defaults
- predictable behavior
- strong error messages
- comprehensive documentation

The product should be understandable to a server owner without reading the Java source.

---

# 58. DEFAULT USER EXPERIENCE

A fresh installation should be simple.

Administrator:

```text
/fb create Arena 500
```

Result:

- Arena border is created
- border appears according to configuration
- border is saved
- relevant players are updated
- no unnecessary console spam

Then:

```text
/fb escapable Arena false
```

Now players cannot physically leave through normal movement.

Then:

```text
/fb enderpearl Arena deny
```

Ender Pearl escape is disabled.

Then:

```text
/fb limitrender Arena true
```

Border-aware rendering is enabled.

---

# 59. COMMAND ALIASES

Support:

```text
/fakeborder
/fb
```

Optional compatibility aliases:

```text
/fakeborder escapeable
/fakeborder enderpearlleave
```

Do not create dozens of confusing aliases.

---

# 60. PROJECT STRUCTURE

Use a clean architecture such as:

```text
FakeBorder/
├── build.gradle
├── settings.gradle
├── gradle.properties
├── README.md
│
├── fakeborder-api/
│   └── src/main/java/
│
├── fakeborder-core/
│   └── src/main/java/
│
├── fakeborder-bukkit/
│   └── src/main/java/
│
├── fakeborder-protocol/
│   └── src/main/java/
│
├── fakeborder-placeholders/
│   └── src/main/java/
│
├── fakeborder-test/
│   └── src/test/java/
│
└── fakeborder-bukkit/
    └── src/main/resources/
        ├── plugin.yml
        ├── config.yml
        ├── messages.yml
        └── borders.yml
```

Use better structure if your engineering judgment identifies a superior architecture.

---

# 61. PACKAGE STRUCTURE

Example:

```text
com.fakealt.fakeborder

api/
core/
border/
border/model/
border/service/
border/repository/
assignment/
command/
command/subcommand/
listener/
render/
render/strategy/
enforcement/
placeholder/
storage/
config/
integration/
integration/protocollib/
integration/worldguard/
integration/placeholderapi/
util/
debug/
```

Avoid giant classes.

---

# 62. TESTING

Create tests for:

### Geometry

- center
- size
- min/max
- containment
- edge detection
- distance

### Assignment

- player enters
- player leaves
- overlapping borders
- priority
- deleted border
- world changes

### Movement

- inside
- boundary
- outside
- diagonal movement
- teleport
- vehicle
- flying

### Configuration

- valid YAML
- invalid YAML
- missing values
- corrupted border

### PlaceholderAPI

- border name
- no border
- player count
- unknown border

### Persistence

- save
- load
- restart simulation
- malformed entry

### Performance

- many borders
- many players
- repeated resolution

---

# 63. EDGE CASES

Explicitly test:

- border size = 0
- negative size
- extremely large size
- player exactly on border
- player 0.001 blocks inside
- player 0.001 blocks outside
- world unloaded
- border deleted while player is inside
- player disconnects
- server restarts
- plugin reload
- border resized while player is outside
- player teleported outside
- player enters another border
- overlapping borders
- Nether coordinate differences
- End worlds
- vehicles crossing border
- ender pearl crossing border
- plugin-created teleports
- respawn
- death
- spectator mode
- vanished players

Define sensible behavior for each.

---

# 64. SPECTATOR MODE

Make spectator behavior configurable.

Example:

```yaml
special-modes:
  spectator:
    ignore-movement: true
    ignore-render-limit: false
```

Do not accidentally trap spectators in an arena unless configured.

---

# 65. VANISH SUPPORT

If a player is vanished through another plugin:

- do not reveal them through FakeBorder
- optionally exclude vanished players from player count

Configuration:

```yaml
player-count:
  exclude-vanished: true
```

Make integration optional.

---

# 66. API STABILITY

Use semantic versioning.

Example:

```text
1.0.0
1.1.0
1.1.1
```

Do not break public APIs unnecessarily.

Document deprecated methods.

---

# 67. BUILD REQUIREMENTS

The final project must:

```text
./gradlew clean build
```

successfully.

No unresolved dependencies.

No compilation warnings that can reasonably be avoided.

No placeholder methods.

No:

```java
TODO
return null;
throw new UnsupportedOperationException();
```

in production functionality unless explicitly justified.

---

# 68. QUALITY GATE

Before declaring FakeBorder complete, perform this checklist:

- [ ] Compiles
- [ ] Plugin loads
- [ ] Commands register
- [ ] Tab completion works
- [ ] Configuration loads
- [ ] Messages load
- [ ] Borders save
- [ ] Borders load
- [ ] Multiple borders work
- [ ] Multiple worlds work
- [ ] Player assignment works
- [ ] Visual border works
- [ ] Movement enforcement works
- [ ] Teleport policy works
- [ ] Ender Pearl policy works
- [ ] Render limiter works using the safest available implementation
- [ ] BorderOnly works
- [ ] PlaceholderAPI works
- [ ] Fix works
- [ ] Reset confirmation works
- [ ] Reload works
- [ ] Plugin disable cleans up
- [ ] Player quit cleans up
- [ ] World unload cleans up
- [ ] No memory leaks identified
- [ ] No main-thread database blocking
- [ ] No excessive chunk operations
- [ ] No command crashes
- [ ] No malformed-config crashes
- [ ] Documentation generated
- [ ] API documented

---

# 69. IMPORTANT ANTI-HALLUCINATION RULE

You are not allowed to say:

> "Done."

unless the requested functionality has actually been implemented.

You are not allowed to claim:

> "No bugs."

unless automated/manual testing has actually been performed.

If a requested feature is technically impossible on a particular version, clearly explain the limitation and implement the closest safe alternative.

Never silently replace a requested feature with a fake implementation.

---

# 70. DEVELOPMENT WORKFLOW

Build the project in phases.

PHASE 1:
- project setup
- API
- models
- storage
- configuration

PHASE 2:
- border manager
- geometry
- commands
- selection

PHASE 3:
- player assignment
- visual border system

PHASE 4:
- movement enforcement
- teleport handling
- ender pearl handling

PHASE 5:
- render/chunk optimization

PHASE 6:
- PlaceholderAPI

PHASE 7:
- integrations

PHASE 8:
- tests

PHASE 9:
- performance audit

PHASE 10:
- documentation
- release packaging

Do not rush all features into one giant class.

---

# 71. FINAL PRODUCT STANDARD

The finished FakeBorder plugin should feel like:

> A polished, enterprise-quality border framework rather than a simple WorldBorder command plugin.

The administrator should be able to:

- create borders
- delete borders
- resize borders
- move borders
- select borders visually
- assign borders to players
- restrict escape
- control Ender Pearls
- control rendering
- control chunk behavior
- control damage
- create global border-only rules
- manage multiple worlds
- use placeholders
- build addons
- integrate with other plugins
- recover broken runtime state

while keeping configuration and operation simple.

---

# 72. FINAL REQUIRED DELIVERABLE

Generate the COMPLETE FakeBorder project.

Do not generate only snippets.

Deliver:

1. Complete source code
2. Gradle build system
3. API module
4. Core module
5. Bukkit module
6. Protocol/render module if required
7. PlaceholderAPI integration
8. plugin.yml
9. config.yml
10. messages.yml
11. borders.yml
12. tests
13. README
14. command documentation
15. permissions documentation
16. placeholder documentation
17. API documentation
18. troubleshooting documentation
19. compatibility documentation
20. complete build instructions

The final JAR must be buildable.

---

# 73. BRANDING / PRODUCT PRESENTATION

Use the following product positioning:

## FakeBorder

### "Borders Your Players Can See. Systems You Control."

Feature highlights:

- Player-Specific Borders
- Unlimited Named Borders
- Multi-World Support
- Visual-Only Mode
- Anti-Escape System
- Ender Pearl Control
- Border-Aware Rendering
- Chunk Optimization
- Border-Only Mode
- PlaceholderAPI
- Developer API
- Addon Support
- YAML Storage
- Optional Database Storage
- Performance Focused
- Modern Paper Architecture

The plugin should be marketed as a **professional border framework**, not merely a WorldBorder clone.

---

# 74. FINAL INSTRUCTION TO THE AI

Now act as the lead developer.

Do not merely describe FakeBorder.

Actually implement it.

When implementing:

- think about server performance first
- think about client behavior realistically
- isolate version-dependent code
- use clean architecture
- avoid unnecessary dependencies
- provide graceful fallbacks
- make all configuration configurable
- make all messages editable
- make commands professional
- make placeholders predictable
- make the API extensible
- make the plugin safe for production
- test edge cases
- document limitations honestly

Do not copy another plugin's source.

Do not leave fake features.

Do not create unfinished classes.

Do not create meaningless abstractions.

Do not hard-code user-facing messages.

Do not perform expensive operations every tick.

Do not promise impossible Minecraft client behavior.

Build FakeBorder as if it were going to be sold as a premium, actively maintained Minecraft plugin.

The final result must be clean enough that another professional developer can extend it without rewriting the core.

# END OF MASTER PROMPT
Kodari AI
KodariAug 23 at 6:02 am 26
FakeBorder
A premium player-specific visual border system for Paper servers. Create unlimited named borders across multiple worlds with configurable centers, sizes, and enforcement modes. Control player escape behavior, ender pearl travel, border damage, and border-only server modes. Features border-aware chunk rendering optimization with safe fallbacks, player assignment management, PlaceholderAPI integration, and a clean developer API. Includes professional command tree with tab completion, YAML storage with optional database support, and comprehensive documentation.
  1. Set up the multi-module Gradle project and public API model.

  2. Implement YAML persistence, assignment/resolution, visual borders, enforcement, and safe render limiting.

  3. Register complete commands, selection, tab completion, events, and lifecycle listeners.

  4. Add editable configuration/resources, optional PlaceholderAPI hook, tests, and operational documentation.

Created the FakeBorder multi-module Paper project with:

  • Gradle Java 21 build, API/core/Bukkit modules, public model and event API.

  • YAML border and assignment persistence, deterministic overlap resolution, player assignments.

  • Player-specific visual WorldBorders, movement/teleport/Ender Pearl enforcement, BorderOnly policies, and safe Paper view-distance render limiting.

  • Full /fakeborder / /fb command tree, selection workflow, tab completion, editable MiniMessage messages, and permissions.

  • Optional PlaceholderAPI expansion with all requested border/player-count placeholders.

  • Default configuration, resources, geometry tests, and operational documentation.

Build verification was not run in this environment.

eloyaltyx

Escapeable Features Not Working Players Can Escape By Any No Matter Escapeable Allowed Or Not Player Can Still Escape Fix This

Kodari AI
KodariAug 28 at 4:32 am 3

The generation was stopped before any content could be produced.

eloyaltyx
📎 1 file 21,801 chars
📄
FakeBorder — Replace Existing RenderLimit System Only.md
md 1479 lines
▶
# FAKEBORDER — RENDERLIMIT SYSTEM REPLACEMENT PROMPT
## MODIFY EXISTING PLUGIN — DO NOT REBUILD FAKEBORDER

You are an expert Minecraft Paper/Java/Protocol developer.

I already have a fully working plugin named **FakeBorder**.

Your job is NOT to create a new plugin.

Your job is NOT to rewrite FakeBorder.

Your job is ONLY to completely replace/fix the existing **RenderLimit / `limitrender` implementation** with the system described below.

Everything else in the existing FakeBorder plugin must remain working exactly as it currently does.

---

# 1. ABSOLUTE RULE

DO NOT MODIFY unrelated FakeBorder systems.

Keep all existing:

- commands
- border creation
- border deletion
- border resizing
- border center
- pos1/pos2
- enable/disable
- fix
- escapeable/escapable
- Ender Pearl behavior
- BorderOnly
- player assignment
- PlaceholderAPI
- messages
- borders.yml
- storage
- API
- existing visual WorldBorder
- existing movement system
- existing damage system

unless a tiny integration change is strictly required for the new RenderLimit system.

The ONLY major system being changed is:

```text
FakeBorder RenderLimit
```

---

# 2. CURRENT PROBLEM

The old RenderLimit implementation is wrong.

It treats RenderLimit as if:

```text
RenderLimit = player's render distance
```

For example, if the plugin uses:

```text
limitrender = 2
```

it may effectively make the player render only around 2 chunks.

That is NOT what I want.

Remove this behavior.

---

# 3. WHAT RENDERLIMIT ACTUALLY MEANS

RenderLimit means:

> Keep the player's normal Minecraft render distance inside the FakeBorder, while preventing/suppressing world chunks outside the FakeBorder from being rendered/received where technically possible.

Example:

Player's normal render distance:

```text
64 chunks
```

FakeBorder:

```text
1000 × 1000 blocks
```

RenderLimit:

```text
true
```

The player must NOT become:

```text
2 chunks
```

Instead:

```text
NORMAL PLAYER RENDER DISTANCE = 64
```

remains intact.

The FakeBorder acts as a **world visibility boundary**.

---

# 4. SIMPLE VISUAL EXAMPLE

Imagine:

```text
Player Render Distance = 64
```

and the player is here:

```text
                         OUTSIDE
                  CHUNKS MUST BE LIMITED
                           ↓
             ┌─────────────────────────┐
             │                         │
             │       FAKEBORDER        │
             │                         │
             │           ● PLAYER      │
             │                         │
             │                         │
             └─────────────────────────┘
```

The player should be able to render far inside the border.

If the player is near the right edge:

```text
                  64 CHUNKS
        ←────────────────────────●
                                 PLAYER
                           │
                           │ FAKEBORDER
                           │
                           │
                      OUTSIDE
                    BLOCK/SUPPRESS
```

The player still has a large render distance toward the **inside**.

Only the **outside direction** is clipped.

This is the most important requirement.

---

# 5. DO NOT REDUCE VIEW DISTANCE

Do NOT implement the new system by doing things such as:

```java
player.setViewDistance(2);
```

or:

```java
server.setViewDistance(2);
```

or changing:

```text
view-distance
simulation-distance
```

to achieve the border effect.

The player's configured/client render distance must remain untouched.

If the player has:

```text
64
```

they continue having:

```text
64
```

as their normal render distance.

---

# 6. CORRECT FORMULA

Think of the system as:

```text
NORMAL PLAYER RENDER AREA
                +
        FAKEBORDER CLIPPING
```

or mathematically:

```text
Effective Visible Chunks =
Normal Player Render Chunks
INTERSECT
FakeBorder Allowed Chunks
```

NOT:

```text
Effective Render Distance = 2
```

---

# 7. CHUNK-BASED VISIBILITY

The new system should operate on chunks.

For each chunk relevant to the player:

```text
chunkX
chunkZ
```

calculate its world-space area.

A chunk is approximately:

```text
16 × 16 blocks
```

Determine whether the chunk is:

```text
INSIDE BORDER
```

or:

```text
OUTSIDE BORDER
```

or optionally:

```text
BORDER BUFFER
```

---

# 8. BORDER CLIPPING

Suppose:

```text
Player render distance = 64
FakeBorder size = 1000
```

If the player is in the center:

```text
          64 chunk range
       ┌──────────────────┐
       │                  │
       │   ┌──────────┐   │
       │   │ BORDER   │   │
       │   │    ●     │   │
       │   └──────────┘   │
       │                  │
       └──────────────────┘
```

The player's normal render distance remains available because the border is farther away than the render range.

If the player moves close to the edge:

```text
     INSIDE BORDER
███████████████████│
███████████████████│ BORDER
███████████████████│
                    │
                    │
                    OUTSIDE
                    BLOCKED
```

The renderer becomes directional.

---

# 9. BUFFER

If the existing FakeBorder plugin already has a RenderLimit distance setting, reinterpret it correctly.

If it has:

```text
limitrender = 2
```

do NOT use that as:

```text
render distance = 2
```

Instead treat it as an optional:

```text
border buffer
```

if appropriate.

Example:

```yaml
render:
  limit-render: true
  buffer-chunks: 2
```

Meaning:

```text
0 = strict border clipping
2 = allow approximately 2 chunks of controlled buffer
```

The buffer MUST NOT modify the player's overall render distance.

If the current plugin does not have a numeric limit value, simply add:

```yaml
buffer-chunks
```

without breaking the existing configuration.

---

# 10. PLAYER-SPECIFIC

This is extremely important.

FakeBorder can have different borders for different players.

Example:

```text
Player A → Border A
Player B → Border B
```

Player A's chunk visibility must be calculated independently from Player B's.

Never globally unload a chunk because Player A cannot see it.

For example:

```text
Player A cannot see Chunk 100,100
Player B can see Chunk 100,100
```

The chunk must remain loaded for Player B.

Therefore:

## NEVER use global world chunk unloading as the player-specific RenderLimit mechanism.

---

# 11. EXISTING VISUAL BORDER

Do not remove or replace the existing visual FakeBorder system.

The current visual border must continue working.

The new RenderLimit system works alongside it:

```text
Visual Border
      +
Movement System
      +
RenderLimit
```

RenderLimit must not become the visual border itself.

---

# 12. PLAYER CHUNK STATE

Create or modify the existing player-specific render tracking.

Track something similar to:

```text
Player UUID
Current World
Current Chunk X
Current Chunk Z
Current Border
Border Revision
Player Render Distance
Buffer
Sent Chunks
Allowed Chunks
Blocked Chunks
```

Do not store Bukkit Player objects forever.

Clean everything on:

```text
PlayerQuitEvent
WorldUnloadEvent
PluginDisableEvent
```

---

# 13. DO NOT RECALCULATE EVERYTHING EVERY TICK

The old implementation must not brute-force huge areas every tick.

Do not do:

```text
every player
    every tick
        every 64×64 chunk
            calculate again
```

Instead update when necessary:

- player changes chunk
- player changes border
- border moves
- border resizes
- RenderLimit changes
- player changes world
- player teleports
- player reconnects
- render distance changes
- border is enabled
- border is disabled

Use:

- caching
- dirty flags
- border revision numbers
- incremental updates
- throttling
- batching

---

# 14. BORDER REVISION

Add a lightweight revision/version to the runtime border state if the existing architecture does not already have one.

Example:

```text
Border revision = 15
```

When:

```text
resize
center
limitrender
enable
disable
```

changes:

```text
revision++
```

Player render caches can detect:

```text
cached revision != current revision
```

and refresh.

---

# 15. PLAYER MOVEMENT

When a player moves from one chunk to another:

DO NOT rebuild the entire visibility map unnecessarily.

Calculate only the difference.

Example:

```text
OLD VISIBLE CHUNKS
        ↓
NEW VISIBLE CHUNKS
        ↓
ADD NEW VALID CHUNKS
REMOVE INVALID CHUNKS
```

This is especially important for players with:

```text
32
64
```

render distance.

---

# 16. CHUNK OUTSIDE BORDER

If a chunk is outside the permitted FakeBorder visibility area:

The plugin should prevent the player from receiving/maintaining that chunk where safely possible.

Use the best available mechanism for the target Paper version.

Possible approaches include:

- Paper-supported player chunk tracking
- per-player chunk visibility
- packet-level chunk control
- ProtocolLib where required
- player-specific unload/suppression

Do not use global chunk unloading.

---

# 17. ALREADY SENT CHUNKS

The Minecraft client may already have a chunk cached.

Therefore:

```text
Preventing a future chunk send
```

is different from:

```text
Removing an already received chunk
```

The implementation must handle both.

When an already-sent chunk becomes outside the border:

- identify it
- safely remove/suppress it for that player where supported
- update internal state
- avoid repeated unload packets

If a specific Minecraft version prevents completely reliable client-side removal, use the safest available fallback and document it.

---

# 18. CHUNK GENERATION

RenderLimit must not cause unnecessary world generation.

Example:

Player:

```text
render distance = 64
```

Border:

```text
500 × 500
```

The server must not generate enormous amounts of terrain outside the FakeBorder simply because the player has a large render distance.

Where technically safe, prevent unnecessary generation outside the border.

BUT:

Do not globally cancel world generation required by another player.

Everything must remain player-aware.

---

# 19. MULTI-WORLD

The system must continue working with:

- Overworld
- Nether
- End
- custom worlds
- Multiverse worlds

Never assume:

```text
world
```

is the only world.

---

# 20. BORDER RESIZE

Existing command:

```text
/fakeborder resize  
```

must automatically update RenderLimit.

Example:

```text
/fb resize Arena 2000
```

The render system should detect the border revision change and update affected players.

No restart.

No reload.

No manual `/fix` required.

---

# 21. BORDER CENTER

Existing:

```text
/fakeborder center 
```

must also invalidate the render cache.

The new center must immediately affect chunk visibility.

---

# 22. LIMITRENDER COMMAND

Keep the existing command:

```text
/fakeborder limitrender 
```

It should mean:

```text
true
```

= enable border-aware chunk visibility.

```text
false
```

= disable border-aware chunk visibility and return that player/border to normal rendering behavior.

If the existing plugin supports per-border settings, preserve them.

Do not break existing command syntax.

---

# 23. CONFIGURATION

Modify the existing `config.yml` only as much as necessary.

Recommended:

```yaml
render:
  limit-render: false

  buffer-chunks: 2

  update-interval-ticks: 2

  max-chunk-operations-per-tick: 50

  prevent-generation-outside-border: false
```

If the plugin already uses different names, preserve backward compatibility where possible.

Do not randomly rename existing configuration keys.

---

# 24. EXISTING FILES

Do NOT unnecessarily create a completely different configuration structure.

Keep:

```text
config.yml
messages.yml
borders.yml
```

working.

If migration is necessary:

- automatically migrate old values
- preserve user settings
- document migration
- never silently delete configuration

---

# 25. PLACEHOLDERS

Do not break:

```text
%fakeborder_playercount_%
```

or:

```text
%fakeborder_border%
```

The RenderLimit rewrite must not alter their existing behavior.

---

# 26. FIX COMMAND

Existing:

```text
/fakeborder fix 
```

must also repair RenderLimit state.

After executing:

```text
/fakeborder fix Arena
```

the plugin should:

1. increment border revision
2. invalidate affected player render caches
3. recalculate allowed chunks
4. remove stale blocked/sent state
5. resend required chunks where safe
6. restore visual state if necessary

Do not delete the border.

---

# 27. FAILSAFE

If advanced packet/chunk visibility fails:

DO NOT:

- crash the server
- kick players
- globally unload chunks
- permanently blind players
- corrupt chunk state

Instead:

```text
log error
↓
disable advanced RenderLimit for affected session if necessary
↓
restore normal rendering
↓
keep FakeBorder visual system working
```

---

# 28. VERSION SAFETY

Minecraft chunk packet behavior changes between versions.

Do not hard-code one packet structure and assume it works forever.

Keep version-dependent logic isolated.

Preferred architecture:

```text
RenderLimitService
        ↓
ChunkVisibilityAdapter
        ↓
Paper/Protocol implementation
```

If ProtocolLib is already installed in the project, integrate cleanly with the existing dependency.

Do not make the entire FakeBorder codebase dependent on ProtocolLib classes.

---

# 29. IMPORTANT EXAMPLE — 64 CHUNKS

Test:

```text
Player Render Distance = 64
FakeBorder = 5000 blocks
RenderLimit = true
```

Player is in the center.

Expected:

```text
Player can render normally up to their 64-chunk range.
```

NOT:

```text
2 chunks
```

NOT:

```text
5 chunks
```

NOT:

```text
border size / 16
```

---

# 30. IMPORTANT EXAMPLE — NEAR BORDER

Player:

```text
Render Distance = 64
```

Player is close to the border.

Expected:

```text
INSIDE BORDER
<---------------- 64 chunks ---------------->
PLAYER

OUTSIDE BORDER
<--- blocked/suppressed --->
```

The player still gets their full possible render distance toward the interior.

---

# 31. IMPORTANT EXAMPLE — SMALL BORDER

Border:

```text
100 × 100 blocks
```

Player:

```text
64 render distance
```

The player should NOT render 64 chunks outside the border.

The allowed area is limited by the border.

The player can still render the available interior world.

---

# 32. IMPORTANT EXAMPLE — LOW PLAYER RENDER DISTANCE

Player:

```text
render distance = 8
```

FakeBorder:

```text
limit-render = true
```

The plugin must NOT increase them to 64.

Effective visibility can only be:

```text
player's normal 8-chunk range
```

further clipped by the FakeBorder.

Formula:

```text
Effective =
Player Render Distance
INTERSECT
FakeBorder Visibility
```

---

# 33. IMPORTANT EXAMPLE — LIMITRENDER FALSE

Player:

```text
render distance = 64
```

Border:

```text
limit-render = false
```

Expected:

Normal rendering.

FakeBorder may still show the visual border and perform its other configured systems.

---

# 34. DIRECTIONAL CLIPPING

This is the most important visual behavior.

DO NOT implement a circular/square render-distance reduction centered around the player.

Example WRONG:

```text
             PLAYER
                ●
           ┌────────┐
           │  2     │
           │ chunks │
           └────────┘
```

Correct:

```text
                 NORMAL RENDER RANGE
           ←──────────────────────────→
                     PLAYER
                       ●
                       │
                       │ BORDER
                       │
                       │
                  OUTSIDE BLOCKED
```

The border itself determines the clipping boundary.

---

# 35. PERFORMANCE

The new RenderLimit system must be optimized for:

- 10 players
- 50 players
- 100 players
- large render distances
- multiple borders
- multiple worlds

Avoid:

- full world scans
- block-by-block calculations
- 64×64 brute-force loops every tick
- global chunk unloads
- synchronous database operations
- repeated identical packet sends

Use mathematical chunk bounds whenever possible.

---

# 36. DEBUG

If the existing plugin has debug functionality, extend it.

Otherwise add an optional debug mode.

Example:

```yaml
debug:
  render-limit: false
```

Debug information should show:

```text
Player:
Border:
Render Distance:
Border Size:
Buffer:
Current Chunk:
Allowed Chunks:
Blocked Chunks:
Sent Chunks:
Render Strategy:
Border Revision:
```

Only show it when debugging.

---

# 37. DO NOT CHANGE THE REST OF FAKEBORDER

Again:

This is a modification request.

Do NOT rebuild:

```text
FakeBorder
```

from scratch.

Inspect the existing code first.

Find the current:

```text
RenderLimit
limitrender
chunk visibility
chunk loading
render distance
packet
```

implementation.

Replace ONLY the relevant implementation.

Reuse existing:

- BorderManager
- FakeBorder model
- Player assignment
- configuration
- commands
- services
- events
- API
- integrations

where appropriate.

---

# 38. CODE QUALITY

Before modifying anything:

1. Inspect the current project.
2. Identify all RenderLimit-related classes.
3. Identify all callers.
4. Identify configuration keys.
5. Identify command handling.
6. Identify packet/chunk integrations.
7. Identify existing caches.
8. Identify existing player-border resolution.
9. Identify compatibility abstractions.

Then implement the new RenderLimit system using the existing architecture.

Do not duplicate existing systems.

Do not create a second BorderManager.

Do not create a second PlayerAssignmentService.

Do not create duplicate event listeners.

---

# 39. BACKWARD COMPATIBILITY

Existing servers using FakeBorder should not lose their configuration.

Preserve:

```text
/fakeborder limitrender true
/fakeborder limitrender false
```

and existing border configuration.

If old RenderLimit configuration means something different, migrate it safely.

Explain the migration clearly.

---

# 40. ACCEPTANCE TEST

The new implementation is correct only if this exact test passes:

SERVER:

```text
Paper
```

PLAYER:

```text
Render Distance = 64
```

BORDER:

```text
1000 × 1000 blocks
```

RENDER LIMIT:

```text
true
```

BUFFER:

```text
2 chunks
```

Player is inside the center.

EXPECTED:

```text
Player retains 64 render distance.
```

When the player approaches the border:

```text
Inside:
normal rendering continues as far as the player's 64-chunk range allows.

Outside:
chunks beyond the FakeBorder are blocked/suppressed as safely possible.

Buffer:
approximately 2 chunks may remain visible if configured.
```

The player MUST NOT suddenly become:

```text
2 chunk render distance.
```

---

# 41. SECOND ACCEPTANCE TEST

Player is 1 chunk from the border.

Render distance:

```text
64
```

Expected:

```text
Toward the interior:
large/full available render range.

Toward the outside:
clipped at the FakeBorder + configured buffer.
```

This must be directional.

---

# 42. THIRD ACCEPTANCE TEST

Player is in the center of a huge border.

Border:

```text
10000 × 10000
```

Render distance:

```text
64
```

Expected:

```text
normal 64-chunk rendering
```

because the border is farther away than the player's render area.

---

# 43. FOURTH ACCEPTANCE TEST

Player has:

```text
render distance = 8
```

FakeBorder:

```text
limitrender = true
```

Expected:

```text
maximum normal render = 8
```

FakeBorder may reduce it because of the border.

FakeBorder must NEVER increase it.

---

# 44. FIFTH ACCEPTANCE TEST

Two players:

```text
Player A → Border A
Player B → Border B
```

Their visibility must be independent.

A chunk hidden from Player A must still be visible to Player B if Border B allows it.

---

# 45. SIXTH ACCEPTANCE TEST

Execute:

```text
/fakeborder resize Arena 500
```

Expected:

RenderLimit updates automatically.

No restart.

No reload.

No reconnect.

---

# 46. SEVENTH ACCEPTANCE TEST

Execute:

```text
/fakeborder center Arena
```

Expected:

RenderLimit recalculates around the new center.

---

# 47. EIGHTH ACCEPTANCE TEST

Execute:

```text
/fakeborder limitrender false
```

Expected:

The affected border/player returns to normal chunk rendering behavior.

---

# 48. FINAL IMPLEMENTATION REQUIREMENT

After modifying the code:

- compile the complete existing project
- resolve all compilation errors
- inspect all RenderLimit call sites
- verify no duplicate listeners exist
- verify no global chunk unload is being used incorrectly
- verify normal player render distance is untouched
- verify border clipping is player-specific
- verify multi-world behavior
- verify teleport behavior
- verify reconnect behavior
- verify border resize
- verify border center changes
- verify `/fakeborder fix`
- verify `/fakeborder limitrender`
- verify PlaceholderAPI is unaffected

Do not report the system as fixed until the implementation actually compiles.

---

# FINAL CORE REQUIREMENT

Remember this exact distinction:

```text
PLAYER RENDER DISTANCE
        ↓
How far Minecraft normally renders around the player.

FAKEBORDER RENDER LIMIT
        ↓
Which portion of that normal render area is allowed
based on the FakeBorder boundary.
```

Therefore:

```text
Player Render Distance = 64
FakeBorder Limit = ON
Buffer = 2
```

means:

```text
             PLAYER
                ●

       ←── UP TO 64 CHUNKS ──→
                │
                │
       ┌────────┴────────┐
       │   FAKEBORDER    │
       │                 │
       │    VISIBLE      │
       │                 │
       └────────┬────────┘
                │
             BUFFER
                │
          OUTSIDE BLOCKED
```

It does NOT mean:

```text
Player Render Distance = 2
```

The `2` is only the optional border buffer.

Keep the player's actual render distance untouched.

Implement the new system inside the EXISTING FakeBorder project, replacing only the old RenderLimit implementation.

# END OF PROMPT
Kodari AI
KodariAug 28 at 4:45 am 29
  1. Inspect the existing RenderLimit implementation, its command/configuration hooks, and player-border resolution before replacing only that system.

  1. Escape enforcement: correct the escapable check so movement and Ender Pearl handling block only non-escapable borders.

  2. RenderLimit: replace the view-distance limiter with player-specific border-aware chunk visibility, without modifying normal render distance.

Escape prevention now defaults to blocking non-escapable borders; listeners can explicitly allow an escape by uncancelling the escape-attempt event. The Ender Pearl check now honors escapable too.

  1. Escapeable fixed: non-escapable borders now block regular movement and Ender Pearl escapes. Escape-attempt events default to cancelled, while integrations can still explicitly allow an escape.

  2. RenderLimit replaced: it no longer calls Player#setViewDistance, so players retain their normal Minecraft/client render distance.

  3. Directional chunk clipping: RenderLimit now evaluates chunks against each player’s assigned/resolved border plus the configured buffer. With ProtocolLib installed, outside chunk packets are cancelled and already-sent outside chunks receive per-player unload packets—never globally unloading world chunks.

  4. State/lifecycle: per-player render state is cleared on quit, world unload, disable, assignment changes, border edits, /fb fix, reload, and /fb limitrender.

  5. ProtocolLib integration: added as an optional soft dependency. Without it, FakeBorder safely preserves normal rendering and logs that chunk suppression is unavailable rather than reducing render distance or risking global chunk state.

Kodari can make mistakes. Review important code before using.
Files
fakeborder-api
fakeborder-bukkit
fakeborder-core
ADDON_DEVELOPMENT.md
API.md
build.gradle
COMMANDS.md
COMPATIBILITY.md
CONFIGURATION.md
gradle.properties
INSTALLATION.md
manifest.kod
PERFORMANCE.md
PERMISSIONS.md
PLACEHOLDERS.md
README.md
settings.gradle
TROUBLESHOOTING.md
Code
49 1,734
fakeborder-bukkit/src/main/java/com/fakealt/fakeborder/bukkit/FakeBorderPlugin.java
package com.fakealt.fakeborder.bukkit;

import com.fakealt.fakeborder.api.FakeBorderManager;
import com.fakealt.fakeborder.core.AssignmentRepository;
import com.fakealt.fakeborder.core.BorderAssignmentService;
import com.fakealt.fakeborder.core.BorderRepository;
import com.fakealt.fakeborder.core.BorderService;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class FakeBorderPlugin extends JavaPlugin {
    private static FakeBorderPlugin instance;
    private Settings settings;
    private Messages messages;
    private BorderAssignmentService assignments;
    private BorderService borders;
    private BorderVisualService visuals;
    private BorderRenderService rendering;
    private ChunkVisibilityAdapter chunkVisibility;
    private BorderEnforcementService enforcement;
    private boolean placeholderApiEnabled;

    public static FakeBorderPlugin getInstance() { return instance; }
    public FakeBorderManager getFakeBorderManager() { return borders; }
    public boolean isPlaceholderApiEnabled() { return placeholderApiEnabled; }

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();
        saveResource("messages.yml", false);
        saveResource("borders.yml", false);
        settings = new Settings(this);
        messages = new Messages(this);
        assignments = new BorderAssignmentService(new AssignmentRepository(this));
        assignments.load();
        borders = new BorderService(new BorderRepository(this), assignments);
        borders.load();
        visuals = new BorderVisualService(borders);
        rendering = new BorderRenderService(borders, settings);
        hookChunkVisibility();
        enforcement = new BorderEnforcementService(borders, settings);
        registerCommand();
        Bukkit.getPluginManager().registerEvents(new FakeBorderListener(borders, visuals, rendering, enforcement), this);
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            visuals.refreshAll();
            rendering.refreshAll();
        }, 20L, Math.max(20L, getConfig().getLong("render.update-interval-ticks", 10L)));
        Bukkit.getScheduler().runTaskTimer(this, enforcement::damageOutsidePlayers, 20L, Math.max(20L, getConfig().getLong("damage.interval-ticks", 20L)));
        hookPlaceholderApi();
        getLogger().info("FakeBorder v" + getPluginMeta().getVersion() + " enabled. Loaded " + borders.getBorders().size() + " borders and " + assignments.size() + " assignments.");
    }

    @Override
    public void onDisable() {
        if (borders != null) borders.save();
        if (visuals != null) Bukkit.getOnlinePlayers().forEach(visuals::clear);
        if (rendering != null) Bukkit.getOnlinePlayers().forEach(rendering::clear);
        if (chunkVisibility != null) chunkVisibility.close();
        instance = null;
    }

    private void registerCommand() {
        PluginCommand command = getCommand("fakeborder");
        if (command == null) throw new IllegalStateException("fakeborder command is missing from plugin.yml");
        FakeBorderCommand executor = new FakeBorderCommand(this, borders, assignments, new SelectionService(), settings, messages, visuals, rendering);
        command.setExecutor(executor);
        command.setTabCompleter(executor);
    }

    private void hookPlaceholderApi() {
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") == null) return;
        try {
            placeholderApiEnabled = new FakeBorderPlaceholderExpansion(this, borders, settings).register();
            if (placeholderApiEnabled) getLogger().info("PlaceholderAPI hooked.");
        } catch (LinkageError error) {
            getLogger().warning("PlaceholderAPI was detected but its API could not be loaded.");
        }
    }

    private void hookChunkVisibility() {
        if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
            getLogger().warning("ProtocolLib is not installed; RenderLimit will preserve normal view distance but cannot suppress chunk packets.");
            return;
        }
        try {
            chunkVisibility = new ProtocolLibChunkVisibilityAdapter(this, rendering);
            rendering.setVisibilityAdapter(chunkVisibility);
            getLogger().info("ProtocolLib chunk visibility enabled for RenderLimit.");
        } catch (LinkageError | RuntimeException exception) {
            getLogger().warning("ProtocolLib chunk visibility could not be enabled; RenderLimit will preserve normal rendering.");
        }
    }
}