๐
pasted-code-1775828338225.txt
txt
176 lines
โถ
UPDATED PLUGIN GENERATION PROMPT (COPY & USE)
Create a fully functional, optimized Minecraft plugin with the following specifications:
---
๐น Plugin Information
- Name: NyxBillHologram
- Java Version: 21
- Minecraft Version: 1.21.11+ (must support lower minor versions under 1.21.11 as well)
- Type: Advanced Hologram System (Billboard-style but STATIC, no player-facing rotation)
---
๐น Core Features
1. Static Holograms
- Holograms MUST NOT rotate toward players.
- They remain fixed in direction.
- Rotation only changes manually via command or wand.
2. Full Color Support
- Supports legacy color codes ("&a", "&l", etc.)
- Supports HEX colors ("#FFFFFF")
- Supports formatting: bold, italic, underline, etc.
3. Multi-line System
- Each hologram supports multiple lines.
- Stored and editable via "text.yml".
4. Text Shadow
- Toggleable shadow rendering (true/false).
5. Background System
- Supports:
- Transparent background
- Custom color background (HEX or named)
---
๐น PlaceholderAPI Support (IMPORTANT)
- Full integration with PlaceholderAPI
- Support ALL types of placeholders dynamically:
- Standard placeholders โ "%server_online%", "%player_name%", etc.
- Bungee placeholders โ "%bungee_%"
- Velocity placeholders โ "%velocity_%"
- Auto-detect installed expansions
- Real-time updating (configurable refresh interval)
- Safe fallback if PlaceholderAPI is missing
- Hook system:
- Soft-depend in "plugin.yml"
- No errors if not installed
---
๐น Commands
Implement ALL commands with permissions + tab completion:
- "/nbh create (name) (text)"
- "/nbh addline (name) (text)"
- "/nbh removeline (name) (line)"
- "/nbh movehere (name)"
- "/nbh move (name) (x y z)"
- "/nbh rotate (name) (yaw)"
- "/nbh textshadow (name) (true/false)"
- "/nbh background (name) (color/transparent)"
- "/nbh wand (name)"
- "/nbh remove (name)"
- "/nbh reload"
- "/nbh help"
---
๐น Wand Tool System
- Custom stick item:
- Name: "&aNyxBill Wand"
- Custom lore
- NBT-tagged (prevent duplication/abuse)
Functions:
- Right-click:
- Ray trace block
- Snap hologram perfectly to surface (wall/floor/ceiling)
- Left-click:
- Rotate hologram smoothly (+15ยฐ per click)
---
๐น File System
config.yml
- text-shadow-default
- background-default
- line-spacing
- render-distance
- placeholder-refresh-interval (ticks)
- debug-mode
text.yml
Stores:
- name
- world, x, y, z, yaw
- lines (with placeholders supported)
- shadow
- background
---
๐น Technical Requirements
- Use TextDisplay entities (preferred)
- Fallback to ArmorStand if needed
- Highly optimized:
- Minimal entity usage
- Efficient updates
- No memory leaks
- Async-safe placeholder updates
- Modular structure:
- "HologramManager"
- "CommandManager"
- "WandManager"
- "PlaceholderHook"
---
๐น Extra Features
- Prevent:
- Auto rotation
- Player-facing behavior
- Ensure:
- Perfect wall alignment using ray tracing
- Smooth rotation system
- Add:
- Permissions ("nyxbillhologram.*")
- Console support
- Clean colored messages
- Debug logging toggle
---
๐น Output Requirements
- Full ready-to-compile source code
- Proper package structure
- Includes:
- "plugin.yml" (with softdepend: PlaceholderAPI)
- Well-commented code
- Professional formatting
---
๐น Goal
Build a high-performance, modern hologram system that:
- Supports dynamic placeholders (including Bungee/Velocity)
- Stays fully static unless manually controlled
- Looks cleaner and performs better than existing hologram plugins
---
END OF PROMPT
Iโll create a fully functional, optimized hologram system with static displays, PlaceholderAPI support, and a wand tool system.
All files created successfully! This hologram system features:
Core Features:
Static TextDisplay holograms (no rotation toward players)
Full color support (legacy codes
&a, HEX#FFFFFF, formatting)Multi-line system with dynamic PlaceholderAPI integration
Toggleable text shadows and customizable backgrounds
Wand System:
NBT-tagged stick with right-click surface snapping via ray tracing
Left-click rotates hologram +15ยฐ per click
Prevents duplication through PersistentDataContainer
Technical Highlights:
Async-safe placeholder updates with change detection
Optimized entity management with lazy initialization
Modular architecture with dedicated managers
Full command system with tab completion and permissions
Safe PlaceholderAPI soft-depend (no errors if missing)
It is so glitchy. I made a hologram and remove but it didn't remove. I restarted the server. It duplicated and so glitchy. Give fix.
Iโll read all the files to identify the issues causing the glitchy hologram behavior.
I found critical bugs causing hologram duplication and glitchy removal:
Problems:
TextDisplay entities persist across restarts but lose tracking (transient displays list)
Old entities arenโt found/removed before spawning new ones โ duplication
Remove command canโt delete entities it canโt track
No cleanup of orphaned entities from crashes
Fixes:
Add entity cleanup before spawning (search nearby TextDisplay entities)
Store entity UUIDs in hologram data for tracking
Add orphaned entity cleanup on plugin startup
Fixed all hologram duplication and removal bugs by implementing proper entity tracking with UUIDs and aggressive cleanup of orphaned TextDisplay entities on startup.
Make it the player placeholder works. So %player_name% always shows the player name. And also ajlb plugin placeholders luke this - '&#FF3636#%ajlb_position_statistic_deaths_alltime% &7| &f%player_name%: &#FF3636%ajlb_value_statistic_deaths_alltime% โ ' must show the player name. Give full fixed.
Iโll read all the relevant files to understand the current placeholder system and fix it.
Iโll fix the placeholder system to support player-specific placeholders. The issue is that placeholders are being parsed with null player context. Iโll implement a system that uses nearby players or online players as context for parsing.
Now I understand the issue. The problem is that PlaceholderHook.parsePlaceholders() is passing null as the player, which means player-specific placeholders like %player_name% and AJLB placeholders wonโt work.
The solution is to make holograms render differently for each player viewing them. This requires:
Per-player rendering system
Packet-based displays instead of actual entities
Or simpler: use a nearby player for placeholder parsing
Iโll implement a viewer-based system that shows personalized holograms to each player within range:
Fixed! The hologram system now:
Renders personalized holograms for each player within range
Parses
%player_name%and other player-specific placeholders correctlySupports AJLB and all PlaceholderAPI placeholders with player context
Updates per-player every tick (configurable via
placeholder-refresh-interval)Automatically despawns holograms outside render distance
๐
pasted-code-1775834581753.txt
txt
118 lines
โถ
FIX PROMPT โ PER-PLAYER PLACEHOLDERS (%player_name% UNIQUE FOR EACH PLAYER)
Modify the plugin so holograms are player-specific (packet-based) instead of global entities. Each player must see their own placeholders like "%player_name%".
---
๐ฅ Core Change (IMPORTANT)
โ Current system = ONE entity for all players โ same text for everyone
โ
Required system = PER-PLAYER rendering โ different text per player
---
๐ง Implementation Guide
1. Switch to Player-Based Rendering
- DO NOT use one shared "TextDisplay" entity
- Instead:
- Either:
- Spawn separate TextDisplay per player
- OR (better):
- Use packets (ProtocolLib) to send fake entities per player
---
โ
Option 1 (Simpler) โ Per Player Entities
- Store:
Map> playerHolograms;
- When a player joins:
for (Hologram holo : holograms) {
holo.spawnForPlayer(player);
}
- Spawn hologram per player:
public void spawnForPlayer(Player player) {
String parsed = PlaceholderAPI.setPlaceholders(player, rawText);
parsed = colorize(parsed);
TextDisplay display = player.getWorld().spawn(location, TextDisplay.class);
display.setText(Component.text(parsed));
display.setBillboard(Display.Billboard.FIXED);
playerHolograms.computeIfAbsent(player.getUniqueId(), k -> new ArrayList<>()).add(display);
}
---
โ
Update Placeholders Per Player
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
List displays = playerHolograms.get(player.getUniqueId());
if (displays == null) continue;
for (int i = 0; i < displays.size(); i++) {
String parsed = PlaceholderAPI.setPlaceholders(player, lines.get(i));
parsed = colorize(parsed);
displays.get(i).text(Component.text(parsed));
}
}
}, 20L, 20L);
---
๐ Option 2 (BEST) โ Packet-Based (Advanced)
- Use ProtocolLib
- Send "TextDisplay" packets per player
- Do NOT actually spawn entities in the world
- Each player receives:
- Their own "%player_name%"
- Their own "%balance%" etc.
---
โ ๏ธ MUST FOLLOW
- "%player_name%" ONLY works if:
PlaceholderAPI.setPlaceholders(player, text);
- NEVER use:
null player โ
---
๐ Extra Fixes
- Remove global hologram rendering
- On player quit:
removePlayerHolograms(player);
- On reload:
- Respawn all per-player holograms
---
๐ฏ Final Goal
Each player sees:
Hello SmartBoyGamer
Hello AnotherPlayer
FROM SAME HOLOGRAM โ
---
END FIX PROMPT
Iโll analyze the current implementation and convert it to a per-player hologram system where each player sees their own placeholders.
Looking at the code, the per-player hologram system is already implemented! However, itโs missing player join/quit event handling. Holograms only spawn during the update task cycle, not immediately when a player joins.
Iโll add a listener to handle player join/quit events:
Now Iโll add the missing player join/quit event handling to make holograms spawn immediately when players join:
Summary:
The plugin now implements per-player hologram rendering where each player sees their own placeholders:
PlayerListener spawns holograms for players when they join (with render distance check)
PlaceholderManager updates each playerโs view independently every tick (configurable interval)
HologramRenderer manages separate TextDisplay entities per player
Hologram stores per-player displays in
Map<UUID, List<TextDisplay>>Players see their own
%player_name%,%balance%, etc. from the same hologram locationAutomatic cleanup on player quit and proper distance-based rendering
package com.nyxbill.hologram;
import com.nyxbill.hologram.listener.WandListener;
import com.nyxbill.hologram.manager.*;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class NyxBillHologram extends JavaPlugin {
private HologramManager hologramManager;
private WandManager wandManager;
private PlaceholderManager placeholderManager;
private CommandManager commandManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.hologramManager = new HologramManager(this);
this.wandManager = new WandManager(this);
this.placeholderManager = new PlaceholderManager(this);
this.commandManager = new CommandManager(this);
hologramManager.initialize();
wandManager.initialize();
placeholderManager.initialize();
commandManager.initialize();
Bukkit.getPluginManager().registerEvents(new WandListener(this), this);
Bukkit.getPluginManager().registerEvents(new com.nyxbill.hologram.listener.PlayerListener(this), this);
getLogger().info("NyxBillHologram has been enabled!");
}
@Override
public void onDisable() {
if (placeholderManager != null) {
placeholderManager.shutdown();
}
if (hologramManager != null) {
hologramManager.shutdown();
}
getLogger().info("NyxBillHologram has been disabled!");
}
}