What is GetPerWorldPlugin?
**GetPerWorldPlugin** is a lightweight yet powerful Paper plugin that allows server administrators to restrict specific plugins to specific worlds. It creates a "per-world plugin" experience without actually loading/unloading plugins per world.
### The Problem It Solves
Many Minecraft servers use multiple worlds for different purposes:
- Survival world with economy plugins
- Creative world without economy
- Minigame worlds with specific plugins
- Hub world with limited features
Without GetPerWorldPlugin, all plugins work in all worlds, which can cause:
- Economy exploits (earning money in creative)
- Skill grinding in unintended worlds
- Command spam in hub/lobby areas
- Gameplay inconsistencies
### The Solution
GetPerWorldPlugin intercepts commands before they execute and checks:
1. Does this command belong to a restricted plugin?
2. Is the player in an allowed world for that plugin?
If not allowed → **Block the command silently**
---
## Key Features
### ✅ Default Allow Behavior
```
If a plugin is NOT in the config → It works EVERYWHERE
If a plugin IS in the config → It ONLY works in listed worlds
```
This means you only configure what you want to restrict, not what you want to allow.
### ✅ Whitelist Approach
Unlike blacklist systems where you block specific worlds, GetPerWorldPlugin uses a whitelist:
- List the worlds where the plugin SHOULD work
- All other worlds are automatically blocked
### ✅ Complete Command Blocking
- **Execution Blocking**: Commands are cancelled before they run
- **Tab Completion Hiding**: Restricted commands don't appear in tab suggestions
- **Alias Support**: Blocks all aliases of a command automatically
### ✅ Performance Optimized
- Configuration cached in memory (no file reads per command)
- Command-to-plugin mapping cached after first lookup
- Minimal overhead on command execution
### ✅ Bypass Permission
Administrators can bypass all restrictions with a single permission.
### ✅ Hot Reload
Reload configuration without restarting the server.
### ✅ Debug Mode
Enable detailed logging to troubleshoot restriction issues.
### ✅ Multiverse Compatible
Works seamlessly alongside Multiverse-Core for world management.
---
## How It Works
### Flow Diagram
```
Player types command (e.g., /mcmmo)
↓
[PlayerCommandPreprocessEvent]
↓
Does player have bypass permission?
YES → Allow command, exit
NO → Continue
↓
Identify which plugin owns this command
NULL → Allow (vanilla command), exit
Plugin Found → Continue
↓
Is this plugin in restriction list?
NO → Allow (default allow), exit
YES → Continue
↓
Is player's current world in allowed list?
YES → Allow command, exit
NO → BLOCK command, send message
```
### Tab Completion Flow
```
Player opens tab completion
↓
[PlayerCommandSendEvent]
↓
For each command in the list:
↓
Does player have bypass? → Keep all
↓
Get owning plugin of command
↓
Is plugin restricted AND world not allowed?
YES → Remove from tab list
NO → Keep in tab list
```
---
## Installation
### Requirements
| Requirement | Version |
|-------------|---------|
| Minecraft Server | 1.21.1 - 1.21.8 |
| Server Software | Paper (or forks like Purpur) |
| Java | 21 or higher |
### Steps
1. **Download** the `GetPerWorldPlugin.jar` file
2. **Place** the JAR in your server's `plugins/` folder
3. **Start/Restart** your server
4. **Configure** the plugin by editing `plugins/GetPerWorldPlugin/config.yml`
5. **Reload** with `/getperworld reload` or restart server
### Optional Dependencies
| Plugin | Purpose |
|--------|---------|
| Multiverse-Core | World management (soft dependency) |
---
## Configuration Guide
### Config File Location
```
plugins/GetPerWorldPlugin/config.yml
```
### Complete Configuration Example
```yaml
#######################################################
# GetPerWorldPlugin Configuration #
#######################################################
# =====================================================
# PLUGIN RESTRICTIONS
# =====================================================
# Format:
# PluginName:
# - allowed_world_1
# - allowed_world_2
#
# IMPORTANT:
# - Plugin names are CASE-SENSITIVE
# - World names are case-insensitive
# - If a plugin is NOT listed, it works everywhere
# =====================================================
plugin-restrictions:
# McMMO only works in survival worlds
mcMMO:
- survival
- survival_nether
- survival_the_end
# Jobs plugin restricted to main survival
Jobs:
- survival
# Slimefun in its own dedicated world
Slimefun:
- slimefun_world
- slimefun_nether
# AureliumSkills only in RPG world
AureliumSkills:
- rpg_world
- rpg_dungeons
# Economy commands only in survival
EssentialsX:
- survival
- survival_nether
- survival_the_end
- shops
# Disable all CMI commands except in survival
CMI:
- survival
# =====================================================
# BLOCKED MESSAGE
# =====================================================
# Shown when a player tries a restricted command
#
# Color Codes:
# &0-9, &a-f = Colors
# &l = Bold, &o = Italic
# &n = Underline, &m = Strikethrough
# &r = Reset
# =====================================================
blocked-message: "&c&lBlocked! &7This command is not available in this world."
# Alternative message examples:
# blocked-message: "&8[&c✖&8] &7This feature is disabled here."
# blocked-message: "&e⚠ &7You cannot use that command in this world!"
# blocked-message: "&7(&c!&7) &fCommand restricted to survival worlds."
# =====================================================
# DEBUG MODE
# =====================================================
# Enable for detailed console logging
# Useful for troubleshooting restrictions
# WARNING: Can spam console on busy servers
# =====================================================
debug: false
```
### Finding Plugin Names
To find the exact plugin name (case-sensitive):
1. Run `/plugins` in-game
2. Look at the plugin list
3. Use the EXACT name shown (including capitalization)
**Examples:**
| Shown in /plugins | Use in Config |
|-------------------|---------------|
| mcMMO | `mcMMO` |
| Jobs | `Jobs` |
| EssentialsX | `EssentialsX` |
| Slimefun | `Slimefun` |
| AureliumSkills | `AureliumSkills` |
### Finding World Names
To find world names:
```
/getperworld list # If you have the plugin
/mv list # If using Multiverse
/worlds # Various world plugins
```
Or check your server's world folders.
---
## Commands
### Main Command
```
/getperworld [subcommand]
```
**Aliases:** `/gpw`, `/perworld`
### Subcommands
| Command | Description | Permission |
|---------|-------------|------------|
| `/getperworld help` | Show help menu | `getperworld.admin` |
| `/getperworld reload` | Reload configuration | `getperworld.admin` |
| `/getperworld list` | List all restrictions | `getperworld.admin` |
| `/getperworld info <plugin>` | Show plugin restriction details | `getperworld.admin` |
### Command Examples
**Reload Configuration:**
```
/getperworld reload
> [GetPerWorld] Configuration reloaded successfully! (12ms)
> [GetPerWorld] Loaded 5 plugin restriction(s).
```
**List All Restrictions:**
```
/getperworld list
> [GetPerWorld] Restricted Plugins (3):
> • mcMMO → survival, survival_nether, survival_the_end
> • Jobs → survival
> • Slimefun → slimefun_world
```
**Check Specific Plugin:**
```
/getperworld info mcMMO
> [GetPerWorld] Restriction info for mcMMO:
> Allowed Worlds: survival, survival_nether, survival_the_end
```
---
## Permissions
### Permission Nodes
| Permission | Description | Default |
|------------|-------------|---------|
| `getperworld.bypass` | Bypass all world restrictions | OP |
| `getperworld.admin` | Access admin commands | OP |
| `getperworld.*` | All permissions | OP |
### Permission Examples (LuckPerms)
**Give bypass to VIP players:**
```
/lp group vip permission set getperworld.bypass true
```
**Give admin access to moderators:**
```
/lp group moderator permission set getperworld.admin true
```
**Remove bypass from specific player:**
```
/lp user PlayerName permission set getperworld.bypass false
```
### Permission Inheritance
```
getperworld.*
├── getperworld.bypass
└── getperworld.admin
```
---
## Use Cases & Examples
### Use Case 1: Survival-Only Skills
**Scenario:** You want mcMMO and Jobs to only work in survival worlds.
**Config:**
```yaml
plugin-restrictions:
mcMMO:
- survival
- survival_nether
- survival_the_end
Jobs:
- survival
- survival_nether
- survival_the_end
```
**Result:**
- ✅ `/mcmmo` works in survival
- ✅ `/jobs` works in survival_nether
- ❌ `/mcmmo` blocked in creative
- ❌ `/jobs` blocked in hub
---
### Use Case 2: Separate Game Modes
**Scenario:** Different plugins for different game modes.
**Config:**
```yaml
plugin-restrictions:
# Survival plugins
mcMMO:
- survival
Jobs:
- survival
# Skyblock plugins
ASkyBlock:
- skyblock
# Prison plugins
Prison:
- prison_mines
- prison_cells
# Factions plugins
Factions:
- factions_world
```
**Result:** Each game mode has isolated plugins.
---
### Use Case 3: Hub World Lockdown
**Scenario:** Block almost everything in the hub world.
**Config:**
```yaml
plugin-restrictions:
# All these plugins are blocked in hub
# because hub is NOT in their allowed worlds
mcMMO:
- survival
Jobs:
- survival
Essentials:
- survival
- creative
WorldEdit:
- creative
- build
```
**Result:**
- Hub world has no plugin commands available
- Only vanilla commands and unrestricted plugins work
---
### Use Case 4: Creative World Restrictions
**Scenario:** Allow WorldEdit in creative, block economy.
**Config:**
```yaml
plugin-restrictions:
# Economy blocked in creative (not in list)
EssentialsX:
- survival
Vault:
- survival
# WorldEdit allowed in creative and build worlds
WorldEdit:
- creative
- build_world
- admin_world
# FAWE also restricted
FastAsyncWorldEdit:
- creative
- build_world
- admin_world
```
---
### Use Case 5: Event/Minigame Worlds
**Scenario:** Minigame worlds with no external plugins.
**Config:**
```yaml
plugin-restrictions:
# None of these work in minigame worlds
mcMMO:
- survival
Jobs:
- survival
EssentialsX:
- survival
- creative
# Minigame plugin works everywhere (not listed)
# BedWars: works everywhere
# SkyWars: works everywhere
```
---
## Technical Details
### Supported Plugin Types
| Type | Supported | Notes |
|------|-----------|-------|
| Bukkit/Spigot Plugins | ✅ Yes | Full support |
| Paper Plugins | ✅ Yes | Full support |
| Vanilla Commands | ⚪ Ignored | Cannot restrict |
| Mod Commands (hybrid) | ⚠️ Partial | Depends on registration |
### Event Priorities
| Event | Priority | Reason |
|-------|----------|--------|
| `PlayerCommandPreprocessEvent` | HIGHEST | Execute after other plugins modify command |
| `PlayerCommandSendEvent` | HIGHEST | Filter after other plugins add commands |
### Performance Metrics
| Operation | Typical Time |
|-----------|--------------|
| Config Load | 5-20ms |
| Command Check | <0.1ms |
| Cache Lookup | <0.01ms |
| Tab Filter (100 cmds) | <1ms |
### Memory Usage
| Component | Approximate Size |
|-----------|------------------|
| Plugin Base | ~50KB |
| Config Cache | ~1KB per restriction |
| Command Cache | ~100 bytes per command |
---
## Troubleshooting
### Issue: Commands Not Being Blocked
**Check 1: Plugin Name**
```yaml
# WRONG (lowercase)
plugin-restrictions:
mcmmo:
- survival
# CORRECT (exact case)
plugin-restrictions:
mcMMO:
- survival
```
**Check 2: World Name**
```yaml
# Check your actual world folder names
# Use lowercase in config for safety
plugin-restrictions:
mcMMO:
- survival_world # Matches "Survival_World", "survival_world", etc.
```
**Check 3: Enable Debug**
```yaml
debug: true
```
Then check console for messages like:
```
[GetPerWorld] [Debug] Command 'mcmmo' from plugin 'mcMMO' allowed in world 'survival'.
[GetPerWorld] [Debug] BLOCKED: Command 'mcmmo' from plugin 'mcMMO' in world 'creative'.
```
**Check 4: Bypass Permission**
```
/lp user <player> permission check getperworld.bypass
```
---
### Issue: Tab Completion Still Shows Commands
**Cause:** Client-side caching
**Solution:**
1. Player should relog
2. Or change worlds and back
3. Tab cache refreshes on world change
---
### Issue: Plugin Name Not Found
Run this command to verify:
```
/plugins
```
Look for the exact name. Common mistakes:
| Wrong | Correct |
|-------|---------|
| `Essentials` | `EssentialsX` or `Essentials` (check your version) |
| `MCMMO` | `mcMMO` |
| `worldedit` | `WorldEdit` |
| `FastAsyncWorldedit` | `FastAsyncWorldEdit` |
---
### Issue: Subcommands Not Blocked
**This is expected behavior!**
GetPerWorldPlugin blocks by **plugin**, not by individual command. If `/mcmmo` is blocked, all mcMMO commands are blocked:
- `/mcmmo`
- `/mctop`
- `/mcstats`
- `/mining`
- etc.
---
### Issue: High Memory/CPU Usage
**Check 1:** Disable debug mode
```yaml
debug: false
```
**Check 2:** Reduce restriction count if excessive
**Check 3:** Ensure you're on Paper (not Spigot)
---
## FAQ
### Q: Does this actually disable the plugin per world?
**A:** No. The plugin is still loaded and running. GetPerWorldPlugin only blocks **commands** from executing in restricted worlds. Background features (like mcMMO passive skills) may still function.
---
### Q: Can I block vanilla commands?
**A:** No. Vanilla commands don't belong to any plugin, so they cannot be identified and restricted. Use a permissions plugin for vanilla commands.
---
### Q: Does this work with command aliases?
**A:** Yes! When you type `/mctop`, GetPerWorldPlugin traces it back to mcMMO and applies mcMMO's restrictions.
---
### Q: What happens to scheduled tasks/events from blocked plugins?
**A:** Only commands are blocked. Plugin events, scheduled tasks, and listeners still function. This plugin is specifically for command restriction.
---
### Q: Can I restrict specific commands instead of entire plugins?
**A:** Not with this plugin. GetPerWorldPlugin restricts at the **plugin level**. For command-level control, use a permissions plugin like LuckPerms with context.
---
### Q: Does this work with BungeeCord/Velocity?
**A:** This is a server-side plugin. It works on each individual server. For network-wide restrictions, configure it on each server separately.
---
### Q: Is there a GUI?
**A:** No. Configuration is done through `config.yml` only. This keeps the plugin lightweight and simple.
---
### Q: Can players see they're being blocked?
**A:**
- **Execution:** Yes, they see the blocked message
- **Tab Complete:** No, commands are hidden (invisible restriction)
---
### Q: What's the performance impact?
**A:** Minimal. The plugin uses caching and efficient lookups. Typical overhead is less than 0.1ms per command.
---