Stock Market
StockMarket
StockMarket is a plugin designed to create a virtual and random in game Stock Market that has random events and can be a lot of fun.
You can customize the plugin so in general players will lose money, but the smart ones will come out making money. You can customize it so just about everyone is constantly making money. You can customize it so in general the stocks price stay about the same, with max and min prices so players cannot profit much from it.
Theres lots of random events and always room for more, where stocks prices are affected by certain world events or company events. The frequency of these events can be customized.
All data is stored using mySQL. Support for other DBs including flatfiles and sqlite will come later.
Plugin is currently in alpha (or whatever you want to think of it as).
Dependencies
- Vault
- Vault Compatible Economy Plugin
- MySQL Database
Commands
- /sm help <page> - Displays StockMarket help. - Permission Node: stockMarket.user.help
- /sm info - Displays plugin version & status. - Permission Node: stockMarket.user.info
- /sm list - Displays a list of stocks you are allowed to buy and their current price. - Permission Node: stockMarket.user.list
- /sm list mine - Displays a list of stocks that you currently own and their current price. - Permission Node: stockMarket.user.list
- /sm buy <stockID> <amount> - Buys the stock & amount specified. - Permission Node: stockMarket.user.buy
- /sm sell <stockID> <amount> - Sells the stock & amount specified - Permission Node: stockMarket.user.sell
- /sm add <stockID> <basePrice> <maxPrice> <minPrice> <volatility> <amount> <dividend> <stockName> - Adds a new stock to the list of all stocks. - Permission Node: stockMarket.admin.add
- /sm remove <stockID> - Removes an existing stock from the list of all stocks. Cannot be undone. - Permission Node: stockMarket.admin.remove
- /sm set <stockID> <newBasePrice> <newMaxPrice> <newMinPrice> <newVolatility> <newAmount> <newDividend> <newStockName> - Edits an existing stocks information. - Permission Node: stockMarket.admin.set
- /sm forcerandom - Forces a random event to occur on a random stock. Does nothing if no stocks exist - Permission Node: stockMarket.admin.event
- /sm reload - Reloads the plugins config. - Permission Node: stockMarket.admin.reload
- /sm <stockID> - displays more info about stock requested. - Permission Node: stockMarket.user.detail
Configuration
So right now the plugin is purely MySQL, as stated above support for other formats will be added later. Run the plugin once to generate the default config file. By default the MySQL server is localhost:3306 user: root pass: "" database: sm. If the database does not exist, it will be created. There are a few other options in there as well. :)
This plugin depends on Vault. It also requires that there be an economy plugin and a permissions plugin, else it unloads on start-up.
Adding Stocks
To add a stock use /sm add.
For example:
- /sm add MASH 100 200 1 100 -1 1 Mashlol's Epic Business of Amazingness
- /sm add AAPL 500 1000 1 25 500 2 Apple Inc.
In general:
- /sm add ID BasePrice MaxPrice MinPrice Volatility Amount Dividend (Name Can Continue For As Long As You Want)
Creating Events
#: <-- This number must follow order (i.e. don't have events 0-3 and 5-7, that would be pointless and also wouldn't work) message: Message <-- This message will be displayed when the event occurs. All instances of %s will be replaced with the Stock ID. effect: 50 <-- This is the base effect based on the base price. I.e. the max price change that can occur if this is 50, is an increase in the stocks price equal to 50% of the base price (that is of course if the volatility of the stock is 100) up: true <-- Does this event increase the price or decrease it? True for increase, false for decrease. frequency: 50 <-- This has a chance of 50/(sum of all frequencies) to be selected. For example if there are 3 events, each with a frequency of 1, they each have a 1/3 chance of occuring.
Default Config
# How many stocks is the player allowed in total? max-total-stocks-per-player: 250 # How many stocks is the player allowed of each stock? max-total-stocks-per-player-per-stock: 50 # How often in minutes should random events occur? random-event-frequency: 60 # How often in minutes should dividends be paid out? dividend-frequency: 1440 # Should offline players be paid during dividend payouts? pay-offline-players: true # Broadcast events? broadcast-events: true # Broadcast dividend payouts? broadcast-payouts: true mysql: ip: localhost port: 3306 username: root password: "" database: sm events: 0: message: "The CEO of %s has died of a heart attack. The replacement is looking to be a poor one." effect: 40 up: false frequency: 50 1: message: "The CEO of %s has died of a heart attack. The replacement looks like he is even better than his successor!" effect: 40 up: true frequency: 50 2: message: "%s has announced a new product to be released! Speculation is high!" effect: 8 up: true frequency: 250 3: message: "%s has announced a new product to be released! Speculation is high!" effect: 8 up: false frequency: 250 4: message: "%s's announced product was a huge success, customers are extremely satisfied!" effect: 45 up: true frequency: 250 5: message: "%s's announced product was poorly made, causing poor customer satisfaction!" effect: 45 up: false frequency: 250 6: message: "%s had a bad quarter." effect: 30 up: false frequency: 100 7: message: "%s had a fantastic quarter." effect: 30 up: true frequency: 100 8: message: "Everyone is speculating that %s is soon to come out with an extremely amazing product!" effect: 65 up: true frequency: 5 9: message: "%s is on the brink of bankruptcy." effect: 65 up: false frequency: 5 10: message: "%s just invented the next best thing since sliced bread!" effect: 400 up: true frequency: 1 11: message: "%s just went bankrupt." effect: 400 up: false frequency: 1 12: message: "%s just announced that they are replacing their current CEO, who has a bad reputation." effect: 25 up: true frequency: 25 13: message: "%s just announced that they are replacing their current CEO, who everyone loves." effect: 25 up: false frequency: 25
Misc
- Source: https://github.com/Mashlol/StockMarket
- Tickets: https://github.com/Mashlol/StockMarket/issues
Warning
If you decide to test this plugin, I hold no responsibility for any possible bugs. As it is in alpha, there are likely to be exploits and such which may possibly allow a player to abuse the economy. If you run a server that is based solely on economy, you might want to wait until beta or release :)
Hello, I realize that this was last updated to 1.8.
I was wondering if this would see any more activity? And if so, if it would be for the more major releases, such as 1.10, and 1.12, or just straight to 1.13?
Thank you for your mod and time :) .
Hey Drakster,
I have a problem which most of us are experiencing it that is related to mySQL.
Would you mind showing us how to set up a database and sync with our server?
Please response in a language that we can understand, please no high-end technical/programming language.
Thank you,
Portman6987
Hi and thanks for a nice plugin. This is precisely the type of plugin I looked for to my server. Unfortunately I face some problems when running it on Bukkit 1.11.
I have succeded to create stocks and can buy and sell without problems. But when I want the price to change with /sm forcerandom something happens.
Sorry for spamming the comment field but it may be of interest to show all the warning/error messages as they appeared when I sent the command. I guess the SSL-connection warnings in the beginning are of minor importance and is derived from some settings I have to do on my MySQL-server, correct me if I am wrong. The other half of the log may be more interesting showing errors of unhandled exceptions.
I am greatful for all help in this issue
@xXMcViRuzXx
Hi Mate,
Please show me your config file (link it)
I've got my MySQL open... but when I install stockmarket and reload/refresh the server, the config file does not appear...
@TheGamerRules
Needs to be on a MySQL database server that doesn't conflict. You can use another database, just don't try to run two instances of StockMarket from the same place. No Multi-server support just yet !
@drakster2012
Hi, I have a question. So I'm trying to get this to work right now, Our host has a MySQL that we use, does the IP count for localhost? Does the MySQL need to be dedicated? mysql: ip: localhost port: 3306 username: XXXX password: 'XXXX' database: sm
@CraftinCrazy
You need to install a MySQL database server and tell Stock Market how to talk to it via the config settings.... if you have no database server, you CAN NOT use this plugin.
I am having some issues as-well. Whenever I start the server, Stock Market fails to load and pops up in red under /plugins .
Is this another Mysql problem, and if so what do I need to change to solve this?
mysql: ip: localhost port: 3306 username: root password: '' database: sm
^ Is in my config.
Please respond as soon as possible.
@GeorgeDaTurtle
You need to install it, its a separate application designed to host databases and commonly used on Linux based servers.... (but works on Windows).
so how do you access MySQL???
@MynaLoL
You need a MySQL database server that you can connect to and to place the details in for the database in the Stockmarket Config file.
Flatfile storage is not supported, sorry.
If you do not provide valid SQL credentials it will not work.
- Drakster2012
mysql: ip: localhost port: 3306 username: root password: "" database: sm
it says in config database is sm and that pass is ""
Plz help fast
what do i need to change?
@MynaLoL
@MynaLoL
I am running StockMarket v.08 with the below settings;
mysql: ip: localhost port: 3306 username: root password: password database: mydatabasename
There shouldn't need to be any quotes etc, please tell me what yours looks like?
Please be aware that these connection details need to point at a valid database server and database, or nothing will occur.
I have same problem too it failed to initialise. can u help me config mysql settings?
[18:28:24] [Server thread/INFO]: [StockMarket] Failed to create database during initialisation. Most likely due to incorrect database settings in config file. [18:28:24] [Server thread/ERROR]: [StockMarket] Database failed to initialise! [18:28:24] [Server thread/INFO]: [StockMarket] Disabling StockMarket v0.08 [18:28:24] [Server thread/INFO]: [StockMarket] No cleanup required as event threads never started. [18:28:24] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it [18:28:24] [Server thread/INFO]: CONSOLE: [0;32;1mReload complete.[m [18:28:24] [Server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 5253ms behind, skipping 105 tick(s) [18:28:24] [pool-3-thread-19/INFO]: [Vault] Checking for Updates ... [18:28:25] [pool-3-thread-19/WARN]: [Vault] No files found, or Feed URL is bad. [18:28:25] [pool-3-thread-19/INFO]: [Vault] No new version available [18:28:26] [User Authenticator #1/INFO]: UUID of player Georgemmm is 1e535169-842c-4339-87d0-0030054277d0 [18:28:27] [Server thread/INFO]: Debug 1; [18:28:27] [Server thread/INFO]: Debug 2; [18:28:27] [Server thread/INFO]: Debug 3; [18:28:27] [Server thread/INFO]: Georgemmm[/192.168.0.190:55331] logged in with entity id 497 at ([creative]-1598.376058298013, 40.98690604536911, 1348.689273371576) [18:28:27] [Server thread/INFO]: [0;31;1mGeorgemmm[0;33;22m has joined the game.[m [18:28:27] [Server thread/INFO]: [1.8Tags] PermissionsEX was found, Synchronizing... [18:28:27] [Server thread/INFO]: [1.8Tags] Synchronized Groups with GroupFile! [18:28:47] [Server thread/INFO]: Georgemmm issued server command: /sm
so typing /sm didn't work (nothing happened) and the bold thing in the log is some sort of error.
Thanks drakster2012, it was the Java 8 thing, I'll let you know if I encounter any more problems.
help me x_x
What do you mean configure valid MySQL settings? my config is correct
mysql: ip: localhost port: 3306 username: root password: '' database: sm
That is what is under the mysql section
@MynaLoL
You need to configure valid MySQL settings for Stockmarket, this is relied upon to store information.