SteamWar/BauSystem2.0
Archiviert
12
0

Hotfix AttributeRemoveCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-12-08 20:34:42 +01:00
Ursprung 75ba8813d3
Commit 9c788a27d6

Datei anzeigen

@ -56,7 +56,15 @@ public class AttributeRemoveCommand extends SWCommand {
public void genericCommand(Player player, @Mapper("attribute") String attribute) { public void genericCommand(Player player, @Mapper("attribute") String attribute) {
ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemStack itemStack = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta == null) {
BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player);
return;
}
List<String> lore = itemMeta.getLore(); List<String> lore = itemMeta.getLore();
if (lore == null) {
BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player);
return;
}
if (lore.isEmpty()) { if (lore.isEmpty()) {
BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player); BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player);
return; return;
@ -83,7 +91,9 @@ public class AttributeRemoveCommand extends SWCommand {
Player player = (Player) commandSender; Player player = (Player) commandSender;
ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemStack itemStack = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta == null) return null;
List<String> lore = itemMeta.getLore(); List<String> lore = itemMeta.getLore();
if (lore == null) return null;
if (lore.isEmpty()) return null; if (lore.isEmpty()) return null;
if (!lore.get(0).equals("§eAttributes§8:")) return null; if (!lore.get(0).equals("§eAttributes§8:")) return null;
return lore.stream() return lore.stream()