Filled Equip permission plugin

Discussion in 'Plugin Requests' started by MrFade, Jan 26, 2025.

  1. Offline

    MrFade

    Plugin category: Random

    Minecraft version: 1.21.4+

    Suggested name: PermissionEquip

    What I want: I’d like a plugin where equipping armor, elytra, or any item for the armor slots requires permission. If a player lacks the necessary permission, they shouldn’t be able to equip the item. Whether through their inventory, dispensers, or any other method. Additionally, the plugin should support customizable messages with hex color support, allowing each item to have its own unique message when a player tries to equip it without the required permission.

    This is how config should look like
    Code:
    items:
      diamond_helmet:
        permission: "armor.diamondhelmet"
        deny_message: "&cYou do not have permission to equip a &bDiamond Helmet&c!"
    
      elytra:
        permission: "equip.elytra"
        deny_message: "&cYou do not have permission to equip an &bElytra&c!"
    
      netherite_chestplate:
        permission: "armor.netheritechestplate"
        deny_message: "&cYou do not have permission to equip a &bNetherite Chestplate&c!"
    
      # Add more items as needed
      # Use hex colors in messages with the syntax &#RRGGBB (if supported)
      gold_boots:
        permission: "armor.goldboots"
        deny_message: "&#FFD700You cannot equip Gold Boots!"
    
    Ideas for commands: /Permissionequip reload

    Ideas for permissions: PermissionEquip.reload

    When I'd like it by: As soon as possible please
     
    Last edited: Jan 27, 2025
  2. Offline

    AtomFeGaming

    I am starting on this now. With it being Monday morning, give me until the weekend and I should have it done for you.
     
  3. Offline

    MrFade

    Great thanks

    EDIT: btw if items are not listed in the config then player should not require any permission to equip those item
     
  4. Offline

    AtomFeGaming

    https://github.com/bukkit-requests/PermissionEquip/releases/tag/1.0

    Should be able to grab it from the link above. I didn't test all of the items, but as long as you match the item listed under "Permissions" in the README.md file in config.yml, you should be able to restrict that specified item. Let me know if this works or you run into any bugs. :)
     
  5. Offline

    MrFade

    Hey Thank you for the plugin but I found some bugs:
    - I can right click the armor to equip it
    - For some reason I can't break/use/rightclick anything

    can you please make it like this??
    items:
    diamond_helmet:
    permission: "armor.diamondhelmet"
    deny_message: "&cYou do not have permission to equip a &bDiamond Helmet&c!"
    elytra:
    permission: "equip.elytra"
    deny_message: "&cYou do not have permission to equip an &bElytra&c!"

    netherite_chestplate:
    permission: "armor.netheritechestplate"
    deny_message: "&cYou do not have permission to equip a &bNetherite Chestplate&c!"

    so I can customize permissions for each item (if possible)
     
  6. Offline

    AtomFeGaming

    Yup! I forgot about right-clicking. I can get that fixed and look into being unable to break things. I didn't have that issue on my end. What about the permissions do you want to customize?
     
  7. Offline

    MrFade

    so maybe each items permission should be configurable just like deny message
     
  8. Offline

    AtomFeGaming

    The only thing that can change is the permission node itself. If you change that then it breaks code within the plugin. I will work on the bugs but the permissions aren't going to change.
     
  9. Offline

    MrFade

    okay no problem
     
  10. Offline

    AtomFeGaming

  11. Offline

    MrFade

    oh nvm about the breaking blocks and stuff. Turns out I had world spawn protection really high.

    but more bugs:
    - You can hotkey armor in the armor slots
    - dispensers can equip armor
     
  12. Offline

    AtomFeGaming

  13. Offline

    MrFade

    here are all the bugs:

    - when right clicking armor while looking at a block it equips it (if looking at air then it works fine)
    - dispensers still works
    - while holding armor and spam clicking on your armor slot sometimes it equips it
    - hotkeys still works
     
    Last edited: Feb 2, 2025
  14. Offline

    AtomFeGaming

    https://github.com/bukkit-requests/PermissionEquip/releases/tag/1.0.3

    Give the link above a shot. I was able to fix everything but the spam-clicking one. After looking into that, it only happens when you're moving your cursor around the armor slot and clicking. I tried to find an even to detect cursor movement, but I couldn't get far. I would consider that a bug.

    If you happen to find out how I can stop that, I would love to add that to the code for you.:)
     
  15. Offline

    MrFade

    maybe if someone try's to click the armor on. it takes it off their cursor and puts it in inventory (drops it if inventory is full) or it just closes their inventory.

    EDIT: If someone still able to equip the armor. maybe adding like every second or something it checks if player have anything equipped without permission then it puts it in inventory (drops it if inventory is full)
    Also is it possible to add a cooldown on spam clicking armor on?
     
    Last edited: Feb 2, 2025
  16. Offline

    KarimAKL

    Sounds to me like you're only checking the InventoryClickEvent. You also need to cancel the InventoryDragEvent, which occurs when moving the cursor while the cursor button is held. It can happen by accident at times when spam-clicking.
     
  17. Offline

    AtomFeGaming

    Even after adding the InventoryDragEvent this doesn't stop the player from moving the cursor around the armor slot and getting the armor to be placed.
     
  18. Offline

    AtomFeGaming

    If you'd like, I can make it so the player can't move the item at all in their inventory but can move it anywhere within something like a chest?
     
  19. Offline

    MrFade

    That won’t be good. But just make it if they don’t have permission for equip something and then click on the armor slot with that item it closes their inventory and also checks if player have that item equipped then gives it back or drops it
     
  20. Offline

    AtomFeGaming

    v1.0.4

    This should include your latest request. I was still able to replicate it, but I wasn't able to do it as often.
     
  21. Offline

    MrFade

    Also please add if a player attempts to equip armor without the required permission, the item should either be dropped on the ground or returned to their inventory if there is available space. So this should hopefully resolve the issue.
     
  22. Offline

    AtomFeGaming

    This is already in place.
     
  23. Offline

    MrFade

    But I can still equip armor by holding it and clicking on the armor slot.
     
  24. Offline

    AtomFeGaming

    That's because you are moving your cursor at the same time as placing the armor in the armor slot. As I stated before, there isn't a way for me to detect that (that I know of) and consider that a bug.
     
  25. Offline

    MrFade

    Can't you check if armor slot has changed?

    I just made this in skript plugin which works great
    Code:
    on inventory click:
      if clicked slot is 38:
        if cursor slot of player is netherite chestplate:
          if player don't have permission "netherite.chestplate":
            cancel event
            close player's inventory
            send "&cYou don't have permission to equip this armor"
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 5, 2025 at 11:51 AM
  26. Offline

    AtomFeGaming

    Right, I have this in the code as well. However, if you're actively moving the mouse around an armor slot and clicking in that armor slot at the same time, the armor will be placed. That is what I can't fix. Everything you listed before works as intended.
     
  27. Offline

    MrFade

    Oh okay, but can you make it so when a player's inventory closes, it checks if they have any armor equipped that they’re not supposed to? If they do, it should drop or go back to their inventory if there’s space. If this is already added, it's not working.


    Edit: also there use to be a skript plugin's addon (Abandoned now) which did the same thing and it never had that issue he's the code if you want to take a look at it https://github.com/Sharpjaws/SharpS...forcookies/armorequip/ArmorEquipListener.java
     
    Last edited: Feb 5, 2025 at 2:14 PM
  28. Offline

    AtomFeGaming

    v1.0.5

    Above should be the fix you need.
     
  29. Offline

    MrFade

    when someone equips the armor and instead of closing inventory if they get kicked or something and then join back the armor is still equipped

    EDIT: also it's not letting me equip any thing with right click even if its not in the config
     
    Last edited: Feb 5, 2025 at 2:42 PM
  30. Offline

    AtomFeGaming

    v1.0.6

    I added a quit/kick event so when they leave or quit, it will take the restricted armor off and when they come back in game, it should be in their inventory or dropped.

    You should be able to right-click armor not in the config now.
     
    Last edited: Feb 5, 2025 at 9:23 PM

Share This Page