SkylaskInvsee

Discussion in 'Plugin Requests' started by Skrubzy, Nov 19, 2016.

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

    Skrubzy

    Plugin category: Administrative

    Minecraft version: Spigot 1.9.4

    Suggested name: SkylaskInvsee

    What I want: I need a plugin that works almost exactly like Essential's "/invsee" feature, but with a different GUI.

    I made this image to display the GUI and how it should be formatted: Logo Thing.png

    I need this plugin because Essentials currently doesn't have any support for the armor, offhand, or crafting slots.

    This will probably just confuse you, but the crafting slots should be in this order:
    Code:
    1234
    
    and
    
    12
    34
    All chat messages should be configurable in the config.yml
    Here is a quick example of what the config.yml should look like:
    Code:
    Invsee-open: &aYou have successfully opened &a%player%&a's Inventory!
    No-Define: &c&l(!) &r&cPlease define a player!
    Player-Not-Found: &c&l(!) &r&cThat player could not be found!
    No-Permission: &c&l(!) &r&cYou don't have permission to view inventories
    No-Edit: &c&l(!) &r&cYou don't have permission to edit inventories
    No-Usage: &c&l(!) &r&cInproper Usage! (/invsee <player>)
    Player-Inv: &7%player%&7's Inventory
    This plugin should also have offline support; Meaning that you can view a player's inventory even if they're not online
    And if you can, please make offline support with tabbing their name and opening their Enderchest too.

    Ideas for commands:
    /invsee <player> | Opens the defined player's inventory

    Aliases - All of these should do the same thing:
    /invsee <player>
    /einvsee <player>
    /inventory <player>
    /einventory <player>

    Ideas for permissions:
    skylaskinvsee.use - Allows you to open a player's inventory
    skylaskinvsee.edit - Allows you to edit a player's inventory once you have opened it
    skylaskinvsee.* - Grats you access to all of the SkylaskInvsee permissions

    When I'd like it by: ASAP

    Note: I am aware of other plugins that perform these actions, but most of them (Like OpenInv) Either have a lot more features than I need, or they don't have the same format that I'm requesting.
     
    Last edited: Nov 19, 2016
  2. Offline

    AL_1

    Being able to see what is in the players inventory crafting space would be a bit tricky, because if the player exits their inventory with items in there they drop. So if their inventory is closed then someone edits it, it could cause problems.
     
  3. Offline

    I Al Istannen

    @DiamondDeveloper
    I agree. Crafting slots are not that nice to implement.

    Yoou could however just show them when the target player has their inventory open and clear them when he closes it again. That would solve this issue.

    @Skrubzy
    Should you be able to modify it? Because that could easily cause glitches.

    I will most likely not do this.
     
  4. Offline

    Skrubzy

    If they have the permission "skylaskinvsee.edit" They can edit it. If not, the can't move items around or add new ones.
     
  5. Offline

    I Al Istannen

    Skrubzy likes this.
  6. Offline

    Skrubzy

    Regarding the crafting slots, wouldn't they work just like the inventory? If the player puts something in their crafting slot and you're viewing their inventory, you'll see it in real-time. If nothing is in their crafting slot, nothing will show...
    I don't see what's difficult about that? That sounded kind of rude lol that wasn't my intention.

    Then if you try to place something in the player's crafting slot but their inventory isn't open...how about a true/false statement in the config.yml? Then it either throws the item out of the player's inventory or it doesn't let you add the item in the first place - Depending on if the statement is true or false; but as soon as the player opens their inventory, you can place the item in the crafting slots and it won't be thrown out - unless the player closes their inventory afterwards. But if you don't have the permission node "skylaskinvsee.edit" You can only view the items - you can't move them around, add more items, or take away items.

    Code:
    craftingslot-throw: false
    #This will make it so you can't add the item into the player's crafting slot (If their inventory is closed)
    
    craftingslot-throw: true
    #This will make it so the item gets thrown out of the player's inventory when you put it in their crafting-slot (If their inventory is closed)
     
  7. Offline

    Skrubzy

  8. Offline

    Skrubzy

  9. Offline

    Skrubzy

    Bump ._. I really need this plugin
     
  10. Offline

    I Al Istannen

    @Skrubzy
    I wasn't crazy enough to add offline player support and might never will. Why do you need it?

    Just some hoops I had to jump through to make this plugin:
    • Completly redo how the player interacts with the inventory to let the appropiate changes write through to the player being watched
    • Recreate the vanilla behaviour of clicking and interacting with item stacks (Might have actually been unneeded, if I could have waited a few ticks there. Screw me overcomplicating things :()
    • Keep the two inventories in sync! Both ways.
    • Make your own freaking packet listener for the INVENTORY_DRAG action (It is called QUICK_CRAFT) for some godforsaken reason.
      This action (picking up some items, holding left/right and dragging it) doesn't call ANY event. I needed to intercept the packets, figure out if they are from a player who is in a watch gui and then drop them, so the server never processes them. Then update the player to show that nothing has changed.
      Fun stuff and only relying on like 5 methods with unguaranteed behaviour...

      And because of that, I also needed to listen to the damned packet just for figuring out if the player being watched updated their inventory with a drag.
      Screw the hellhole that is Bukkit's inventories (I am not sure who to blame for that. Maybe it was me).
    • All of that while the normal player being watched retains all inventory functions

    And about your offline players:
    Bukkit has no way of getting the inventory of one. I will need to:
    • Parse the NBT file representing the Player's inventory
    • Or call the NMS PlayerLoader to do it for me. Both are highly unsafe and even worse than the packet listener.
    The "backend" supports working with an arbitray inventory though, so it shouldn't need much adjustmens there.

    Please back up your version of PC core, if you have any before replacing the jar!!
    I am not sure the two versions are compatible... :D

    The plugin is in the attachment.
     

    Attached Files:

    DinosaurKappa likes this.
  11. Offline

    Skrubzy

    Thanks so much! I haven't tested it yet, but I'll inform you of any issues when I do.

    I need offline support in case a player logs out with glitched items or something like that; I know it's possible because it's a feature in the OpenInv plugin.
     
  12. Offline

    I Al Istannen

    @Skrubzy
    Of course it is possible.

    OpenInv has a connector PER VERSION to be able to call the NMS loader.

    I am really unsure if I should invest that much time just for the support of offline players, which can potentially corrupt their whole player file.

    And you will probably find bugs, so just shout ;)
     
  13. Offline

    Skrubzy

    When I try to open my inventory (An online player) I get this message:
    Code:
    [SkylaskInvsee] Please press E instead!
    I'm not quite sure what that means or what I'm supposed to do...
    And when I try to open an offline or unrecognized player's inventory, it sends me this message:
    Code:
    [SkylaskInvsee] No translation for [command.invsee.target.not.online]
    Those are the only bugs I've found so far. If I come across anymore, I'll just edit this post.

    EDIT: Could you also make the code available on GitHub please?
     
    Last edited: Nov 30, 2016
  14. Offline

    I Al Istannen

    @Skrubzy
    You can not invsee yourself. "E" is the default key to open your own inventory :). Changed to message to make that clearer.

    Added the correct message to the language file.

    Why do you need it? :)
    I mean, I could release it but what do you want to do with it. Licencing wise (for example) that can make a difference.


    Please delete your language file in the "languages" folder.
     

    Attached Files:

  15. Offline

    Skrubzy

    Could you please make it so that I can view my own inventory, just not edit it?
    I don't necessarily need the code on GitHub, I'm just trying to teach myself Java and I'm more of a visual learner. I don't plan on changing the code or anything like that, I just wanted to check it out and see how it all functions.

    EDIT: I just noticed that offline player support is still missing. Are you not going to implement this feature?
     
  16. Offline

    I Al Istannen

    @Skrubzy
    You are completely unable to modify anything. But added. Delete your language file or update it yourself.

    I am still unsure. Maybe not. Depends whether I have some free hours where I am motivated enough to hack that functionality in. It is not exactly what you would call safe.

    Ugh. My code is probably not what you want to look at for learning stuff :p
    But here it is.
     

    Attached Files:

  17. Offline

    Skrubzy

    Okay thank you so much :) By the way, I like what you did about the crafting slots (With the barriers)

    I wrote my message a few hours ago but I guess it never sent...
    I found a "glitch" In the language file, I don't want it to say when I start/stop watching a player's inventory.
    But when I remove the text, it sends me a blank message in chat
    Code:
    general.status.stopped.watching= &a&l(!) &r&aYou are no longer watching &a{0}&a
    
    general.status.stopped.watching= 
    2a2afff9eaef8cfdc0cac8eb8e4c7c10.png

    Also, where it says "You are no longer watching Skrubzy" the player's name is red even though the color code is green in the config.yml
    Code:
    command.invsee.target.is.player= &a&l(!) &r&aYou are viewing your own inventory
    
    command.invsee.target.is.player=
     
  18. Offline

    I Al Istannen

    @Skrubzy
    I changed it. It was no glitch though, an empty message just is a blank line ;)

    Just replace your jar with the one in the attachment.
     

    Attached Files:

  19. Offline

    Skrubzy

    I'm using a friend to help me test it now: I can't edit their inventory?
     
  20. Offline

    I Al Istannen

    @Skrubzy
    Incredible dumb mistake on my part.

    Here is the commit. You can build the plugin yourself too, if you want. You should be able to clone the repo and use mvn to build it.
     

    Attached Files:

  21. Offline

    UnseenMC

    OpenInv can do exactly this @Skrubzy.
     
    ipodtouch0218 likes this.
  22. Offline

    Skrubzy

     
  23. Offline

    UnseenMC

    Then ignore the extra features if you don't like/want them. The only downside is that the plugin is more MB on your server.
     
  24. Offline

    Skrubzy

    I have just recently been able to test this plugin with a friend but it doesn't seem to be working.
    I can see her inventory and it updates in real-time, the problem is that I can't edit anything
    Sometimes it will let me put an item in her inventory (Only allows me to randomly..) but I can't take any items out.

    Also, could you make the barriers automatically appear? With this version of the plugin, I have to click on something for the barriers to appear (The barriers representing locked crafting slots) Maybe you could just remove the barrier feature and instead make it so that putting items in their crafting slot will just drop the item
    (As if they dropped the item out of their inventory)
     
  25. Offline

    I Al Istannen

    @Skrubzy
    I rewrote a good chunk of it, I think it now works as expected. The action COLLECT_TO_CURSOR is still blocked when watching, as i couldn't find a nice way to make it work.

    There is also no way to check if the player has his inventory open, so the LOCKED barriers in the crafting slots will only appear when the player is in another Gui (e.g. chest, anvil, furnace,...).
    This is minecraft, not me being an idiot. I could add support for that by creatively abusing Achivements, but honestly screw that.

    You will need to use the PerceiveCore in the zip file, as it is incompatible with older versions. So backup your old and tell me which other plugins I wrote do not longer work with the new version (if any).

    EDIT: You can also download it here at github.
     

    Attached Files:

    Last edited: Dec 25, 2016
  26. Offline

    Skrubzy

    I still can't edit my tester's inventory. Also this PerceiveCore file interferes with my "StaffSecure" plugin, you made that right?

    Console Error Log:
    Code:
    [00:31:06] [Server thread/INFO]: [StaffSecure] Enabling StaffSecure v1.0.2-SNAPSHOT
    [00:31:07] [Server thread/ERROR]: Error occurred while enabling StaffSecure v1.0.2-SNAPSHOT (Is it up to date?)
    java.lang.NoSuchMethodError: com.perceivedev.perceivecore.PerceiveCore.getDisableManager()Lcom/perceivedev/perceivecore/other/DisableManager;
        at me.ialistannen.staffsecure.event.PlayerListener.<init>(PlayerListener.java:43) ~[?:?]
        at me.ialistannen.staffsecure.StaffSecure.onEnable(StaffSecure.java:55) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) ~[spigot.jar:git-Spigot-8a048fe-5ff377a]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at org.bukkit.craftbukkit.v1_9_R2.CraftServer.loadPlugin(CraftServer.java:362) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at org.bukkit.craftbukkit.v1_9_R2.CraftServer.enablePlugins(CraftServer.java:322) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at net.minecraft.server.v1_9_R2.MinecraftServer.t(MinecraftServer.java:416) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at net.minecraft.server.v1_9_R2.MinecraftServer.l(MinecraftServer.java:381) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at net.minecraft.server.v1_9_R2.MinecraftServer.a(MinecraftServer.java:336) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at net.minecraft.server.v1_9_R2.DedicatedServer.init(DedicatedServer.java:268) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at net.minecraft.server.v1_9_R2.MinecraftServer.run(MinecraftServer.java:532) [spigot.jar:git-Spigot-8a048fe-5ff377a]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
     
  27. Offline

    I Al Istannen

    @Skrubzy
    The failure of StaffSecure was expected, I released an updated version here.

    That is not that helpful. It works for me.
    • Any messages in the console?
    • Any errors?
    • Do you have the permission "skylaskinvsee.edit"
     
  28. Offline

    kentlivar

    @I Al Istannen the invsee plugin works, but you cant take the items out of the inventory if you hold shift
    You litrelly can pickup the item with the mouse click and move it to where you want or take it that way but not taking it out while holding tab please try to make that possible.
    Video :
    [​IMG] https://vid.me/nGG7
    @Skrubzy
    Skrubzy you need to give permissions to the groups skylaskinvsee.edit
    to be able to edit em thats the thing.
     
    Last edited: Jan 7, 2017
  29. Offline

    Skrubzy

    I was experiencing those issues too, but my tester is rarely online and I didn't know how to explain what was happening. I just decided to use the OpenInv plugin and add some aliases in the commands.yml file.
     
  30. Offline

    kentlivar

    @Skrubzy oh am using that Skylaskinvsee i think it was awesome but i would like to be able to use shift
     
Thread Status:
Not open for further replies.

Share This Page