50 lines
2.2 KiB
Java
50 lines
2.2 KiB
Java
package net.t2code.lib.Spigot.Lib.eco;
|
|
|
|
import net.milkbowl.vault.economy.Economy;
|
|
import net.milkbowl.vault.permission.Permission;
|
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
import net.t2code.lib.Spigot.system.Main;
|
|
import net.t2code.lib.Util;
|
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
|
|
public class Vault {
|
|
|
|
public static Boolean vaultEnable;
|
|
public static Boolean connected;
|
|
|
|
public static void loadVault() throws InterruptedException {
|
|
long long_ = System.currentTimeMillis();
|
|
if (Main.plugin.getServer().getPluginManager().getPlugin("Vault") != null) {
|
|
vaultEnable = true;
|
|
RegisteredServiceProvider<Economy> eco = Main.plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
|
if (eco != null) {
|
|
Main.eco = eco.getProvider();
|
|
if (Main.eco != null) {
|
|
connected = true;
|
|
send.console(Util.getPrefix() + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
} else {
|
|
connected = false;
|
|
send.console(Util.getPrefix() + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
}
|
|
} else {
|
|
connected = false;
|
|
send.console(Util.getPrefix() + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
}
|
|
RegisteredServiceProvider<Permission> perm = Main.plugin.getServer().getServicesManager().getRegistration(Permission.class);
|
|
if (perm != null) {
|
|
Main.perm = perm.getProvider();
|
|
}
|
|
} else {
|
|
vaultEnable = false;
|
|
connected = false;
|
|
send.console(Util.getPrefix() + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
}
|
|
}
|
|
|
|
public static void vaultDisable() {
|
|
if (!connected) return;
|
|
connected = false;
|
|
send.console(Util.getPrefix() + " §4Vault / Economy successfully deactivated.");
|
|
}
|
|
}
|