mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
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.Logger;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -114,7 +112,8 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
|
||||
getCommand("import-auth").setExecutor(new ImportCommand(core));
|
||||
|
||||
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 me.clip.placeholderapi.PlaceholderAPI;
|
||||
|
||||
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)) {
|
||||
@ -32,4 +34,8 @@ public class PremiumPlaceholder extends PlaceholderHook {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean register(FastLoginBukkit plugin) {
|
||||
return PlaceholderAPI.registerPlaceholderHook(plugin, new PremiumPlaceholder(plugin));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user