Add Paper Plugin support, Pl3xMap hook (#332)

This commit is contained in:
William authored and GitHub committed 2023-03-30 10:35:50 +01:00
1 parent 17af935379
commit bc421ae3d8
23 files changed
+770 -198

No files matched your search

@@ -3,7 +3,6 @@ package net.william278.huskhomes.command;
import me.lucko.commodore.CommodoreProvider;
import me.lucko.commodore.file.CommodoreFileReader;
import net.william278.huskhomes.BukkitHuskHomes;
import org.bukkit.command.PluginCommand;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
@@ -16,22 +15,22 @@ public class BrigadierUtil {
* Uses commodore to register command completions
*
* @param plugin instance of the registering Bukkit plugin
* @param pluginCommand the Bukkit PluginCommand to register completions for
* @param bukkitCommand the Bukkit PluginCommand to register completions for
* @param command the {@link Command} to register completions for
*/
protected static void registerCommodore(@NotNull BukkitHuskHomes plugin, @NotNull PluginCommand pluginCommand,
protected static void registerCommodore(@NotNull BukkitHuskHomes plugin, @NotNull org.bukkit.command.Command bukkitCommand,
@NotNull Command command) {
final InputStream commandCommodore = plugin.getResource("commodore/" + pluginCommand.getName() + ".commodore");
final InputStream commandCommodore = plugin.getResource("commodore/" + bukkitCommand.getName() + ".commodore");
if (commandCommodore == null) {
return;
}
try {
CommodoreProvider.getCommodore(plugin).register(pluginCommand,
CommodoreProvider.getCommodore(plugin).register(bukkitCommand,
CommodoreFileReader.INSTANCE.parse(commandCommodore),
player -> player.hasPermission(command.getPermission()));
} catch (IOException e) {
plugin.log(Level.SEVERE, "Failed to read command commodore completions for "
+ pluginCommand.getName(), e);
+ bukkitCommand.getName(), e);
}
}