KarmicShare Version: v0.32 BukkitDev page GitHub source About This plugin acts as cloud storage for items that anyone (with the proper permission nodes or in the same group) can give and take items to/from. However, in order to prevent players from abusing the global / group item pools, there is a configurable per-item karma system in place to limit how many items a player can take without giving back. This system can effectively create protected item pools that are accessible anywhere: between different locations, worlds, even servers (by sharing MySQL). Essentially, its a "one chest to rule them all" plugin. Players and groups can create these item pools with peace of mind that their items are safe from griefers/theives/accidents. Think of it like Dropbox for items: Just put your items in KarmicShare and access them wherever and whenever. Features: Shared global pool of items based on player item donations to the community. Per-item karma multiplier: specify which items have more karma points. Admin commands to manage the item pool and player karma. Nifty (optional) effects Enchantment support Potion support Physical chests that link to the item pool Chest page support Can hold more than 2000000000 pages of items! More item slots than you will ever need. To change the "page" of a linked chest, either left click the chest or click on the sign (left or right click). Or jump to a specific page using an in-game command. Group support, groups have their own shared item pool Shift click a link sign / chest to cycle through your groups. Or use a command to set your selected group. Multiworld control: Define which worlds have / don't have access Vault support MySQL support Way more powerful than native Ender Chests Comment on comparison here Economy support Usage: Signs and Chest access (Move your mouse to reveal the content) Signs and Chest access (open) Signs and Chest access (close) To have a chest hook into the item pool, you need to have a wall sign directly above the chest with the tag [KarmicShare] (including brackets) on the second line. Commands and Permissions Configuration Changelog: v0.32 Basic economy support Use your economy system in place of the karma system Requires Vault and a supported economy plugin Separate give / take values on items For default settings in the config.yml, set karma.change.give and karma.change.set Completely redesigned per-item karma configuration structure Make sure to update your karma.yml to reflect the new structure Changelog (Move your mouse to reveal the content) Changelog (open) Changelog (close) v0.317 Fixed NPE from previous version on load. v0.316 Overhauled how the configuration is handled internally Consolidated some duplicate code Fixed so that blocks are not placed when interacting with signs Thanks to FlukiestEmperor for pointing it out. Fixed some FindBugs issues Other minor edits v0.315 skipped v0.314 Fixed admin commands that dealt with groups / karma. Fixed resetting / setting a player's karma Fixed remove a group Fixed draining items from a group Updated help to show the cleanup command and updated drain parameters Displaying groups should now word wrap appropriately (or close to it) Changes to inventory click logic Removed internal custom version of LogBlockQuestioner. Old questions are now using the Conversations API. v0.313 Fixed adding initial groups to players with null group. Thanks again to FlukiestEmperor for taking the time to help me step through the issue. v0.312 Fix adding players to the new, persistent groups, if they lack groups. Fix on exception when grabbing player groups. v0.311 Fixes group commands to use the new format correctly now. Fixes the right click add single item to chest. Fixes sign permission check. Fixed "duplication" issue with a specific inventory interaction Using the self group should no longer change karma Thanks again to FlukiestEmperor for catching the above issues. v0.31 Multiworld control: define what worlds should not have access to KarmicShare List of disabled worlds should be added to the config. The new path will automatically be added in. World names are not case sensitive. Fix permissions check for certain commands. v0.3 Massive Overhaul Major changes throughout the plugin. Database schema changes. The updater should handle it properly, however I urge you to read the important note below regarding this. Reduction in overall complexity. Should produce faster results for certain situations. (Also looks cleaner too) Removed anything unused / outdated. (Unless its to be re-added later) Consolidated old and similar code into shared methods. Internalized custom SQLibrary classes so that changes do not conflict with other plugins. Use of custom inventory holder rather than populating the chest's inventory. This means that a chest's previous items will **no longer be wiped**. Also, people viewing the same inventories from different locations will now be able to see other player edits in real time. This enables the chest inventory view to be accessed via a command as well. The inventory will always emulate the size of a double chest, even if the chest opened is a single chest. The inventory, when opened, will be titled the group your are viewing and the current page. Groups and interactions have been completely overhauled You no longer have to define a group for the link sign. Groups are now tied to the player. To cycle between groups, you can either: Shift click the sign/chest to cycle in increments of the groups you are a part of Use command to set your selected group, so long as you are a part of that group or have the appropriate ignore permission node. Your currently selected group is highlighted in your group list in the /ks command. List command now allows for viewing and paging through any group (no longer statically defined as "global"). This is tied to your currently selected group. Should work the same for give/take commands as well. Fixed issue with ghost item exploit of enchanted items. This was due to not having an order to the enchantments of an item. Remedied with custom enchantment wrapper to provide necessary order / sorting. Removed the automated "cleanup" task and replaced it with a command. Command changes: New command to set your selected group: /ks group set <group> New command to remove irregular items (items with negative amount) : /ks admin cleanup New command to open an inventory view anywhere: /ks open [page#] Permission changes: Removed unnecessary node - KarmicShare.group Added node - KarmicShare.admin.cleanup Added node - KarmicShare.commands.open Thanks to FlukiestEmperor for the brainstorm that led to these changes. And thanks to everyone that has been using this plugin. Wouldn't be here if it weren't for your support IMPORTANT: VERY important changes to the database. While I've tested it to be a clean transition, we all know things can go wrong... So, please back up your databases just in case the updater doesn't work entirely correct. Also, in the case that you have groups that have capital letters, please change them to be lower case in the interim. v0.262 Fixed tools with high durability with certain inventory actions, most notability shift-click and switching items. Thanks to odielag for pointing out that it was still around v0.261 Fixed SQL query with the list command Thanks to @consultingdetective for notifying me Internal changes to how permissions are handled, another set towards 0.3 v0.26 Fixed exploit with diamond tools / items with high durability (which means soon to break) reverting to back full durability. Old items prior to this will automatically be "fixed" to show appropriate durability. Thanks to odielag for pointing it out. Internal restructuring in preparation for next major milestone, 0.3. v0.259 MAJOR BUG FIXES Fixes exploits and errors with player-chest inventory interaction logic. v0.258 Should now play nice with custom inventories of other plugins. Increased intervals between cleanup task. Probably not even needed at this point. Fixed shift right click from chest. SQLibrary changes. If you use any of the following plugins, update them as well due to this internal library change: Karmiconomy KarmicJail CashFlow v0.257 Tested to resolve conflict with OpenInv and probably any other plugins that interact with inventories. Also, tested on a 1.2.4 server. v0.256 Fix for double chests as Bukkit has fixed their issue. v0.255 Actually cancel event on the NPE check for inventory interaction. v0.254 Added NPE checks for Inventory interactions. Skipped v0.253 for no reason v0.252 Ability to jump page numbers for chests using chat command: /ks page <num> Requires chests to be enabled and player to have chest permission node: KarmicShare.chest v0.251 Chests now correctly clear contents when they are destroyed by an explosion. v0.25 Major changes to custom SQLibrary classes. Removed dependency on Spout. Uses Bukkit API for Inventory click events. A lot of minor changes to update to the latest Bukkit API. v0.24 Updated to new Event system of the latest recommended builds. v0.23 Completely assimilated custom LogBlockQuestioner package. Should resolve conflicts with existing LogBlockQuestioner.jar. They should now coexist fine. Config is reloaded before saving on server stop. Changes to config.yml should now be preserved on plugin disable. v0.22 Removing a group also removes the group's associated items from the item table. v0.21 Massive internal refactoring and optimization. Smaller file size for what its worth... Fix on the drain command when giving a specific group name. Minor edits on strings. v0.2 MySQL support Drain command now accepts a group name, so you can specify what item pool you want to empty. IMPORTANT: If you were on a release before v0.2, and wish to use MySQL. Run the plugin as it at least once for the following reasons: Add the config automatically to the config.yml. VERY important changes to the database and table names. If you do not run it at least once, and configure everything manually from MySQL, then there is no way use the built-in auto-import process. You will have to either: 1) Manually import from SQLite to MySQL 2) Rename the SQLite database tables to the appropriate table names 3) Revert the version number to something before '0.2', set mysql.use to false in the config, and then run at least once to update the SQLite tables to the appropriate names Version 0.192 Better Spout checks on the Listeners Minor edits to the internal LogBlockQuestioner Version 0.191 Bows are now considered tools, so enchantments and durability will be appropriately saved. Sorry for not catching this earlier in regards to durability. (Maybe it sorta was working...?) Version 0.19 Full right-click support for chest access Potions now stack appropriately when using the command to take them from the item pool Right clicking the link sign now goes to the previous page. Should make navigating the chest pages a bit nicer. Forwarding the page is still left click either the sign or the chest. This should allow for some consistency in that left goes forward and right goes backward. Chest access re-population occurs on a 1-tick interval, instead of the 5-tick. Changes made to chests should now be ever so slightly faster. IF this is an issue, please let me know. Adding ALL the permission nodes (or a lot at the very least) KarmicShare.commands.list : Allows user to use the command, /ks list KarmicShare.commands.value : Allows user to use the command to view multipliers, /ks value KarmicShare.group.* : Allows users access to all group commands KarmicShare.group.create : Allows user to create groups KarmicShare.group.add : Allows user to add players to their groups KarmicShare.group.remove : Allows user to remove players from their groups KarmicShare.group.leave : Allows user to leave their groups KarmicShare.admin.*: Allows admin to access to all admin commands KarmicShare.admin.add : Allows admin to add generated items to item pool KarmicShare.admin.reset : Allows admin to reset player's karma KarmicShare.admin.set : Allows admin to set a player's karma KarmicShare.admin.drain : Allows admin to drain the item pool KarmicShare.admin.reload : Allows admin to reload plugin KarmicShare.admin.group.* : Allows admin access to all group admin commands KarmicShare.admin.group.create : Allows admin to create groups KarmicShare.admin.group.delete : Allows admin to delete groups KarmicShare.admin.group.add : Allows admin to force add players to groups KarmicShare.admin.group.remove : Allows admin to force remove players from groups These permissions were added to have more fine control over what players had access to. For instance, you would probably want mods the ability to force add players to a group, but not access to the drain command. Or, maybe you want to hide the command-based list function from users to persuade them to use the chests. Maybe you want players to add and create groups, but not to remove other players. Etc, etc. Please adjust your permissions accordingly KarmicShare.admin has been replace with the modular permission nodes. For a better list, as to how its supposed to work, look on the Commands and Permissions page. Version 0.18 ProperPEX support. Sorry, apparently Vault was getting first dibs when checking permission. Now, Vault is second if PEX is detected. This should fix permission errors with PEX and Vault. Changed group commands to support multiple users: /ks group add <groupname> <player> [player2]... /ks group remove <groupname> <player> [player2]... /ks group leave <group> [group2] ... /ks admin group add <group> <player> [player2] ... /ks admin group remove <group> <player> [player2] ... Added more defaults for items thanks to @holsamoht Version 0.17 Chests now display the stacks of the items rather than a singular item Linked chests now behave a lot like regular Minecraft chests. Interactions should now be much faster and enjoyable. The /ks list command now only shows items for the global group rather than all the groups. New permission nodes specifically for the chat commands /ks give and /ks take. Please update your permissions accordingly. Respective nodes are: KarmicShare.commands.give and KarmicShare.commands.take Please note, these are ONLY for chat commands. Not needed for chest access. However, you still need the main command, KarmicShare.give / KarmicShare.take to either give/take. Much like how chests enable viewing, but you still need the respective permissions to do anything. Version 0.16 Cleanup task occurs every minute and is much more concise of a query. Now check against the impossible, rather than assume that the impossible is impossible. Basically, rather than only removing entries if the amount equals 0, remove entries if they're zero or negative. Should have fixed dupe bugs on chest access. Shift clicks may or may not still be an issue.... The ignore permission nodes are now default to false, and thus must be explicitly added. Version 0.15 Critical update: fixed typos on queries. Version 0.14 Initial group support Players can create and add people to groups. When adding players to a group, if no group is specified, it will use your main group (if you are in a group), which is the first group listed when using /ks. Admin commands to manage/force groups and membership. Chest support for groups. Due to sign line limitations, group names must be at or less than 15 characters, alphanumeric, no spaces. Chest link signs have been modified. You must put the [KarmicShare] tag on the secondline, or it will NOT be detected. To link a chest to a group, put the group name in the first line. You may colorize it / or use caps. Due to the new group system, current signs will need to be remade. Fixed a critical bug regarding enchanted items and chest access. Added a cleaner thread, in the event that an item's amount hits 0 or a negative number. This does not ordinarily happen, and it probably only occurred during testing. However, just in case, this cleanup task occurs every hour only for erroneous item entries. So, all in all, it probably isn't necessary unless the SQLite database gets mucked up from an external source. Drain, reset, and other admin commands now ask for confirmation (if you're in-game. Console bypasses it.), thanks to DiddiZ's LogBlockQuestioner. Added new permission nodes, all of which default to op: KarmicShare.ignore.karma - Completely ignores the karma system for the player. Player's karma does not change. KarmicShare.ignore.group - Player is treated as if they are in the group, even if they're not. Thus, they're in "all" groups essentially. KarmicShare.ignore.* - has the above nodes enabled. Please note, the item table needs to be rebuilt due to database schema changes. While I have repeatedly tested the updater for tables of v0.13 (and thus supports any other previous versions), if for whatever reason it isn't able to smoothly transfer your item database, then I can only suggest removing the database file and starting anew. Once again though, I have tested it and it ought to work just fine. It may take an extra second when enabling on update to move stuff over into the new table, but it ought to be rather quick. Version 0.13 CRITICAL : Fixed bug on wall sign breaking saying no permission. When moving stuff around, I forgot the vital check to see if it was even one of the plugin signs and not a generic sign that I shouldn't care about. VERY SORRY ABOUT THIS. D: Version 0.12 Fixed shift-click from linked chest to player inventory. Made the item re-population occur twice as fast. If item re-population does not occur, and you know the item still exists in the pool, please let me know. It takes 5 ticks now before it adds the item back to the chest, so long as it exists, versus the 10 ticks in previous versions. I don't believe this should be an issue, especially considering the shift-click task on the player side is set to only a 1 tick delay. I'll keep testing and see if 1 tick for the chest is alright or not. Updated version to 0.12 Version 0.11 Shift-click from chest to inventory seems to be bugged. Currently disabled until ghost item issue is fixed. When using /ks version to show current config, chests state is given now. Updated version to 0.11 Version 0.1 Physical chest support To make a chest linked to the item pool, just create a wall sign above the chest with "[KarmicShare]" (no quotations). Or place a chest under a sign that has been detected and it will activate. To cycle through the item pool using chests, either left click the chest or left/right click the sign. The page number will change appropriately. Using chests require the KarmicShare.chest permission node. Creation/Destruction of [KarmicShare] signs require the KarmicShare.sign permission node. Signs/chests that are destroyed do NOT drop items from the item pool. So, they're safe to destroy. Items in chests only have a stack size of 1. Thus, each item is a representation of a unique item in the item pool. When an item is taken out, it is automatically repopulated if there is still more in the pool. Right click has been disabled for KarmicShare chests due to a ghost item bug. To ensure that users don't encounter such issues, right click events are cancelled/denied. Chests are enabled by default. To disable them, make sure that you set chests to false in the config.yml before the plugin is enabled. Due to a weird dupe bug, that shouldn't happen, signs cannot be placed next to existing, verified [KarmicShare] signs. Item edits are reflected in the item cache for the command-based version of item-lists. So, everything should be in sync. Per-item karma has potion support. Vault support for permissions. Generic cleanup and edits on minor sections of code. Changed version number to 0.1 Important notes: If you want to use chests, you NEEDto have the SpoutPlugin on the server side. If you don't, then you cannot use chests at all. This is vital as there is no base Bukkit for me to get the individual clicks and interactions in an inventory at the moment. Delayed update due to working on a custom jail plugin solution for my server. If you encounter any issues, please don't hesitate to create a ticket. Version 0.09 Full potion support! Only supports known, usable potions. The unused potions are stored correctly, however they have the display name of "potion" Music discs are now appropriately named, following the Minecraft Wiki. Fixed cauldron name, used to be "cauldron item" due to bukkit's naming scheme. SQLite database will be auto-updated to support potions, so, no need to replace the database file. When taking potions or glass bottles from the item pool, they are given one at a time since they don't stack normally anyways. Item inspection command, /ks info, supports potions with a new boolean check. When using the admin command to add potions to the item pool, the data value is actually the durability. Just use it as normal and it will work. Changed version number to 0.09 Sorry for the delayed update as well as the missing potion support on earlier versions. I have been working on my personal fork of the CashFlowplugin for the past few days. This took up much of my time away from my current projects. I didn't know that potions were so special and weren't being handled correctly. Same with music discs, I thought that the names would have been in Bukkit... Anyways, majority of special items are supported now. And since my fork of CashFlow is mostly done and stable I ought to be able to update this more often. I'll be trying to work on physical chests soon. Thanks to all those that have been using my plugin Past Versions Missing the change logs. However, all commit changes can be found on the GitHub link.