P
📎 1 file 5,643 chars
📄
pasted-code-1789908027927.txt
txt 76 lines
▶
Create a comprehensive, production-ready Spigot/Paper 1.20+ Minecraft plugin in Java named "MTCrimineelCore" designed for Minetopia / CityRP servers.

### Dependency Integration:
- Softdepend / Optional Integration: MineTopiaSDB (SDB API)
- Detect if MineTopiaSDB is enabled on server startup via PluginManager.
- If MineTopiaSDB is present:
  - Fetch player data (such as player prefix/suffix, level, or profession status if applicable) using the MineTopiaSDB API.
  - Utilize MineTopiaSDB's player data hooks when issuing fines, arrest logs, crime record lookups, or handling financial transactions (black money to clean money conversion).
- If MineTopiaSDB is absent:
  - Gracefully fallback to standard Bukkit/Paper offline player data, Vault API (if available), and internal SQLite/MySQL storage without throwing ClassNotFoundException or crashing.

### Core Features & Systems:

1. Criminal Record System (Strafblad):
   - Command: /strafblad  (Permission: mtcrimineel.strafblad)
   - Opens a GUI displaying the player's active and historical criminal offenses, active warrants, total fines paid/unpaid, and jail time history.
   - Command: /addstrafblad    (Permission: mtcrimineel.police)

2. Handcuff & Arrest System (Handboeien):
   - Item: Custom item (e.g., Heavy Weighted Pressure Plate / Shears named "&c&lHandboeien").
   - Action: Right-click a player within 3 blocks to cuff them.
   - Effect: Cuffed players cannot interact with blocks/inventories, open doors, use ender pearls, or execute prohibited commands (e.g., /spawn, /tpa).
   - Follow Mechanic: Cuffed players smoothly teleport/follow the police officer.
   - Command: /uncuff  (Permission: mtcrimineel.police)

3. Search & Frisk System (Fouilleren):
   - Command: /fouilleer  (Permission: mtcrimineel.police)
   - Requires player to be cuffed or within 2 blocks.
   - Opens a GUI previewing the targeted player's inventory.
   - Allows police officers to click illegal items (configurable list in config.yml, including custom weed/drugs items and black money) to seize/confiscate them.

4. Jail & Wanted System (Gevangenis & Gezocht):
   - Command: /jail    (Permission: mtcrimineel.police)
   - Command: /unjail  (Permission: mtcrimineel.police)
   - Command: /gezocht   [reden] [sterren 1-5]
   - BossBar or Scoreboard integration showing remaining jail time when jailed.
   - Automatic teleportation to pre-configured jail location (saved via /mtc setjail) and release location (/mtc setrelease).

5. Drugs & Weed System (Wiet & Teelt):
   - Custom Items:
     - Wietzaadjes (Seeds): Can be planted on farmland or custom planters.
     - Wietplant (Growing Stages): Block/crop growth stage tracking.
     - Gedroogde Wiet (Weed Buds) & Joint: Usable consumable items.
   - Mechanics:
     - Planting, harvesting, and processing weed items via custom GUI or right-click interactions.
     - Consumable effects (e.g., temporary Potion Effects like Speed, Confusion, Resistance, or Blindness upon right-clicking/smoking a joint).
     - Configurable growth speed, yield, and illegal item tags for police frisk searches.

6. Weed Sales PC / Darkweb Terminal (Wiet-Verkoop PC):
   - Physical PC Terminal:
     - Players set up or interact with a dedicated block/GUI (e.g., Black Stained Glass / Daylight Detector named "&8&lDarkweb PC") placed in bases or secret locations.
     - Right-clicking the block opens the "Darkweb Wiet Markt" GUI.
   - Marketplace Mechanics:
     - Sell harvested weed directly for Black Money (Zwart Geld) at dynamic or fixed prices per gram/bag.
     - Bulk Sell Option: Sell all weed in inventory with one click.
     - Police Risk Event: Configurable % chance per transaction that police receive a ping/cooperatieve melding (e.g., "Verdacht IP-adres gedetecteerd in buurt van X: %location%").
     - Cool-down timer per PC / player to prevent instant spam dumping.

7. Money Washing System (Witwassen / Zwart Geld):
   - Black Money Item: Custom item representing dirty money (e.g., Paper named "&c&lZwart Geld" with NBT tag or CustomModelData).
   - Money Washer (NPC / GUI / Machine):
     - Players can interact with a Money Wash NPC or dedicated block (/mtc setwitwas location).
     - GUI interface to deposit Black Money and initiate a laundering timer.
     - Tax/Fee rate: Configurable percentage cut lost during laundering (e.g., 20% cut -> €1000 black money becomes €800 clean money).
     - Money payout directly integrates with MineTopiaSDB currency / Vault economy upon completion.
     - Risky Laundering option: Chance of triggering a police alert/broadcast if the transaction fails or gets reported.

### Configuration & Messages:
- config.yml: Configurable illegal item materials, drug types, sell prices per gram, Darkweb PC block materials, police alert chances, wash tax percentages, jail locations, sound effects, item display names, and MineTopiaSDB toggle.
- messages.yml: Fully customizable MiniMessage / Legacy Color Code Dutch localization for all system output messages, PC interface text, drug messages, money wash alerts, and GUI titles.

### Technical & Architecture Requirements:
- Follow modern Spigot/Paper coding standards (Java 17+).
- Use clean event listening (PlayerInteractEvent, PlayerInteractEntityEvent, InventoryClickEvent, BlockPlaceEvent, BlockBreakEvent, PlayerCommandPreprocessEvent).
- Use robust null-checks and safe API checks when hooking into MineTopiaSDB and Vault.
- Provide clear comments in code sections where MineTopiaSDB API imports and methods are instantiated.
Kodari AI
KodariSep 20 at 12:56 pm 4
MTCrimineelCore
Comprehensive Spigot/Paper 1.20+ plugin for Minetopia/CityRP servers. Features criminal record system with GUI, handcuff and arrest mechanics with follow behavior, search and frisk system for confiscating illegal items, jail and wanted system with BossBar integration, drugs and weed cultivation with growth stages and consumable effects, darkweb PC terminal for selling weed with police risk events, and money washing system with configurable tax rates. Integrates with MineTopiaSDB and Vault APIs with graceful fallback. Configurable via config.yml and messages.yml with Dutch localization.
  1. Create the Gradle project, plugin metadata, configurable Dutch messages, and persistence layer.

  2. Add core integrations and domain managers for crimes, cuffs, jail, wanted players, weed, market sales, and money washing.

  3. Add GUI/event/command handling and wire every feature through the main plugin class.

Created the complete MTCrimineelCore project with:

  • Gradle Java 17 setup, Paper 1.20.6, Vault, XSeries, and SQLite integration.

  • Optional reflective MineTopiaSDB integration with safe fallback behavior.

  • SQLite persistence for criminal records, wanted players, jail status, and jail history.

  • Dutch configurable messages with legacy color and MiniMessage support.

  • Handcuffs, following behavior, command restrictions, arrests, jail BossBars, and configurable locations.

  • Criminal records GUI with fines, wanted status, and jail history.

  • Frisk GUI with configurable illegal-item confiscation.

  • Weed planting, growth, harvesting, joints, effects, and darkweb sales.

  • Black-money items, configurable market prices, police alerts, and cooldowns.

  • Money washing with tax rates, delayed payouts, Vault/fallback economy support, and alerts.

  • Commands and permissions for all requested systems.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
22 1,130
src/main/java/com/kodari/mtcrimineelcore/MTCrimineelCore.java
package com.kodari.mtcrimineelcore;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;

public final class MTCrimineelCore extends JavaPlugin {
    private MessageManager messages;
    private StorageManager storage;
    private EconomyBridge economy;
    private ItemFactory items;
    private CrimeManager crimes;
    private WantedManager wanted;
    private CuffManager cuffs;
    private JailManager jail;
    private WeedManager weed;
    private MarketManager market;
    private WashManager wash;
    private GuiManager guis;

    @Override public void onEnable() {
        saveDefaultConfig();
        messages = new MessageManager(this);
        storage = new StorageManager(this); storage.open();
        economy = new EconomyBridge(this); economy.setup();
        items = new ItemFactory(this);
        crimes = new CrimeManager(this, storage, economy);
        wanted = new WantedManager(storage, economy);
        cuffs = new CuffManager(this);
        jail = new JailManager(this, storage);
        weed = new WeedManager(this);
        market = new MarketManager(this);
        wash = new WashManager(this);
        guis = new GuiManager(this);
        Bukkit.getPluginManager().registerEvents(new CoreListener(this), this);
        CommandRouter router = new CommandRouter(this);
        for (String command : List.of("strafblad", "addstrafblad", "uncuff", "fouilleer", "jail", "unjail", "gezocht", "mtc")) {
            if (getCommand(command) != null) { getCommand(command).setExecutor(router); getCommand(command).setTabCompleter(router); }
        }
        getLogger().info("MTCrimineelCore is ingeschakeld.");
    }

    @Override public void onDisable() { if (storage != null) storage.close(); }
    public MessageManager messages() { return messages; }
    public StorageManager storage() { return storage; }
    public EconomyBridge economy() { return economy; }
    public ItemFactory items() { return items; }
    public CrimeManager crimes() { return crimes; }
    public WantedManager wanted() { return wanted; }
    public CuffManager cuffs() { return cuffs; }
    public JailManager jail() { return jail; }
    public WeedManager weed() { return weed; }
    public MarketManager market() { return market; }
    public WashManager wash() { return wash; }
    public GuiManager guis() { return guis; }
}