package com.github.games647.fastlogin.bukkit;

import java.util.List;

import me.clip.placeholderapi.PlaceholderAPI;
import me.clip.placeholderapi.PlaceholderHook;

import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;

public class PremiumPlaceholder extends PlaceholderHook {

    private final FastLoginBukkit plugin;

    public PremiumPlaceholder(FastLoginBukkit plugin) {
        this.plugin = plugin;
    }

    @Override
    public String onPlaceholderRequest(Player player, String variable) {
        if (player != null && "fastlogin_status".contains(variable)) {
            List<MetadataValue> metadata = player.getMetadata(plugin.getName());
            if (metadata == null) {
                return "unknown";
            }

            if (metadata.isEmpty()) {
                return "cracked";
            } else {
                return "premium";
            }
        }

        return "";
    }

    public static void register(FastLoginBukkit plugin) {
        PlaceholderAPI.registerPlaceholderHook(plugin, new PremiumPlaceholder(plugin));
    }
}

@@ -57,20 +57,33 @@
 va.util.
-Li
 st
+ream.Collectors
 ;%0A%0Aimpor
@@ -145,32 +145,42 @@
 .placeholderapi.
+expansion.
 PlaceholderHook;
@@ -174,20 +174,25 @@
 ceholder
-Hook
+Expansion
 ;%0A%0Aimpor
@@ -222,50 +222,8 @@
 yer;
-%0Aimport org.bukkit.metadata.MetadataValue;
 %0A%0Apu
@@ -275,16 +275,97 @@
 lder
-Hook
+Expansion
  %7B%0A%0A
+    private static final String PLACEHOLDER_VARIABLE = %22fastlogin_status%22;%0A%0A
     
@@ -492,24 +492,253 @@
 gin;%0A    %7D%0A%0A
+    public static void register(FastLoginBukkit plugin) %7B%0A        PremiumPlaceholder placeholderHook = new PremiumPlaceholder(plugin);%0A        PlaceholderAPI.registerPlaceholderHook(PLACEHOLDER_VARIABLE, placeholderHook);%0A    %7D%0A%0A
     @Overrid
@@ -846,34 +846,34 @@
  && 
-%22fastlogin_status%22.contain
+PLACEHOLDER_VARIABLE.equal
 s(va
@@ -899,75 +899,60 @@
     
-List%3CMetadataValue%3E metadata = player.getMetadata(plugin.getN
+return plugin.getStatus(player.getUniqueId()).n
 ame()
-)
 ;%0A  
@@ -961,190 +961,185 @@
     
-    if (metadata == null) %7B%0A                return %22unknown%22;%0A            %7D%0A%0A            if (metadata.isEmpty()) %7B%0A                return %22cracked%22
+%7D%0A%0A        return %22%22;%0A    %7D%0A%0A    @Override%0A    public String getIdentifier() %7B%0A        return PLACEHOLDER_VARIABLE
 ;%0A    
+%7D%0A%0A
     
-    %7D else %7B%0A    
+@Override%0A    public String getPlugin() %7B%0A
         
     
@@ -1138,224 +1138,266 @@
     
-    
 return 
-%22premium%22;%0A            %7D%0A        %7D%0A%0A        return %22%22;%0A    %7D%0A%0A    public static void register(FastLoginBukkit plugin) %7B%0A        PlaceholderAPI.registerPlaceholderHook(plugin, new PremiumPlaceholder(plugin)
+plugin.getName();%0A    %7D%0A%0A    @Override%0A    public String getAuthor() %7B%0A        return plugin.getDescription().getAuthors().stream().collect(Collectors.joining(%22, %22));%0A    %7D%0A%0A    @Override%0A    public String getVersion() %7B%0A        return plugin.getName(
 );%0A 

Migrate to PlaceholderExpansion from PlaceholderAPI