BG-Software-LLC / WildChests

Sell chests, auto crafters, storage units, larger chests and more in one plugin!
https://bg-software.com/wildchests/
GNU General Public License v3.0
38 stars 23 forks source link

WildChestsAPI#getStorageChest throws ClassCastException instead of returning null #178

Closed mfnalex closed 1 year ago

mfnalex commented 1 year ago

Minecraft's Version

Spigot 1.19

Plugin's Version

2023.1-b5

Describe the bug

Using WildChestsAPI#getStorageChest on a chest that's not a storage chest, but e.g. a linked chest, throws a ClassCastException instead of returning null - so either there's a bug in the code, or the API docs are wrong ( https://bg-software.com/wildchests/api/com/bgsoftware/wildchests/api/WildChestsAPI.html#getStorageChest-org.bukkit.Location- claims it returns null if it's not a storage chest ).

For a full stacktrace, see issue #177. The line in my code (WildChestsHook line 25) looks like this:

StorageChest storageChest = WildChestsAPI.getStorageChest(event.getBlock().getLocation());

To Reproduce

Use WildChestsAPI#getStorageChest on a chest that is a linked chest

Additional Information

This is related to issue #177 which unfortunately was closed without any useful reply.

OmerBenGera commented 1 year ago

Fixed in latest dev build, sorry about that.