Skip to content

Commit 5eebcb9

Browse files
committed
make sure chests are in the same world
fixes #14
1 parent 63d508f commit 5eebcb9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/lol/hyper/toolstats/events/GenerateLoot.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ public void onGenerateLoot(LootGenerateEvent event) {
6565
// if the distance is less than 1, it's the same chest
6666
for (Block chest : toolStats.playerInteract.openedChests.keySet()) {
6767
Location chestLocation = chest.getLocation();
68-
double distance = lootLocation.distance(chestLocation);
69-
if (distance <= 1.0) {
70-
openedChest = chest;
68+
if (chest.getWorld() == lootLocation.getWorld()) {
69+
double distance = lootLocation.distance(chestLocation);
70+
if (distance <= 1.0) {
71+
openedChest = chest;
72+
}
7173
}
7274
}
7375
// ignore if the chest is not in the same location

0 commit comments

Comments
 (0)