Overview
TheRemain class is Foundation’s main compatibility layer, providing:
- Cross-version player methods
- JSON and component messaging
- Title and action bar support
- Boss bar rendering
- Particle effects
- Command registration
- NMS packet handling
- Block and entity manipulation
Many methods handle version differences automatically, allowing your plugin to work across multiple Minecraft versions
Player methods
getOnlinePlayers
Gets all online players (handles Collection vs Array return types).Collection of online players
getHealth
Gets entity health as integer (handles double vs int).The entity
The health value
getMaxHealth
Gets max health of entity.The entity
Maximum health value
getViewDistance
Gets player’s client view distance.The player
View distance in chunks
respawn
Respawns a player (handles different API versions).The player to respawn
Delay before respawn (default: 2)
JSON and components
sendJson
Sends a JSON message to a player.The recipient
The JSON string
toJson
Converts text to JSON format.The content to convert
JSON representation
toLegacyText
Converts JSON to legacy colored text.The JSON string
Throw exception if click/hover events found (default: true)
Legacy text with color codes
Title and action bar
sendTitle
Sends a title to the player.The player
Main title text
Subtitle text
Fade in time in ticks (default: 20)
Stay time in ticks (default: 60)
Fade out time in ticks (default: 20)
resetTitle
Clears the title from player’s screen.The player
sendActionBar
Displays text above hotbar.The player
The message to display
sendTablist
Sets tab list header and footer.The player
Header text (can be null)
Footer text (can be null)
Boss bar
sendBossbarPercent
Shows a boss bar with percentage.The player
The boss bar text
Fill percentage (0.0 to 1.0)
Bar color
Bar style
sendBossbarTimed
Shows boss bar for limited time.The player
The message
Duration in seconds
removeBossbar
Removes boss bar from player.The player
Block manipulation
setTypeAndData
Sets block type and data (handles legacy data values).The block to modify
The material to set
Legacy data value (pre-1.13)
setData
Sets block data value (legacy support).The block
The data value
setBed
Places a bed block correctly (handles legacy two-block beds).The initial block/location
Direction the bed should face
Entity spawning
spawnFallingBlock
Spawns a falling block entity.Where to spawn
The block type
Legacy data value
The spawned falling block
Command registration
newCommand
Creates a new plugin command instance.The command name
The command instance
registerCommand
Registers a command to the server.The command to register
unregisterCommand
Unregisters a command from the server.The command label
Also remove aliases (default: true)
Utility methods
newNamespaced
Creates a NamespacedKey (MC 1.13+).The key name (optional, generates random if null)
The namespaced key
getLocation
Gets the location of an inventory.The inventory
The location (null if not available)
getBiome
Gets biome at location (handles coordinate changes).The location
The biome
getLocale
Gets player’s client language.The player
Language code (e.g., “en_US”) or null
Advanced features
sendPacket
Sends an NMS packet to a player.The player
The NMS packet object
getHandleEntity
Gets the NMS entity handle.The Bukkit entity or block state
The NMS entity
Version checks
TheRemain class provides several boolean flags: