Java Code Examples for be.maximvdw.placeholderapi.PlaceholderAPI

The following examples show how to use be.maximvdw.placeholderapi.PlaceholderAPI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: factions-top   Source File: MVdWPlaceholderAPIHook.java    License: MIT License 6 votes vote down vote up
@Override
public boolean initialize(List<Integer> enabledRanks) {
    LastReplacer lastReplacer = new LastReplacer(this.lastReplacer);
    boolean updated = PlaceholderAPI.registerPlaceholder(plugin, "factionstop_name:last", lastReplacer);

    for (int rank : enabledRanks) {
        RankReplacer replacer = new RankReplacer(rankReplacer, rank);
        if (PlaceholderAPI.registerPlaceholder(plugin, "factionstop_name:" + rank, replacer)) {
            updated = true;
        }
    }

    PlayerReplacer playerReplacer = new PlayerReplacer(this.playerReplacer);
    if (PlaceholderAPI.registerPlaceholder(plugin, "factionstop_rank:player", playerReplacer)) {
        updated = true;
    }

    return updated;
}
 
Example 2
public MVdWPlaceholderReplacer(MarriageMaster plugin, PlaceholderManager placeholderManager)
{
	set(plugin, placeholderManager);
	boolean MVdW = true;
	for(String placeholder : placeholderManager.getPlaceholders().keySet())
	{
		MVdW &= PlaceholderAPI.registerPlaceholder(plugin, "marriagemaster_" + placeholder, this);
	}
	if(MVdW)
	{
		this.plugin.getLogger().info(ConsoleColor.GREEN + "MVdW placeholder hook was successfully registered!" + ConsoleColor.RESET);
	}
	else
	{
		this.plugin.getLogger().info(ConsoleColor.RED + "MVdW placeholder hook failed to registered!" + ConsoleColor.RESET);
	}
}
 
Example 3
Source Project: Crazy-Crates   Source File: MVdWPlaceholderAPISupport.java    License: MIT License 5 votes vote down vote up
public static void registerPlaceholders(Plugin plugin) {
    for (final Crate crate : cc.getCrates()) {
        if (crate.getCrateType() != CrateType.MENU) {
            PlaceholderAPI.registerPlaceholder(plugin, "crazycrates_" + crate.getName(), e -> NumberFormat.getNumberInstance().format(cc.getVirtualKeys(e.getPlayer(), crate)));
            PlaceholderAPI.registerPlaceholder(plugin, "crazycrates_" + crate.getName() + "_physical", e -> NumberFormat.getNumberInstance().format(cc.getPhysicalKeys(e.getPlayer(), crate)));
            PlaceholderAPI.registerPlaceholder(plugin, "crazycrates_" + crate.getName() + "_total", e -> NumberFormat.getNumberInstance().format(cc.getTotalKeys(e.getPlayer(), crate)));
        }
    }
}
 
Example 4
Source Project: CombatLogX   Source File: HookMVdW.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void register() {
    String prefix = "combatlogx_";
    JavaPlugin plugin = this.plugin.getPlugin();
    for(String string : placeholderList) {
        String placeholder = (prefix + string);
        PlaceholderAPI.registerPlaceholder(plugin, placeholder, this);
    }
}
 
Example 5
Source Project: spark   Source File: SparkMVdWPlaceholders.java    License: GNU General Public License v3.0 4 votes vote down vote up
public SparkMVdWPlaceholders(BukkitSparkPlugin plugin, SparkPlatform platform) {
    this.platform = platform;
    PlaceholderAPI.registerPlaceholder(plugin, "spark_*", this);
}
 
Example 6
public static String replacePlaceholders(Player player, String string) {
    return PlaceholderAPI.replacePlaceholders(player, string);
}
 
Example 7
Source Project: FunnyGuilds   Source File: MVdWPlaceholderAPIHook.java    License: Apache License 2.0 4 votes vote down vote up
public static String replacePlaceholders(Player user, String base) {
    return PlaceholderAPI.replacePlaceholders(user, base);
}