[FUN][ADMN] OpenInv 2.2.4 - Open anyone's inventory as a chest Real-Time! [1.4.5-1.7.10]

Discussion in 'Archived: Plugin Releases' started by lishid, Apr 30, 2011.

  1. Offline


    OpenInv - Open anyone's inventory as a chest! in real time! Works with offline players! Open EnderChests of any player via command!

    Source Code hosted on GitHub

    Link to BukkitDev: http://dev.bukkit.org/server-mods/openinv/

    Open a player's inventory as a chest and interact with it in real time.
    Access to the inventory and armor slots.
    Open any chest that has blocks on top (blocked chests) with AnyChest.
    Open a chest silently (without chest animation nor sound) with SilentChest.
    Open any player's EnderChest from a command.
    Drop item as another player (by putting it in the 5 unused slots in openinv)!

    How to use:
    Install: Copy to your plugins folder, and restart/reload your server.

    Use command "/openinv <player>" to open a player's inventory
    Use command "/toggleopeninv" to toggle Item openinv:
    Hit a player with an item of your choice (STICK by default), and you will open the player's inventory (no damage)
    Right click the air with the item opens the last opened inventory (toggle must be ON)
    Use command "/anychest" to toggle anychest (blocked chest bypass)
    Use command "/silentchest" to toggle silent chest
    Use command "/openender <Player>" to open a player's enderchest
    Use command "/searchinv <Item> [MinimalAmount]" list all players having a certain item in their inventory.

    To use a sign for quick access (this uses the normal Openinv.openinv permissions, override and exempt applies), You need:
    "[openinv]" (without quotes) on the 1st line
    and the player's name on the other lines.

    Permissions nodes (CaSe SeNsItIvE):
    "OpenInv.openinv" gives permission to use OpenInv
    "OpenInv.openself" Allows opening the inventory of the command user
    "OpenInv.editinv" - Allows editing of inventory

    "OpenInv.openender" - Allows opening of EnderChests
    "OpenInv.openenderall" - Allows opening of EnderChests of everybody. Without this permission, someone can only open his own enderchest.
    "OpenInv.editender" - Allows editing of enderchest

    "OpenInv.search" gives permission to use searchinv
    "OpenInv.crossworld" allows cross-world openinv.
    "OpenInv.exempt" makes the player's inventory protected (unable to be opened)
    "OpenInv.override" gives permission to open anyone's inventory, even protected ones
    "OpenInv.anychest" gives permission to open chests that are blocked by a block on top.
    "OpenInv.silent" gives permission to open chests in total silence, without animation.
    (without quotes)

    • Read-only permissions for OpenInv and OpenEnder! Just don't give the editinv and editender permissions nodes!
    • Administrators can modify any user's inventory contents as they wish, in real time.
    • Access it anywhere! No distance or obstacle limitations.
    • Permissions support.
    • Use the command without argument opens the last accessed person's inventory.
    • Use sticks or any (configurable) item and toggles for quick access.
    • Search all online players for a certain item in their inventory.
    • Protect players from openinv with exempt permission, and bypass protection with override permission.
    • Use a sign to perform openinv for convenience.
    • Cross-world openinv protection.
    • Offline player openinv supported.
    • Open chests that are blocked because they have a solid block on top. (AnyChest)
    • Silent opening of chest, no sound and opening animation.
    • EnderChests can be opened, even for offline players!
    • NEW: Drop item as another player (by putting it in the 5 unused slots in openinv)
    • Self-opening protection.

    Video tutorial:

    Thanks to WMisiedjan for the source of iSee, located here: http://forums.bukkit.org/threads/6676/
    Thanks to Dark_Balor from AdminCmd for helping with the bugs in Offline Openinv.
    Thanks to the many supporters who've tested this plugin.


    Download OpenInv (2.2.4) CB1.4.5 up to CB1.7.10

    Legacy versions:
    See http://dev.bukkit.org/server-mods/openinv/

    Source Code

    • None ATM
    • None ATM
    Openinv will connect to http://mcstats.org/ to collect anonymous data (only version information).


    Version 2.2.4[CB 1.7.10]
    • Fixed getting inventory from other plugin's custom inventory crashing

    Version 2.2.2[CB 1.7.10]
    Finally fixed offline players
    Version 2.1.8[CB 1.7.10]
    Updated to MC1.7.10
    Removed metrics as the service is no longer available
    Version 2.1.7[CB 1.7.8]
    Fixed Offline player NoSuchMethodError
    Version 2.1.6[CB 1.7.8]
    Fixed ClassNotFoundError.
    Version 2.1.5[CB 1.7.8]
    Updated to CB1.7.8
    Version 2.1.4[CB 1.7.5]
    Updated to CB1.7.5
    Version 2.1.3[CB 1.7.4]
    Fixed silent chest not working with sneak+build.
    Removed /enderchest as alias for compatibility with Essentials. Use /openender or /oe instead.
    Version 2.1.2[CB 1.7.2]
    Changed updater to be compliant with new Bukkit rules.
    Version 2.1.1[CB 1.7.2]
    Changed updater to be compliant with new Bukkit rules.
    Version 2.1.0[CB 1.7.2]
    Update to CB1.7.2.
    Version 2.0.9[CB 1.6.4]
    Update to CB1.6.4.
    Version 2.0.8[CB 1.6.2]
    Added * nodes for permissions.
    Version 2.0.7[CB 1.6.2]
    Added OpenInv.openenderall permission node.
    Version 2.0.6[CB 1.6.2]
    Updated to CB1.6.2.
    Version 2.0.5[CB 1.6.1]
    Fixed editinv not locking shift-click and click-drag.
    Version 2.0.4[CB 1.6.1]
    Added config options for notifications for SilentChest and AnyChest.
    Version 2.0.3[CB 1.6.1]
    Updated to CB1.6.1.
    Version 2.0.2[CB 1.5.2]
    Updated to CB1.5.2.
    Version 2.0.1[CB 1.5.1]
    Fixed player loading crash caused by CraftBukkit internal change.
    Version 2.0.0[CB 1.5.1]
    Fixed trapped chest problem.
    Version 1.9.9 [CB 1.5.1]
    Updated to 1.5.1.
    Version 1.9.8 [CB 1.5]
    Updated to 1.5.
    Version 1.9.7 [CB 1.4.7]
    Fixed offline inventory not saved when server restarts.
    Version 1.9.6 [CB 1.4.7]
    Updated to 1.4.7.
    Version 1.9.5 [CB 1.4.6]
    Added new feature: Put item in any of the 5 unused slots and the item will be dropped by the targeted player.
    Version 1.9.4 [CB 1.4.6]
    Updated for MC1.4.6.
    Version 1.9.3 [CB 1.4.5]
    Fixed an issue about copying code from my other plugin without proper renaming.
    Version 1.9.2 [CB 1.4.5]
    Massive rewrite to support new CB naming system.
    Added auto-updater.
    Version 1.8.8 [CB 1.3.2/CB 1.4.2]
    Added permissions "OpenInv.openself".
    Version 1.8.7 [CB 1.3.1-R1]
    Added /openender <player>
    permissions, added "OpenInv.editinv", "OpenInv.openender", "OpenInv.editender".
    Version 1.8.6 [CB 1.3.1]
    Updated to 1.3.1. Not only works with 1.3.1.
    Version 1.8.5 [CB 1.2.5-R4]
    Fixed all problems related to Offline OpenInv (including inventory not updating AND/OR inventory being emptied on some occasions).
    Updated Metrics module to R5.
    Version 1.8.4 [CB 1.2.4-R0.1]
    Updated to MC 1.2.4.
    Version 1.8.3 [1.1-R6/CB 1.2.3-R0.1]
    Fixed perms not working.
    Version 1.8.2 [1.1-R6/CB 1.2.3-R0.1]
    New permissions system (removed support for old perms).
    Version 1.8.1 [1.1-R6/CB 1.2.3-R0.1]
    Updated to 1.1-R6.
    Version 1.7.5 [1.1-R3]
    Fixed Metrics add-on error on startup.
    Version 1.7.4 [1.1-R3]
    Fixed offline openinv being case sensitive.
    Version 1.7.3 [1.1-R3]
    New CB events.
    Version 1.7.2 [1.0.0-R1/1.1-R1]
    CraftBukkit refactoring. Fix the Exception caused by that.
    Version 1.7.1 [1.0.0-R1/1.1-R1]
    Official CB1.1-R1 support.
    Still backward compatible (with 1.0.1-R1).
    Version 1.6.6 [1.0.1-R1]
    Help menu (/openinv ?).
    Code re-organizing.
    AnyChest now toggle-able.
    Version 1.6.5 [1.0.1-R1]
    Fix for silentchest + spout error.
    Version 1.6.4 [1.0.1-R1]
    Silent chest opening, no animation, no sound, use /silentchest to toggle on/off.
    Version 1.6.3 [1.0.1-R1]
    Switched toolbar from top to bottom.
    Added armor slots.
    Version 1.6.2 [1.0.1-R1]
    Added a fix for Offline Openinv.
    Version 1.6.1 [1550]
    Fixed inventory update bug that everyone was having!
    Updated for Minecraft 1.0.
    Version 1.5.2 [1185]
    Offline openinv bugfix.
    Version 1.5.1 [1185]
    Version 1.4.6 [1118-1160]
    Fix conflict of anychest with other plugin.
    Version 1.4.5 [1118-1160]
    Fix for previous update not closing chests.
    Version 1.4.4 [1118-1160]
    Now allows opening of chests that are blocked by solid blocks on top!
    Use "OpenInv.anychest" for permission node.
    Version 1.4.3 [1118-1160]
    Toggle should now be saved between server restarts.
    Added configuration file.
    Configure the item to use instead of a stick be default.
    Version 1.4.2 [1118-1160]
    Fixed a character limit problem.
    Version 1.4.1 [1118-1160]
    Updated for 1.8.
    Version 1.3.3 [953+]
    Cross world openinv disabled! Use permissions node 'OpenInv.crossworld' to allow cross-world openinv.
    Version 1.3.2-test [818+]
    Try fixing compatibility problem.
    Version 1.3.1 [818+]
    Fixed for 818.
    Only works for 1.6+ (CraftBukkit RB 818).
    Version 1.2.3 [803-]
    Sign quick access: use second line for "[openinv]" (without quotes) and third line for target name.
    Use this for 1.5 versions.
    Version 1.2.2
    PERMISSIONS NODES CHANGE: please read permissions section.
    new "OpenInv.exempt" and "OpenInv.override" feature.
    Version 1.2.1
    MAJOR BUGFIX: inventory not updated correctly, especially after a death/respawn.
    Version 1.1.1
    New feature: /searchive Item Amount.
    Version 1.1.0
    New feature: sticks + toggle openinv (explainations on top).
    Version 1.0.3
    Fixed history not saved correctly.
    Fixed inventory access to respawned players.
    Version 1.0.2
    use the command without argument opens the last accessed person's inventory .
    Version 1.0.1
    Initial Release.
    Support the developer: [​IMG]
  2. Offline


    Exactly! I will have to see how to do stuff for them if I added the squares.
    also, I will be needing to install SpoutCraft to test -_-
  3. Offline


    one of the best plugins out there for admins i use this more than any other plugin
  4. Offline


    FYI there was a problem with 1.4.4 in that it broke chest protection plugins and let people bypass them and open chests anyway -- even if they don't have the anychest permission. Maybe this is fixed with 1.4.5. I have no idea.
  5. Offline


    Please update your git.

    I would like to verify by looking at the code, that 1.4.5 closes the security hole that 1.4.4 opened.

  6. Offline


    Sorry, I'm updating 1.4.6 now. It should fix the problem.
    Also gonna push in a bit.

    I think this should do (1.4.6), check source if you need.

    Sorry for the inconvenience.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
  7. Offline


    Mkay, looking over now, though here are some points:

    * Generally, you should use priority normal for player interact events. Highest is usually used by local area security like Lockette and LWC, and high is generally used by region/cuboid based security plugins. Security should get the last say on what is allowed. :3

    * In an onPlayerInteract function, isCancelled and setCancelled are poor proxy functions to the actual event results. The improved functions are useInteractedBlock/setUseInteractedBlock and useItemInHand/setUseItemInHand.

    * Last, you currently have a event.setCancelled(true); which is in error to allow opening a box even if it is blocked. (You probably had this set to false in 1.4.4. Instead you are not allowing the chest to be opened.) What you want to do is check if useInteractedBlock() == Result.DENY, and if so don't touch the result/return as it was set to deny by another plugin, the default being Result.DEFAULT. Otherwise you can setUseInteractedBlock(Result.ALLOW) to specifically allow the chest to be opened. You only need to check useInteractedBlock if you wish to change the value with setUseInteractedBlock.

    I hope this helps you to fix security compatibility.
  8. Offline


    I guess I should use Monitor then, since I'm looking for whether it is allowed or not to then open the chest.

    I changed my code according to your suggestions, and I will see if 1.4.6 has the same problem. If not I will release the new code along with a future update.
  9. Offline


    No, you should never use setUseInteractedBlock at monitor level. You should use normal as I said before, as the higher and highest are called after normal~

    Edit: This is so that the security plugins can properly modify things previous plugins have done to the result or cancellation of an event.

    1.4.6 doesn't have the problem, as it only ever calls setCancelled(true) and not setCancelled(false), but it doesn't open chests with blocks on top either. :3

    Edit: I misunderstood the code a bit, now I'm not so sure it is fixed.
  10. Offline


    I use monitor because I dont need to modify the event.
    Re-released 1.4.6, It should work now...
  11. Offline


    You do need to modify the event as to not circumvent chest security.

    To be clear, don't use the code:
     Object inventory = (TileEntityChest)player.world.getTileEntity(x, y, z);
    //Link chest
    if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) inventory = new InventoryLargeChest("Large chest", (TileEntityChest)world.getTileEntity(x - 1, y, z), (IInventory)inventory);
    if (world.getTypeId(x + 1, y, z) == Block.CHEST.id) inventory = new InventoryLargeChest("Large chest", (IInventory)inventory, (TileEntityChest)world.getTileEntity(x + 1, y, z));
    if (world.getTypeId(x, y, z - 1) == Block.CHEST.id) inventory = new InventoryLargeChest("Large chest", (TileEntityChest)world.getTileEntity(x, y, z - 1), (IInventory)inventory);
    if (world.getTypeId(x, y, z + 1) == Block.CHEST.id) inventory = new InventoryLargeChest("Large chest", (IInventory)inventory, (TileEntityChest)world.getTileEntity(x, y, z + 1));
    //Open chest
    And instead just use the following, and it should work(?):


    Edit: And doing it this way won't circumvent data loggers as well, which will use the monitor priority to see which chests are accessed by who, etc.
  12. Offline


    I don't think it will. It only lets the data be continued to pass on, but then when craftbukkit goes to the interaction method it is interrupted because of the chest being blocked (by minecraft default function).

    If you look closely, the "override" boolean check is for seeing whether the block of one of its adjacent chest block is being blocked by a solid block. These checks are copied from craftbukkit's BlockChest interact method, and instead of being used for cancelling the interaction, I use it for the opposite.

    Also, if I use Chest.GetInventory() to get the inventory, It will return me the inventory of the single chest if the other half of chest is blocked. Thus the usage of "//Link chest" part of my code.
  13. Offline


    Great plugin! Thanks!
  14. Offline


    Okay, I tried it myself and it doesn't work as it is supposed to. Result.DEFAULT is supposed to be the MC default action, and Result.ALLOW is supposed to allow interactions where MC would usually block. Probably something that was overlooked for blocked chests. (Might want to add a leaky report for that.)

    In any case, the way you are accessing the chest still causes problems. The user @fysics was telling me earlier how OpenINV was bypassing LogBlock's detection of chest contents changing, causing items to go missing in the log trace.

    Though as long as you check for a DENY, it should be okay with Lockette and LWC, etc.
  15. Offline


    OK well, I will remind people that the use of anychest should be given to people who are responsable.
  16. Offline


    Thank you for updating this plugin! lishid
  17. Offline


    No problem!
    Will be working on offline openinv now!
  18. Offline


    What about long names on signs? I cant put them on it :p
    Maybe u could add the last line for adding the remaining characters?
  19. Offline


    I'll be working on this shortly then!

    BTW, I'm working really hard on this plugin
    And I might put this a little lower in my priorities. Sorry.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
    recon88 likes this.
  20. Offline


    @lishid Please upload 1.4.6 to your dev bukkit page - the issue of being able to open any chest has came up to me multiple times today and is becoming an issue on servers because Craftbukkit up to date uses DevBukkit, so it downgrades back to 1.4.4!

    Thank you!
  21. Offline


    Ah I forgot!
    Thanks for reminding me.
  22. Offline


    I keep getting a "You do not have permission to view player's inventory" error whenever I try to do anything.
    I'm using PermissionsBukkit as my permissions plugin, and have set the "OpenInv.*" permission for admins, but it still won't let me use it. Is there any help for this?
  23. Offline


    Offline Openinv is 50% complete!
    Right now, I can see the inventory already, but interacting with it still doesn't save yet.

    Sorry, I think it's because OpenInv does not support bukkit superperms yet.
    I will implement it after everything else is done.

    Sorry for replying to this so long after, but
    for the record
    I did not use setCancelled(false)
    but rather
    I had player.a((IInventory)inventory);
    that caused a chest to open no matter what.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
  24. Offline


    Yea, I misread the code the first time, heh. Ohwell
  25. Offline


    In the tutorial, it shows when you drag something out or into the inventory of another player it appears at the moment you take something out or put into it.
    But.. somehow I have to reload my server or the person needs to relog or else the item will stay in his inventory.
    Well atleast.. the illumination of it.
    If the player had like.. 64 levers, and he puts one on the floor, all of them dissapear. With diamond swords if I hit something it wouldn't dissapear.
    And if I drag something in the inventory of another player he / she can't use nor see it until he/she relogged or I reloaded my server.
    So can you please fix this?
  26. Offline


    Most likely you have something that is conflicting...
    Nobody else have this problem and last time this was reported it was in some of the few initial releases and I fixed them.
  27. Offline


    So.. can you think of any fix?
  28. Offline


    List your other plugins
  29. Offline


    I have offline inventory checking + editing working if you need code...
  30. Offline


    Sure, that would be great, I got lazy last night digging through craftbukkit finding a correct way to save it without conflicting with the actual player logging in or something.
  31. Offline


    Permissions 3.1.6
    Safe Creeper
    There you go =)

Share This Page