Fixed harmless NPE in the party UI

This commit is contained in:
Jules 2024-05-24 18:51:58 -07:00
parent bded64d44a
commit daa052cabd

View File

@ -193,12 +193,12 @@ public class EditablePartyView extends EditableInventory {
}
if (item.getFunction().equals("member") && context.getClickType() == ClickType.RIGHT) {
if (!party.getOwner().equals(playerData))
return;
if (!party.getOwner().equals(playerData)) return;
OfflinePlayer target = Bukkit.getOfflinePlayer(UUID.fromString(context.getClickedItem().getItemMeta().getPersistentDataContainer().get(UUID_NAMESPACEDKEY, PersistentDataType.STRING)));
if (target.equals(player))
return;
final String uuidTag = context.getClickedItem().getItemMeta().getPersistentDataContainer().get(UUID_NAMESPACEDKEY, PersistentDataType.STRING);
if (uuidTag == null || uuidTag.isEmpty()) return;
final OfflinePlayer target = Bukkit.getOfflinePlayer(UUID.fromString(uuidTag));
if (target.equals(player)) return;
party.removeMember(PlayerData.get(target));
ConfigMessage.fromKey("kick-from-party", "player", target.getName()).send(player);