A simple global shop which is used through commands.
To use GlobalShop you must install one of the following Economy plugins:
- iConomy 4,5 or 6
- BosEconomy 6 or 7
- Essentials Economy 2.2.17+
The first found Economy plugin is used. Economy functions are used through Nijikokun's Register API which is implemented in GlobalShop.
Globalshop v0.8 now supports (and requires) Vault
- Shop that can be accessed from everywhere.
- Add customizable item names.
- Damage/Color can be defined in config. So you can sell for example black_wool.
- Considers the durability of an item to calculate the selling price.
- Set the sellratio. This defines how much money you get for selling an item. Default is 80%.
- All commands can be renamed to your wish by re-configuring the aliases in plugin.yml HowTo.
There are ParentPermissions for SuperPerms: globalshop.trade.* and globalshop.admin.*
- 'globalshop.trade.buy' -> Allow /buy and /price
- 'globalshop.trade.sell' -> Allow /sell and /checksell
- 'globalshop.admin.reload' -> Allow /shop reload
- /price (name|id) -> Show the price you must pay to buy name|id
- /buy (name|id) [amount] -> Buy name|id (with optional amount)
- /checksell -> Shows the money you would get for the item you are holding
- /sell -> Sells the item you are holding
- /sell <quantity> -> (v0.8) Sell a given quantity of the item held (only applies to stack in hand)
- /sell all -> (v0.8) Sell all items of the same type throughout inventory
- /shop reload -> Reloads the config of GlobalShop
At moment you must setup all prices in the config file. This is explained here: Configuration
- Setting up prices with commands
- Writeout of a HTML-File where all prices can be viewed
- Fix: disallow selling in Creative mode
- Add: Metrics support (see http://mcstats.org/learn-more/ for more info)
- Fix: non-stackable items no longer stack when buying multiple
- Added: now checks for available inventory space (so you don't waste money if your purchase doesn't fit).
- Support for Vault
- Added /sell <quantity> (from current held stack only)
- Added /sell all (sells all of the same item from your inventory)
0.7b2 (modifications by Zarius)
- fix for new Bukkit Version
- code cleanup
- start of coding for buy/sell with exp (doesn't work yet)
GlobalShop uses Metrics for anonymous usage stats (learn more). From v0.91 only.
Hmm... seems to work fine for me if I put cobblestone with data 50 - you can give blocks durability values but when they go into your inv they reset back to 0 (unless they're a special block like slabs, brick, etc). In my OtherDrops plugin I let users add whatever integer durability value they want and doesn't seem to have had any problems.
Thanks for making a list of items with durabilities, as that saves quite a bit of time, but an iterator would be a more efficient option.
It seems that the best way to fix this plugin specifically would be to rework the criteria for what can be sold. The "true" best way to handle this for the future would be to add a new method to the org.bukkit.material class with the following definition:
Some of the configs will still work, and some may not, as some of the files the configuration API references may no longer exist.
EDIT: That's actually not the case, what that line does is check to see if the item you inputted does NOT have a maximum durability of -1. The only items with a maximum durability of -1, are tools like swords, picks, armor, fishing rod, etc. So if you input a damage value for an item that isn't a tool, it will throw an exception. All blocks have damages, but all they represent is how much damage that block has taken, and blocks only take damage while you are mining them, so the only way you can set the damage of those blocks is to have them "in use", which is a bad way of describing that blocks only different damage values while a player is mining them. Of course this detects all items that aren't tools, so it also throws exceptions for items like lapis dye.
To sum it all up you need that check, but here's a better way to do it, just create an array of all the tool ids, and iterate through them all to check it the item in question is a tool. Like this. One more thing, before that executes you'll have to do another cross-reference to check if the item uses MaterialData. If it does you can set the data and skip the check for damage. Luckily none of the items that need to be in the reference list for tools use MaterialData, otherwise this would be much harder.
I wouldn't be so sure of that. I haven't updated my own plugin from the old config API and there's a lot of config usage there without I problem (although I know I'll have to work out what needs to be changed soon).
The error section is:
I assume it's to ensure you don't sell half used swords, though I don't know why that's a bad idea :) Not sure if it worked in the first place as I expect wool & dye always had durability. Here's a Link Removed: http://www.mediafire.com/download.php?9lneea7qgu0rd4m that disables that line and seems to load properly (I changed a message to "sold" instead of "saled" and also removed the old yeti permissions as it didn't compile properly first go with it).
@Zephim - btw: your git repository is broken, I think :( Though I did download a package (.tar.gz) from your site.
The reason you have no idea what's wrong is because you coded your "catch" clause to print the relevant error message which happened to be "lapiz get's it's damage by using it.". Seeing as this error message is practically useless, might I recommend that you add "e.printStackTrace();" on the next line? It makes life sooo much easier.
Other than that, by reading your code I can see that the error was caused by an InvalidDataException. Knowing that, and that the function that threw the exception was created to read and parse the config.yml, specifically the items in it, I can guess what the problem is.
The person who got the error likely put an invalid item-id in the config.yml. I'm guessing they didn't know that lapis is represented by id as 351:4, and by string as INK_SACK:4. But of course I can't be sure of this, and nor can I prove it, as there is no StackTrace.
This plugin has been broken because it uses the old Configuration API, which has been deprecated for some time now. This being the case it's likely the old Configuration API has passed the deprecation stage and has been deleted, or at the very least crippled. Updating it to use the FileConfiguration API, would likely fix many, if not all, of the problems.
Any devs willing to help out with this? A lot of people rely on it. :/
I got your plugin but the thing is, Its not working for me :/ this is the file I'm using;
Everytime i test the /buy command, it says "That item is not for sale!" I'm not sure how to fix this... :/
@souldevour: I have an idea why this is so. But I must find time first...
@22alec22 Don't give the permission in the world there the users should not be able to use it.
@rolecraft It is on the feature wishlist. But as always there is not enough time. :-(
@all: I know I should spend more time on developing this plugin. But I don't have it. This plugin is under Public Domain. If someone can fix the issues let me know. GitRepo: http://publicprojects.x-pantion.de/gitweb.cgi/globalshop.git
1.1-R3 broke this plugin please update :D ERROR: http://pastebin.com/TjXGZ1Yi
EDIT: something wrong with stuff that uses that extra ":" like lapis RE-EDIT: yeah i had to drop lapis items for lapis blocks
Is it possible to make it so people can't use it in certain worlds? I have a creative and survival world and i don't want people to be able to use the shop in creative.
Looking forward to trying this out on CB 1.1-R1. Following your page for the update. :)
quick question: Does this works with mysql support as wel? (server versioin 1.1)
Running latest dev-craftbukkit works fine :-/
Well, which Bukkit build do you use? How I said I just "reloaded" the server 1 or 2 times and after that, the plugin lost his fuctionality ._.
Nevermind. It was working but now on some items it gives me an error when trying to buy/sell. Probably could be fixed with a simple update. Man, I spent hours writing the config for that.
Great plugin, thanks! For anyone wandering, yes this works on 1.0.1-R1 perfectly.
Jeah after 2 reloads ingame yesterday your plugin gave up his function o_O don't know what happend but I get the message about an "error while atteping that command" or whatever ._. I use the recommend Bukkit build
What about build #1597?