Skip to content

M9MX/SMPNetheriteLimiter

Repository files navigation

SMPNetheriteLimiter

A Paper/Spigot plugin for controlling netherite progression on multiplayer survival servers. Restrict when and how players can craft netherite items with flexible progression modes and per-item customization.

Features

  • 5 Progression Modes: ALL_DISABLED, ONLY_TOOLS, ONLY_ARMOR, CUSTOM, NONE
  • Per-Item Limits: Set craft limits for individual netherite items
  • Dual-Phase Upgrades: Support for both smithing table upgrades and direct crafting
  • Craft Tracking: Track all netherite crafts with timestamps and player names
  • File-Based Storage: No database required, uses YAML and text files
  • Admin Notifications: Notify admins of upgrade attempts when disabled
  • Sound Feedback: Optional sound on craft denial
  • Public API: Easy integration with other plugins
  • Live Reload: Update config without restarting

Installation

  1. Download the plugin JAR file
  2. Place it in your server's plugins/ directory
  3. Restart the server or run /reload
  4. Edit plugins/SMPNetheriteLimiter/config.yml as needed
  5. Run /smpn reload to apply changes

Configuration

config.yml

# Set the current progression mode
current-mode: ALL_DISABLED

# Five available modes:
# - ALL_DISABLED: No netherite items can be crafted or upgraded
# - ONLY_TOOLS: Only netherite tools (sword, pickaxe, etc.) allowed
# - ONLY_ARMOR: Only netherite armor pieces allowed
# - CUSTOM: Per-item rules (configure in custom-mode section)
# - NONE: All restrictions disabled (unrestricted netherite)

settings:
  play-sound-on-fail: true          # Play sound when craft is denied
  notify-admins: true                # Notify admins of denied attempts
  debug-mode: false                  # Enable debug logging

# Used only when current-mode = CUSTOM
custom-mode:
  netherite_sword:
    enabled: true
    limit: 1
  netherite_pickaxe:
    enabled: true
    limit: 2
  netherite_axe:
    enabled: false
    limit: 0
  netherite_shovel:
    enabled: true
    limit: 1
  netherite_hoe:
    enabled: true
    limit: 1
  netherite_helmet:
    enabled: true
    limit: 1
  netherite_chestplate:
    enabled: true
    limit: 1
  netherite_leggings:
    enabled: true
    limit: 1
  netherite_boots:
    enabled: true
    limit: 1

Custom Mode Configuration

When using CUSTOM mode, configure individual items:

custom-mode:
  netherite_sword:
    enabled: true      # true = allow, false = block
    limit: 2           # max number that can be crafted globally

Available items:

  • Tools: netherite_sword, netherite_pickaxe, netherite_axe, netherite_shovel, netherite_hoe
  • Armor: netherite_helmet, netherite_chestplate, netherite_leggings, netherite_boots

Commands

/smpn mode [mode]

Change the current progression mode.

Usage:

/smpn mode ALL_DISABLED
/smpn mode ONLY_TOOLS
/smpn mode ONLY_ARMOR
/smpn mode CUSTOM
/smpn mode NONE

Permission: smpn.admin (OP)

/smpn status

Display current progression mode and how many of each netherite item have been crafted across the server.

Permission: smpn.status (Everyone)

/smpn custom

Show current custom mode configuration (only works when in CUSTOM mode).

Permission: smpn.status (Everyone)

/smpn reload

Reload configuration from disk without restarting the server.

Permission: smpn.admin (OP)

/smpn scan

Scan the world for existing netherite items and track them.

Permission: smpn.admin (OP)

⚠️ Warning: This feature is not fully finished. Do not use while players are online as it can crash the server. Only use on an empty server.

/smpn help

Show help message with all available commands and their descriptions.

Permission: smpn.help (Everyone)

Requirements

  • Server: Paper 1.21.x+
  • Java: 21+

Dependencies

⚠️ Important Note

The NetheriteScanner feature is not fully finished. Do not use it while players are online as it can crash the server. Only use it on an empty server for scanning purposes.

Permissions

Permission Default Description
smpn.admin OP Access to mode, reload commands
smpn.status Everyone View status and custom mode info
smpn.help Everyone View help command
smpn.* OP All permissions

How It Works

Tracking

  • Global Counts: Tracks total crafts per item across all players
  • Per-Player Counts: Records which player crafted what
  • Craft Log: All crafts logged to craftlog.txt with timestamps
  • No Limits: Unlimited per-player crafts; limits are global only

Storage

  • netherite-tracker.yml: Stores current counts per material
  • craftlog.txt: Plain text log of all crafts with timestamps
  • No Database: Everything stored in files, easy to backup/restore

Data Files

Located in plugins/SMPNetheriteLimiter/:

  • config.yml - Main configuration file
  • netherite-tracker.yml - Current craft counts (YAML)
  • craftlog.txt - Detailed craft log with timestamps (text)

Progression Examples

Phase-Based Progression

Early Game (Week 1-2)

current-mode: ALL_DISABLED

No netherite crafting allowed yet.

Mid Game (Week 3-4)

current-mode: ONLY_TOOLS

Only netherite tools allowed, armor restricted.

Late Game (Week 5+)

current-mode: CUSTOM
custom-mode:
  netherite_sword:
    enabled: true
    limit: 3
  netherite_pickaxe:
    enabled: true
    limit: 2
  netherite_helmet:
    enabled: true
    limit: 1
  # ... etc

Selective per-item restrictions.

End Game

current-mode: NONE

Full access to all netherite items.

Building from Source

Requirements:

  • Java 21+
  • Gradle 7.0+
  • Paper API (included in dependencies)
./gradlew build

Output JAR: build/libs/SMPNetheriteLimiter-1.0.jar

For Plugin Developers

SMPNetheriteLimiter provides a comprehensive API for other plugins. See API.md for complete documentation.

Quick Start

import org.m9mx.smpnetheritelimiter.api.NetheriteLimiterAPI;
import org.bukkit.Material;

NetheriteLimiterAPI api = NetheriteLimiterAPI.getInstance();

// Get current mode
ProgressionMode mode = api.getMode();

// Check if item allowed
boolean allowed = api.isItemAllowed(Material.NETHERITE_SWORD);

// Get item limit
int limit = api.getItemLimit(Material.NETHERITE_PICKAXE);

// Check if player can craft
boolean canCraft = api.canPlayerCraft(playerUUID, Material.NETHERITE_HELMET);

// Record a craft
api.recordCraft(playerUUID, playerName, Material.NETHERITE_SWORD);

Plugin Dependency

Add to your plugin.yml:

depend:
  - SMPNetheriteLimiter

API Usage Guide

Getting Started

import org.m9mx.smpnetheritelimiter.api.NetheriteLimiterAPI;

NetheriteLimiterAPI api = NetheriteLimiterAPI.getInstance();

Mode Management

// Get current mode
ProgressionMode mode = api.getMode();

// Set mode
api.setMode(ProgressionMode.ONLY_TOOLS);

// Get description
String description = api.getModeDescription(ProgressionMode.ONLY_ARMOR);

Item Limits

// Get limit for specific item
int limit = api.getItemLimit(Material.NETHERITE_SWORD);

// Get all limits
Map<Material, Integer> limits = api.getAllLimits();

// Check if item allowed
boolean allowed = api.isItemAllowed(Material.NETHERITE_PICKAXE);

// Check if material is netherite
boolean isNetherite = api.isNetheriteItem(Material.NETHERITE_HELMET);

Custom Mode Configuration

// Enable item with limit
api.setCustomItemEnabled(Material.NETHERITE_SWORD, true, 2);

// Disable item
api.setCustomItemEnabled(Material.NETHERITE_AXE, false, 0);

// Check if enabled
boolean enabled = api.isCustomItemEnabled(Material.NETHERITE_CHESTPLATE);

// Get limit
int limit = api.getCustomItemLimit(Material.NETHERITE_PICKAXE);

// Get all custom settings
Map<Material, CustomItemSetting> settings = api.getCustomModeSettings();

Crafting & Tracking

// Get total times item was crafted
int totalCrafted = api.getCraftedCount(Material.NETHERITE_SWORD);

// Check if player can craft
boolean canCraft = api.canPlayerCraft(playerUUID, Material.NETHERITE_HELMET);

// Record a craft
boolean recorded = api.recordCraft(playerUUID, playerName, Material.NETHERITE_SWORD);

// Get player statistics
int totalCrafts = api.getPlayerCraftCount("PlayerName");
int itemCrafts = api.getPlayerItemCraftCount(playerUUID, Material.NETHERITE_SWORD);
boolean hasCrafted = api.hasPlayerCraftedItem(playerUUID, Material.NETHERITE_PICKAXE);

Information & Queries

// Get all netherite tools
Set<Material> tools = api.getNetheriteTools();

// Get all netherite armor
Set<Material> armor = api.getNetheriteArmor();

// Get all netherite items
Set<Material> allItems = api.getAllNetheriteItems();

Complete Example

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.CraftItemEvent;
import org.m9mx.smpnetheritelimiter.api.NetheriteLimiterAPI;

public class NetheriteListener implements Listener {

    private NetheriteLimiterAPI api;

    @EventHandler
    public void onCraft(CraftItemEvent event) {
        api = NetheriteLimiterAPI.getInstance();
        Player player = (Player) event.getWhoClicked();
        Material item = event.getRecipe().getResult().getType();

        // Check if netherite and allowed
        if (!api.isNetheriteItem(item)) {
            return;
        }

        if (!api.isItemAllowed(item)) {
            player.sendMessage("§cThis netherite item is not allowed!");
            event.setCancelled(true);
            return;
        }

        // Check limit
        if (!api.canPlayerCraft(player.getUniqueId(), item)) {
            int limit = api.getItemLimit(item);
            player.sendMessage("§cLimit of " + limit + " reached!");
            event.setCancelled(true);
            return;
        }

        // Record craft
        api.recordCraft(player.getUniqueId(), player.getName(), item);
    }
}

Error Handling

// Check if plugin loaded
if (Bukkit.getPluginManager().getPlugin("SMPNetheriteLimiter") == null) {
    getLogger().warning("SMPNetheriteLimiter not found!");
    return;
}

try {
    NetheriteLimiterAPI api = NetheriteLimiterAPI.getInstance();
} catch (IllegalStateException e) {
    getLogger().warning("SMPNetheriteLimiter failed to initialize!");
}

Troubleshooting

Plugin won't start

  • Check Java version (requires 17+)
  • Check Paper API is compatible with your server version
  • Check console for errors

Crafts not being tracked

  • Ensure debug-mode: true to see logs
  • Check that netherite-tracker.yml exists and is writable
  • Verify player is in CREATIVE mode or has perms (plugin doesn't track creative)

Commands not working

  • Verify you have OP or correct permissions
  • Check spelling: /smpn (not /smpnetheritelimiter)
  • Run /smpn help to see available commands

Config changes not applying

  • Run /smpn reload after editing config.yml
  • Or restart the server

License

MIT License - Feel free to use and modify

Support

For issues, feature requests, or questions:

  • Check the API Documentation
  • Review this README
  • Check console logs with debug-mode: true

Made for SMP servers. Enjoy your progression!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages