mfnalex / ChestSort

Best sorting plugin for Minecraft / Spigot 1.14+
https://www.chestsort.de
GNU General Public License v3.0
91 stars 34 forks source link

e.getPlayer() is always null when using the ChestSortEvent (in a chest) #125

Closed rockyhawk64 closed 3 years ago

rockyhawk64 commented 3 years ago

Used ChestSort version Tell us your ChestSort version 11.0.3

Used Spigot version Tell us your Spigot version (output of /version). Please also tell us if you use another fork like Paper, etc. Paper-49

Describe the bug A clear and concise description of what the bug is. This is the developer of CommandPanels. I have updated the plugin to support the new API class location, however I have users who are reporting this error: https://pastebin.com/raw/nKTe9Pqd When sorting a chest e.getPlayer() is always null for the ChestSortEvent.

To Reproduce How can the behaviour be reproduced? By sorting a chest and having a plugin using e.getPlayer()

Expected behavior A clear and concise description of what you expected to happen. NullPointerException

Additional context Add any other context about the problem here.

mfnalex commented 3 years ago

Hi, it's not a bug, although I admit it's confusing.

ChestSortEvent#getPlayer is @Nullable: https://repo.jeff-media.com/javadocs/ChestSortAPI/de/jeff_media/chestsort/api/ChestSortEvent.html#getPlayer()

The player is only set by ChestSort when a player sorts their own inventory. Is there any need why you need to get the player that triggered sorting? If so I can just add that.