Registering Placeholders in PlaceHolderAPI

Discussion in 'Spigot Plugin Development' started by ItZ_JameZ_, May 17, 2016.

  1. Hello All, I'm having some trouble implementing my plugin into PlaceHolderAPI Here is what i have and it doesn't work and i'm not sure why. - Where I registered the identifer
    Code (Text):
    package net.JameZ.util;

    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;

    import me.clip.placeholderapi.external.EZPlaceholderHook;
    import net.JameZ.Immortal;

    public class ChatTags extends EZPlaceholderHook implements Listener {

        public ChatTags(Immortal plugin) {
            super(plugin, "immortal");

        public String onPlaceholderRequest(Player p, String identifier) {
            // placeholder: %immortal_title%
            if (identifier.equals("title")) {
                return _Player.getTitle(p).toString();
            if (p == null) {
                return "";
            return null;
    } - Where i'm getting the String from
    Code (Text):
        public static String getTitle(Player p) {
            PlayerFile file = getPlayerFile.getFile(p);
            if (file.get("title") == "off") {
                return null;
            if (file.get("title") != "off") {
                return (String) file.get("deaths").toString();
            return null;
    Immortal.yml - Main Class[ Just the snippet from where i checked is the plugin was enabled ]
    Code (Text):
            if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {  
                Bukkit.getPluginManager().registerEvents(new ChatTags(this), this);
                new ChatTags(this).hook();
  2. What doesn't work exactly?
  3. well everything works but it doesn't replace the variable when a player talks in chat
  4. Did you include the API in your plugins folder? Did you set it as a dependency?
  5. yeah its in my plugins folder and i just now added it as a dependency and it still didn't work.
  6. Registering the class as an event listener is pointless.

    I believe all of this should be done through expansions.

    As well, use String#equals to conpare the two strings. Their identities are not the same.