forked from TuxCoding/FastLogin
Fix NoClassDef errors if the optional PlaceholderAPI is not available (Fixes #108)
This commit is contained in:
@ -27,8 +27,6 @@ import java.util.concurrent.ThreadFactory;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -114,7 +112,8 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
|
|||||||
getCommand("import-auth").setExecutor(new ImportCommand(core));
|
getCommand("import-auth").setExecutor(new ImportCommand(core));
|
||||||
|
|
||||||
if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||||
PlaceholderAPI.registerPlaceholderHook(this, new PremiumPlaceholder(this));
|
//prevents NoClassDef errors if it's not available
|
||||||
|
PremiumPlaceholder.register(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,14 +7,16 @@ import org.bukkit.metadata.MetadataValue;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
|
|
||||||
public class PremiumPlaceholder extends PlaceholderHook {
|
public class PremiumPlaceholder extends PlaceholderHook {
|
||||||
|
|
||||||
private final FastLoginBukkit plugin;
|
private final FastLoginBukkit plugin;
|
||||||
|
|
||||||
public PremiumPlaceholder(FastLoginBukkit plugin) {
|
public PremiumPlaceholder(FastLoginBukkit plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onPlaceholderRequest(Player player, String variable) {
|
public String onPlaceholderRequest(Player player, String variable) {
|
||||||
if (player != null && "fastlogin_status".contains(variable)) {
|
if (player != null && "fastlogin_status".contains(variable)) {
|
||||||
@ -32,4 +34,8 @@ public class PremiumPlaceholder extends PlaceholderHook {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean register(FastLoginBukkit plugin) {
|
||||||
|
return PlaceholderAPI.registerPlaceholderHook(plugin, new PremiumPlaceholder(plugin));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user