forked from Upstream/CitizensCMD
Make Citizens a hard depend
Fixes some issues where Bukkit would decide to load Citizens after CitizensCMD with a high plugin count and mess things up - Some other misc refactoring
This commit is contained in:
parent
8663ea4b0c
commit
703929bc9f
@ -86,7 +86,7 @@ public final class CitizensCMD extends JavaPlugin {
|
||||
private static CitizensCMDAPI api;
|
||||
private static Economy economy;
|
||||
|
||||
private boolean papi = false;
|
||||
private boolean usePAPI = false;
|
||||
private BukkitCommandManager<CommandSender> commandManager;
|
||||
private SettingsManager settings;
|
||||
|
||||
@ -96,20 +96,14 @@ public final class CitizensCMD extends JavaPlugin {
|
||||
private String newVersion;
|
||||
private DisplayFormat displayFormat;
|
||||
|
||||
private final Map<String, Boolean> waitingList = new HashMap<>();;
|
||||
private final Map<String, Boolean> waitingList = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Init setup
|
||||
audiences = BukkitAudiences.create(this);
|
||||
final Audience console = audiences.console();
|
||||
|
||||
if (!hasCitizens()) {
|
||||
console.sendMessage(TAG.append(LEGACY.deserialize("&cCitizens &7is needed for this plugin to work!")));
|
||||
console.sendMessage(TAG.append(LEGACY.deserialize("&cCitizens.jar &7is not installed on the server!")));
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enabling lets go!
|
||||
console.sendMessage(TAG.append(LEGACY.deserialize("&3Citizens&cCMD &8&o" + getDescription().getVersion())));
|
||||
console.sendMessage(TAG.append(LEGACY.deserialize("&8by &3Mateus Moreira &c@LichtHund &8& Maintained by &3HexedHero")));
|
||||
@ -154,9 +148,9 @@ public final class CitizensCMD extends JavaPlugin {
|
||||
registerEvents();
|
||||
|
||||
// Hooks
|
||||
if (hasPAPI()) {
|
||||
if (isPAPIEnabled()) {
|
||||
console.sendMessage(TAG.append(lang.getMessage(Messages.PAPI_AVAILABLE)));
|
||||
papi = true;
|
||||
usePAPI = true;
|
||||
}
|
||||
|
||||
if (setupEconomy()) {
|
||||
@ -199,16 +193,12 @@ public final class CitizensCMD extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCitizens() {
|
||||
return Bukkit.getPluginManager().isPluginEnabled("Citizens");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if PAPI is installed or not on the server
|
||||
*
|
||||
* @return Returns true if PAPI is found and false if not
|
||||
*/
|
||||
private boolean hasPAPI() {
|
||||
private boolean isPAPIEnabled() {
|
||||
return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
||||
}
|
||||
|
||||
@ -330,7 +320,7 @@ public final class CitizensCMD extends JavaPlugin {
|
||||
* @return Returns true if PAPI is being used
|
||||
*/
|
||||
public boolean papiEnabled() {
|
||||
return papi;
|
||||
return usePAPI;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,9 +38,12 @@ public class ReloadCommand extends Npcmd {
|
||||
case "short":
|
||||
plugin.setDisplayFormat(DisplayFormat.SHORT);
|
||||
break;
|
||||
|
||||
case "full":
|
||||
plugin.setDisplayFormat(DisplayFormat.FULL);
|
||||
break;
|
||||
|
||||
case "medium":
|
||||
default:
|
||||
plugin.setDisplayFormat(DisplayFormat.MEDIUM);
|
||||
break;
|
||||
|
@ -9,7 +9,8 @@ version: ${project.version}
|
||||
name: CitizensCMD
|
||||
website: https://spigotmc.org/resources/30224/
|
||||
authors: [Mateus Moreira, HexedHero]
|
||||
softdepend: [Citizens, PlaceholderAPI, Vault]
|
||||
depend: [Citizens]
|
||||
softdepend: [PlaceholderAPI, Vault]
|
||||
api-version: 1.13
|
||||
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user