- rename the Main to T2CodeMain
- amalll bugfix
This commit is contained in:
2022-06-08 05:13:00 +02:00
parent 3ce11b3d12
commit 72d33dca90
16 changed files with 158 additions and 129 deletions

View File

@@ -0,0 +1,48 @@
package net.t2code.lib.Spigot.system;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import net.t2code.lib.Spigot.Lib.messages.send;
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 (T2CodeMain.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null) {
vaultEnable = true;
RegisteredServiceProvider<Economy> eco = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Economy.class);
if (eco != null) {
T2CodeMain.setEco(eco.getProvider());
if (T2CodeMain.getEco() != 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 = T2CodeMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
if (perm != null) {
T2CodeMain.setPerm(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.");
}
}