Npc commands/permissions for shop navigation

Discussion in 'Spigot Plugin Help' started by Espinete87, Jul 24, 2018.

  1. Hello guys, im using Citizens and commandNPC. But i dont know if there is any way to add permissions to the NPC to let him navigate trought a menu that needs permissions.
    For know i only got to overpass one permission becouse im opening the shop menu with a command.
    Im simulating the opening menu putting this command "/npc cmdadd -o fish menu buy_bait" ( i need to put "-o" that means that the command will be executed as a OP, becouse i wont give to the permissions to the players)
    So when you right click the NPC, will open the menu and you can buy, but only in that "section" of the shop.

    So the problem is, if you right click in the npc, then the shop will be open, you buy your bait, then you go back, and then you want to click in "sell bait" for ex, and YOU CANT , becouse you need another permission to do that. ( and i dont want to give the permissions to the players becouse otherwhise they could open the shop everywhere, and i want to let them open only talking to the NPC)

    So i need 3 permissions to be able to navigate trought the menus, /-o fish menu buy_bait /-o fish menu sell_bait and /-o fish menu sell_fish.
    Is this possible? How you would do it?

    Obviusly i could create 3 npcs with 1 permissions per NPC and that would be okay, but is dirty solution, and i want to learn this becouse before or later i will have similar situation creating my server.

    THANKS GUYS
     
  2. Heyo,
    I read this and thought that it would be easy to do this if you were able to have a command be set to run when the player closes the GUI, but I couldn't find anything.
    If you want, it's a bit of a hacky way, but you can add the sell permission to the player when they click the npc, then add a delayed command to remove the permission. That way they had at least recently clicked the npc to be able to sell.
    Another thing that could possibly happen is if you separate the sell/buy shops and only make the sell shop able to be opened from the NPC. You can use the right/left command features of the plugin to utilize this.

    Hope I could help!
     
    • Like Like x 1