From f193276372f816cce61eeb6a6fddc592f5c4e69d Mon Sep 17 00:00:00 2001 From: Andrzej Pomirski Date: Sat, 12 Apr 2014 17:27:16 +0200 Subject: [PATCH] Prevent from breaking signs for non-existant players --- .../ChestShop/Listeners/Player/PlayerInteract.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java index b198de2..ce657c1 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java @@ -28,6 +28,8 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import java.util.UUID; + import static com.Acrobot.Breeze.Utils.BlockUtil.isChest; import static com.Acrobot.Breeze.Utils.BlockUtil.isSign; import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType; @@ -116,7 +118,13 @@ public class PlayerInteract implements Listener { String material = sign.getLine(ITEM_LINE); String ownerName = NameManager.getFullUsername(name); - OfflinePlayer owner = Bukkit.getOfflinePlayer(NameManager.getUUID(ownerName)); + UUID uuid = NameManager.getUUID(ownerName); + + if (uuid == null) { + return null; + } + + OfflinePlayer owner = Bukkit.getOfflinePlayer(uuid); Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK; double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));