Skip to content

Commit

Permalink
Add way to disable help override
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 18, 2017
1 parent 3612017 commit c0d1eef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/Settings.java
Expand Up @@ -34,6 +34,11 @@ public static boolean showDebug() {
.getBoolean("Debug.Show", true);
}

public static boolean overrideHelp() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Debug.Override help", true);
}

public static int consoleWidth() {
return DenizenAPI.getCurrentInstance().getConfig()
.getInt("Debug.Console width", 60);
Expand Down
@@ -1,6 +1,7 @@
package net.aufdemrand.denizen.scripts.containers.core;

import com.google.common.base.Predicate;
import net.aufdemrand.denizen.Settings;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizen.utilities.DenizenAliasHelpTopic;
import net.aufdemrand.denizen.utilities.DenizenCommand;
Expand Down Expand Up @@ -57,17 +58,18 @@ public CommandScriptHelper() {
// so let's force the server to use Bukkit's version if it's running
// Mojang's version.
// TODO: figure out a different workaround?
// TODO: config option for this?
new BukkitRunnable() {
@Override
public void run() {
if (knownCommands.get("help") instanceof HelpCommand) {
return;
if (Settings.overrideHelp()) {
new BukkitRunnable() {
@Override
public void run() {
if (knownCommands.get("help") instanceof HelpCommand) {
return;
}
knownCommands.put("help", knownCommands.get("bukkit:help"));
helpTopics.put("/help", helpTopics.get("/bukkit:help"));
}
knownCommands.put("help", knownCommands.get("bukkit:help"));
helpTopics.put("/help", helpTopics.get("/bukkit:help"));
}
}.runTaskLater(DenizenAPI.getCurrentInstance(), 1);
}.runTaskLater(DenizenAPI.getCurrentInstance(), 1);
}
}
catch (Exception e) {
dB.echoError("Error getting the server's command information! Are you running a non-CraftBukkit server?");
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/main/resources/config.yml
Expand Up @@ -12,6 +12,8 @@ Debug:
# This is purely to maintain basic information on things like how many servers run any given version of Denizen.
# Please do not disable this unless it is throwing errors (Please report any errors you receive as well).
Stats: true
# Whether to force the help command to be the default bukkit help.
Override help: true

Scripts:
World:
Expand Down

0 comments on commit c0d1eef

Please sign in to comment.