Shopkeepers

Shopkeepers

2M Downloads

Regarding the inquiry about the method of opening the GUI.

zoe-may opened this issue ยท 2 comments

commented

This is not a bug. I'm using the Citizens plugin, and I just want to ask if it's possible to disable opening the trade GUI by right-clicking on an NPC and instead open it using a command. I want to open the GUI during the conversation with the NPC, rather than directly by right-clicking.Thank you very much!

commented

I think the easiest would be to not actually use the NPC as the shopkeeper directly, but have the shopkeeper object hidden somewhere else, and then remotely access it via commands when you want to access it (both the editor and the trading can be opened via commands).

Unfortunately, there are no "virtual" shopkeepers yet. So you would have to hide a dummy shopkeeper entity or sign somewhere (maybe below the Citizens NPC).

--

An other alternative might be to enable the check-shop-interaction-result setting, but I am not sure how well this will actually work together with the Citizens plugin. Basically, with this enabled, there are 2 interactions events triggered for a single actual interaction of a player: The Shopkeepers plugin tries to handle the first real interaction as early as possible and then cancels it to hopefully prevent other plugins from handling the interaction as well. And then, if check-shop-interaction-result is enabled, the Shopkeepers plugin triggers a second dummy interaction event to figure out if other plugins maybe want to handle the interaction instead. If any other plugins, e.g. Citizens, cancels the second interaction event, the Shopkeepers plugin will skip its own interaction logic. But for this to work correctly, two conditions must be fulfilled, which I don't know if they apply to the Citizens plugin:

  • The Citizens plugin must ignore the first interaction event that was already cancelled by the Shopkeepers plugin. Otherwise, it might triggers its own logic twice due to the subsequent second dummy interaction event.
  • The Citizens plugin must cancel the second interaction event to indicate that it is handling the event.

You can try out if this setting works, but if it does not, you might have to fallback to the first solution I proposed above.

commented

I have tested the second method and it is completely feasible. Thank you so much. :)