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 CitizensCMDAPI api;
|
||||||
private static Economy economy;
|
private static Economy economy;
|
||||||
|
|
||||||
private boolean papi = false;
|
private boolean usePAPI = false;
|
||||||
private BukkitCommandManager<CommandSender> commandManager;
|
private BukkitCommandManager<CommandSender> commandManager;
|
||||||
private SettingsManager settings;
|
private SettingsManager settings;
|
||||||
|
|
||||||
@ -96,20 +96,14 @@ public final class CitizensCMD extends JavaPlugin {
|
|||||||
private String newVersion;
|
private String newVersion;
|
||||||
private DisplayFormat displayFormat;
|
private DisplayFormat displayFormat;
|
||||||
|
|
||||||
private final Map<String, Boolean> waitingList = new HashMap<>();;
|
private final Map<String, Boolean> waitingList = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
// Init setup
|
||||||
audiences = BukkitAudiences.create(this);
|
audiences = BukkitAudiences.create(this);
|
||||||
final Audience console = audiences.console();
|
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!
|
// Enabling lets go!
|
||||||
console.sendMessage(TAG.append(LEGACY.deserialize("&3Citizens&cCMD &8&o" + getDescription().getVersion())));
|
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")));
|
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();
|
registerEvents();
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
if (hasPAPI()) {
|
if (isPAPIEnabled()) {
|
||||||
console.sendMessage(TAG.append(lang.getMessage(Messages.PAPI_AVAILABLE)));
|
console.sendMessage(TAG.append(lang.getMessage(Messages.PAPI_AVAILABLE)));
|
||||||
papi = true;
|
usePAPI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setupEconomy()) {
|
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
|
* Checks if PAPI is installed or not on the server
|
||||||
*
|
*
|
||||||
* @return Returns true if PAPI is found and false if not
|
* @return Returns true if PAPI is found and false if not
|
||||||
*/
|
*/
|
||||||
private boolean hasPAPI() {
|
private boolean isPAPIEnabled() {
|
||||||
return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +320,7 @@ public final class CitizensCMD extends JavaPlugin {
|
|||||||
* @return Returns true if PAPI is being used
|
* @return Returns true if PAPI is being used
|
||||||
*/
|
*/
|
||||||
public boolean papiEnabled() {
|
public boolean papiEnabled() {
|
||||||
return papi;
|
return usePAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,9 +38,12 @@ public class ReloadCommand extends Npcmd {
|
|||||||
case "short":
|
case "short":
|
||||||
plugin.setDisplayFormat(DisplayFormat.SHORT);
|
plugin.setDisplayFormat(DisplayFormat.SHORT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "full":
|
case "full":
|
||||||
plugin.setDisplayFormat(DisplayFormat.FULL);
|
plugin.setDisplayFormat(DisplayFormat.FULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "medium":
|
||||||
default:
|
default:
|
||||||
plugin.setDisplayFormat(DisplayFormat.MEDIUM);
|
plugin.setDisplayFormat(DisplayFormat.MEDIUM);
|
||||||
break;
|
break;
|
||||||
|
@ -9,7 +9,8 @@ version: ${project.version}
|
|||||||
name: CitizensCMD
|
name: CitizensCMD
|
||||||
website: https://spigotmc.org/resources/30224/
|
website: https://spigotmc.org/resources/30224/
|
||||||
authors: [Mateus Moreira, HexedHero]
|
authors: [Mateus Moreira, HexedHero]
|
||||||
softdepend: [Citizens, PlaceholderAPI, Vault]
|
depend: [Citizens]
|
||||||
|
softdepend: [PlaceholderAPI, Vault]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user