fixeltem az itemloadokat, guik keszen vannak de meg nemjok semmire
This commit is contained in:
154
src/main/java/hu/jgj52/wolfFFA/Commands/EditKitCommand.java
Normal file
154
src/main/java/hu/jgj52/wolfFFA/Commands/EditKitCommand.java
Normal 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;
|
||||
*/
|
||||
@@ -18,16 +18,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WolfFfaCommand implements CommandExecutor, TabCompleter {
|
||||
public class TpToFfaCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private final WolfFFA plugin;
|
||||
|
||||
public WolfFfaCommand(WolfFFA plugin) {
|
||||
public TpToFfaCommand(WolfFFA plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
private int getItem(String key, String kittype, Player player) {
|
||||
String path = "kits." + kittype + "." + player.getUniqueId() + "." + key;
|
||||
private int getItem(String key, String kit, Player player) {
|
||||
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
|
||||
|
||||
if (plugin.getConfig().contains(path)) {
|
||||
try {
|
||||
@@ -40,15 +40,13 @@ public class WolfFfaCommand implements CommandExecutor, TabCompleter {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private boolean checkItem(String key, String kittype, Player player) {
|
||||
String path = "kits." + kittype + "." + player.getUniqueId() + "." + key;
|
||||
|
||||
return plugin.getConfig().getBoolean(path, false);
|
||||
private boolean checkItem(String key, String kit, Player player) {
|
||||
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
|
||||
player.sendMessage("Slot: " + plugin.getConfig().get(path));
|
||||
return plugin.getConfig().get(path) != null ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
|
||||
if (cmds.hasPermission("wolfffa.admin.tptoffa")) {
|
||||
@@ -1,25 +0,0 @@
|
||||
package hu.jgj52.wolfFFA.Commands;
|
||||
|
||||
import hu.jgj52.wolfFFA.WolfFFA;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class WolfFfaReloadCommand implements CommandExecutor {
|
||||
private final WolfFFA plugin;
|
||||
|
||||
public WolfFfaReloadCommand(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.admin.reload")) {
|
||||
plugin.reloadConfig();
|
||||
cmds.sendMessage("§aKész!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package hu.jgj52.wolfFFA;
|
||||
|
||||
import hu.jgj52.wolfFFA.Commands.WolfFfaCommand;
|
||||
import hu.jgj52.wolfFFA.Commands.WolfFfaReloadCommand;
|
||||
import hu.jgj52.wolfFFA.Commands.EditKitCommand;
|
||||
import hu.jgj52.wolfFFA.Commands.TpToFfaCommand;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class WolfFFA extends JavaPlugin {
|
||||
@@ -11,8 +11,8 @@ public final class WolfFFA extends JavaPlugin {
|
||||
// Plugin startup logic
|
||||
getConfig().options().copyDefaults(true);
|
||||
|
||||
getCommand("tptoffa").setExecutor(new WolfFfaCommand(this));
|
||||
getCommand("wolfffareload").setExecutor(new WolfFfaReloadCommand(this));
|
||||
getCommand("tptoffa").setExecutor(new TpToFfaCommand(this));
|
||||
getCommand("editkit").setExecutor(new EditKitCommand(this));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@ commands:
|
||||
tptoffa:
|
||||
permission: wolfffa.admin.tptoffa
|
||||
usage: /tptoffa <ffa> <player>
|
||||
wolfffareload:
|
||||
permission: wolffa.admin.reload
|
||||
usage: /wolfffareload
|
||||
editkit:
|
||||
permission: wolfffa.command.editkit
|
||||
usage: /editkit <kit>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user