update
This commit is contained in:
@@ -16,14 +16,16 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.title.Title;
|
||||
import java.time.Duration;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.min;
|
||||
|
||||
public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
@@ -50,10 +52,12 @@ public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
int x = 0;
|
||||
String arena = "";
|
||||
boolean survival = false;
|
||||
|
||||
if (gamemode.equals("uhc")) {
|
||||
x = 1000;
|
||||
arena = "football";
|
||||
survival = true;
|
||||
player.getInventory().setContents(kitManager.getUhcKit(player).getContents());
|
||||
enemy.getInventory().setContents(kitManager.getUhcKit(player).getContents());
|
||||
} else if (gamemode.equals("pot")) {
|
||||
@@ -86,15 +90,18 @@ public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
} else if (gamemode.equals("cart")) {
|
||||
x = 0;
|
||||
arena = "";
|
||||
survival = true;
|
||||
|
||||
} else if (gamemode.equals("diasmp")) {
|
||||
x = 1800;
|
||||
arena = "football";
|
||||
survival = true;
|
||||
player.getInventory().setContents(kitManager.getDiaSMPKit(player).getContents());
|
||||
enemy.getInventory().setContents(kitManager.getDiaSMPKit(player).getContents());
|
||||
} else if (gamemode.equals("shieldlessuhc")) {
|
||||
x = 0;
|
||||
arena = "";
|
||||
survival = true;
|
||||
|
||||
}
|
||||
World world = Bukkit.getWorld("world");
|
||||
@@ -129,8 +136,8 @@ public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
enemy.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
enemy.setSaturation(5);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
enemy.setGameMode(GameMode.ADVENTURE);
|
||||
player.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
enemy.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
|
||||
player.setMetadata("DuelingWith", new FixedMetadataValue(plugin, enemy.getUniqueId()));
|
||||
enemy.setMetadata("DuelingWith", new FixedMetadataValue(plugin, player.getUniqueId()));
|
||||
|
||||
206
src/main/java/lnmpro/Commands/EditKitCommand.java
Normal file
206
src/main/java/lnmpro/Commands/EditKitCommand.java
Normal file
@@ -0,0 +1,206 @@
|
||||
package lnmpro.Commands;
|
||||
|
||||
import lnmpro.Main;
|
||||
import lnmpro.Utils.Kits;
|
||||
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.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
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 Main plugin;
|
||||
|
||||
public EditKitCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
private int getItemSlot(String key, String kit, Player player) {
|
||||
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
|
||||
|
||||
if (plugin.getConfig().contains(path)) {
|
||||
try {
|
||||
return plugin.getConfig().getInt(path);
|
||||
} catch (NumberFormatException e) {
|
||||
plugin.getLogger().warning("Invalid slot number in config for " + path);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private @NotNull List<Integer> getItemSlotArray(String key, String kit, Player player) {
|
||||
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
|
||||
|
||||
if (plugin.getConfig().contains(path)) {
|
||||
List<Integer> slots = plugin.getConfig().getIntegerList(path);
|
||||
|
||||
if (!slots.isEmpty()) {
|
||||
return slots;
|
||||
} else {
|
||||
plugin.getLogger().warning("Invalid or empty slot numbers in config for " + path);
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.singletonList(-1);
|
||||
}
|
||||
|
||||
@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) {
|
||||
Kits kitManager = new Kits(plugin);
|
||||
Inventory gui = Bukkit.createInventory(null, 27, "Kit Editor");
|
||||
|
||||
ItemStack saveKit = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
|
||||
ItemMeta saveMeta = saveKit.getItemMeta();
|
||||
|
||||
ItemStack infoItem = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
ItemMeta infoMeta = infoItem.getItemMeta();
|
||||
|
||||
ItemStack undoKit = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
ItemMeta undoMeta = undoKit.getItemMeta();
|
||||
saveMeta.setDisplayName("§aSave Kit");
|
||||
saveKit.setItemMeta(saveMeta);
|
||||
undoMeta.setDisplayName("§cUndo Changes");
|
||||
undoKit.setItemMeta(undoMeta);
|
||||
|
||||
gui.setItem(0, saveKit);
|
||||
gui.setItem(1, saveKit);
|
||||
gui.setItem(2, saveKit);
|
||||
gui.setItem(6, undoKit);
|
||||
gui.setItem(7, undoKit);
|
||||
gui.setItem(8, undoKit);
|
||||
gui.setItem(9, saveKit);
|
||||
gui.setItem(10, saveKit);
|
||||
gui.setItem(11, saveKit);
|
||||
gui.setItem(15, undoKit);
|
||||
gui.setItem(16, undoKit);
|
||||
gui.setItem(17, undoKit);
|
||||
gui.setItem(18, saveKit);
|
||||
gui.setItem(19, saveKit);
|
||||
gui.setItem(20, saveKit);
|
||||
gui.setItem(24, undoKit);
|
||||
gui.setItem(25, undoKit);
|
||||
gui.setItem(26, undoKit);
|
||||
Inventory inv = player.getInventory();
|
||||
switch (args[0]) {
|
||||
case "sword":
|
||||
inv.clear();
|
||||
inv.setContents(kitManager.getSwordKit(player).getContents());
|
||||
|
||||
infoMeta.setDisplayName("§fSword Kit");
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
|
||||
player.openInventory(gui);
|
||||
break;
|
||||
case "uhc":
|
||||
inv.clear();
|
||||
inv.setContents(kitManager.getUhcKit(player).getContents());
|
||||
|
||||
infoMeta.setDisplayName("§fUHC Kit");
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
|
||||
player.openInventory(gui);
|
||||
break;
|
||||
case "mace":
|
||||
inv.clear();
|
||||
inv.setContents(kitManager.getMaceKit(player).getContents());
|
||||
|
||||
infoMeta.setDisplayName("§fMace Kit");
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
|
||||
player.openInventory(gui);
|
||||
break;
|
||||
case "axe":
|
||||
inv.clear();
|
||||
inv.setContents(kitManager.getAxeKit(player).getContents());
|
||||
|
||||
infoMeta.setDisplayName("§fAxe Kit");
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
|
||||
player.openInventory(gui);
|
||||
break;
|
||||
case "diasmp":
|
||||
inv.clear();
|
||||
inv.setContents(kitManager.getAxeKit(player).getContents());
|
||||
|
||||
infoMeta.setDisplayName("§fDiamondSmp Kit");
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
|
||||
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) {
|
||||
if (args.length == 1) {
|
||||
return List.of("sword", "uhc", "mace", "axe", "diasmp");
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,12 @@ public class DuelEndListener implements Listener {
|
||||
}
|
||||
}, 60L);
|
||||
|
||||
player.removeMetadata("DuelingWith", plugin);
|
||||
enemy.removeMetadata("DuelingWith", plugin);
|
||||
player.removeMetadata("ArenaLoc", plugin);
|
||||
enemy.removeMetadata("ArenaLoc", plugin);
|
||||
player.removeMetadata("DueledWithGamemode", plugin);
|
||||
enemy.removeMetadata("DueledWithGamemode", plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,13 @@ public class DuelRequestListener implements Listener {
|
||||
|
||||
TextComponent info = new TextComponent("§7ℹ");
|
||||
info.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("§fJátékmód: " + ChatColor.stripColor(clickedItem.getItemMeta().getDisplayName().toLowerCase())).create()));
|
||||
new ComponentBuilder("§7Játékmód: §a" + ChatColor.stripColor(clickedItem.getItemMeta().getDisplayName()) + "\n")
|
||||
.append("§7Aréna: §aFootball\n")
|
||||
.append("§7Ellenfél: §e" + player.getName() + "\n")
|
||||
.append("§7Opciók:\n")
|
||||
.append("§8- §7Kör: §e1\n")
|
||||
.append("§8- §7Megfigyelők: §aBEKAPCSOLVA\n")
|
||||
.create()));
|
||||
|
||||
TextComponent fullMessage = new TextComponent();
|
||||
fullMessage.addExtra(accept);
|
||||
|
||||
18
src/main/java/lnmpro/Listeners/FreezeListener.java
Normal file
18
src/main/java/lnmpro/Listeners/FreezeListener.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package lnmpro.Listeners;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class FreezeListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player.hasMetadata("Frozen")) {
|
||||
if (!event.getFrom().toVector().equals(event.getTo().toVector())) {
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,21 @@
|
||||
package lnmpro.Listeners;
|
||||
|
||||
import lnmpro.Main;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class KitListener implements Listener {
|
||||
@@ -113,4 +122,221 @@ public class KitListener implements Listener {
|
||||
plugin.reloadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (!(event.getWhoClicked() instanceof Player player)) return;
|
||||
Inventory gui = event.getInventory();
|
||||
ItemStack[] inv = player.getInventory().getContents();
|
||||
|
||||
if (event.getClickedInventory() == event.getView().getTopInventory() && event.getView().title().equals(Component.text("Kit Editor"))) {
|
||||
event.setCancelled(true);
|
||||
if ((0 <= event.getSlot() && event.getSlot() <= 2) || (9 <= event.getSlot() && event.getSlot() <= 11) || (18 <= event.getSlot() && event.getSlot() <= 20)) {
|
||||
List<Integer> uhclavaSlots = null;
|
||||
List<Integer> uhcwaterSlots = null;
|
||||
List<Integer> uhcshieldSlots = null;
|
||||
List<Integer> boxcartstrenghtSlots = null;
|
||||
List<Integer> boxcartspeedSlots = null;
|
||||
List<Integer> boxcartfireresistanceSlots = null;
|
||||
List<Integer> boxcartcartSlots = null;
|
||||
List<Integer> boxcartenderpearlSlots = null;
|
||||
List<Integer> macetotemSlots = null;
|
||||
List<Integer> maceenderpearlSlots = null;
|
||||
List<Integer> macestrengthSlots = null;
|
||||
List<Integer> macespeedSlots = null;
|
||||
List<Integer> macegoldenappleSlots = null;
|
||||
List<Integer> macewindchargeSlots = null;
|
||||
List<Integer> diasmpwaterSlots = null;
|
||||
List<Integer> diasmpxpSlots = null;
|
||||
List<Integer> diasmpstrengthSlots = null;
|
||||
List<Integer> diasmpspeedSlots = null;
|
||||
List<Integer> diasmpfireresistanceSlots = null;
|
||||
List<Integer> diasmpgoldenappleSlots = null;
|
||||
if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fSword Kit")) {
|
||||
for (int i = 0; i < inv.length; i++) {
|
||||
ItemStack item = inv[i];
|
||||
|
||||
if (item != null) {
|
||||
if (item.getType() == Material.DIAMOND_SWORD) {
|
||||
plugin.getConfig().set("kits.sword." + player.getUniqueId() + ".sword", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fUHC Kit")) {
|
||||
|
||||
uhclavaSlots = new ArrayList<>();
|
||||
uhcwaterSlots = new ArrayList<>();
|
||||
uhcshieldSlots = new ArrayList<>();
|
||||
for (int i = 0; i < inv.length; i++) {
|
||||
ItemStack item = inv[i];
|
||||
|
||||
if (item != null) {
|
||||
if (item.getType() == Material.DIAMOND_AXE) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".axe", i);
|
||||
} else if (item.getType() == Material.DIAMOND_SWORD) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".sword", i);
|
||||
} else if (item.getType() == Material.LAVA_BUCKET) {
|
||||
uhclavaSlots.add(i);
|
||||
} else if (item.getType() == Material.COBWEB) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".cobweb", i);
|
||||
} else if (item.getType() == Material.COBBLESTONE) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".cobblestone", i);
|
||||
} else if (item.getType() == Material.GOLDEN_APPLE) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".goldenapple", i);
|
||||
} else if (item.getType() == Material.WATER_BUCKET) {
|
||||
uhcwaterSlots.add(i);
|
||||
} else if (item.getType() == Material.CROSSBOW) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".crossbow", i);
|
||||
} else if (item.getType() == Material.BOW) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".bow", i);
|
||||
} else if (item.getType() == Material.ARROW) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".arrow", i);
|
||||
} else if (item.getType() == Material.OAK_PLANKS) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".planks", i);
|
||||
} else if (item.getType() == Material.DIAMOND_PICKAXE) {
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".pickaxe", i);
|
||||
} else if (item.getType() == Material.SHIELD) {
|
||||
uhcshieldSlots.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".lava", uhclavaSlots);
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".water", uhcwaterSlots);
|
||||
plugin.getConfig().set("kits.uhc." + player.getUniqueId() + ".shield", uhcshieldSlots);
|
||||
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fMace Kit")) {
|
||||
macetotemSlots = new ArrayList<>();
|
||||
maceenderpearlSlots = new ArrayList<>();
|
||||
macestrengthSlots = new ArrayList<>();
|
||||
macespeedSlots = new ArrayList<>();
|
||||
macegoldenappleSlots = new ArrayList<>();
|
||||
macewindchargeSlots = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < inv.length; i++) {
|
||||
ItemStack item = inv[i];
|
||||
|
||||
if (item != null) {
|
||||
if (item.getType() == Material.NETHERITE_AXE) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".axe", i);
|
||||
} else if (item.getType() == Material.NETHERITE_SWORD) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".sword", i);
|
||||
} else if (item.getType() == Material.ENDER_PEARL) {
|
||||
maceenderpearlSlots.add(i);
|
||||
} else if (item.getType() == Material.SPLASH_POTION) {
|
||||
if (item.getItemMeta().getDisplayName().equals("§rSplash Potion of Strength")) {
|
||||
macestrengthSlots.add(i);
|
||||
} else if (item.getItemMeta().getDisplayName().equals("§rSplash Potion of Swiftness")) {
|
||||
macespeedSlots.add(i);
|
||||
}
|
||||
} else if (item.getType() == Material.SHIELD) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".shield", i);
|
||||
} else if (item.getType() == Material.MACE) {
|
||||
if (item.getItemMeta().getEnchants().containsKey(Enchantment.DENSITY)) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".density", i);
|
||||
} else if (item.getItemMeta().getEnchants().containsKey(Enchantment.BREACH)) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".breach", i);
|
||||
}
|
||||
} else if (item.getType() == Material.GOLDEN_APPLE) {
|
||||
macegoldenappleSlots.add(i);
|
||||
} else if (item.getType() == Material.WIND_CHARGE) {
|
||||
macewindchargeSlots.add(i);
|
||||
} else if (item.getType() == Material.POTION) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".jumpboost", i);
|
||||
} else if (item.getType() == Material.ELYTRA) {
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".elytra", i);
|
||||
} else if (item.getType() == Material.TOTEM_OF_UNDYING) {
|
||||
macetotemSlots.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".totem", macetotemSlots);
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".enderpearl", maceenderpearlSlots);
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".strength", macestrengthSlots);
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".speed", macespeedSlots);
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".goldenapple", macegoldenappleSlots);
|
||||
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".windcharge", macewindchargeSlots);
|
||||
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fAxe Kit")) {
|
||||
for (int i = 0; i < inv.length; i++) {
|
||||
ItemStack item = inv[i];
|
||||
|
||||
if (item != null) {
|
||||
if (item.getType() == Material.DIAMOND_AXE) {
|
||||
plugin.getConfig().set("kits.axe." + player.getUniqueId() + "axe.", i);
|
||||
} else if (item.getType() == Material.DIAMOND_SWORD) {
|
||||
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".sword", i);
|
||||
} else if (item.getType() == Material.CROSSBOW) {
|
||||
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".crossbow", i);
|
||||
} else if (item.getType() == Material.BOW) {
|
||||
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".bow", i);
|
||||
} else if (item.getType() == Material.ARROW) {
|
||||
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".arrow", i);
|
||||
} else if (item.getType() == Material.SHIELD) {
|
||||
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".shield", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fDiamondSmp Kit")) {
|
||||
diasmpwaterSlots = new ArrayList<>();
|
||||
diasmpxpSlots = new ArrayList<>();
|
||||
diasmpstrengthSlots = new ArrayList<>();
|
||||
diasmpspeedSlots = new ArrayList<>();
|
||||
diasmpfireresistanceSlots = new ArrayList<>();
|
||||
diasmpgoldenappleSlots = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < inv.length; i++) {
|
||||
ItemStack item = inv[i];
|
||||
|
||||
if (item != null) {
|
||||
if (item.getType() == Material.DIAMOND_AXE) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".axe", i);
|
||||
} else if (item.getType() == Material.DIAMOND_SWORD) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".sword", i);
|
||||
} else if (item.getType() == Material.ENDER_PEARL) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".enderpearl", i);
|
||||
} else if (item.getType() == Material.OAK_LOG) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".log", i);
|
||||
} else if (item.getType() == Material.WATER_BUCKET) {
|
||||
diasmpwaterSlots.add(i);
|
||||
} else if (item.getType() == Material.GOLDEN_APPLE) {
|
||||
diasmpgoldenappleSlots.add(i);
|
||||
} else if (item.getType() == Material.COBWEB) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".cobweb", i);
|
||||
} else if (item.getType() == Material.SPLASH_POTION) {
|
||||
if (item.getItemMeta().getDisplayName().equals("§rSplash Potion of Strength")) {
|
||||
diasmpstrengthSlots.add(i);
|
||||
} else if (item.getItemMeta().getDisplayName().equals("§rSplash Potion of Swiftness")) {
|
||||
diasmpspeedSlots.add(i);
|
||||
} else if (item.getItemMeta().getDisplayName().equals("§rSplash Potion of Fire Resistance")) {
|
||||
diasmpfireresistanceSlots.add(i);
|
||||
}
|
||||
} else if (item.getType() == Material.TOTEM_OF_UNDYING) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".totem", i);
|
||||
} else if (item.getType() == Material.NETHERITE_PICKAXE) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".pickaxe", i);
|
||||
} else if (item.getType() == Material.EXPERIENCE_BOTTLE) {
|
||||
diasmpxpSlots.add(i);
|
||||
} else if (item.getType() == Material.CHORUS_FRUIT) {
|
||||
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".chorusfruit", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.saveConfig();
|
||||
plugin.reloadConfig();
|
||||
player.sendMessage("§aSikeresen elmentetted a kitedet!");
|
||||
player.closeInventory();
|
||||
|
||||
} else if ((6 <= event.getSlot() && event.getSlot() <= 8) || (15 <= event.getSlot() && event.getSlot() <= 17) || (24 <= event.getSlot() && event.getSlot() <= 26)) {
|
||||
player.closeInventory();
|
||||
player.sendMessage("§cA kited nem került mentésre.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
if (!(event.getPlayer() instanceof Player player)) return;
|
||||
if (event.getInventory() == event.getView().getTopInventory() && event.getView().title().equals(Component.text("Kit Editor"))) {
|
||||
player.getInventory().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package lnmpro;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import lnmpro.Commands.*;
|
||||
import lnmpro.Listeners.*;
|
||||
@@ -20,6 +21,7 @@ public final class Main extends JavaPlugin {
|
||||
getCommand("duel").setExecutor(new DuelCommand(this));
|
||||
getCommand("acceptduel").setExecutor(new AcceptDuelCommand(this));
|
||||
getCommand("denyduel").setExecutor(new DenyDuelCommand(this));
|
||||
getCommand("editkit").setExecutor(new EditKitCommand(this));
|
||||
|
||||
getServer().getPluginManager().registerEvents(new DuelRequestListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new KitListener(this), this);
|
||||
|
||||
@@ -175,10 +175,12 @@ public class Kits {
|
||||
|
||||
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
|
||||
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
|
||||
strengthmeta.setDisplayName("§rSplash Potion of Strength");
|
||||
strengthmeta.setMainEffect(PotionEffectType.STRENGTH);
|
||||
strength.setItemMeta(strengthmeta);
|
||||
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
|
||||
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1800, 1), true);
|
||||
speedmeta.setDisplayName("§rSplash Potion of Speed");
|
||||
speedmeta.setMainEffect(PotionEffectType.SPEED);
|
||||
speed.setItemMeta(speedmeta);
|
||||
|
||||
@@ -304,13 +306,16 @@ public class Kits {
|
||||
PotionMeta fireresistancemeta = (PotionMeta) fireresistance.getItemMeta();
|
||||
fireresistancemeta.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 9600, 0), true);
|
||||
fireresistancemeta.setMainEffect(PotionEffectType.FIRE_RESISTANCE);
|
||||
fireresistancemeta.setDisplayName("§rSplash Potion of Fire Resistance");
|
||||
fireresistance.setItemMeta(fireresistancemeta);
|
||||
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
|
||||
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
|
||||
strengthmeta.setDisplayName("§rSplash Potion of Strength");
|
||||
strengthmeta.setMainEffect(PotionEffectType.STRENGTH);
|
||||
strength.setItemMeta(strengthmeta);
|
||||
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
|
||||
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 9600, 0), true);
|
||||
speedmeta.setDisplayName("§rSplash Potion of Speed");
|
||||
speedmeta.setMainEffect(PotionEffectType.SPEED);
|
||||
speed.setItemMeta(speedmeta);
|
||||
|
||||
|
||||
@@ -15,12 +15,18 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import lnmpro.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class SchematicManager {
|
||||
private final Main plugin;
|
||||
|
||||
@@ -6,4 +6,5 @@ authors: [ LnmPro, JGJ52 ]
|
||||
commands:
|
||||
duel:
|
||||
acceptduel:
|
||||
denyduel:
|
||||
denyduel:
|
||||
editkit:
|
||||
Binary file not shown.
BIN
target/classes/lnmpro/Commands/AcceptDuelCommand$1.class
Normal file
BIN
target/classes/lnmpro/Commands/AcceptDuelCommand$1.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/lnmpro/Commands/DuelCommand.class
Normal file
BIN
target/classes/lnmpro/Commands/DuelCommand.class
Normal file
Binary file not shown.
BIN
target/classes/lnmpro/Listeners/DuelEndListener.class
Normal file
BIN
target/classes/lnmpro/Listeners/DuelEndListener.class
Normal file
Binary file not shown.
BIN
target/classes/lnmpro/Listeners/FreezeListener.class
Normal file
BIN
target/classes/lnmpro/Listeners/FreezeListener.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/lnmpro/Utils/SchematicManager.class
Normal file
BIN
target/classes/lnmpro/Utils/SchematicManager.class
Normal file
Binary file not shown.
@@ -6,4 +6,5 @@ authors: [ LnmPro, JGJ52 ]
|
||||
commands:
|
||||
duel:
|
||||
acceptduel:
|
||||
denyduel:
|
||||
denyduel:
|
||||
editkit:
|
||||
@@ -3,3 +3,4 @@ lnmpro/Commands/AcceptDuelCommand$1.class
|
||||
lnmpro/Commands/DuelCommand.class
|
||||
lnmpro/Listeners/DuelEndListener.class
|
||||
lnmpro/Utils/SchematicManager.class
|
||||
lnmpro/Commands/EditKitCommand.class
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Commands/AcceptDuelCommand.java
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Commands/DenyDuelCommand.java
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Commands/DuelCommand.java
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Commands/EditKitCommand.java
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Listeners/DuelEndListener.java
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Listeners/DuelRequestListener.java
|
||||
/home/jgj52/IdeaProjects/InsaneDuels/src/main/java/lnmpro/Listeners/FreezeListener.java
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user