Sueta

AStockMarketPlugin2 (NOW WITH GUI)

2-DEV

A very basic stock plugin that will be expanded with more features in the future!

·Plugin

AStockMarketPlugin2 DEV Build
A stock market plugin for Spigot 1.21 with GUI-based trading, economy integration, and volatile price fluctuations.

Features

  • Economy Integration: Full Vault economy support for transactions
  • Admin Commands: Create and manage stocks with customizable parameters
  • Player GUI: Intuitive chest-style interface for trading
  • Volatility System: Dynamic price fluctuations based on configurable volatility
  • Data Persistence: Automatic saving of stocks and player holdings
  • Configurable Messages: Fully customizable text and colors
  • Real-time Updates: Live price updates and GUI refreshing

Dependencies

  • Tested on Spigot/Paper 1.21.6
  • Vault (for economy integration)
  • Economy Plugin (e.g., EssentialsX, CMI, etc.)

Installation

  1. Download the plugin JAR file
  2. Place it in your server's plugins/ folder
  3. Ensure Vault and an economy plugin are installed
  4. Start/restart your server
  5. Configure the plugin files as needed

Commands
Admin Commands (Permission: stock.admin)

  • /createstock <n> <price> <volatility> <minPrice> <maxPrice>
    • Create a new stock with specified parameters
    • name: Unique stock identifier
    • price: Starting price (decimal)
    • volatility: 0.01-5.00 controlling price fluctuation
    • minPrice/maxPrice: Absolute price bounds
  • /deletestock <n>
    • Delete an existing stock (removes from all player holdings)

Player Commands (Permission: stock.view)

  • /stock
    • Opens the main stock market GUI

Permissions

  • stock.admin - Access to admin commands (default: op)
  • stock.view - Access to stock market GUI (default: true)
  • stock.* - All permissions (default: op)

Volatility Categories

  • 0.01-0.10: Ultra-Stable (e.g., agriculture/minerals)
  • 0.50-1.50: Moderately Dynamic (e.g., tech/logistics)
  • 2.00-5.00: Highly Speculative (e.g., crypto/meme stocks)

Configuration
config.yml
# Market tick interval in seconds
market-tick-interval: 60

# GUI Settings
gui:
items-per-page: 28
update-interval: 20

# Debug mode
debug: false

# Auto-save interval in minutes
auto-save-interval: 5
stocks.yml
Automatically managed - stores all stock definitions with current prices, volatility, and bounds.

data.yml
Automatically managed - stores player holdings including purchase history and profit/loss tracking.

messages.yml
Fully configurable messages with color codes and placeholders:

  • {stock} - Stock name
  • {price} - Price amount
  • {volatility} - Volatility percentage
  • {amount} - Share amount
  • {totalValue} - Total monetary value
  • {profitLoss} - Profit or loss amount

GUI Navigation
Main Menu

  • My Holdings: View owned stocks, current values, and profit/loss
  • Market: Browse and purchase available stocks

Holdings View

  • Lists all owned stocks with real-time values
  • Shows profit/loss with color coding
  • Click any stock to access sell menu

Market View

  • Paginated list of all available stocks
  • Color-coded by volatility level
  • Click any stock to access buy menu

Buy/Sell Menus

  • Pre-defined quantity buttons for easy trading
  • Real-time affordability checking
  • Immediate transaction processing


Disclaimer: This plugin is a fun project for our private server and may contain bugs. It is not well-polished and should not be used on a public server without proper testing.

This plugin does not reflect the real stock market and does not use an advanced simulation for stock prices.

Similar projects

Plugin →