GeneralStore
GeneralStore
Version: v1.0
Description: This plugin is my first plugin I have ever made, What it does is it allows you to create a block then when right clicked will open a inventory were players can sell things to the server. The player can add all the items they want to trade to the inventory and click the block that says "Value", it will tell them how much everything is worth. When they click the block that says "Sell", all the items in the store inventory will be "Sold to the server", meaning the items disappear and the player is given cash for there value.
This is a great way to have players easily make money they can use to buy items in your stores, or to trade other players with. It is also great for encouraging players to go out and collect resources, and make a profit while doing it! And if a player besides they don't want to trade, they can back out by pressing 'e' or the escape key to close the windows. All of there items will be returned to them, and they will get a message telling them they canceled the selling.
Adding items to the store to sell is easy, all they have to do it drag them into the window, or shift click them when they are in there inventory. If they want to remove an item, they can drag it back out, or shift click it back out.
Commands:
- /gsign This will set the target block you are looking at to the block that opens the store for players. It will give you a message when done, as well as update and reload the config automatically for you so you don't have to restart the server.
- /gsell
Configuration:
You can customize how much the items are worth, and how much the store will actually buy them for.
Also OP's can use /gsell to open the store without using a block, and can use /gsign to asign the targeted block to open the store when right clicked.
This is the default config.yml:
scam: scam: true rate: 0.01 sign: cordx: cordy: cordz: world:
Note: If you mess up either your config.yml or worth.yml, you can delete them and the plugin will replace them with the defaults.
Here is the explanation of the config:
scam: true #This determines if the store will buy items for what they are worth, or for slightly less then that.
rate: 0.01 #If scamming is enabled (which it is by default) this will be how much the store will deduct from the price it will pay
The formula used in scamming is this: priceStorePays = actualValue - (actualValue * scamRate)
Here is a example of some of the prices in worth.yml and how to change them:
worth: stonebutton: 6.0 wood: 0.50 arrow: 3.50
The number after the name of the item is its value, and how much it is worth before taking any value off of it if scamming. The item name, is the name of the item without any spaces or underscores.
Tested On: Bukkit-1.5.2-R1.0 and Bukkit-1.6.2-R0.1
Dependencies:
- Vault: For payment to players.
Credit: The worth.yml was made by essentials, I hope you don't mind if I utilize it here.
Features:
- Allows you to use /gsign to assign a block to open the store windows when right clicked.
- Changeable prices.
- Changeable "Tax"
- Open store with a command
Permissions:
I tested these using PermisstionEX, but I don't see why it wouldn't work with any other permission system. /gsell and /gsign are default to OP, If you have admins that aren't OP you can use GeneralStore.* to allow them to use all the GeneralStore commands.
For normal players you can add the node GeneralStore.usesign but it should work without doing so, because it is default. If you don't want a player to be able to use the store you can negate the permission based on your permission system. For example if you were using pEX you could do:
- -GeneralStore.usesign and the player wouldn't be able to use the store.
GeneralStore.nosign:
description: Allows the use of /gsell.
default: op
GeneralStore.gsign:
description: Allows the use of /gsign.
default: op
GeneralStore.usesign:
description: Allows users to use the GeneralStore.
default: true
Known Bugs:
If the player only puts 1 item in and cancels the trade, the item doesn't show back up in his inventory until the game refreshes. I tried using the updateInventory(); but it just wasn't working. But the player doesn't lose any of his items.
Future Updates:
- Ability to have more then 1 blocked assigned.
- Different prices for different worlds.
- Add features that allow players to buy items players sell to the store.
- After the above mentioned feature, price value change based on amount of the item in the store, if scamming is enabled.
- Add a reload command, so you can change prices without restarting the server.
Change log:
- V1.0: Released GeneralStore.
Comments