Prevent a backpack from being opened when it is already open

This commit is contained in:
GeorgH93 2020-01-06 16:13:21 +01:00
parent d352ec9c75
commit e469f1a16d
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 3 additions and 1 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks</artifactId>
<version>2.1-RC2</version>
<version>2.1-RC3</version>
<scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>

View File

@ -298,6 +298,8 @@ public void openBackpack(@NotNull Player opener, @Nullable Backpack backpack, bo
messageInvalidBackpack.send(opener);
return;
}
//noinspection ObjectEquality
if(opener.getOpenInventory().getTopInventory().getHolder() == backpack) return; // == is fine as there is only one instance of each backpack
if(openSound != null)
{
opener.getWorld().playSound(opener.getLocation(), openSound, 1, 0);