Prevent backpack shrinking if player doesn't have the permission to open it

This commit is contained in:
GeorgH93 2018-07-24 23:47:35 +02:00
parent 5a60f09ed7
commit 192d805154
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId> <groupId>at.pcgamingfreaks</groupId>
<artifactId>MinePacks</artifactId> <artifactId>MinePacks</artifactId>
<version>1.17.11</version> <version>1.17.12-SNAPSHOT</version>
<scm> <scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection> <connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>

View File

@ -93,7 +93,7 @@ public void open(Player p, boolean editable)
if(owner.isOnline()) if(owner.isOnline())
{ {
Player player = owner.getPlayer(); Player player = owner.getPlayer();
if(player != null) if(player != null && (player.hasPermission("backpack") || player.hasPermission("backpack.use")))
{ {
int size = MinePacks.getBackpackPermSize(player); int size = MinePacks.getBackpackPermSize(player);
if(size != bp.getSize()) if(size != bp.getSize())
@ -101,7 +101,7 @@ public void open(Player p, boolean editable)
List<ItemStack> items = setSize(size); List<ItemStack> items = setSize(size);
for(ItemStack i : items) for(ItemStack i : items)
{ {
if (i != null) if(i != null)
{ {
player.getWorld().dropItemNaturally(player.getLocation(), i); player.getWorld().dropItemNaturally(player.getLocation(), i);
hasChanged = true; hasChanged = true;