mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-10 20:29:28 +00:00
More cleanup
This commit is contained in:
parent
555bb76428
commit
b5e559ff66
|
@ -544,6 +544,7 @@ public class EssentialsPlayerListener implements Listener
|
||||||
|| !invOwner.isOnline()))
|
|| !invOwner.isOnline()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
user.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,10 +566,28 @@ public class EssentialsPlayerListener implements Listener
|
||||||
}
|
}
|
||||||
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
||||||
{
|
{
|
||||||
User user = ess.getUser(event.getWhoClicked());
|
final User user = ess.getUser(event.getWhoClicked());
|
||||||
if (user.isInvSee())
|
final InventoryHolder invHolder = top.getHolder();
|
||||||
|
if (invHolder != null && invHolder instanceof HumanEntity)
|
||||||
|
{
|
||||||
|
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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,11 +617,20 @@ public class EssentialsPlayerListener implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
else if (type == InventoryType.CHEST && top.getSize() == 9)
|
||||||
|
{
|
||||||
|
final InventoryHolder invHolder = top.getHolder();
|
||||||
|
if (invHolder != null && invHolder instanceof HumanEntity)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
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);
|
user.setInvSee(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerFishEvent(final PlayerFishEvent event)
|
public void onPlayerFishEvent(final PlayerFishEvent event)
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class Commandinvsee extends EssentialsCommand
|
||||||
super("invsee");
|
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
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
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);
|
final User invUser = getPlayer(server, args, 0);
|
||||||
Inventory inv;
|
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());
|
inv.setContents(invUser.getInventory().getArmorContents());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue