Overview
Players can right-click a dye item to toggle between seeing all players (Visible) and hiding all players (Hidden). The item automatically updates its appearance and display name based on the current state.Configuration
config.yml
Configuration Options
enabled
enabled
Enable or disable the player visibility feature.Type: Boolean
Default:
Default:
truevisible.item
visible.item
The material to display when players are visible.Type: Material
Default:
Suggestion: Use a green/positive colored item
Default:
LIME_DYESuggestion: Use a green/positive colored item
visible.text
visible.text
The display name shown when players are visible.Type: String (supports color codes)
Default:
Default:
&rPlayers: &aVisiblehidden.item
hidden.item
hidden.text
hidden.text
How It Works
Player receives the item
Give the player visibility item through join actions, custom items, or inventory configuration.
Right-click to toggle
When the player right-clicks the item, the visibility mode toggles between VISIBLE and HIDDEN.
Item updates automatically
The item in the player’s hand automatically changes to reflect the new state (swaps between lime dye and gray dye).
Permissions
Permission:hubbly.use.player_visibility
Players need this permission to use the player visibility toggler.
Database Integration
Player visibility preferences are automatically saved to the database (if enabled) and persist across sessions.PlayerVisibilityListener.java
Implementation Details
The system uses PersistentDataContainer to track the visibility state on the item itself:Visibility Modes
Two visibility modes are available:PlayerVisibilityMode.VISIBLE- All players are visiblePlayerVisibilityMode.HIDDEN- All other players are hidden
Custom Item Example
You can add the player visibility item to your custom items configuration:items.yml
config.yml
Best Practices
Choose intuitive colors
Use green/lime for visible and gray/red for hidden to make the state immediately clear to players.
Add to hotbar on join
Place the visibility toggler in an easily accessible hotbar slot (like slot 8 or 9) for quick access.
Troubleshooting
Item not working when clicked
Item not working when clicked
- Verify the player has the
hubbly.use.player_visibilitypermission - Check that
playervisibility.enabledis set totruein config.yml - Ensure the item has the correct PersistentDataContainer key
Players still visible when toggled to hidden
Players still visible when toggled to hidden
Preference not saving
Preference not saving
- Confirm database is enabled and connected in config.yml
- Check StorageManager logs for any database errors
- Verify the player_data table exists with the visibility column
Related Features
- Database Integration - Learn about persistent data storage
- Custom Items - Create custom items with actions