Amit datta
📎 1 file 25,550 chars
📄
pasted-code-1788521956300.txt
txt 1826 lines
▶
CREATE A COMPLETELY NEW MINECRAFT PAPER PLUGIN FROM SCRATCH.

PLUGIN NAME:
InfinityOrder

VERSION:
1.0.0

==================================================
SERVER
==================================================

Minecraft:
Paper 26.1.2

Java:
25

Main package:
com.infinityorder

Main class:
com.infinityorder.InfinityOrder

The plugin must be:

- Standalone
- Production-ready
- Paper 26.1.2 compatible
- Java 25 compatible
- Vault compatible
- Compatible with InfinityShop
- No EconomyShopGUI dependency
- No resource pack
- No unnecessary NMS

==================================================
IMPORTANT
==================================================

Build the complete working plugin.

Do not create a demo.

Do not create pseudocode.

Do not leave TODOs.

All commands and GUI buttons must actually work.

The final plugin must be ready to install on a Paper 26.1.2 server.

==================================================
MAIN IDEA
==================================================

InfinityOrder is a player-to-player item ordering marketplace.

A customer creates an order by selecting:

1. Item
2. Quantity
3. Total order price

There are NO fixed item prices.

The customer decides how much the entire order is worth.

Example:

64 Diamonds
Total price: $640

This means:

64 Diamonds = $640 total

Therefore:

$640 / 64 = $10 per Diamond

IMPORTANT:

The configured price is the TOTAL price for the requested quantity.

Never multiply the selected total price by quantity.

==================================================
MAIN /ORDER GUI
==================================================

Command:

/order

Open a modern marketplace GUI.

Do NOT show hundreds of items directly.

Main GUI should contain categories and buttons such as:

Blocks
Building Blocks
Doors
Trapdoors
Wood
Logs
Planks
Stairs
Slabs
Fences
Fence Gates
Glass
Glass Panes
Ores & Minerals
Tools
Weapons
Armor
Food
Farming
Seeds
Plants
Mob Drops
Redstone
Transportation
Minecarts
Rails
Boats
Potions
Brewing
Nether
End
Decoration
Dyes
Candles
Banners
Books
Enchanting
Workstations
Utility
Rare Items
Miscellaneous

Also:

SEARCH
MY ORDERS
CLOSE

==================================================
SEARCH
==================================================

SEARCH MUST BE GUI-BASED.

When the player clicks:

SEARCH

Open an appropriate search input GUI.

For mobile/Bedrock/Geyser players, the search input should allow the device's normal/default keyboard to be used where supported.

Do NOT force the player to type the search into Minecraft chat.

Do NOT show:

"Type item name in chat"

Do NOT use chat as the order search workflow.

Search must support:

- Case-insensitive search
- Partial names
- Friendly item names
- Material names

Example:

diamond

Results:

Diamond
Diamond Block
Diamond Ore
Deepslate Diamond Ore
Diamond Sword
Diamond Pickaxe
Diamond Axe
Diamond Shovel
Diamond Hoe
Diamond Helmet
Diamond Chestplate
Diamond Leggings
Diamond Boots
etc.

Use pagination.

Player clicks an item to continue.

==================================================
ITEM SELECTION
==================================================

After selecting an item:

Open the order setup GUI.

Show:

Selected Item
Quantity
Total Price

Example:

Diamond

Quantity:
64

Total Price:
$640

==================================================
QUANTITY CONTROLS
==================================================

Minimum:

1

Maximum:

2304

GUI must contain:

-64
-10
-1

CURRENT QUANTITY

+1
+10
+64

Also provide useful quick quantity buttons:

1
16
32
64
128
256
512
1024
2304

Clamp safely.

Never allow:

0
negative quantity
quantity above 2304
integer overflow

The quantity must be validated server-side.

==================================================
PRICE CONTROLS
==================================================

Minimum:

$50

Maximum:

$10,000,000,000

The player chooses the TOTAL order price.

Show:

CURRENT PRICE

Buttons:

+$50
+$500
+$1000

-$50
-$500
-$1000

Also provide useful larger adjustments/presets:

+$5,000
+$10,000
+$50,000
+$100,000
+$1,000,000
+$10,000,000
+$100,000,000
+$1,000,000,000

and corresponding negative buttons.

Useful preset buttons:

$50
$100
$500
$1K
$5K
$10K
$50K
$100K
$1M
$10M
$100M
$1B
$10B

Never go below:

$50

Never go above:

$10,000,000,000

Never use float for money.

Use exact monetary calculations.

==================================================
CONFIRMATION
==================================================

Show a confirmation GUI.

Example:

CONFIRM ORDER

Item:
Diamond

Quantity:
64

Total Price:
$640

Price per item:
$10

Delivery deadline:
12 Hours

Buttons:

CONFIRM ORDER

CHANGE ITEM

CHANGE QUANTITY

CHANGE PRICE

BACK

CANCEL

==================================================
ORDER CREATION
==================================================

When the customer clicks:

CONFIRM ORDER

Validate everything server-side.

Check:

- Permission
- Item
- Quantity
- Price
- Player balance
- Database
- Order state

If valid:

FULL TOTAL PRICE is deducted immediately.

Example:

Player has:

$2,000

Creates:

64 Diamonds
$640 total

After creation:

Balance:
$1,360

The $640 becomes HELD ORDER FUNDS.

Do not permanently pay anyone at order creation.

Start the 12-hour order timer immediately after successful creation.

==================================================
VERY IMPORTANT:
PARTIAL DELIVERY SYSTEM
==================================================

The order supports PARTIAL DELIVERY.

This is extremely important.

Example:

Customer creates:

64 Diamonds
Total price:
$640

Therefore:

Price per Diamond:

$640 / 64 = $10

The customer initially pays:

$640

==================================================
PARTIAL DELIVERY EXAMPLE
==================================================

A delivery player has only:

10 Diamonds

They deliver:

10 Diamonds

The plugin calculates:

10 / 64 × $640

= $100

Therefore:

Customer receives:

10 Diamonds

Used order value:

$100

Remaining order:

54 Diamonds

Remaining held money:

$540

The delivery player receives their reward immediately based on the delivered value.

Example with 10% reward:

Delivered value:
$100

Delivery reward:
$10

The remaining $90 belongs to the server after successful delivery.

==================================================
SECOND PARTIAL DELIVERY
==================================================

Another delivery player can continue the SAME order if the order remains available for partial delivery.

Example:

Remaining:

54 Diamonds
$540 held

A player delivers:

20 Diamonds

Value:

20 × $10
= $200

Customer receives:

20 Diamonds

Remaining:

34 Diamonds

Remaining held money:

$340

Delivery reward:

10% of $200
= $20

Reward is paid immediately.

==================================================
IMPORTANT PARTIAL DELIVERY RULE
==================================================

Every successful partial delivery must permanently consume only the proportional amount of the order.

Formula:

deliveredValue =
totalOrderPrice × deliveredQuantity / originalQuantity

Use exact monetary arithmetic.

Do not use floating-point money calculations.

Make sure the final remaining amount is handled exactly so there is no lost or duplicated money due to rounding.

==================================================
FINAL DELIVERY
==================================================

When the remaining quantity reaches:

0

The order becomes:

COMPLETED

All remaining held funds have been allocated.

No further delivery is possible.

No further refund is possible.

==================================================
12-HOUR TIMER
==================================================

Default:

12 hours

Config:

order-timeout-hours: 12

The timer starts when the order is successfully created and the customer's money is successfully deducted.

Store real timestamps.

Store:

created_at
expires_at

Do not rely only on server ticks.

The timer must survive:

- Server restart
- Server shutdown
- Customer disconnect
- Delivery player disconnect

==================================================
EXPIRATION WITH PARTIAL DELIVERY
==================================================

This is extremely important.

Example:

Original order:

64 Diamonds
$640

During the 12 hours:

10 Diamonds delivered.

Used value:

$100

Remaining:

54 Diamonds

Remaining held money:

$540

If the 12-hour timer expires:

Customer receives:

$540 refund

Customer keeps:

the 10 Diamonds already received

The $100 already used for successfully delivered Diamonds is NOT refunded.

Delivery players keep their already-paid delivery rewards.

The order becomes:

FAILED

No further delivery is allowed.

==================================================
NO DELIVERY
==================================================

Example:

64 Diamonds
$640

Nobody delivers anything.

12 hours expire.

Customer receives:

100% refund:

$640

Nobody receives a delivery reward.

No delivery player receives a cooldown because nobody accepted/delivered the order.

Order becomes:

FAILED

==================================================
ACCEPTANCE
==================================================

/orders

Show available orders.

A delivery player clicks:

ACCEPT

IMPORTANT:

Because partial delivery is supported, design the order system so that the marketplace can safely support partial delivery.

Decide and implement a safe assignment model.

A player may deliver a partial quantity.

Prevent two players from taking the same items simultaneously.

Use proper locking/transactions.

==================================================
DELIVERY
==================================================

Command:

/order deliver 

When the player uses delivery:

Show a delivery GUI if needed.

Display:

Customer
Item
Original Quantity
Remaining Quantity
Total Order Price
Remaining Order Value

Allow the delivery player to choose how many items to deliver.

Example:

Remaining:

64 Diamonds

Controls:

-64
-10
-1
+1
+10
+64

The player cannot select more than the remaining quantity.

The player cannot deliver more items than they actually have.

==================================================
DELIVERY TRANSACTION
==================================================

Before delivery:

Lock the order.

Verify:

- Order exists
- Order is active
- Order has not expired
- Customer exists
- Correct item
- Delivery quantity is valid
- Delivery player has enough items
- Customer can receive the items
- Order still has remaining quantity
- Order has not already completed

Then:

1. Calculate delivered value.
2. Check customer inventory.
3. Remove exact quantity from delivery player's inventory.
4. Give exact quantity to customer.
5. Calculate delivery reward.
6. Pay delivery reward.
7. Reduce remaining quantity.
8. Reduce remaining held funds.
9. Save order state.
10. Unlock order.

Everything must be atomic and duplication-safe.

==================================================
CUSTOMER INVENTORY FULL
==================================================

If the customer cannot receive the complete delivery quantity:

DO NOTHING.

Do not remove items from the delivery player.

Do not pay reward.

Do not reduce held funds.

Do not complete the order.

Show:

"The customer's inventory is full."

The delivery player can try again later.

==================================================
CUSTOMER OFFLINE
==================================================

If the customer is offline:

Do NOT remove delivery player's items.

Do NOT pay reward.

Do NOT mark delivery successful.

Create/use a safe pending delivery mechanism only if the delivery transaction can be completed safely.

When customer joins:

Safely deliver the pending items.

Then:

Calculate value.

Pay reward.

Update remaining quantity.

Never duplicate items or money.

==================================================
ITEM VALIDATION
==================================================

Support all legitimate Paper 26.1.2 inventory items.

Automatically discover valid inventory Materials.

Do not manually enter hundreds of items.

Use Bukkit/Paper Material APIs.

Exclude:

AIR
technical/internal-only materials
non-inventory materials

Use real ItemStack icons in GUI.

NEVER use CHEST as a generic placeholder for valid items.

Example:

Diamond -> DIAMOND icon

Diamond Block -> DIAMOND_BLOCK icon

Oak Door -> OAK_DOOR icon

Mangrove Fence Gate -> MANGROVE_FENCE_GATE icon

==================================================
CATEGORY SYSTEM
==================================================

Automatically categorize items.

Each item must have ONE primary category.

Specialized categories have priority.

Example:

MANGROVE_FENCE_GATE

must be:

Fence Gates

NOT:

Ores & Minerals

NOT:

Blocks

NOT:

Miscellaneous

Category priority must correctly handle:

Doors
Trapdoors
Fence Gates
Fences
Stairs
Slabs
Logs
Wood
Planks
Glass Panes
Glass
Ores
Tools
Weapons
Armor
Food
Seeds
Farming
Plants
Redstone
Transportation
Nether
End
Decoration
etc.

==================================================
GUI NAVIGATION
==================================================

All GUIs must have:

Back

Previous

Next

Close

where appropriate.

Use pagination.

Do not put hundreds of items into one GUI.

==================================================
MY ORDERS
==================================================

/order my

Show:

WAITING
ACCEPTED
PARTIALLY DELIVERED
COMPLETED
FAILED
CANCELLED

For each order show:

Order ID
Item
Original Quantity
Remaining Quantity
Original Price
Remaining Held Value
Status
Created time
Expiration time
Delivery players
Delivered quantity

==================================================
ORDERS GUI
==================================================

/orders

Show marketplace orders.

Display:

Order ID
Item
Original quantity
Remaining quantity
Original total price
Remaining value
Creator
Time remaining
Delivery status

Allow safe acceptance/delivery.

==================================================
DELIVERY REWARD
==================================================

Default:

10%

Config:

delivery-reward:
  type: PERCENT
  value: 10.0

Reward is based on the VALUE ACTUALLY DELIVERED.

Example:

64 Diamonds
$640

10 Diamonds delivered:

Value:
$100

10% reward:

$10

20 Diamonds delivered:

Value:
$200

10% reward:

$20

Never calculate reward from the original order price when only part was delivered.

Also support:

FIXED

Example:

delivery-reward:
  type: FIXED
  value: 100

If fixed reward is used, safely define how it applies to partial deliveries and prevent the reward from exceeding the value available for the delivered portion.

==================================================
SERVER SHARE
==================================================

Example:

Order:

$640

10 Diamonds delivered:

$100 value

10% delivery reward:

$10

The remaining:

$90

becomes the server share for that successful delivered portion.

At full completion:

Total customer payment:

$640

Total delivery rewards:

based on each successful delivery

Remaining amount:

server share

Never duplicate funds.

==================================================
COOLDOWN
==================================================

Config:

failed-delivery-cooldown-hours: 6

Only a player who accepted/was assigned delivery responsibility and failed to complete their assigned responsibility should receive the 6-hour restriction.

No money penalty.

During cooldown:

Cannot accept orders.

Cannot deliver orders.

Can continue normal gameplay.

Cooldown survives restart.

Permission:

infinityorder.bypass.cooldown

Default:

op

==================================================
DATABASE
==================================================

Use SQLite.

Store orders safely.

Orders table should support:

order_id
creator_uuid
creator_name
material
serialized_item
original_quantity
remaining_quantity
original_price
remaining_held_value
delivery_reward
created_at
expires_at
status
completion_at
failure_at
cancelled_at

Track delivery assignments and delivery history safely.

Cooldown table:

player_uuid
expires_at

Pending deliveries:

order_id
customer_uuid
delivery_uuid
quantity
serialized_item
value
reward
created_at

==================================================
TRANSACTION SAFETY
==================================================

Protect against:

Double delivery

Double refund

Double reward

Double completion

Item duplication

Money duplication

Two players delivering the same quantity

Two players accepting the same order

Expiration during delivery

Server restart during transaction

Player disconnect during transaction

GUI double-clicks

Use:

database transactions
atomic state changes
row locking or equivalent safe locking
synchronized order processing

Terminal states:

COMPLETED
FAILED
CANCELLED

Terminal orders can never be processed again.

==================================================
RESTART SAFETY
==================================================

If the server restarts:

Orders remain.

Timers remain.

Remaining quantity remains.

Remaining held money remains.

Cooldowns remain.

Pending deliveries remain.

No duplicate refunds.

No duplicate rewards.

No duplicate item delivery.

Example:

Order created:

10:00

Expires:

22:00

Server restarts:

17:00

Expiration remains:

22:00

==================================================
COMMANDS
==================================================

/order

/order my

/order info 

/order deliver 

/order cooldown

/order help

/orders

/orderadmin

/orderadmin reload

/orderadmin cancel 

/orderadmin forcecomplete 

/orderadmin info 

/orderadmin cooldown  clear

/orderadmin list

/orderadmin database

Implement all commands fully.

==================================================
PERMISSIONS
==================================================

infinityorder.order

default:
true

infinityorder.orders

default:
true

infinityorder.admin

default:
op

infinityorder.bypass.cooldown

default:
op

Normal players must NOT require OP.

==================================================
ADMIN
==================================================

/orderadmin

Open admin GUI.

Admin must be able to safely:

View orders
View status
Cancel orders
Refund orders
Force complete
View cooldowns
Clear cooldown
View pending deliveries
Reload configuration
View database status

Admin actions must also be transaction-safe.

==================================================
MESSAGES
==================================================

All messages configurable.

Include:

order-created:
"&aOrder created! Order ID: &f%order_id%"

money-deducted:
"&e$%price% &7has been deducted from your balance."

order-accepted:
"&aYou accepted order &f%order_id%&a."

delivery-success:
"&aDelivery successful!"

delivery-reward:
"&aYou received &f$%reward% &afor the delivery."

partial-delivery:
"&aYou delivered &f%quantity% &aitems worth &f$%value%&a."

remaining-order:
"&7Remaining: &f%quantity% &7items worth &f$%amount%"

order-failed:
"&cOrder &f%order_id% &cexpired."

full-refund:
"&aYou received a refund of &f$%amount%&a."

cooldown:
"&cYou cannot accept or deliver orders for another &f%time%&c."

inventory-full:
"&cThe customer's inventory is full."

not-enough-money:
"&cYou do not have enough money."

invalid-price:
"&cInvalid price."

price-too-low:
"&cMinimum order price is $50."

price-too-high:
"&cMaximum order price is $10,000,000,000."

order-not-found:
"&cOrder not found."

not-assigned:
"&cYou are not assigned to this order."

already-completed:
"&cThis order has already been completed."

customer-offline:
"&cThe customer is offline."

no-item:
"&cYou do not have the required item."

wrong-quantity:
"&cYou do not have enough of the required item."

no-permission:
"&cYou do not have permission."

==================================================
CONFIG
==================================================

Create config.yml:

order-timeout-hours: 12

failed-delivery-cooldown-hours: 6

min-order-price: 50

max-order-price: 10000000000

min-order-quantity: 1

max-order-quantity: 2304

delivery-reward:
  type: PERCENT
  value: 10.0

database:
  type: SQLITE

gui:
  main-size: 54
  category-size: 54
  orders-size: 54
  my-orders-size: 54
  admin-size: 54

==================================================
GUI SECURITY
==================================================

Use secure GUI sessions.

Track:

player
GUI type
selected item
quantity
price
page
order ID
delivery quantity

Never trust:

inventory title alone
client input
GUI item display
old/stale GUI sessions

Prevent rapid duplicate clicks.

==================================================
GEYSER / BEDROCK
==================================================

Must work with Geyser/Bedrock as much as standard Bukkit inventory GUIs allow.

No resource pack.

No chat-based order workflow.

Search should use an inventory-based GUI/input mechanism.

Use normal Bukkit/Paper APIs wherever possible.

==================================================
INFINITYSHOP
==================================================

InfinityOrder uses Vault economy.

It must coexist with InfinityShop.

Do not modify InfinityShop.

Do not depend on EconomyShopGUI.

Do not create a conflicting /sell command.

==================================================
FINAL TESTS
==================================================

Test this exact example:

CUSTOMER:

64 Diamonds
Total price:
$640

Verify:

$640 is deducted immediately.

Price per item:

$10.

Then DELIVERY PLAYER delivers:

10 Diamonds.

Verify:

Customer receives:
10 Diamonds

Used value:
$100

Remaining:
54 Diamonds

Remaining held money:
$540

Delivery reward at 10%:
$10

Then another player delivers:

54 Diamonds.

Verify:

Customer receives:
54 Diamonds

Remaining:
0

Order:
COMPLETED

No refund.

No duplicate reward.

==================================================
EXPIRATION TEST
==================================================

Create:

64 Diamonds
$640

Deliver:

10 Diamonds

Then simulate expiration.

Verify:

Customer keeps:
10 Diamonds

Customer receives:
$540 refund

Already-paid delivery reward remains valid.

Order becomes:
FAILED

==================================================
NO DELIVERY TEST
==================================================

Create:

64 Diamonds
$640

Deliver:
0

Expire after 12 hours.

Verify:

Customer gets:
$640 refund

No delivery reward.

No delivery cooldown.

==================================================
PRICE TESTS
==================================================

$49:
REJECT

$50:
ACCEPT

$1,000:
ACCEPT

$10,000:
ACCEPT

$1,000,000:
ACCEPT

$1,000,000,000:
ACCEPT

$10,000,000,000:
ACCEPT

$10,000,000,001:
REJECT

==================================================
QUANTITY TESTS
==================================================

0:
REJECT

-1:
REJECT

1:
ACCEPT

64:
ACCEPT

2304:
ACCEPT

2305:
REJECT

==================================================
SEARCH TEST
==================================================

Search:

diamond

Verify real item icons appear.

Verify:

Diamond
Diamond Block
Diamond Ore
Deepslate Diamond Ore
Diamond Sword
Diamond Pickaxe
Diamond Axe
Diamond Shovel
Diamond Hoe
Diamond Helmet
Diamond Chestplate
Diamond Leggings
Diamond Boots

==================================================
CATEGORY TEST
==================================================

Open:

Fence Gates

Verify:

Oak Fence Gate
Spruce Fence Gate
Birch Fence Gate
Jungle Fence Gate
Acacia Fence Gate
Dark Oak Fence Gate
Mangrove Fence Gate
Cherry Fence Gate
Bamboo Fence Gate

All must use REAL Minecraft item icons.

Mangrove Fence Gate must NOT appear under Ores & Minerals.

==================================================
FINAL REQUIREMENT
==================================================

The plugin must provide this complete flow:

/order
↓
Search
↓
Mobile/default keyboard search where supported
↓
Select item
↓
Quantity GUI
↓
Price GUI
↓
Confirm Order
↓
Full price deducted
↓
12-hour timer starts
↓
/orders
↓
Delivery
↓
Partial delivery supported
↓
Customer receives delivered quantity immediately
↓
Delivery player receives reward immediately
↓
Remaining quantity/value stays in order
↓
More delivery can happen
↓
All quantity delivered
↓
COMPLETED

OR:

12 hours expire
↓
Already delivered items remain with customer
↓
Only undelivered portion is refunded
↓
Order becomes FAILED

If nothing was delivered:

Full refund.

==================================================
FINAL OUTPUT
==================================================

Provide:

Complete working source code
Configuration
plugin.yml
Database implementation
GUI system
Search system
Category system
Quantity system
Price system
Order system
Partial delivery system
Economy system
Reward system
Expiration system
Cooldown system
Pending delivery system
Admin system
Commands
TAB completion
README/install instructions

Build the actual plugin.

Verify the final plugin.

Do not claim a feature works unless it is actually implemented.

Most importantly:

PARTIAL DELIVERY MUST WORK EXACTLY AS DESCRIBED.

64 Diamonds for $640 means:

$10 per Diamond.

10 delivered means:

$100 order value consumed.

54 remaining means:

$540 held.

At expiration:

Only $540 is refunded.

The customer keeps the 10 Diamonds already delivered.

The delivery player receives their reward immediately.

NO DUPLICATION.
NO DOUBLE REFUND.
NO DOUBLE REWARD.
NO DOUBLE DELIVERY.
Kodari AI
KodariSep 4 at 11:45 am 4
InfinityOrder
InfinityOrder is a player-to-player item ordering marketplace plugin for Paper 26.1.2. Customers create orders by selecting an item, quantity (1-2304), and a total price ($50-$10B). The full price is deducted immediately and held. Delivery players can partially deliver items, receiving a configurable reward (percent or fixed) based on the delivered value. The 12-hour timer supports partial delivery; upon expiration, only the undelivered portion is refunded. Features include a GUI-based category system, search, order management, cooldowns, SQLite persistence, and transaction-safe delivery.
  1. Create the Paper/Java 25 project scaffold, plugin metadata, configuration, and installation README.

  2. Implement SQLite persistence, Vault economy integration, order lifecycle, partial delivery, expiration, refunds, rewards, assignments, and cooldowns.

  3. Implement secure inventory/anvil GUI flows for categories, search, order creation, marketplace orders, delivery, and administration.

  4. Register commands, permissions, tab completion, listeners, and startup recovery for pending deliveries and expired orders.

The core project and transactional order layer are in place. I’m adding the session-bound GUI flow and command/listener layer now, keeping all state server-side rather than trusting inventory titles or item names.

Implemented the InfinityOrder Paper plugin project with:

  • Paper 26.1.2 / Java 25 Gradle setup

  • Vault economy integration

  • SQLite persistence with WAL mode

  • Order creation with configurable quantity and price limits

  • Exact BigDecimal order-value calculations

  • Partial delivery support

  • Delivery rewards with percentage/fixed modes

  • Order expiration and proportional refunds

  • Delivery assignments and cooldown persistence

  • Category-based item discovery

  • Inventory-based search GUI using an anvil input

  • Quantity, price, confirmation, marketplace, delivery, and admin GUIs

  • /order, /orders, and /orderadmin commands

  • Permissions and tab completion

  • Configurable messages

  • Restart-safe order timestamps and expiration recovery

  • Installation and configuration README

Required server dependency:

  • Vault

  • A Vault-compatible economy plugin

The project files are ready under the generated Gradle structure, with SQLite data stored at:

Plain Text
plugins/InfinityOrder/orders.db
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
20 708
src/main/java/com/infinityorder/InfinityOrder.java
package com.infinityorder;

import com.infinityorder.command.AdminCommand;
import com.infinityorder.command.OrderCommand;
import com.infinityorder.economy.EconomyService;
import com.infinityorder.gui.MarketplaceGui;
import com.infinityorder.listener.MarketplaceListener;
import com.infinityorder.order.OrderService;
import com.infinityorder.storage.Database;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class InfinityOrder extends JavaPlugin {
    private Database database;
    private EconomyService economy;
    private OrderService orders;
    private MarketplaceGui gui;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        this.database = new Database(this);
        database.open();
        this.economy = new EconomyService(this);
        if (!economy.isAvailable()) {
            getLogger().severe("Vault economy was not found. InfinityOrder will be disabled.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        this.orders = new OrderService(this, database, economy);
        orders.recover();
        this.gui = new MarketplaceGui(this, orders);
        Bukkit.getPluginManager().registerEvents(new MarketplaceListener(this, gui, orders), this);

        OrderCommand orderCommand = new OrderCommand(this, orders, gui);
        getCommand("order").setExecutor(orderCommand);
        getCommand("order").setTabCompleter(orderCommand);
        getCommand("orders").setExecutor(orderCommand);
        getCommand("orders").setTabCompleter(orderCommand);
        AdminCommand adminCommand = new AdminCommand(this, orders, gui);
        getCommand("orderadmin").setExecutor(adminCommand);
        getCommand("orderadmin").setTabCompleter(adminCommand);
    }

    @Override
    public void onDisable() {
        if (database != null) database.close();
    }

    public Database database() { return database; }
    public EconomyService economy() { return economy; }
    public OrderService orders() { return orders; }
}