39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package lnmpro.Commands;
|
|
|
|
import lnmpro.Main;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.command.TabCompleter;
|
|
import org.bukkit.entity.Player;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import java.util.List;
|
|
|
|
public class CreateKitCommand implements CommandExecutor, TabCompleter {
|
|
private final Main plugin;
|
|
|
|
public CreateKitCommand(Main plugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
@Override
|
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
|
|
if (sender instanceof Player player) {
|
|
if (args.length == 1) {
|
|
plugin.getConfig().set("default.kits." + args[0], player.getInventory().getContents());
|
|
plugin.saveConfig();
|
|
plugin.reloadConfig();
|
|
player.sendMessage("§aKit saved as " + args[0]);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
|
|
return List.of();
|
|
}
|
|
}
|