Skip to content

Commit 9bbdf1b

Browse files
committed
let users change what the command is since plugins overlap
1 parent e3a99a7 commit 9bbdf1b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/lol/hyper/anarchystats/AnarchyStats.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import lol.hyper.anarchystats.commands.CommandReload;
55
import org.bstats.bukkit.Metrics;
66
import org.bukkit.Bukkit;
7+
import org.bukkit.command.Command;
78
import org.bukkit.configuration.file.FileConfiguration;
89
import org.bukkit.configuration.file.YamlConfiguration;
910
import org.bukkit.plugin.java.JavaPlugin;
@@ -34,7 +35,12 @@ public void onEnable() {
3435
logger.info("Copying default config!");
3536
}
3637
loadConfig();
37-
this.getCommand("info").setExecutor(commandInfo);
38+
Command commandTest = Bukkit.getPluginCommand(config.getString("info-command-override"));
39+
if (commandTest != null) {
40+
logger.warning("We detected that /" + config.getString("info-command-override") + " is already taken by another plugin. There might be some issues with this. To change this, edit the info-command-override setting in the config.");
41+
}
42+
43+
this.getCommand(config.getString("info-command-override")).setExecutor(commandInfo);
3844
this.getCommand("anarchystats").setExecutor(commandReload);
3945
Bukkit.getScheduler().runTaskAsynchronously(this, () -> this.updateWorldSize(WorldSize.world, WorldSize.nether, WorldSize.end));
4046

src/main/resources/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Some plugins use /info for things. This let's you change the plugins command so they don't override.
2+
# Default is /info.
3+
info-command-override: "info"
4+
15
# This is the start date of your world.
26
# Format: MM/DD/YYYY. You must put zeros for single digits. Example: 06, 02, 01, etc.
37
date: 05/27/2019 # This date is May 27th, 2019.

0 commit comments

Comments
 (0)