OnBoomboxStationValidate
OnBoomboxStationValidate is called when the game checks whether a boombox station URL is valid, letting plugins override the accept/reject decision.
object OnBoomboxStationValidate(string url)Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The station URL a boombox is trying to play, as entered in the boombox UI or set by a plugin. It is passed to the game's BoomBox.IsStationValid check. |
Return value
Return a bool to override the validation: true treats the station as valid, false rejects it. Returning null (or a non-bool value) leaves the decision to the game's built-in check.
How it works
The hook fires inside BoomBox.IsStationValid(string url), which the game runs whenever a boombox needs to decide if a given station URL may be played. Because IsStationValid caches the result through ParseServerUrlList() first, the hook runs against the raw URL string before the game's built-in radio list check. Return a bool to force the decision: true accepts the station even if it is not in the game's list, false rejects it. Returning null (or any non-bool) lets the game proceed with its own validation via ShoutcastStreamer.CheckBuiltInRadios(). Use it to whitelist a custom streaming host, block a specific domain, or gate stations behind permissions. Since Oxide dispatches by declared parameter type, keep string as the parameter; there is no narrower type to declare. Keep the handler fast because it can be called repeatedly as players browse stations.
Example plugin: Domain whitelist for boombox stations
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("BoomboxStationWhitelist", "RustPluginGenerator", "1.0.0")]
[Description("Restricts boombox stations to a configurable host whitelist.")]
public class BoomboxStationWhitelist : RustPlugin
{
private PluginConfig config;
private class PluginConfig
{
[JsonProperty("Allowed stream hosts")]
public List<string> AllowedHosts { get; set; } = new List<string>
{
"stream.rustserver.com",
"radio.example.com"
};
[JsonProperty("Allow any host when whitelist is empty")]
public bool AllowAllWhenEmpty { get; set; } = true;
}
protected override void LoadDefaultConfig() => config = new PluginConfig();
protected override void LoadConfig()
{
base.LoadConfig();
try
{
config = Config.ReadObject<PluginConfig>();
if (config == null) throw new Exception();
}
catch
{
PrintWarning("Configuration file is invalid, using defaults");
LoadDefaultConfig();
}
SaveConfig();
}
protected override void SaveConfig() => Config.WriteObject(config);
private object OnBoomboxStationValidate(string url)
{
if (string.IsNullOrEmpty(url)) return false;
if (config.AllowedHosts == null || config.AllowedHosts.Count == 0)
return config.AllowAllWhenEmpty ? (object)null : false;
string host;
try
{
host = new Uri(url).Host.ToLowerInvariant();
}
catch
{
return false;
}
foreach (string allowed in config.AllowedHosts)
{
if (string.IsNullOrEmpty(allowed)) continue;
if (host == allowed.Trim().ToLowerInvariant())
return true;
}
return false;
}
}
}The plugin reads a config list of allowed stream hosts and blocks anything else. When OnBoomboxStationValidate fires, it parses the URL host and returns true if that host is in the whitelist, false otherwise, so only approved radio hosts can be played on boomboxes. Empty config falls back to letting the game decide. Invalid URLs are rejected. The example uses System.Uri for host parsing and lowercases it for case-insensitive matching, avoiding any network calls or manual string parsing that could be bypassed.
Common use cases
Whitelist trusted radio hosts
Only allow stations from domains your community runs, blocking random external streams.
Block problem stations
Reject a specific URL or host that players abuse (e.g. loud troll streams) by returning false.
Gate stations by permission
Allow any URL for VIPs but restrict others to the built-in list by returning true only when the requesting context has the permission (via other tracking).
Pitfalls
Returning false blocks everyone
The check has no player argument, so a blanket false disables all custom stations for the whole server. Only reject URLs you specifically want gone.
Case-sensitive hosts
URLs may vary in case; normalize the host with ToLowerInvariant before comparing so an allowed host is not rejected.
Unparseable URLs
Malformed URLs will throw in Uri parsing; catch the exception and return false (or null) instead of letting it bubble into the game's validation.
Build a plugin with OnBoomboxStationValidate
Describe what should happen and get a compiled plugin that uses this hook.
Edit the prompt on the next screen. 2 free plugins a month, no card.
Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.
Build a plugin with OnBoomboxStationValidate
Generate