Placeholdar (PHAR)

A modern placeholder api

Placeholdar (PHAR)

This mod will no longer receive many updates in favor of Placeholder API

Placeholdar is a simple placeholder system for Hytale mods. It provides a parsing utility and an expansion framework for mods to register their own placeholders.

If you have ever used the minecraft plugin PlaceholderAPI(papi) this will seem familiar.

Getting started

Commands

/phar list
/phar enable
/phar disable
/phar test %player_name%

Built-in Placeholders

Exterenal Plugins

EconomyAPI

I have also added support to some plugins myself, if the plugin developers want to implement an official version please contact me to remove this one to prevent errors.

TheEconomy
EcoTale - Economy
Luckperms

* Enable these using /phar enable (theeconomy or ecotale)

Player Placeholders

Identifier: player

All player placeholders require a player context to work.

Placeholder Description Example Output
%player_uuid% Player's unique ID 123e4567-e89b-12d3-a456-426614174000
%player_name% Player's display name Sennecoolgames
%player_gamemode% Player's current game mode Adventure
%player_language% Player's language setting en_US
%player_world_name% Name of the world the player is in default
%player_world_uuid% UUID of the world the player is in 123e4567-e89b-12d3-a456-426614174000
%player_is_first_spawn% Whether this is the player's first spawn true or false
%player_fall_distance% Player's current fall distance (rounded) 15
%player_fall_distance_exact% Player's current fall distance (exact) 15.234

Position Placeholders

Placeholder Description Example Output
%player_x% Player's X coordinate (rounded) 125
%player_x_exact% Player's X coordinate (exact) 125.67
%player_y% Player's Y coordinate (rounded) 64
%player_y_exact% Player's Y coordinate (exact) 64.0
%player_z% Player's Z coordinate (rounded) -89
%player_z_exact% Player's Z coordinate (exact) -89.12

Health Placeholders

Placeholder Description Example Output
%player_health% Player's current health 20.0
%player_max_health% Player's maximum health 20.0
%player_min_health% Player's minimum health 0.0

Mana Placeholders

Placeholder Description Example Output
%player_mana% Player's current mana 100.0
%player_max_mana% Player's maximum mana 100.0
%player_min_mana% Player's minimum mana 0.0

Oxygen Placeholders

Placeholder Description Example Output
%player_oxygen% Player's current oxygen level 300.0
%player_max_oxygen% Player's maximum oxygen level 300.0
%player_min_oxygen% Player's minimum oxygen level 0.0

Stamina Placeholders

Placeholder Description Example Output
%player_stamina% Player's current stamina 100.0
%player_max_stamina% Player's maximum stamina 100.0
%player_min_stamina% Player's minimum stamina 0.0

Ammo Placeholders

Placeholder Description Example Output
%player_ammo% Player's current ammo 30.0
%player_max_ammo% Player's maximum ammo 30.0
%player_min_ammo% Player's minimum ammo 0.0

 


Server Placeholders

Identifier: server

Server placeholders work without a player context.

Server Information

Placeholder Description Example Output
%server_name% Server name My Hytale Server
%server_motd% Server message of the day Welcome to my server!
%server_password% Server password (if set) secret123
%server_players% Online player amount 4
%server_max_players% Maximum number of players 10
%server_default_world% Default world name default
%server_default_gamemode% Default game mode Adventure

Time & Date Placeholders

Placeholder Description Example Output
%server_time% Current time 14:35:42
%server_date% Current date 2026-01-30
%server_datetime% Current date and time 2026-01-30 14:35:42
%server_uptime% Server uptime 02:15:30:45 (days:hours:minutes:seconds)

Resource Usage Placeholders

Placeholder Description Example Output
%server_memory_used_mb% Memory currently used (MB) 512
%server_memory_free_mb% Memory currently free (MB) 1536
%server_memory_max_mb% Maximum memory available (MB) 2048

 


Extensions

EconomyAPI

Can be fount on the EconomyAPI page

Ecotale Placeholders
/phar enable ecotale

Placeholder Description Example Output
%ecotale_balance% Player's balance 100.0
%ecotale_formatted_balance% Player's formatted balance 100.00

 

TheEconomy Placeholders
/phar enable theeconomy

Placeholder Description Example Output
%theeconomy_balance% Player's balance 100.0
%theeconomy_formatted_balance% Player's formatted balance $100

 

Luckperms Placeholders
/phar enable luckperms

Placeholder Description Example Output
%luckperms_prefix% Player's prefix [Owner]
%luckperms_suffix% Player's suffix (OG)
%luckperms_group% Player's primary group Owner
%luckperms_weight% Highest weight of a player 100

 

 

* Want your plugin featured here just send me a dm or post a comment!


Implementation

Using Placeholdar to parse placeholders

Use Placeholdar.parse() to replace placeholders in text:

import com.sennecoolgames.placeholdar.Placeholdar;
import com.hypixel.hytale.server.core.universe.PlayerRef;

// Parse with a player context
String message = "Balance: %mymod_balance%";
String parsedPlayer = Placeholdar.parse(message, playerRef);
// If you are using it as an optional dependency:
public static boolean PHARAvailable = false;
try {
Class.forName("com.sennecoolgames.placeholdar.Placeholdar");
economyExpansion = new EconomyExpansion();
economyExpansion.register();
PHARAvailable = true;
getLogger().atInfo().log("Placeholdar support enabled!");
} catch (Exception e) {
getLogger().atInfo().log("Not using Placeholdar because it is not available");
}

String parsedPlayer = PHARAvailable ? Placeholdar.parse(message, playerRef) : message; // Result: "Balance: 1000.50" // Parse without a player context String parsedNoPlayer = Placeholdar.parse(message); // Result: "Balance: %mymod_balance%" (no player, returns original)

Placeholders can be used in any text:

String message = Placeholdar.parse("Hello %player_name%, you are at %player_x%, %player_y%, %player_z%", playerRef);

Without player context:

String message = Placeholdar.parse("Server: %server_name% | Time: %server_time%");

Creating a PlaceholdarExpansion

Create a class that extends PlaceholdarExpansion:

import com.sennecoolgames.placeholdar.PlaceholdarExpansion;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;

public class EconomyExpansion extends PlaceholdarExpansion {

    @Override
    @Nonnull
    public String getIdentifier() {
        // This is what will be in from of your placeholder (%mymod_placeholder%)
        return "MyMod";
    }

    @Override
    @Nonnull
    public String getAuthor() {
        return "YourName";
    }

    @Override
    @Nonnull
    public String getVersion() {
        return "1.0.0";
    }

    @Override
    @Nullable
    public String onRequest(@Nullable PlayerRef player, @Nonnull String params) {
        if (player == null) {
            return null;
        }

        if (params.equalsIgnoreCase("balance")) {
            return String.valueOf(getBalance(player));
        }

        if (params.equalsIgnoreCase("formatted_balance")) {
            return String.valueOf(formatBalance(getBalance(player)));
        }

        return null;
    }
}

Registering an Expansion

Register your expansion in your plugin's initialization:

import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;

public class MyPlugin extends JavaPlugin {
    // Global variable to know if Placeholdar is enabled/available
    public static boolean PHARAvailable = false; 

    private EconomyExpansion economyExpansion;

    public MyPlugin(JavaPluginInit init) {
        super(init);
    }


    // Dont crash the plugin if Placeholdar is not available
    try {
        Class.forName("com.sennecoolgames.placeholdar.Placeholdar");
        economyExpansion = new EconomyExpansion();
        economyExpansion.register();
        PapiAvailable = true;
        getLogger().atInfo().log("Placeholdar support enabled!");
    } catch (Exception e) {
        getLogger().atInfo().log("Not using Placeholdar because it is not available");
    }

    @Override
    protected void shutdown() {
        if (economyExpansion != null) {
            economyExpansion.unregister();
        }
    }
}

Add Placeholdar as a (optional) dependency

If you want your plugin to work with or without Placeholdar installed, check if it's present before registering:

Step 1: Update your manifest to make Placeholdar optional

In your manifest.json:

Optional:

{
  "OptionalDependencies": {
    "Sennecoolgames:Placeholdar": ">=1.0.0"
  }
}

Required:

{
  "Dependencies": {
    "Sennecoolgames:Placeholdar": ">=1.0.0"
  }
}

To test your placeholders you can use the /phar test command to check if it got registered correctly

Placeholder format

Placeholders follow the format: %identifier_param%

  • identifier – the expansion's identifier (e.g., "myeconomy")
  • param – the parameter passed to onRequest() (e.g., "balance")

Example: %myeconomy_balance% calls the economy expansion with param "balance".

Examples

Health expansion

public class HealthExpansion extends PlaceholdarExpansion {

    @Override
    @Nonnull
    public String getIdentifier() {
        return "health";
    }

    @Override
    @Nonnull
    public String getAuthor() {
        return "Developer";
    }

    @Override
    @Nonnull
    public String getVersion() {
        return "1.0.0";
    }

    @Override
    @Nullable
    public String onRequest(@Nullable PlayerRef player, @Nonnull String params) {
        if (player == null) {
            return null;
        }

        if (params.equalsIgnoreCase("current")) {
            return String.valueOf(getCurrentHealth(player));
        }

        if (params.equalsIgnoreCase("max")) {
            return String.valueOf(getMaxHealth(player));
        }

        return null;
    }

    private float getCurrentHealth(PlayerRef player) {
        // Get current health
        return 20.0f;
    }

    private float getMaxHealth(PlayerRef player) {
        // Get max health
        return 20.0f;
    }
}

Usage: %health_current% → "20", %health_max% → "20"

The Placeholdar (PHAR) Team

profile avatar
  • 2
    Followers
  • 6
    Projects
  • 6.4K
    Downloads
Donate

More from SennecoolgamesView all