Filled PermissionsBinding

Discussion in 'Plugin Requests' started by Dark_Serpent, Dec 27, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Dark_Serpent

    Plugin category: Role Playing

    Suggested name: PermissionsBinding

    What I want: Alright, so let's begin.
    The plugin first must be able to turn the words [Bind], [Upgrade], and [Unbind], if placed on a sign by somebody with the permissions "permissionsbinding.sign", DARK_BLUE, like shown here:
    Show Spoiler

    [​IMG]

    Binding will give you a set of permissions located in a config. Upgrading will add more permissions for each tier of upgrade. Unbinding will remove permissions that contain the phrase located in the quotes.

    In theory, the config.yml would look something like this:
    Show Spoiler

    [​IMG]

    bindsign This will show all the required entries for the [Bind] Sign.
    Bind This will show what permissions will be added once binding to this sign.​
    upgradesign This will show all the required entries for the [Upgrade] Sign.
    Upgrade(1,2,3 ... etc.) This will show what permissions will be added for each tier of upgrade.
    exp This will show how much experience is needed to upgrade to the next level. Experience can be given via the '/permbind addexp (PLAYER) (NUMBER)' command.​
    unbind This shows what permissions get removed upon unbinding to the sign.
    weapon This shows what weapon you need in order to interact with all 3 signs under 'Olympus' using Bukkit's default YAML encoding for items, located here. The weapon must be located in your hot bar in order to interact with these signs. The tags 'null' mean that any lore can be placed on those lines and the weapon will still be accepted, this is because my server uses the plugin Soulbound.

    There would also be a player.yml that would look something like this:
    Show Spoiler

    [​IMG]


    The text if you try to use a sign without the required weapon:
    [​IMG]
    The text if you bind to a sign successfully:
    §dYou have bound to {SIGNNAME}!
    The text if you upgrade a sign successfully:
    §2You leveled up in your {SIGNNAME} mastery!
    The text if you unbind to a sign successfully:
    §dYou have unbinded from {SIGNNAME!}

    Ideas for commands: /permbind
    addweapon (NAME OF SIGN) You must be holding the weapon in your hand. This will add the weapon that you are currently holding to the 'Weapon' section of the config.yml
    addexp
    (PLAYER) (NUMBER) Adds experience to a player's player.yml file
    reload


    When I'd like it by: Before March, if at all possible! Before February would be excellent, but I don't even know if a plugin of this caliber is even possible, much less to be expected to done if at all. Much thanks to anybody who takes up this project!

    Additional Information: It must be able to work properly in Minecraft Version 1.7.10, it must be compatible with bPermissions.
     
    Last edited: Dec 27, 2015
  2. Offline

    pie_flavor

    @Dark_Serpent And hello once again! I will also make this. It's a little confusing, but I think I understand.

    YAML item encoding means that I can just pull an ItemStack object directly out of the config, no complicated trickery. Problem is, it'll throw an exception if something such as the lore has null elements. Can I just ignore any extra lines, and only consider as many as the original had?

    Will there ever be a case where unbinding removes permissions that weren't added by binding, or doesn't remove permissions that were?

    If I do not receive a response before the plugin is complete, I will assume that the answers to the questions are yes and no respectively. If the second one is yes, everything including the configs is going to get a whole lot more complicated, since I'd have to store past unbindings.

    Also, if question 2 is no, suggestion: Unbind sign should be universal and not require an item. Think about it - if you lose the item, you're stuck - you can't level up and you can't unbind.
     
    Last edited: Dec 28, 2015
  3. Offline

    Dark_Serpent

    First off. thank you so much!
    As for your questions, I completely forgot I asked for YAML, so that's my fault. What occurs is that "Bind on (use/equip/pickup" appears on the item's lore, and after completing the required task to bind, "Bind" is replaced with the player's name, and a new tag is added with the player's ID, which would cause a mismatch with the originally defined tag.

    Although
    it is possible for me to simply remove the line of lore that says "Bind" when adding the item to the sign, so then any extra lines after could be ignored.

    As for the second question, no. The permissions the binding adds will be the only thing removed.

    And finally, I completely forgot that would be an issue, yes, absolutely, making it one universal sign would simplify things by a long shot.
     
  4. Offline

    pie_flavor

    Dark_Serpent likes this.
  5. Offline

    Dark_Serpent

    You are amazing! XD
    It works perfectly, as expected.
    Do you think you could add a command called /bindexp and /viewexp (PLAYER)? /bindexp would show:
    [​IMG]
    Of course replacing Bound and Exp with your current info, saying "None" for both if nothing is bound, with the max exp being how much exp you need until the next upgrade (If there is no next upgrade, perhaps "MAX" should be shown?). And /viewbindexp (PLAYER) would do much the same, except you can view the stats of another player, rather than just yourself.

    Both commands would have permissionsbinding.bindexp and permissionsbinding.viewbindexp respectively. Thank you!

    EDIT 1: The addweapon command doesn't seem to be working. It gives me a confirmation but doesn't add the weapon into the config.
    EDIT 2: I just realized there needs to be a way to remember what level you are with every Patron. Do you think you could change the players.yml to look like this?
    [​IMG]
     
    Last edited: Dec 28, 2015
  6. Offline

    pie_flavor

    @Dark_Serpent Uhh... I thought you could only be bound to one patron at a time.
     
  7. Offline

    Dark_Serpent

    @pie_flavor
    Sorry, I was a bit unclear with my last edit. You can only be bound to one patron at a time, but you can unbind and rebind to a new patron.
    If you unbind and rebind, though, you lose the level you had with your last patron. I want the levels to be remembered, so if you switch back to that old patron, you don't have to get experience to upgrade it all over again.
     
  8. Offline

    pie_flavor

    @Dark_Serpent Oh. I can't recommend that in terms of overall effect (I value the aspect of commitment in things I play) but you're the boss, boss. Will fix that and additem.
     
  9. Offline

    Dark_Serpent

    Ha ha, thanks.
     
  10. Offline

    pie_flavor

    @Dark_Serpent Added the message thing. My code would probably make someone else's eyes bleed, tell me if there are any problems.
    As for addweapon... I can't believe I forgot to call saveConfig() after adding the item.
    Redownload for fix.
     
  11. Offline

    Dark_Serpent

    @pie_flavor
    Thank you!
    When I launched my server, whenever my players try to use the [Bind] signs, they do not get anything in chat, and the permissions are not added. It only works for OP'ed players.
     
    Last edited: Dec 29, 2015
  12. Offline

    pie_flavor

  13. Offline

    Dark_Serpent

    Sorry! The way it is currently is good. Forget about my last alterations.
    The "Bind" signs are not working for players though. They don't receive the permissions or any message telling them they have binded to the sign. Is there a permission they need?
    EDIT: I managed to catch the error in my console:
    Show Spoiler

    [​IMG]
     
    Last edited: Dec 29, 2015
  14. Offline

    pie_flavor

    @Dark_Serpent That's... weird, to say the least. Redownload for a supposed fix, if it breaks again give me your config too.
     
  15. Offline

    Dark_Serpent

    @pie_flavor
    Well, it's still doing it, I checked the logs though, and it gave slightly more information that's leaving me puzzled. There appears to be a conflict of plugins, except both plugins have nothing to do with each other?
    Show Spoiler

    [14:00:10] [SoundCenter Plugin/ERROR]: Could not pass event PlayerInteractEvent to PermissionsBinding v1.0
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:294) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:233) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PlayerInteractManager.interact(PlayerInteractManager.java:375) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:642) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.a(SourceFile:60) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.handle(SourceFile:9) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:180) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.ServerConnection.c(ServerConnection.java:81) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:720) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:283) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:583) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:489) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    Caused by: java.lang.IndexOutOfBoundsException: toIndex = 11
    at java.util.ArrayList.subListRangeCheck(Unknown Source) ~[?:1.7.0_75]
    at java.util.ArrayList.subList(Unknown Source) ~[?:1.7.0_75]
    at flavor.pie.PermissionsBinding.onInteract(PermissionsBinding.java:130) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_75]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    ... 16 more

    And in case that's not the problem, here's my config:
    http://pastebin.com/3uLddmsF

    EDIT: I removed the plugin and the same thing occurred.
    Show Spoiler

    [14:11:28] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to PermissionsBinding v1.0
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:294) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:233) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PlayerInteractManager.interact(PlayerInteractManager.java:375) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:642) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.a(SourceFile:60) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.handle(SourceFile:9) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:180) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.ServerConnection.c(ServerConnection.java:81) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:720) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:283) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:583) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:489) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    Caused by: java.lang.IndexOutOfBoundsException: toIndex = 11
    at java.util.ArrayList.subListRangeCheck(Unknown Source) ~[?:1.7.0_75]
    at java.util.ArrayList.subList(Unknown Source) ~[?:1.7.0_75]
    at flavor.pie.PermissionsBinding.onInteract(PermissionsBinding.java:130) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_75]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292) ~[spigot-1.7.9-R0.2-SNAPSHOT-1486.jar:git-Spigot-1486]
    ... 16 more

    I forgot to mention I logged into a clean account previously without OP permissions and I was able to bind successfully.
    I also tested it with a weapon that lost durability and binded just fine.
     
  16. Offline

    pie_flavor

    @Dark_Serpent Yeah, I anticipated that durability would be an issue and ignored it. Only for weapons and such, though.
    Can't find any problems with the config, that's probably because it's frigging massive. Could you send me a screenshot of what weapon you were carrying, and tell me which patron you were trying to bind to?
     
  17. Offline

    Dark_Serpent

    @pie_flavor
    Alright. Some quick updates, I logged into an account, but this time I did not give it /OP once. Upon giving a player /OP and the test account /OP, it still did not work.
    Player's Account Weapon: (Located under 'Glaive' in the config)
    Show Spoiler

    [​IMG]

    Newly Made Account Weapon: (Located under 'Khorne' in the config)
    Show Spoiler

    [​IMG]

    EDIT 1: If the weapon wasn't correct, shouldn't they still get the message telling them?
    EDIT 2: I created a brand new server folder only containing Essentials, bPermissions, PermissionsBinding, AltarForge, and ShoutCommands. It works fine in every test scenario, so there must be a plugin conflicting with this one. I'll attempt to hunt it down.
     
    Last edited: Dec 31, 2015
  18. Offline

    pie_flavor

  19. Offline

    Dark_Serpent

    @pie_flavor
    I don't know what the heck just happened.
    I was running out of ideas so I hopped on a test account. I could not use the signs. I gave him OP. I could not use the signs. I gave him Creative mode, and then suddenly, I could use the signs. I removed Creative mode and I could still use the signs. I then found the problem

    I run a plugin called Magic on my server that allows players to use Wands, and upon Right-Clicking, it opens up a list of spells:
    Show Spoiler

    [​IMG]
    [​IMG]

    When these wands are in the hot bar of players, it conflicts with the Bind plugin. Going into Creative mode forces the wand to drop, and thus how I figured out the issue.
    I could avoid this by placing signs that informs players to put up their wands before attempting to bind, but before that, is there any reason this conflict occurs?


    EDIT 1: In addition, would this be avoidable if the player had to hold the weapon in their hand, rather than have it in their inventory?

    EDIT 2: Never mind! It seems any item with lore will not let you bind if they are in your inventory. It doesn't seem to matter what item it is.
     
    Last edited: Dec 31, 2015
  20. Offline

    pie_flavor

    @Dark_Serpent I think I know EXACTLY what the problem is. I had to do some ugly code to get the whole hotbar part to work. EDIT 1 will fix everything, I just thought that since you specifically formatted the example config to be a list of items instead of a single item, you wanted multiple items to be required at some point. If it's only going to ever be one item, and they have to be holding it, I can fix this completely. Do you want that?
     
  21. Offline

    Dark_Serpent

    @pie_flavor
    Ah, you're correct, I completely forgot about that fact.
    A few reasons I asked for the weapon to be in the hot bar is that some enchantments activate on right clicking, along with a few patrons requiring multiple weapons.
    If there is no other option, then I am completely fine with the weapon having to be in your hand, but otherwise, I would greatly appreciate it if worked off their hot bar instead.

    EDIT: Some other things if you don't mind, sorry for the request, but I found a few problems.

    One of the major ones is that when rebinding to a Patron they already have mastery with, they only receive the level 1 permissions, not the rest that they should have.

    Also, with /bindexp, do you think it could say Bound: (Name/None) Exp: (Number)[/(Number until upgrade/MAX] Mastery: (Number)?

    Thanks again!
     
    Last edited: Dec 31, 2015
  22. Offline

    pie_flavor

    @Dark_Serpent I have solved both the interaction bug and enchantment potential problem: Left click now works as well as right click on the signs.
    I fixed bindexp and the permissions thing too.

    Bonus features that I added for no reason:
    Tab-completes on all the commands, especially for where I thought they'd be most useful - for instance, if you try to tab-complete the exp number, it'll show in chat how much exp they currently have.
    /bindexp and /showexp also have /bindxp and /showxp aliases, and they change the Exp to XP in the sent message.
    All commands involving you entering a player's name allow you to use UUIDs as well. Starting a UUID with : will allow it to be tab-completed, including just entering a : and nothing else.

    Redownload for fix.
     
  23. Offline

    Dark_Serpent

    @pie_flavor
    Alright, I tested it out and as of right now the signs aren't working period for anyone, even with a clear inventory.
    In addition, do you think you could change the "Level" text in /bindexp to color code e?
    Thanks!
     
  24. Offline

    pie_flavor

    @Dark_Serpent To clarify:
    The config needs to be changed to be a single item instead of a list of items, i.e. no dash (-) before the tag start. The player also has to be holding the item.
    Also, made the change. Redownload.
     
  25. Offline

    Dark_Serpent

    @pie_flavor
    Ah, thanks for the clarification! Everything's working as expected now, thank you!
    I love the bonus features by the way, so thanks for that too :D

    If I may request one more feature (Sorry! I know it's been a lot of work), is there a way to add a "/permbind refresh" command of sorts that updates all permissions that have been given to each player?

    A more in depth explanation: Whenever a change is made in the config players will have to unbind and rebind to receive the changes currently, if I'm not mistaken. Entering in the command would change each player's current permission to what is currently stated in the config for their current mastery level so that they may receive the newest permissions or lose any permissions that have been omitted from the config.

    Again, I have no words to describe how amazing this plugin is so far, so thank you so much for helping! :D
     
  26. Offline

    pie_flavor

    @Dark_Serpent /permbind reloadpermissions <player> already exists, and permissions refresh on server login. However, I have updated the /permbind reload command to also reload all permissions. Redownload for fix.
     
  27. Offline

    Dark_Serpent

    @pie_flavor
    Thanks! Unfortunately, it seems that bows and other items that use durability are affected by the [Bind] Signs. Do you think you could make it so that durability is ignored for all items?
     
  28. Offline

    pie_flavor

    @Dark_Serpent Ah, I was doing materialed tools (e.g. diamond pick, gold sword, etc) only, I'll change it to do all of them. Redownload for fix.
     
  29. Offline

    Dark_Serpent

    @pie_flavor
    Hm, bows still don't seem to work when under full durability. Are you sure the last update fixed them?
     
  30. Offline

    pie_flavor

    Oh. The bow you used as a template was probably damaged when you added it, make sure that the durability is 0 in config.yml
     
Thread Status:
Not open for further replies.

Share This Page