mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-28 22:57:29 +02: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;
|
private boolean hasCommandBookGodMode;
|
||||||
boolean extraStats;
|
boolean extraStats;
|
||||||
|
private boolean hasEssentialsGodMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
@ -124,4 +125,12 @@ public void updateCommandBookGodMode() {
|
|||||||
public boolean hasCommandBookGodMode() {
|
public boolean hasCommandBookGodMode() {
|
||||||
return 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(ToggleCommands.class);
|
||||||
reg.register(ProtectionCommands.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);
|
reg.register(GeneralCommands.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,8 +195,6 @@ public void onEnable() {
|
|||||||
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
|
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.getGlobalStateManager().updateCommandBookGodMode();
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
||||||
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
|
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,10 @@ public void onPluginEnable(PluginEnableEvent event) {
|
|||||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||||
getConfig().updateCommandBookGodMode();
|
getConfig().updateCommandBookGodMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||||
|
getConfig().updateEssentialsGodMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -42,5 +46,9 @@ public void onPluginDisable(PluginDisableEvent event) {
|
|||||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||||
getConfig().updateCommandBookGodMode();
|
getConfig().updateCommandBookGodMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||||
|
getConfig().updateEssentialsGodMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,5 @@ name: WorldGuard
|
|||||||
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
||||||
version: "${internalVersion}"
|
version: "${internalVersion}"
|
||||||
depend: [WorldEdit]
|
depend: [WorldEdit]
|
||||||
softdepend: [CommandBook]
|
softdepend: [CommandBook, Essentials]
|
||||||
api-version: "1.20"
|
api-version: "1.20"
|
||||||
|
Loading…
Reference in New Issue
Block a user