Skip to content

Commit

Permalink
Add PaperKnownCommandsProvider for Paper 1.11.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Sep 15, 2020
1 parent 6b28e18 commit 840a519
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Essentials/src/com/earth2me/essentials/Essentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ public void onEnable() {
}

//Known Commands Provider
knownCommandsProvider = new ReflKnownCommandsProvider();
if (PaperLib.isPaper() && VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_12_2_R01)) {
knownCommandsProvider = new PaperKnownCommandsProvider();
} else {
knownCommandsProvider = new ReflKnownCommandsProvider();
}

execTimer.mark("Init(Providers)");
reload();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.ess3.provider.providers;

import net.ess3.provider.KnownCommandsProvider;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;

import java.util.Map;

public class PaperKnownCommandsProvider implements KnownCommandsProvider {
@Override
public Map<String, Command> getKnownCommands() {
return Bukkit.getCommandMap().getKnownCommands();
}

@Override
public String getDescription() {
return "Paper Known Commands Provider";
}
}

0 comments on commit 840a519

Please sign in to comment.