be.maximvdw.placeholderapi.PlaceholderReplaceEvent Java Examples

The following examples show how to use be.maximvdw.placeholderapi.PlaceholderReplaceEvent. 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 File: HookMVdW.java    From CombatLogX with GNU General Public License v3.0 6 votes vote down vote up
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent e) {
    Player player = e.getPlayer();
    if(player == null) return null;

    String placeholder = e.getPlaceholder();
    if(!placeholder.startsWith("combatlogx_")) return null;

    String id = placeholder.substring("combatlogx_".length());
    switch(id) {
        case "time_left": return PlaceholderReplacer.getTimeLeftSeconds(this.plugin, player);
        case "in_combat": return PlaceholderReplacer.getInCombat(this.plugin, player);
        case "status": return PlaceholderReplacer.getCombatStatus(this.plugin, player);
        case "enemy_name": return PlaceholderReplacer.getEnemyName(this.plugin, player);
        case "enemy_health": return PlaceholderReplacer.getEnemyHealth(this.plugin, player);
        case "enemy_health_rounded": return PlaceholderReplacer.getEnemyHealthRounded(this.plugin, player);
        case "enemy_hearts": return PlaceholderReplacer.getEnemyHearts(this.plugin, player);

        default: return null;
    }
}
 
Example #2
Source File: SparkMVdWPlaceholders.java    From spark with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    String placeholder = event.getPlaceholder();
    if (!placeholder.startsWith("spark_")) {
        return null;
    }

    String identifier = placeholder.substring("spark_".length());
    return SparkPlaceholderProvider.respond(this.platform, identifier);
}
 
Example #3
Source File: PlayerReplacer.java    From factions-top with MIT License 4 votes vote down vote up
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    return playerReplacer.apply(event.getPlayer());
}
 
Example #4
Source File: LastReplacer.java    From factions-top with MIT License 4 votes vote down vote up
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    return lastReplacer.get();
}
 
Example #5
Source File: RankReplacer.java    From factions-top with MIT License 4 votes vote down vote up
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    return rankReplacer.apply(rank);
}
 
Example #6
Source File: MVdWPlaceholderReplacer.java    From MarriageMaster with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent placeholderReplaceEvent)
{
	if(placeholderManager == null) return "Marriage Master is not running";
	return placeholderManager.replacePlaceholder(placeholderReplaceEvent.getPlayer(), placeholderReplaceEvent.getPlaceholder().substring(15));
}