From e46bc98564bac45d7e8226b86e51950173843d11 Mon Sep 17 00:00:00 2001 From: night0721 Date: Mon, 11 Jul 2022 09:47:03 +0100 Subject: [PATCH] fixed error in weapon command as args isnt joined --- .../com/night/nullvalkyrie/commands/WeaponCommand.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java b/src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java index 53b5288..3f6f867 100644 --- a/src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java +++ b/src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java @@ -2,6 +2,7 @@ package com.night.nullvalkyrie.commands; import com.night.nullvalkyrie.Enchantments.EnchantmentHandler; import com.night.nullvalkyrie.Items.CustomItemManager; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.CommandSender; @@ -30,9 +31,9 @@ public class WeaponCommand extends Command { @Override public void onCommand(CommandSender sender, String[] args) { - System.out.println(args[0]); + String name = String.join(" ", args); Player player = (Player) sender; - if(args[0].equalsIgnoreCase("Snow Gun")) { + if(name.equalsIgnoreCase("Snow Gun")) { ItemStack hoe = new ItemStack(Material.DIAMOND_HOE); hoe.addUnsafeEnchantment(EnchantmentHandler.ThunderBolt, 5); hoe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20); @@ -43,7 +44,7 @@ public class WeaponCommand extends Command { hoe.setItemMeta(hoedata); player.getInventory().addItem(hoe); - } else if(args[0].equalsIgnoreCase("Grenade")) { + } else if(name.equalsIgnoreCase("Grenade")) { ItemStack egg = new ItemStack(Material.EGG); ItemMeta eggdata = egg.getItemMeta(); eggdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade"); @@ -51,7 +52,7 @@ public class WeaponCommand extends Command { eggdata.setLore(Arrays.asList(ChatColor.GOLD + "Boom")); egg.setItemMeta(eggdata); player.getInventory().addItem(egg); - } else if(args[0].equalsIgnoreCase("Widow Sword")) { + } else if(name.equalsIgnoreCase("Widow Sword")) { player.getInventory().addItem(CustomItemManager.WidowSword); } }