mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 18:11:52 +01:00
More cleanup
This commit is contained in:
parent
555bb76428
commit
b5e559ff66
@ -544,6 +544,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
|| !invOwner.isOnline()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
user.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -565,10 +566,28 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
||||
{
|
||||
User user = ess.getUser(event.getWhoClicked());
|
||||
if (user.isInvSee())
|
||||
final User user = ess.getUser(event.getWhoClicked());
|
||||
final InventoryHolder invHolder = top.getHolder();
|
||||
if (invHolder != null && invHolder instanceof HumanEntity)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
final User invOwner = ess.getUser((HumanEntity)invHolder);
|
||||
|
||||
if (user.isInvSee() && (!user.isAuthorized("essentials.invsee.modify")
|
||||
|| invOwner.isAuthorized("essentials.invsee.preventmodify")
|
||||
|| !invOwner.isOnline()
|
||||
|| (event.getSlot() > 3 && event.getSlot() < 9)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
user.updateInventory();
|
||||
}
|
||||
else
|
||||
{
|
||||
final ItemStack[] contents =
|
||||
{
|
||||
top.getItem(0), top.getItem(1), top.getItem(2), top.getItem(3)
|
||||
};
|
||||
invOwner.getInventory().setArmorContents(contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -599,8 +618,17 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.setInvSee(false);
|
||||
final InventoryHolder invHolder = top.getHolder();
|
||||
if (invHolder != null && invHolder instanceof HumanEntity)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final ItemStack[] contents =
|
||||
{
|
||||
top.getItem(0), top.getItem(1), top.getItem(2), top.getItem(3),
|
||||
};
|
||||
((HumanEntity)invHolder).getInventory().setArmorContents(contents);
|
||||
user.setInvSee(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class Commandinvsee extends EssentialsCommand
|
||||
super("invsee");
|
||||
}
|
||||
|
||||
//This method has a hidden param, which if given will display the armour slots. #easteregg
|
||||
//This method has a hidden param, which if given will display the equip slots. #easteregg
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
@ -25,9 +25,9 @@ public class Commandinvsee extends EssentialsCommand
|
||||
final User invUser = getPlayer(server, args, 0);
|
||||
Inventory inv;
|
||||
|
||||
if (args.length > 1)
|
||||
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip"))
|
||||
{
|
||||
inv = server.createInventory(user, 9, "Equipped");
|
||||
inv = server.createInventory(invUser, 9, "Equipped");
|
||||
inv.setContents(invUser.getInventory().getArmorContents());
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user