From deb34d3fcfa425bca8a825047ff63cd47a56ff1c Mon Sep 17 00:00:00 2001 From: Beez0r Date: Fri, 12 Jul 2024 21:06:45 -0700 Subject: [PATCH] iShop 2.26 Update Part 2 --- src/com/minedhype/ishop/CommandShop.java | 2 +- src/com/minedhype/ishop/Shop.java | 4 ++-- src/com/minedhype/ishop/inventories/InvShopList.java | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/com/minedhype/ishop/CommandShop.java b/src/com/minedhype/ishop/CommandShop.java index f0dbb6a..fec4a9b 100644 --- a/src/com/minedhype/ishop/CommandShop.java +++ b/src/com/minedhype/ishop/CommandShop.java @@ -160,7 +160,7 @@ else if(args[0].equalsIgnoreCase("view") && args.length >= 2) private void listSubCmd(Player player, String label) { player.sendMessage(ChatColor.GOLD + "iShop Commands:"); - player.sendMessage(ChatColor.GRAY + "/" + label + " copy "); + player.sendMessage(ChatColor.GRAY + "/" + label + " copy "); player.sendMessage(ChatColor.GRAY + "/" + label + " count "); player.sendMessage(ChatColor.GRAY + "/" + label + " create"); player.sendMessage(ChatColor.GRAY + "/" + label + " delete"); diff --git a/src/com/minedhype/ishop/Shop.java b/src/com/minedhype/ishop/Shop.java index 0045165..dbafa23 100644 --- a/src/com/minedhype/ishop/Shop.java +++ b/src/com/minedhype/ishop/Shop.java @@ -140,7 +140,7 @@ public static void findItem(Player player, ItemStack item, String itemName) { if(row.isPresent() && !foundItemInShop.get()) { boolean itemMatch = row.get().getItemOut().isSimilar(item); boolean itemMatch2 = row.get().getItemOut2().isSimilar(item); - if(((itemMatch && itemMatch2) && Utils.hasDoubleItemStock(s, item, item)) || ((itemMatch && !itemMatch2) && Utils.hasStock(s, row.get().getItemOut2())) || ((!itemMatch && itemMatch2) && Utils.hasStock(s, row.get().getItemOut()))) { + if(((itemMatch && itemMatch2) && Utils.hasDoubleItemStock(s, row.get().getItemOut(), row.get().getItemOut2())) || ((itemMatch && !itemMatch2) && Utils.hasStock(s, row.get().getItemOut())) || ((!itemMatch && itemMatch2) && Utils.hasStock(s, row.get().getItemOut2()))) { foundItem.set(true); foundItemInShop.set(true); player.sendMessage(Messages.SHOP_LOCATION.toString().replaceAll("%id", String.valueOf(s.idTienda)).replaceAll("%x", String.valueOf(s.location.getBlockX())).replaceAll("%y", String.valueOf(s.location.getBlockY())).replaceAll("%z", String.valueOf(s.location.getBlockZ())).replaceAll("%world", s.location.getWorld().getName())); @@ -728,7 +728,7 @@ public static void loadData() { invOut2.setContents(decodeByte(blob.getBinaryStream())); } catch(Exception e) { invOut2.addItem(airItem); } - rows[index] = new RowStore(invIn.getItem(0), invIn2.getItem(0), invOut.getItem(0), invOut2.getItem(0), broadcast); + rows[index] = new RowStore(invOut.getItem(0), invOut2.getItem(0), invIn.getItem(0), invIn2.getItem(0), broadcast); } } catch(Exception e) { e.printStackTrace(); diff --git a/src/com/minedhype/ishop/inventories/InvShopList.java b/src/com/minedhype/ishop/inventories/InvShopList.java index 287c37a..bcac599 100644 --- a/src/com/minedhype/ishop/inventories/InvShopList.java +++ b/src/com/minedhype/ishop/inventories/InvShopList.java @@ -77,9 +77,14 @@ private static void getShopList(UUID uuid) { ItemStack item = new ItemStack(playerHead); SkullMeta skullMeta = (SkullMeta) item.getItemMeta(); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(Shop.shopList.get(id)); - skullMeta.setOwningPlayer(offlinePlayer); + boolean playerNotFound = false; + try { + skullMeta.setOwningPlayer(offlinePlayer); } + catch(Exception e) { playerNotFound = true; } if(Shop.getShopById(id).get().isAdmin()) skullMeta.setDisplayName(Messages.ADMIN_SHOP_NUMBER.toString().replaceAll("%id", id.toString())); + else if(playerNotFound) + skullMeta.setDisplayName(Messages.SHOP_NUMBER.toString().replaceAll("%player", "Unknown Player").replaceAll("%id", id.toString())); else skullMeta.setDisplayName(Messages.SHOP_NUMBER.toString().replaceAll("%player", offlinePlayer.getName()).replaceAll("%id", id.toString())); List skullLore = new ArrayList<>();