fixeltem az itemloadokat, guik keszen vannak de meg nemjok semmire

This commit is contained in:
2025-02-16 23:22:19 +01:00
parent 3a9d5ad9b3
commit 3a54bf198c
8 changed files with 169 additions and 42 deletions

View File

@@ -0,0 +1,154 @@
package hu.jgj52.wolfFFA.Commands;
import hu.jgj52.wolfFFA.WolfFFA;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
public class EditKitCommand implements CommandExecutor, TabCompleter {
private final WolfFFA plugin;
public EditKitCommand(WolfFFA plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
if (cmds.hasPermission("wolfffa.command.editkit")) {
if (cmds instanceof Player player) {
if (args.length > 0) {
Inventory gui = Bukkit.createInventory(null, 45, "Kit Edit");
ItemStack saveKit = new ItemStack(Material.PLAYER_HEAD);
SkullMeta saveMeta = (SkullMeta) saveKit.getItemMeta();
ItemStack info = new ItemStack(Material.PLAYER_HEAD);
SkullMeta infoMeta = (SkullMeta) info.getItemMeta();
if (saveMeta != null) {
saveMeta.setDisplayName("§aSave");
saveKit.setItemMeta(saveMeta);
}
if (infoMeta != null) {
infoMeta.setDisplayName("§aInformáció");
infoMeta.setLore(Collections.singletonList("§5A 4. sor a hotbar, 5. sor 1. iteme az offhand."));
info.setItemMeta(infoMeta);
}
gui.setItem(37, info);
gui.setItem(44, saveKit);
switch (args[0]) {
case "sword":
ItemStack swordsword = new ItemStack(Material.DIAMOND_SWORD);
swordsword.addEnchantment(Enchantment.UNBREAKING, 3);
gui.setItem(27, swordsword);
player.openInventory(gui);
break;
case "uhc":
ItemStack uhchelmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack uhcchestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack uhcleggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack uhcboots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack uhcaxe = new ItemStack(Material.DIAMOND_AXE);
ItemStack uhcsword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack uhclava = new ItemStack(Material.LAVA_BUCKET);
ItemStack uhccobweb = new ItemStack(Material.COBWEB, 8);
ItemStack uhccobblestone = new ItemStack(Material.COBBLESTONE, 64);
ItemStack uhcgoldenapple = new ItemStack(Material.GOLDEN_APPLE, 13);
ItemStack uhcwater = new ItemStack(Material.WATER_BUCKET);
ItemStack uhccrossbow = new ItemStack(Material.CROSSBOW);
ItemStack uhcbow = new ItemStack(Material.BOW);
ItemStack uhcarrow = new ItemStack(Material.ARROW, 16);
ItemStack uhcshield = new ItemStack(Material.SHIELD);
ItemStack uhcplanks = new ItemStack(Material.OAK_PLANKS, 64);
ItemStack uhcpickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
uhchelmet.addEnchantment(Enchantment.PROTECTION, 2);
uhcchestplate.addEnchantment(Enchantment.PROTECTION, 3);
uhcleggings.addEnchantment(Enchantment.PROTECTION, 3);
uhcboots.addEnchantment(Enchantment.PROTECTION, 3);
uhcaxe.addEnchantment(Enchantment.SHARPNESS, 1);
uhcaxe.addEnchantment(Enchantment.EFFICIENCY, 3);
uhcsword.addEnchantment(Enchantment.SHARPNESS, 4);
uhccrossbow.addEnchantment(Enchantment.PIERCING, 1);
uhcbow.addEnchantment(Enchantment.POWER, 1);
uhcpickaxe.addEnchantment(Enchantment.UNBREAKING,3);
uhcpickaxe.addEnchantment(Enchantment.EFFICIENCY, 3);
gui.setItem(27, uhcaxe);
gui.setItem(28, uhcsword);
gui.setItem(29, uhclava);
gui.setItem(30, uhccobweb);
gui.setItem(31, uhccobblestone);
gui.setItem(32, uhcgoldenapple);
gui.setItem(33, uhcwater);
gui.setItem(34, uhccrossbow);
gui.setItem(35, uhcbow);
gui.setItem(36, uhcshield);
gui.setItem(0, uhcarrow);
gui.setItem(4, uhcshield);
gui.setItem(8, uhcplanks);
gui.setItem(11, uhcpickaxe);
gui.setItem(12, uhclava);
gui.setItem(13, uhcwater);
gui.setItem(14, uhcwater);
gui.setItem(15, uhcwater);
player.openInventory(gui);
break;
default:
player.sendMessage("§cNincs ilyen FFA típus!");
break;
}
}
}
}
return true;
}
@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
return List.of();
}
}
/*
Inventory gui = Bukkit.createInventory(null, 45, "Sword Kit");
ItemStack saveKit = new ItemStack(Material.PLAYER_HEAD);
SkullMeta saveMeta = (SkullMeta) saveKit.getItemMeta();
ItemStack info = new ItemStack(Material.PLAYER_HEAD);
SkullMeta infoMeta = (SkullMeta) info.getItemMeta();
if (saveMeta != null) {
saveMeta.setDisplayName("§aSave");
saveKit.setItemMeta(saveMeta);
}
if (infoMeta != null) {
infoMeta.setDisplayName("§aInformáció");
infoMeta.setLore(Collections.singletonList("§5A 4. sor a hotbar, 5. sor 1. iteme az offhand."));
}
gui.setItem(44, saveKit);
player.openInventory(gui);
break;
*/