Skip to content

Commit 4288c7b

Browse files
committed
Fix command registration on older servers
1 parent daeb02d commit 4288c7b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/saicone/pixelbuy/module/command/BukkitCommand.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
public class BukkitCommand {
1414

15+
private static final boolean USE_PREFIX = Bukkit.getServer().getClass().getPackage().getName().startsWith("org.bukkit.craftbukkit.v1_8");
1516
private static final CommandMap COMMAND_MAP;
1617
private static final MethodHandle COMMANDS;
1718

@@ -57,6 +58,9 @@ public static Map<String, Command> all() {
5758
}
5859

5960
public static boolean register(@NotNull Command command) {
61+
if (USE_PREFIX) {
62+
return map().register("pixelbuy", command);
63+
}
6064
final Map<String, Command> map = all();
6165
map.put(command.getName(), command);
6266
for (String alias : command.getAliases()) {

0 commit comments

Comments
 (0)