mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
More fixes for MC 1.20.1
This commit is contained in:
parent
5e24997f93
commit
cf7a6c0617
@ -47,6 +47,8 @@ public interface Backpack extends InventoryHolder
|
||||
*/
|
||||
UUID getOwnerId();
|
||||
|
||||
@Nullable Player getOwnerPlayer();
|
||||
|
||||
/**
|
||||
* Let a given player open this backpack.
|
||||
*
|
||||
|
@ -119,6 +119,12 @@ public Backpack(final OfflinePlayer owner, ItemStack[] backpack, final int ID)
|
||||
return Bukkit.getServer().getOfflinePlayer(ownerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Player getOwnerPlayer()
|
||||
{
|
||||
return Bukkit.getServer().getPlayer(ownerId);
|
||||
}
|
||||
|
||||
private void checkResize()
|
||||
{
|
||||
Player owner = Bukkit.getServer().getPlayer(this.ownerId);
|
||||
|
@ -69,15 +69,15 @@ public void onResult(Backpack backpack)
|
||||
if(backpack != null)
|
||||
{
|
||||
backpack.clear();
|
||||
if(commandSender.equals(backpack.getOwner()))
|
||||
if(commandSender instanceof Player && ((Player) commandSender).getUniqueId().equals(backpack.getOwnerId()))
|
||||
{
|
||||
messageCleared.send(commandSender);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(backpack.getOwner().isOnline())
|
||||
Player owner = backpack.getOwnerPlayer();
|
||||
if(owner != null)
|
||||
{
|
||||
Player owner = backpack.getOwner().getPlayer();
|
||||
messageClearedOther.send(commandSender, owner);
|
||||
messageClearedBy.send(owner, commandSender);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user