mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-16 23:55:23 +01:00
Respect Essentials Commands on Bukkit Servers
CommandBook compat within WorldGuard was gutted some time ago, but the commands don't register when CommandBook is present. Make this functionally identical with the similar-featured and popular plugin Essentials.
This commit is contained in:
parent
0a9eb447d6
commit
81daa2f46f
@ -37,6 +37,7 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
||||
|
||||
private boolean hasCommandBookGodMode;
|
||||
boolean extraStats;
|
||||
private boolean hasEssentialsGodMode;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
@ -124,4 +125,12 @@ public void updateCommandBookGodMode() {
|
||||
public boolean hasCommandBookGodMode() {
|
||||
return hasCommandBookGodMode;
|
||||
}
|
||||
|
||||
public void updateEssentialsGodMode() {
|
||||
hasEssentialsGodMode = plugin.getServer().getPluginManager().isPluginEnabled("Essentials");
|
||||
}
|
||||
|
||||
public boolean hasEssentialsGodMode() {
|
||||
return hasEssentialsGodMode;
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,10 @@ public void onEnable() {
|
||||
reg.register(ToggleCommands.class);
|
||||
reg.register(ProtectionCommands.class);
|
||||
|
||||
if (!platform.getGlobalStateManager().hasCommandBookGodMode()) {
|
||||
platform.getGlobalStateManager().updateCommandBookGodMode();
|
||||
platform.getGlobalStateManager().updateEssentialsGodMode();
|
||||
|
||||
if (!platform.getGlobalStateManager().hasCommandBookGodMode() && !platform.getGlobalStateManager().hasEssentialsGodMode()) {
|
||||
reg.register(GeneralCommands.class);
|
||||
}
|
||||
|
||||
@ -192,8 +195,6 @@ public void onEnable() {
|
||||
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
|
||||
}
|
||||
|
||||
platform.getGlobalStateManager().updateCommandBookGodMode();
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
||||
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||
getConfig().updateCommandBookGodMode();
|
||||
}
|
||||
|
||||
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||
getConfig().updateEssentialsGodMode();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -42,5 +46,9 @@ public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||
getConfig().updateCommandBookGodMode();
|
||||
}
|
||||
|
||||
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||
getConfig().updateEssentialsGodMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
# - If you want to check the format of this file before putting it
|
||||
# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
|
||||
# and see if it gives "ERROR:".
|
||||
# - Lines starting with # are commentsand so they are ignored.
|
||||
# - Lines starting with # are comments and so they are ignored.
|
||||
#
|
||||
# WARNING:
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
|
@ -2,5 +2,5 @@ name: WorldGuard
|
||||
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
||||
version: "${internalVersion}"
|
||||
depend: [WorldEdit]
|
||||
softdepend: [CommandBook]
|
||||
softdepend: [CommandBook, Essentials]
|
||||
api-version: "1.20"
|
||||
|
Loading…
Reference in New Issue
Block a user