mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-02-01 19:51:25 +01:00
1.0.1
+ Fixed issue with Vault not connecting to the plugin properly when using CMI instead of Essentials + Improved the message handling for start-up/shut-down + Added aspect to disable the plugin when it has issues loading
This commit is contained in:
parent
7ec14ec2a1
commit
2d56b90ce1
@ -67,7 +67,7 @@ public class CustomBosses extends JavaPlugin implements IReloadable {
|
||||
@Getter private HolographicDisplayHelper holographicDisplayHelper;
|
||||
@Getter private VaultHelper vaultHelper;
|
||||
|
||||
@Getter private boolean debug = false;
|
||||
@Getter private boolean debug = true;
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
@ -76,10 +76,11 @@ public class CustomBosses extends JavaPlugin implements IReloadable {
|
||||
console.sendMessage(StringUtils.get().translateColor("&a============================="));
|
||||
console.sendMessage(StringUtils.get().translateColor("&7EpicBosses " + getDescription().getVersion() + " by &5Songoda <3&7!"));
|
||||
console.sendMessage(StringUtils.get().translateColor("&7Action: &aDisabling&7..."));
|
||||
console.sendMessage(StringUtils.get().translateColor("&a============================="));
|
||||
|
||||
this.autoSpawnManager.stopIntervalSystems();
|
||||
this.bossEntityManager.killAllHolders((World) null);
|
||||
|
||||
console.sendMessage(StringUtils.get().translateColor("&a============================="));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,7 +90,6 @@ public class CustomBosses extends JavaPlugin implements IReloadable {
|
||||
console.sendMessage(StringUtils.get().translateColor("&a============================="));
|
||||
console.sendMessage(StringUtils.get().translateColor("&7EpicBosses " + getDescription().getVersion() + " by &5Songoda <3&7!"));
|
||||
console.sendMessage(StringUtils.get().translateColor("&7Action: &aEnabling&7..."));
|
||||
console.sendMessage(StringUtils.get().translateColor("&a============================="));
|
||||
|
||||
Debug.setPlugin(this);
|
||||
|
||||
@ -102,6 +102,7 @@ public class CustomBosses extends JavaPlugin implements IReloadable {
|
||||
|
||||
if(!this.vaultHelper.isConnected()) {
|
||||
Debug.FAILED_TO_CONNECT_TO_VAULT.debug();
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -160,6 +161,7 @@ public class CustomBosses extends JavaPlugin implements IReloadable {
|
||||
this.autoSpawnManager.startIntervalSystems();
|
||||
|
||||
ServerUtils.get().logDebug("Loaded all fields and managers, saved messages and plugin is initialized and ready to go. (took " + (System.currentTimeMillis() - beginMs) + "ms).");
|
||||
console.sendMessage(StringUtils.get().translateColor("&a============================="));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,9 +2,7 @@ package com.songoda.epicbosses.utils.dependencies;
|
||||
|
||||
import com.songoda.epicbosses.utils.IHelper;
|
||||
import lombok.Getter;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
@ -15,49 +13,29 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
*/
|
||||
public class VaultHelper implements IHelper {
|
||||
|
||||
@Getter private Permission permission;
|
||||
@Getter private Economy economy;
|
||||
@Getter private Chat chat;
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return (setupChat() && setupPermission() && setupEconomy());
|
||||
return setupEconomy();
|
||||
}
|
||||
|
||||
private boolean setupChat() {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return false;
|
||||
|
||||
public Economy getEconomy() {
|
||||
if(this.economy == null) {
|
||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
|
||||
if (rsp == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.economy = rsp.getProvider();
|
||||
}
|
||||
RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
|
||||
if (rsp == null) {
|
||||
return false;
|
||||
}
|
||||
chat = rsp.getProvider();
|
||||
return chat != null;
|
||||
|
||||
return this.economy;
|
||||
}
|
||||
|
||||
|
||||
private boolean setupEconomy() {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return false;
|
||||
}
|
||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) {
|
||||
return false;
|
||||
}
|
||||
this.economy = rsp.getProvider();
|
||||
return this.economy != null;
|
||||
}
|
||||
|
||||
private boolean setupPermission() {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return false;
|
||||
}
|
||||
RegisteredServiceProvider<Permission> rsp = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (rsp == null) {
|
||||
return false;
|
||||
}
|
||||
this.permission = rsp.getProvider();
|
||||
return this.permission != null;
|
||||
return Bukkit.getServer().getPluginManager().getPlugin("Vault") != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user