Sort button getting stuck on screen?Solved

Hello.. There seems to be a conflict between this plugin and the trade plugin. After using /trade with a player the button gets stuck on the person's screen and the only way for it to go away is for the player to leave and join back..  

I don't recall Sort Button supporting the Trade loot panel. Perhaps the Trade plugin is using a different entity than a shopfront, causing Sort Button to show the UI.

Which version of Sort Button are you using? In 2.0.0, I removed what looked like a redundant hook, to save on performance. If this issue is new with 2.0.0, then perhaps it was caused by removal of that hook.

NKXTQs24ExGTuL8.jpg WhiteThunder

I don't recall Sort Button supporting the Trade loot panel. Perhaps the Trade plugin is using a different entity than a shopfront, causing Sort Button to show the UI.

Which version of Sort Button are you using? In 2.0.0, I removed what looked like a redundant hook, to save on performance. If this issue is new with 2.0.0, then perhaps it was caused by removal of that hook.

The current version is 2.0.0

I looked into this issue. It happens for multiple reasons.

  • Sort Button now allows looting entities that have no owner. This was done to allow the sort button to display in more situations, such as on vehicle storage containers (which have no owner).
  • The Trade plugin calls a hook that allows Sort Button to learn that the trade box has been opened, but it does not call the hook that would allow Sort Button to learn that the trade box has been closed.

There are multiple possible solutions.

  • Update Sort Button to explicitly deny showing the Sort Button on the Trade window. This will likely have a small performance cost because every time Sort Button wants to potentially show the UI, it will have to ask the Trade plugin whether it's a trade box.
  • Update Trade to call the hook that allows Sort Button to learn that the trade box has been closed. This will allow the Sort Button to go away like it's supposed to.
  • Update Trade to stop calling the hook that allows Sort Button to learn that the trade box has been opened, therefore never showing the Sort Button in the first place. This will also prevent other plugins from showing container-related UIs on the trade box.

I think the last solution is the best, so I'll contribute that to the Trade plugin.

For immediate relief, update the following (Trade.cs line 1052).

if (player.inventory.loot.entitySource != null) {

to

Interface.CallHook("OnPlayerLootEnd", player.inventory.loot);

if (player.inventory.loot.entitySource != null) {
NKXTQs24ExGTuL8.jpg WhiteThunder

I looked into this issue. It happens for multiple reasons.

  • Sort Button now allows looting entities that have no owner. This was done to allow the sort button to display in more situations, such as on vehicle storage containers (which have no owner).
  • The Trade plugin calls a hook that allows Sort Button to learn that the trade box has been opened, but it does not call the hook that would allow Sort Button to learn that the trade box has been closed.

There are multiple possible solutions.

  • Update Sort Button to explicitly deny showing the Sort Button on the Trade window. This will likely have a small performance cost because every time Sort Button wants to potentially show the UI, it will have to ask the Trade plugin whether it's a trade box.
  • Update Trade to call the hook that allows Sort Button to learn that the trade box has been closed. This will allow the Sort Button to go away like it's supposed to.
  • Update Trade to stop calling the hook that allows Sort Button to learn that the trade box has been opened, therefore never showing the Sort Button in the first place. This will also prevent other plugins from showing container-related UIs on the trade box.

I think the last solution is the best, so I'll contribute that to the Trade plugin.

For immediate relief, update the following (Trade.cs line 1052).

if (player.inventory.loot.entitySource != null) {

to

Interface.CallHook("OnPlayerLootEnd", player.inventory.loot);

if (player.inventory.loot.entitySource != null) {

Thank you!! I really appreciate the help (: 

Locked automatically