From e469f1a16dff65e7b55d8e0d28ae81a4a9abcf95 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Mon, 6 Jan 2020 16:13:21 +0100 Subject: [PATCH] Prevent a backpack from being opened when it is already open --- pom.xml | 2 +- src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 89b9b01..7423390 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 at.pcgamingfreaks Minepacks - 2.1-RC2 + 2.1-RC3 scm:git:git@github.com:GeorgH93/Minepacks.git diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index a5ea731..993a13d 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -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);