From d6fcf0f15e0d710d0ecef87de06098f865f53dad Mon Sep 17 00:00:00 2001 From: KaiKikuchi Date: Sat, 29 Aug 2015 01:05:46 +0200 Subject: [PATCH] Fixed NullPointerException (bugfix #6) --- src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java b/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java index a69d116..b55ce74 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java +++ b/src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java @@ -19,6 +19,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.maxgamer.quickshop.QuickShop; +import org.maxgamer.quickshop.Shop.ContainerShop; import org.maxgamer.quickshop.Shop.Shop; @SuppressWarnings("deprecation") @@ -143,7 +144,7 @@ public class MsgUtil { p.sendMessage(""); p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+"); p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.shop-information")); - p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner()).getName())); + p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner())==null ? (shop.isUnlimited() ? "AdminShop" : "Unknown") : Bukkit.getOfflinePlayer(shop.getOwner()).getName())); p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item", shop.getDataName())); if (Util.isTool(items.getType())) { p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.damage-percent-remaining", Util.getToolPercentage(items))); @@ -276,7 +277,7 @@ public class MsgUtil { return raw; } for (int i = 0; i < args.length; i++) { - raw = raw.replace("{" + i + "}", args[i]); //TODO Nullpointer? + raw = raw.replace("{" + i + "}", args[i]==null ? "null" : args[i]); } return raw; }