Realizedd / TokenManager

An economy plugin for minecraft.
https://www.spigotmc.org/resources/tokenmanager.8610/
GNU General Public License v3.0
29 stars 47 forks source link

Shop option for cancel permissions. #37

Open mibby opened 4 years ago

mibby commented 4 years ago

Would it be possible to add an option so you can set cancel permissions? That way if someone purchases a shop item and is given a permission node from it, you can have a cancel permission assigned with a message to prevent them from purchasing that item again.

Realizedd commented 4 years ago

Implemented in 5300ab7. Permission is tokenmanager.cancel.<shop name>-<slot>

mibby commented 4 years ago

Sorry, I had a slightly different thought on this idea. I was thinking more along the lines of a permission: specific.node shop setting so TokenManager cancels the purchase if they already have that permission. That way you don't have to add tokenmanager.cancel.<shop name>-<slot> to the player's permission file for no reason, bloating it up in size.

For example;

      '6':
        displayed: "NAME_TAG 1 flags:HIDE_UNBREAKABLE,HIDE_ATTRIBUTES,HIDE_ENCHANTS name:&8<&7Lurker&8> lore:&7Price:&a_%price%_Token|&7Balance:&b_%tokens%_Tokens"
        cost: 10
        message: '&b&lToken &f&l» &7Purchase completed, %player%! &c-%price% token'
        permission: deluxetags.tag.lurker
        commands:
        - 'lp user %player% permission set deluxetags.tag.lurker'

If they don't already have the permission deluxetags.tag.lurker, they can purchase that slot item. If they do already have that permission on check, send a cancel message line that you can specify, such as You have already purchased this item. or something.


The current implementation is nice for group permissions if you want to force a group to not be able to purchase a specific item, like upgrade paths. But then it serves little purpose that you couldn't already do by negating use permissions, i.e. tokenmanager.use.ranks-1. :(

Realizedd commented 4 years ago

I see what you mean. It shouldn't be hard to implement your approach, but it'll need a better option name than permission since it's very likely to confuse people about its meaning. Got any suggestions?

mibby commented 4 years ago

I know the plugin ServerSigns uses the term cancelPermission. Maybe just use the same?

For reference.

permissions: []
permissionMessage: ''
cancelPermission: deluxetags.tag.Suggestive
cancelPermissionMessage: You have already purchased this tag!
world: spawn
X: -1679
Y: 39
Z: -1335
price: 3000.0
exp: 0
cooldown: 0
globalCooldown: 0
lastGlobalUse: 0
confirmation: false
confirmationMessage: ''
cancel_mode: ALWAYS
commands:
  '0':
    command: lp user <player> permission set deluxetags.tag.Suggestive
    type: SERVER_COMMAND
    delay: 0
    grantPerms: []
    alwaysPersisted: false
    interactValue: 0
  '1':
    command: You have purchased the tag &8<&7Suggestive&8> &efor $3,000!
    type: MESSAGE
    delay: 0
    grantPerms: []
    alwaysPersisted: false
    interactValue: 0
grantPermissions: []
priceItems: []
heldItems: []
pi_criteria:
  enchants: false
  name: false
  lores: false
  durability: false
hi_criteria:
  enchants: false
  name: false
  lores: false
  durability: false
loops: -1
loop_delay: 1
uses_limit: 0
uses_tally: 7
protectedBlocks: []
displayInternalMessages: true
timeLimitMaximum: 0
timeLimitMinimum: 0