Skip to content
Valor edited this page Nov 9, 2025 · 1 revision

Opt-out command (/rarespawns optout)

Table of Contents

Quick summary

  • Command: /rarespawns optout
  • Permission: rarespawns.optout
  • Usage: Player-only command that toggles whether rares will spawn near you.
  • Effect: When enabled, the player is opted out and the plugin will skip spawning rares around them. Running the command again re-enables rare spawns for that player.

What it does

  • Toggles the player's opt-out flag in memory and provides feedback:
    • When opting out: you receive a message like "Rares no longer spawn around you."
    • When opting back in: you receive "Rares again spawn around you."
  • The command is only executed for actual Player senders (console/command-block cannot toggle).
  • The in-memory opt-out list is consulted by the spawn logic; SpawnEvent checks PlayerOptOut.isOptedOut(...) and aborts rare spawn replacements when the nearest player has opted out.

Persistence

  • Opt-out data is persisted to optout.yml by the plugin's PlayerOptOut helper (saved on plugin shutdown and reloaded on enable).
  • Note: persistence happens via the plugin’s lifecycle methods (init/load and shutdown/save).

Examples

  • Toggle opt-out (player): /rarespawns optout
  • Tab completion:
    • If you have permission, the command appears in tab suggestions for /rarespawns.

Troubleshooting

  • Nothing happens when you run it:
    • Ensure you are a player (not console).
    • Confirm you have the rarespawns.optout permission.
  • Opt-out didn't persist after restart:
    • Opt-out state is saved on plugin shutdown; check optout.yml and plugin logs if something looks wrong.
  • Rares still spawn nearby after opting out:
    • The spawn logic checks the nearest player; if another nearby player has not opted out, rares may still spawn for them. Opt-out only prevents rare spawns that consider the opting-out player as the relevant nearby player.

Implementation notes (for developers)

  • Command is implemented in CommandOptOut and toggles state via PlayerOptOut.toggleOptOut(player).
  • SpawnEvent checks PlayerOptOut.isOptedOut(player) when determining whether to replace a natural spawn with a rare.
  • Tab completion and command routing require the rarespawns.optout permission to be visible/usable.

🐲 RareSpawns Wiki

✅ Getting Started

⚙️ Configuration

🍳 Resources

🔌⚡ Supported Plugins (And why 🤔💭)

👑 Premium Features

</> For Developers


🔎 Tips

  • Use the search box above to quickly jump to a page.

Clone this wiki locally