The plugin disables noclip for me.
I’ve had this plugin for years, along with Vanish. When I enable Admin Radar while in vanish mode and flying, I crash to the ground.If I’m not mistaken, this has been happening since the last forced wipe.It affects my moderators as well.

link : https://umod.org/plugins/vanish

Merged post

Hi nivex,

Following up with more technical information and a locally modified AdminRadar.cs.

The code analysis and modifications were done with ChatGPT, and I performed the tests on my server. I would prefer an official fix, so I’m sharing the changes, their rationale, and the limitations of the testing.

REPRODUCTION AND ACCOUNT STATE

I’m using Admin Radar 5.4.4 with Vanish 2.1.5. The problem appears to have started after the November force wipe and also affects my moderators.

With Vanish alone, I can fly normally. With the original Admin Radar enabled, noclip stops and I fall while remaining invisible. This happens in either activation order. Reloading the plugins did not resolve it.

The account used for testing had:

authLevel=0
IsAdmin=False
IsDeveloper=True
adminradar.allowed=True
vanish.allow=True

This is therefore not a native owner/admin session: the account can already fly with IsDeveloper=True, while IsAdmin is false.

WHAT HAPPENS IN THE ORIGINAL CODE

In Radar.Awake(), the initial admin state is cached:

isAdmin = player.IsAdmin;

The radar loop then runs:

SetAdminFlag();
DirectDrawAll();
RemoveAdminFlag();

For my account, the cached isAdmin value is false, so the temporary flag-handling path is eligible even though IsDeveloper is already true. Neither of these two methods checks IsDeveloper.

SetAdminFlag() temporarily sets IsAdmin to true and calls SendNetworkUpdateImmediate(). After drawing, RemoveAdminFlag() does the reverse:

if (!isAdmin && hasPermAllowed &&
player.HasPlayerFlag(BasePlayer.PlayerFlags.IsAdmin))
{
player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false);
player.SendNetworkUpdateImmediate();
}

These are actual player-state changes with immediate network-update calls, not just a local variable used to authorize drawing.

Temporary instrumentation confirmed that this branch was executing: eight radar cycles produced eight admin-flag additions and eight removals, including one removal while the server reported IsFlying=True. My normal refresh interval is 0.5 seconds.

There is also a separate potential robustness issue: removal relies on the admin state cached when the radar component was created, without tracking whether this particular cycle actually granted the flag. An admin flag granted later by another component could therefore be cleared. I have not demonstrated that secondary scenario on my server; it is a concern from reading the conditions.

WHY REMOVE THE FLAG CHANGES RATHER THAN FORCE NOCLIP BACK ON?

The temporary elevation appears to serve the older requirement for client admin privileges when using ddraw.

However, Facepunch’s Meta Shift update of 2 October 2025 explicitly lists:

“Fixed client blocking ddraw commands sent from server when player isn't admin”

Source:
https://rust.facepunch.com/news/meta-shift

That is the rationale behind this modification: send the drawings from the server without repeatedly changing the player’s privilege state. It does not try to compensate by repeatedly enabling noclip or granting permanent admin rights.

My working hypothesis is that the temporary privilege changes interact badly with the flight state in this setup. I have not traced the client-side code responsible for stopping noclip, so I cannot claim to have established the exact internal cause or a specific November anticheat change.

EXACT CHANGES IN THE ATTACHED FILE

1. Radar loop and cleanup paths

SetAdminFlag() and RemoveAdminFlag() have been removed, along with their calls in DoRadarRoutine(), StopAll(), HandleException() and SetSource().

The relevant section of the loop is now:

DoRemoves();
DirectDrawAll();
CheckNetworkGroupChange();

This keeps the normal radar processing and drawing, without the temporary flag changes and their associated immediate network updates.

2. Command-based drawing

The original AdminCommand() also grants and removes IsAdmin around its drawing action. This affects the drawing paths used by buildings, drops, find and findbyid, so those temporary changes were removed as well. Its existing guard was retained.

The modified method is:

public void AdminCommand(BasePlayer player, Action action)
{
bool isAdmin = player.IsAdmin;
if (!isAdmin && !player.IsDeveloper && player.IsFlying)
{
return;
}

// Execute the drawing action without changing player privilege flags.
action();
}

3. Shared drawing helper

The attached file routes the 13 existing drawing call sites through:

private void SendRadarDraw(
BasePlayer player, string command, params object[] args)
{
player.SendConsoleCommand(command, args);
}

This helper originated from the troubleshooting version, where it provided a common point to temporarily suppress drawings and count outgoing calls. In the attached file, all that instrumentation has been removed.

It now only forwards the original command and arguments. It does not batch, delay, throttle or otherwise change the drawing commands, and it does not touch noclip or player flags. It should not be considered a separate flight fix.

All 13 drawing call sites retain their original command names and argument expressions, including the regular radar drawings, voice arrows and command-based drawings.

The patch leaves Vanish unchanged and does not introduce configuration keys, change authLevel or IsDeveloper, alter global antihack settings, or add a timer that forces flight back on. The existing radar access checks are retained.

WHAT WAS ACTUALLY TESTED

With temporary instrumentation, I first suppressed the outgoing drawings while leaving the radar calculations running. Flight remained stable.

I then restored drawings. Player information was visible again, and I could continue flying with the radar active.

The longer test lasted approximately 6 minutes and 8 seconds, with 6,915 drawing calls forwarded and none suppressed. I experienced no involuntary fall. The one recorded flight interruption was my own deliberate Vanish off/on test.

There is one unresolved detail worth mentioning: an earlier attempt that also removed the flag toggles still appeared to let me fall after about four seconds. The later instrumented build is the one that passed the longer test. I do not have a controlled explanation for that difference, so I am not presenting the temporary flag changes as conclusively proven to be the sole cause.

The attached file is the cleaned version of the successfully tested build, with the diagnostic commands, counters and drawing-suppression switch removed. The successful long test was performed before that cleanup; the cleaned file has been compared against it, but should not be described as independently validated in-game yet.

Could you review whether these temporary IsAdmin changes are still necessary for server-originated ddraw, and whether removing them is the appropriate compatibility fix—particularly for accounts with authLevel=0, IsAdmin=False and IsDeveloper=True?

Thanks for taking a look.

AdminRadar-5.4.4-local-patch.diff :

--- original/AdminRadar.cs
+++ modified/AdminRadar.cs
@@ -1,3 +1,6 @@
+// Local compatibility patch of Admin Radar 5.4.4 by nivex.
+// Sends radar drawings without temporary changes to player admin flags.
+// This is not an official uMod release.
//#define ARDEBUG

using Facepunch;
@@ -46,6 +49,12 @@
private bool _isPopulatingCache;
private bool isUnloading;
private Cache cache;
+
+ private void SendRadarDraw(BasePlayer player, string command, params object[] args)
+ {
+ // Forward the original command and arguments without changing player flags.
+ player.SendConsoleCommand(command, args);
+ }

private class StoredData
{
@@ -777,7 +786,6 @@
_groupCo = null;
}
try { CancelInvoke(Activity); } catch { }
- try { RemoveAdminFlag(); } catch { }
}

public bool GetBool(EntityType type)
@@ -965,9 +973,7 @@
}

DoRemoves();
- SetAdminFlag();
DirectDrawAll();
- RemoveAdminFlag();
CheckNetworkGroupChange();

checks = 0;
@@ -1115,19 +1121,19 @@
cflag = DrawFlags.Arrow;
if (cobj.HasFlag(DrawFlags.Arrow))
{
- player.SendConsoleCommand("ddraw.arrow", delay, cobj.ei.color, cobj.ei.from, cobj.ei.to, cobj.ei.size);
+ instance.SendRadarDraw(player, "ddraw.arrow", delay, cobj.ei.color, cobj.ei.from, cobj.ei.to, cobj.ei.size);
}
cflag = DrawFlags.Box;
if (cobj.HasFlag(DrawFlags.Box))
{
- player.SendConsoleCommand("ddraw.box", delay, cobj.ei.color, cobj.ei.from, cobj.ei.size);
+ instance.SendRadarDraw(player, "ddraw.box", delay, cobj.ei.color, cobj.ei.from, cobj.ei.size);
}
cflag = DrawFlags.Text;
if (cobj.HasFlag(DrawFlags.Text))
{
try { cobj.action(); } catch (Exception ex) { HandleException(pair.Key, ex); continue; }
if (cobj.ei.info == null) { continue; }
- player.SendConsoleCommand("ddraw.text", delay, cobj.ei.color, cobj.ei.from, cobj.ei.info);
+ instance.SendRadarDraw(player, "ddraw.text", delay, cobj.ei.color, cobj.ei.from, cobj.ei.info);
}
}
}
@@ -1145,7 +1151,7 @@
if (config.Methods.Arrow || @override)
{
if (player == null || !player.IsConnected) { return; }
- player.SendConsoleCommand("ddraw.arrow", delay, color, from, to, size);
+ instance.SendRadarDraw(player, "ddraw.arrow", delay, color, from, to, size);
}
}

@@ -1154,7 +1160,7 @@
if (config.Methods.Text || @override)
{
if (player == null || !player.IsConnected) { return; }
- player.SendConsoleCommand("ddraw.text", delay, color, position, Format(prefix, text, false));
+ instance.SendRadarDraw(player, "ddraw.text", delay, color, position, Format(prefix, text, false));
}
}

@@ -1163,7 +1169,7 @@
if (config.Methods.Box || @override)
{
if (player == null || !player.IsConnected) { return; }
- player.SendConsoleCommand("ddraw.box", delay, color, position, size);
+ instance.SendRadarDraw(player, "ddraw.box", delay, color, position, size);
}
}

@@ -1217,30 +1223,11 @@

private void HandleException(Exception ex)
{
- RemoveAdminFlag();
removeByEntityType.Add(currType);
instance._errorTypes.Add(currType);
instance.Message(player, "Exception");
Puts("Error @{0} ({1}): {2}", currType, cflag, ex);
RemoveByEntityType(currType);
- }
-
- private void SetAdminFlag()
- {
- if (!isAdmin && hasPermAllowed && data.Count > 0 && !player.HasPlayerFlag(BasePlayer.PlayerFlags.IsAdmin))
- {
- player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, true);
- player.SendNetworkUpdateImmediate();
- }
- }
-
- private void RemoveAdminFlag()
- {
- if (!isAdmin && hasPermAllowed && player.HasPlayerFlag(BasePlayer.PlayerFlags.IsAdmin))
- {
- player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false);
- player.SendNetworkUpdateImmediate();
- }
}

private bool API_GetExistingBackpacks(ulong userid)
@@ -1343,7 +1330,6 @@

if (player == source && (player.IsDead() || player.IsSleeping() || player.HasPlayerFlag(BasePlayer.PlayerFlags.ReceivingSnapshot)))
{
- RemoveAdminFlag();
return false;
}

@@ -2472,7 +2458,7 @@
if (victim != null)
{
string text = $"<color={(victim.IsSleeping() ? config.Hex.Sleeper : victim.IsAlive() ? "#00ff00" : config.Hex.OnlineDead)}>{victim.displayName}</color>";
- player.SendConsoleCommand("ddraw.text", delay, color, from + offset, $"<size={config.Settings.PlayerTextSize}>T: {text}</size>");
+ instance.SendRadarDraw(player, "ddraw.text", delay, color, from + offset, $"<size={config.Settings.PlayerTextSize}>T: {text}</size>");
}
}

@@ -3833,7 +3819,7 @@
}

speakers[speakerId] = currentTime + config.Voice.Interval;
- radar.player.SendConsoleCommand("ddraw.arrow", config.Voice.Interval + 0.02f, Color.yellow, a + radar.fiveUp, a + radar.twoHalfUp, 0.5f);
+ SendRadarDraw(radar.player, "ddraw.arrow", config.Voice.Interval + 0.02f, Color.yellow, a + radar.fiveUp, a + radar.twoHalfUp, 0.5f);
}
}

@@ -4111,23 +4097,8 @@
{
return;
}
- if (!isAdmin)
- {
- player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, true);
- player.SendNetworkUpdateImmediate();
- }
- try
- {
- action();
- }
- finally
- {
- if (!isAdmin)
- {
- player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false);
- player.SendNetworkUpdateImmediate();
- }
- }
+ // Execute the drawing action without changing player privilege flags.
+ action();
}

protected new static void Puts(string format, params object[] args)
@@ -4212,7 +4183,7 @@
{
foreach (var obj in objects)
{
- player.SendConsoleCommand("ddraw.text", config.Options.BuildingsDrawTime, Color.red, obj[0], obj[1]);
+ SendRadarDraw(player, "ddraw.text", config.Options.BuildingsDrawTime, Color.red, obj[0], obj[1]);
}
});
}
@@ -4253,7 +4224,7 @@
{
foreach (var obj in objects)
{
- player.SendConsoleCommand("ddraw.text", config.Options.FindByIDDrawTime, obj[0], obj[1], userID);
+ SendRadarDraw(player, "ddraw.text", config.Options.FindByIDDrawTime, obj[0], obj[1], userID);
}
});
Message(player, "ProcessRequestFinished", objects.Count);
@@ -4327,7 +4298,7 @@
{
foreach (var obj in objects)
{
- player.SendConsoleCommand("ddraw.text", config.Options.FindDrawTime, Color.red, obj[0], $"<size={config.Settings.PlayerTextSize}>{obj[1]} {obj[2]}</size>");
+ SendRadarDraw(player, "ddraw.text", config.Options.FindDrawTime, Color.red, obj[0], $"<size={config.Settings.PlayerTextSize}>{obj[1]} {obj[2]}</size>");
}
});
Message(player, "ProcessRequestFinished", objects.Count);
@@ -4357,8 +4328,8 @@
{
foreach (var obj in objects)
{
- if (config.Methods.Text) player.SendConsoleCommand("ddraw.text", config.Options.DropsDrawTime, Color.red, obj[0], obj[1]);
- if (config.Methods.Box) player.SendConsoleCommand("ddraw.box", config.Options.DropsDrawTime, Color.red, obj[0], 0.25f);
+ if (config.Methods.Text) SendRadarDraw(player, "ddraw.text", config.Options.DropsDrawTime, Color.red, obj[0], obj[1]);
+ if (config.Methods.Box) SendRadarDraw(player, "ddraw.box", config.Options.DropsDrawTime, Color.red, obj[0], 0.25f);
}
});
Message(player, "ProcessRequestFinished", objects.Count);

Complet custom code :

// Local compatibility patch of Admin Radar 5.4.4 by nivex.
// Sends radar drawings without temporary changes to player admin flags.
// This is not an official uMod release.
//#define ARDEBUG

using Facepunch;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Rust.Ai.Gen2;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
using static Oxide.Plugins.AdminRadarExtensionMethods.ExtensionMethods;

namespace Oxide.Plugins
{
    [Info("Admin Radar", "nivex", "5.4.4")]
    [Description("Radar tool for Admins and Developers.")]
    internal class AdminRadar : RustPlugin
    {
        [PluginReference] Plugin Clans, Backpacks;

        [Flags] public enum DrawFlags { None = 0, Arrow = 1 << 1, Box = 1 << 2, Text = 1 << 3, }
        public enum EntityType { Active, Airdrop, Bag, Backpack, Boat, Bradley, Car, CargoPlane, CargoShip, CCTV, CH47, Box, Col, TC, TCArrow, Dead, Drop, Limit, Loot, Heli, Mini, MLRS, Npc, Ore, Horse, RHIB, Sleeper, Stash, Trap, Turret }
        private List<string> _tags = new() { "ore", "cluster", "1", "2", "3", "4", "5", "6", "_", ".", "-", "deployed", "wooden", "large", "pile", "prefab", "collectable", "loot", "small" };
        private List<EntityType> _errorTypes = new();
        private List<Radar> _radars = new();
        private List<BaseEntity> _spawnedEntities = new();
        private List<ClanInfo> _clans = new();
        private Dictionary<NetworkableId, Vector3> _despawnedEntities = new();
        private Dictionary<NetworkableId, BaseEntity> _allEntities = new();
        private Dictionary<string, float> _cooldowns = new();
        private Dictionary<ulong, string> _teamColors = new();
        private Dictionary<string, string> _clanColors = new();
        private Array _allEntityTypes = Enum.GetValues(typeof(EntityType));
        private CoroutineTimer _coroutineTimer = new(1.0f);
        private Coroutine _clanCo;
        private Stack<Coroutine> _coroutines = new();
        private StoredData data = new();
        private bool _isPopulatingCache;
        private bool isUnloading;
        private Cache cache;

        private void SendRadarDraw(BasePlayer player, string command, params object[] args)
        {
            // Forward the original command and arguments without changing player flags.
            player.SendConsoleCommand(command, args);
        }

        private class StoredData
        {
            public Dictionary<ulong, UiOffsets> Offsets = new();
            public Dictionary<string, int> EntityTextSize = new();
            public Dictionary<string, int> EntityNameSize = new();
            public Dictionary<string, int> PlayerTextSize = new();
            public Dictionary<string, int> PlayerNameSize = new();
            public List<string> Extended = new();
            public Dictionary<string, List<string>> Filters = new();
            public List<string> Hidden = new();
            public List<string> OnlineBoxes = new();
            public List<string> Visions = new();
            public List<string> Active = new();
            public StoredData() { }
            public void Init()
            {
                Offsets ??= new();
                EntityTextSize ??= new();
                EntityNameSize ??= new();
                PlayerTextSize ??= new();
                PlayerNameSize ??= new();
                Extended ??= new();
                Filters ??= new();
                Hidden ??= new();
                OnlineBoxes ??= new();
                Visions ??= new();
                Active ??= new();
            }
        }

        private class Cache
        {
            public Cache(AdminRadar instance)
            {
                config = instance.config;
                this.instance = instance;
            }

            public Configuration config;
            public AdminRadar instance;
            internal EntityType entityType;
            public Dictionary<NetworkableId, EntityInfo> Airdrops = new();
            public Dictionary<NetworkableId, EntityInfo> Animals = new();
            public Dictionary<NetworkableId, EntityInfo> Backpacks = new();
            public Dictionary<NetworkableId, EntityInfo> Bags = new();
            public Dictionary<NetworkableId, EntityInfo> Boats = new();
            public Dictionary<NetworkableId, EntityInfo> BradleyAPCs = new();
            public Dictionary<NetworkableId, EntityInfo> CargoPlanes = new();
            public Dictionary<NetworkableId, EntityInfo> CargoShips = new();
            public Dictionary<NetworkableId, EntityInfo> Cars = new();
            public Dictionary<NetworkableId, EntityInfo> CCTV = new();
            public Dictionary<NetworkableId, EntityInfo> CH47 = new();
            public Dictionary<NetworkableId, EntityInfo> Cupboards = new();
            public Dictionary<NetworkableId, EntityInfo> Collectibles = new();
            public Dictionary<NetworkableId, EntityInfo> Containers = new();
            public Dictionary<NetworkableId, EntityInfo> Corpses = new();
            public Dictionary<NetworkableId, EntityInfo> Drops = new();
            public Dictionary<NetworkableId, EntityInfo> Helicopters = new();
            public Dictionary<NetworkableId, EntityInfo> MiniCopter = new();
            public Dictionary<NetworkableId, EntityInfo> MLRS = new();
            public Dictionary<NetworkableId, EntityInfo> NPC = new();
            public Dictionary<NetworkableId, EntityInfo> Ores = new();
            public Dictionary<NetworkableId, EntityInfo> RHIB = new();
            public Dictionary<NetworkableId, EntityInfo> RidableHorse = new();
            public Dictionary<NetworkableId, EntityInfo> Turrets = new();
            public Dictionary<NetworkableId, EntityInfo> Traps = new();

            public bool Add(BaseEntity entity)
            {
                if (entity.IsKilled())
                {
                    return false;
                }
                if (IsDrop(entity))
                {
                    Add_Internal<BaseEntity, EntityInfo>(Drops, entity, EntityType.Drop);
                }
                if (entity is BasePlayer player)
                {
                    Interface.Oxide.NextTick(() =>
                    {
                        if (player.IsKilled())
                        {
                            return;
                        }
                        if (player.userID.IsSteamId())
                        {
                            instance._radars.ForEach(radar =>
                            {
                                if (radar.GetBool(EntityType.Active))
                                {
                                    radar.TryCacheOnlinePlayer(player);
                                }
                            });
                        }
                        else if (config.Core.NPC && !NPC.TryGetValue(entity.net.ID, out var ei))
                        {
                            NPC[entity.net.ID] = ei = new(player, EntityType.Npc, config.Distance.Get);
                            instance.TryCacheByType(EntityType.Npc, ei);
                        }
                    });
                    return false;
                }
                if (config.Core.Dead && entity is PlayerCorpse corpse)
                {
                    Interface.Oxide.NextTick(() =>
                    {
                        if (!corpse.IsKilled() && corpse.playerSteamID.IsSteamId() && !Corpses.TryGetValue(entity.net.ID, out var ei))
                        {
                            Corpses[entity.net.ID] = ei = new(entity, EntityType.Dead, config.Distance.Get);
                            ei.name = corpse.parentEnt?.ToString() ?? corpse.playerSteamID.ToString();
                            instance.TryCacheByType(EntityType.Dead, ei);
                        }
                    });
                    return false;
                }
                if ((config.Additional.Traps || config.GUI.Traps) && IsTrap(entity) && Add_Internal<BaseEntity, EntityInfo>(Traps, entity, EntityType.Trap))
                {
                    return true;
                }
                if (config.Additional.RH && Add_Internal<RidableHorse, EntityInfo>(RidableHorse, entity, EntityType.Horse))
                {
                    return true;
                }
                if (config.Core.NPC && Add_Internal<TravellingVendor, EntityInfo>(NPC, entity, EntityType.Npc))
                {
                    return true;
                }
                if (config.Core.Animals && Add_Internal<BaseNpc, EntityInfo>(Animals, entity, EntityType.Npc))
                {
                    return true;
                }
                if (config.Core.Animals && Add_Internal<BaseNPC2, EntityInfo>(Animals, entity, EntityType.Npc))
                {
                    return true;
                }
                if (config.Core.Animals && Add_Internal<WildlifeHazard, EntityInfo>(Animals, entity, EntityType.Npc))
                {
                    return true;
                }
                if (config.Core.Animals && Add_Internal<SimpleShark, EntityInfo>(Animals, entity, EntityType.Npc))
                {
                    return true;
                }
                if (config.Core.Loot && entity is TrainCarUnloadable tcu && Add_Internal<StorageContainer, EntityInfo>(Containers, tcu.GetStorageContainer(), EntityType.Loot))
                {
                    return true;
                }
                if ((config.Core.Loot || config.Core.Box || config.Core.Stash) && entity is StorageContainer && TryGetContainerType(entity, out entityType) && Add_Internal<StorageContainer, EntityInfo>(Containers, entity, entityType))
                {
                    return true;
                }
                if (config.Core.Col && entity is CollectibleEntity && Add_Internal<CollectibleEntity, EntityInfo>(Collectibles, entity, EntityType.Col))
                {
                    return true;
                }
                if (config.Core.Ore && entity is OreResourceEntity && Add_Internal<OreResourceEntity, EntityInfo>(Ores, entity, EntityType.Ore))
                {
                    return true;
                }
                if ((config.Additional.Cars || config.GUI.Cars) && (Add_Internal<BasicCar, EntityInfo>(Cars, entity, EntityType.Car) || Add_Internal<ModularCar, EntityInfo>(Cars, entity, EntityType.Car) || Add_Internal<Bike, EntityInfo>(Cars, entity, EntityType.Car)))
                {
                    return true;
                }
                if ((config.Additional.CP || config.GUI.CP) && entity.prefabID == 2383782438 && Add_Internal<BaseEntity, EntityInfo>(CargoPlanes, entity, EntityType.CargoPlane))
                {
                    return true;
                }
                if (config.Core.Bags && Add_Internal<SleepingBag, EntityInfo>(Bags, entity, EntityType.Bag))
                {
                    return true;
                }
                if (config.Core.TC && Add_Internal<BuildingPrivlidge, EntityInfo>(Cupboards, entity, EntityType.TC))
                {
                    return true;
                }
                if ((config.Additional.CCTV || config.GUI.CCTV) && (Add_Internal<CCTV_RC, EntityInfo>(CCTV, entity, EntityType.CCTV) || Add_Internal<Drone, EntityInfo>(CCTV, entity, EntityType.CCTV)))
                {
                    return true;
                }
                if (config.Core.Airdrop && Add_Internal<SupplyDrop, EntityInfo>(Airdrops, entity, EntityType.Airdrop))
                {
                    return true;
                }
                if (config.Core.Loot && Add_Internal<DroppedItemContainer, EntityInfo>(Backpacks, entity, EntityType.Backpack))
                {
                    return true;
                }
                if (config.Core.Loot && entity is WorldItem wi && wi.item != null && wi.item.IsBackpack() && Add_Internal<WorldItem, EntityInfo>(Backpacks, entity, EntityType.Backpack))
                {
                    return true;
                }
                if ((config.Additional.Heli || config.GUI.Heli) && Add_Internal<PatrolHelicopter, EntityInfo>(Helicopters, entity, EntityType.Heli))
                {
                    return true;
                }
                if ((config.Additional.Bradley || config.GUI.Bradley) && (Add_Internal<BradleyAPC, EntityInfo>(BradleyAPCs, entity, EntityType.Bradley)))
                {
                    return true;
                }
                if ((config.Additional.RHIB || config.GUI.RHIB) && Add_Internal<RHIB, EntityInfo>(RHIB, entity, EntityType.RHIB))
                {
                    return true;
                }
                if ((config.Additional.Boats || config.GUI.Boats) && Add_Internal<BaseBoat, EntityInfo>(Boats, entity, EntityType.Boat))
                {
                    return true;
                }
                if ((config.Additional.MC || config.GUI.MC) && (Add_Internal<Minicopter, EntityInfo>(MiniCopter, entity, EntityType.Mini) || Add_Internal<AttackHelicopter, EntityInfo>(MiniCopter, entity, EntityType.Mini)))
                {
                    return true;
                }
                if ((config.Additional.CH47 || config.GUI.CH47) && Add_Internal<CH47Helicopter, EntityInfo>(CH47, entity, EntityType.CH47))
                {
                    return true;
                }
                if ((config.Additional.CS || config.GUI.CS) && Add_Internal<CargoShip, EntityInfo>(CargoShips, entity, EntityType.CargoShip))
                {
                    return true;
                }
                if (config.Core.Turrets && Add_Internal<AutoTurret, EntityInfo>(Turrets, entity, EntityType.Turret))
                {
                    return true;
                }
                if ((config.Additional.MLRS || config.GUI.MLRS) && Add_Internal<MLRSRocket, EntityInfo>(MLRS, entity, EntityType.MLRS))
                {
                    return true;
                }
                return false;
            }

            private bool TryGetContainerType(BaseEntity entity, out EntityType type)
            {
                if (entity is LockedByEntCrate || IsLoot(entity)) { type = EntityType.Loot; return true; }
                if (entity is StashContainer) { type = EntityType.Stash; return true; }
                if (IsBox(entity)) { type = EntityType.Box; return true; }
                type = (EntityType)0;
                return false;
            }

            public bool Remove(NetworkableId nid, Vector3 entityPos)
            {
                instance._radars.ForEach(radar => radar.RemoveByNetworkId(nid));
                if (Remove_Internal(Airdrops, nid)) return true;
                if (Remove_Internal(Animals, nid)) return true;
                if (Remove_Internal(Backpacks, nid)) return true;
                if (Remove_Internal(Bags, nid)) return true;
                if (Remove_Internal(Boats, nid)) return true;
                if (Remove_Internal(BradleyAPCs, nid)) return true;
                if (Remove_Internal(CargoPlanes, nid)) return true;
                if (Remove_Internal(CargoShips, nid)) return true;
                if (Remove_Internal(Cars, nid)) return true;
                if (Remove_Internal(CCTV, nid)) return true;
                if (Remove_Internal(CH47, nid)) return true;
                if (Remove_Internal(Collectibles, nid)) return true;
                if (Remove_Internal(Containers, nid)) return true;
                if (Remove_Internal(Corpses, nid)) return true;
                if (Remove_Internal(Cupboards, nid)) return true;
                if (Remove_Internal(Helicopters, nid)) return true;
                if (Remove_Internal(MiniCopter, nid)) return true;
                if (Remove_Internal(MLRS, nid)) return true;
                if (Remove_Internal(NPC, nid)) return true;
                if (Remove_Internal(Ores, nid)) return true;
                if (Remove_Internal(RHIB, nid)) return true;
                if (Remove_Internal(RidableHorse, nid)) return true;
                if (Remove_Internal(Traps, nid)) return true;
                if (Remove_Internal(Turrets, nid)) return true;
                return false;
            }

            private bool Add_Internal<TLookFor, TTargetType>(Dictionary<NetworkableId, EntityInfo> cachedList, BaseEntity entity, EntityType type)
            {
                if (entity is TLookFor && !entity.IsKilled() && !cachedList.TryGetValue(entity.net.ID, out var ei))
                {
                    cachedList[entity.net.ID] = ei = new(entity, type, config.Distance.Get, instance.StripTags);
                    instance.TryCacheByType(type, ei);
                    return true;
                }
                return false;
            }

            private bool Remove_Internal<TType, TKeyType>(Dictionary<TKeyType, TType> cachedList, TKeyType key)
            {
                return cachedList.Remove(key);
            }

            public void Print()
            {
                StringBuilder sb = StringBuilderCache.Acquire();

                sb.AppendLine();
                sb.AppendLine($"{nameof(Airdrops)}: {Airdrops.Count}");
                sb.AppendLine($"{nameof(Animals)}: {Animals.Count}");
                sb.AppendLine($"{nameof(Backpacks)}: {Backpacks.Count}");
                sb.AppendLine($"{nameof(Bags)}: {Bags.Count}");
                sb.AppendLine($"{nameof(Boats)}: {Boats.Count}");
                sb.AppendLine($"{nameof(BradleyAPCs)}: {BradleyAPCs.Count}");
                sb.AppendLine($"{nameof(CargoPlanes)}: {CargoPlanes.Count}");
                sb.AppendLine($"{nameof(CargoShips)}: {CargoShips.Count}");
                sb.AppendLine($"{nameof(Cars)}: {Cars.Count}");
                sb.AppendLine($"{nameof(CCTV)}: {CCTV.Count}");
                sb.AppendLine($"{nameof(CH47)}: {CH47.Count}");
                sb.AppendLine($"{nameof(Collectibles)}: {Collectibles.Count}");
                sb.AppendLine($"{nameof(Containers)}: {Containers.Count}");
                sb.AppendLine($"{nameof(Corpses)}: {Corpses.Count}");
                sb.AppendLine($"{nameof(Cupboards)}: {Cupboards.Count}");
                sb.AppendLine($"{nameof(Helicopters)}: {Helicopters.Count}");
                sb.AppendLine($"{nameof(MiniCopter)}: {MiniCopter.Count}");
                sb.AppendLine($"{nameof(MLRS)}: {MLRS.Count}");
                sb.AppendLine($"{nameof(NPC)}: {NPC.Count}");
                sb.AppendLine($"{nameof(Ores)}: {Ores.Count}");
                sb.AppendLine($"{nameof(RHIB)}: {RHIB.Count}");
                sb.AppendLine($"{nameof(RidableHorse)}: {RidableHorse.Count}");
                sb.AppendLine($"{nameof(Traps)}: {Traps.Count}");
                sb.AppendLine($"{nameof(Turrets)}: {Turrets.Count}");

                Puts(StringBuilderCache.GetStringAndRelease(sb));
            }

            public bool IsDrop(BaseEntity entity)
            {
                if (entity is DroppedItem || entity is Landmine || entity is BearTrap || entity is DroppedItemContainer || entity is RFTimedExplosive)
                {
                    return !config.Settings.DropExceptions.Exists(entity.ShortPrefabName.Contains);
                }
                return false;
            }

            public bool IsTrap(BaseNetworkable entity)
            {
                return entity is BaseTrap || config.Options.AdditionalTraps.Exists(entity.ShortPrefabName.Contains);
            }

            public bool IsLoot(BaseNetworkable entity)
            {
                if (config.Core.Loot)
                {
                    if (entity is WorldItem wi)
                    {
                        return wi.item != null && wi.item.IsBackpack();
                    }
                    return entity is TrainCarUnloadable || entity.ShortPrefabName == "campfire"
                            || entity.ShortPrefabName.Contains("loot", CompareOptions.IgnoreCase)
                            || entity.ShortPrefabName.Contains("crate_", CompareOptions.IgnoreCase)
                            || entity.ShortPrefabName.Contains("trash", CompareOptions.IgnoreCase)
                            || entity.ShortPrefabName.Contains("hackable", CompareOptions.IgnoreCase)
                            || entity.ShortPrefabName.Contains("oil", CompareOptions.IgnoreCase)
                            || entity.ShortPrefabName.Contains("vehicle_parts")
                            || entity.ShortPrefabName.Contains("foodbox");
                }
                return false;
            }

            public bool IsBox(BaseNetworkable entity)
            {
                if (config.Core.Box)
                {
                    return config.Options.Boxes.Exists(entity.ShortPrefabName.Contains);
                }
                return false;
            }
        }

        private class CoroutineTimer
        {
            private Stopwatch stopwatch = new();
            private float _maxDurationMs;
            private bool _isRunning;
            //public bool ForceStop;
            public double Elapsed => stopwatch.Elapsed.TotalMilliseconds;

            public CoroutineTimer(float maxDurationMs)
            {
                _maxDurationMs = maxDurationMs;
            }

            public void Stop()
            {
                stopwatch.Stop();
                _isRunning = false;
            }

            public void Start()
            {
                stopwatch.Start();
                _isRunning = true;
            }

            public bool ShouldYield()
            {
                _isRunning = stopwatch.Elapsed.TotalMilliseconds < _maxDurationMs;

                if (!_isRunning)
                {
#if ARDEBUG
                    double milliseconds = Elapsed;
                    if (stopwatch.Elapsed.TotalMilliseconds > 2f * _maxDurationMs)
                    {
                        Interface.Oxide.LogInfo($"[AdminRadar] Time slice took {Elapsed} when it should be around {_maxDurationMs}");
                    }
#endif
                }
                return !_isRunning;
            }

            public void ResetIfYielded()
            {
                if (_isRunning) return;

                stopwatch.Restart();
                _isRunning = true;
            }
        }

        internal static class StringBuilderCache
        {
            public static StringBuilder Acquire(string text = "")
            {
                StringBuilder builder = Pool.Get<StringBuilder>();
                if (string.IsNullOrEmpty(text)) return builder;
                return builder.Append(text);
            }

            public static string GetStringAndRelease(StringBuilder sb)
            {
                string result = sb.ToString();
                Pool.FreeUnmanaged(ref sb);
                return result;
            }
        }

        public class EntityInfo
        {
            public BuildingPrivlidge priv;
            public BaseEntity entity;
            public BasePlayer owner;
            public EntityType type;
            public Color color;
            public Vector3 _from;
            public Vector3 to;
            public Vector3 offset;
            public string name;
            public object info;
            public float dist;
            public float nextonlinecheck;
            public float sqrdist;
            public float size = 0.5f;
            public Transform t;
            public Network.Visibility.Group group => entity?.net?.group;
            public Vector3 from => (t == null ? _from : _from = t.position) + offset;
            public bool Moving => type == EntityType.Airdrop || type == EntityType.Bradley || type == EntityType.CargoPlane || type == EntityType.Heli;
            public bool OutOfRange(Vector3 position)
            {
                if (entity == null || (from - position).sqrMagnitude > sqrdist)
                {
                    info = null;
                    return true;
                }
                return false;
            }
            public BasePlayer ToPlayer()
            {
                if (owner == null && Time.time > nextonlinecheck)
                {
                    nextonlinecheck = Time.time + 30f;
                    owner = BasePlayer.FindAwakeOrSleeping(entity.OwnerID.ToString());
                }
                return owner;
            }
            public EntityInfo() { }
            public EntityInfo(BaseEntity entity, EntityType type, Func<EntityType, BaseEntity, float> getDistance, Func<string, string> stripTags = null)
            {
                if (stripTags != null)
                {
                    name = stripTags(entity.ShortPrefabName);
                }
                if (getDistance != null)
                {
                    dist = getDistance(type, entity);
                    sqrdist = dist * dist;
                }
                if (type == EntityType.TC)
                {
                    priv = entity as BuildingPrivlidge;
                }
                this.type = type;
                this.entity = entity;
                t = entity.transform;
                _from = t.position;
            }
        }

        private class Radar : FacepunchBehaviour
        {
            private string abbr(string s)
            {
                if (string.IsNullOrEmpty(s) || s.Length > 256) return s;

                Span<char> buf = stackalloc char[s.Length];
                int n = 0;

                for (int i = 0; i < s.Length; i++)
                {
                    char c = s[i];
                    if ((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))
                        buf[n++] = c;
                }

                return new string(buf.Slice(0, n));
            }

            public class DataObject : Pool.IPooled
            {
                public EntityInfo ei;
                public Action action;
                public DrawFlags flags;
                public bool disabled;
                public DataObject() { }
                public bool HasFlag(DrawFlags flag)
                {
                    return ((flags & flag) == flag);
                }
                public void SetEnabled(Network.Visibility.Group group, Vector3 to, float max)
                {
                    if (ei == null)
                    {
                        disabled = true;
                    }
                    else if (!ei.Moving)
                    {
                        disabled = ei.group != group && (ei.from - to).sqrMagnitude > Mathf.Max(max * max, ei.sqrdist);
                    }
                }
                public bool IsOfType(EntityType type)
                {
                    if (type != EntityType.Loot)
                    {
                        return ei.type == type;
                    }
                    return ei.type == EntityType.Loot || ei.type == EntityType.Backpack;
                }
                public void Reset()
                {
                    ei = null;
                    action = null;
                    disabled = false;
                    flags = DrawFlags.None;
                }
                public void EnterPool()
                {
                    Reset();
                }
                public void LeavePool()
                {
                    Reset();
                }
            }

            internal class DistantPlayer : Pool.IPooled
            {
                public Vector3 pos;
                public bool alive;
                public DistantPlayer()
                {
                }
                public void Reset()
                {
                    pos = default;
                    alive = false;
                }
                public void EnterPool()
                {
                    Reset();
                }
                public void LeavePool()
                {
                    Reset();
                }
            }

            internal bool setSource = true, canGetExistingBackpacks = true, isEnabled = true, canBypassOverride, hasPermAllowed, isAdmin, showHT, showAll, Extended;
            internal int entityNameSize, entityTextSize, playerNameSize, playerTextSize, inactiveSeconds, activatedSeconds, checks;
            internal float currDistance, invokeTime, maxDistance;
            internal string username, userid;
            internal RaycastHit hit;
            internal EntityType currType;
            internal Vector3 position;
            internal BaseEntity source;
            internal BasePlayer player;
            internal AdminRadar instance;
            internal Network.Visibility.Group group;
            internal ItemContainer _backpackItemContainer;
            internal Coroutine _radarCo, _updateCo, _groupCo;
            internal List<ulong> exclude = Pool.Get<List<ulong>>();
            internal List<NetworkableId> removeByNetworkId = Pool.Get<List<NetworkableId>>();
            internal List<EntityType> entityTypes = Pool.Get<List<EntityType>>();
            internal List<DistantPlayer> distant = Pool.Get<List<DistantPlayer>>();
            internal List<EntityType> removeByEntityType = Pool.Get<List<EntityType>>();
            internal Dictionary<NetworkableId, DataObject> data = Pool.Get<Dictionary<NetworkableId, DataObject>>();
            internal Dictionary<EntityType, Action> filters = Pool.Get<Dictionary<EntityType, Action>>();
            internal Dictionary<ulong, ItemContainer> backpacks = Pool.Get<Dictionary<ulong, ItemContainer>>();
            
            internal Cache Cache => instance.cache;
            internal Configuration config => instance.config;
            internal float delay => invokeTime + 0.05f;

            internal float Distance(Vector3 a)
            {
                float sqrMagnitude = (a - position).sqrMagnitude;

                return Mathf.Ceil(Mathf.Sqrt(sqrMagnitude));
            }

            public Vector3 limitUp;
            public Vector3 halfUp = new(0f, 0.5f);
            public Vector3 twoHalfUp = new(0f, 2.5f);
            public Vector3 twoUp = new(0f, 2f);
            public Vector3 fiveUp = new(0f, 5f);

            private void Awake()
            {
                source = player = GetComponent<BasePlayer>();
                isAdmin = player.IsAdmin;
                userid = player.UserIDString;
                username = player.displayName;
                position = player.transform.position;
                exclude.Add(player.userID);
            }

            private void OnDestroy()
            {
                isEnabled = false;
                Interface.CallHook("OnRadarDeactivated", player, username, userid, position);
                if (config.Settings.Cooldown > 0f)
                {
                    instance._cooldowns[userid] = Time.realtimeSinceStartup + config.Settings.Cooldown;
                }
                if (config.Settings.ShowToggle)
                {
                    instance.Message(player, "Deactivated");
                }
                if (instance._radars.Remove(this) && instance._radars.Count == 0 && !instance.isUnloading)
                {
                    instance.Unsubscribe(nameof(OnPlayerRespawned));
                }
                instance._voices.Remove(userid);
                instance.DestroyUI(player);
                ResetToPool();
                StopAll();
            }

            private void ResetToPool()
            {
                for (int i = distant.Count - 1; i >= 0; i--)
                {
                    var obj = distant[i];
                    if (obj != null)
                    {
                        Pool.Free(ref obj);
                    }
                    distant[i] = null;
                }
                for (int i = data.Count - 1; i >= 0; i--)
                {
                    var obj = data.ElementAt(i);
                    if (obj.Value != null)
                    {
                        var value = obj.Value;
                        value.Reset();
                        Pool.Free(ref value);
                    }
                }
                data.ResetToPool();
                exclude.ResetToPool();
                distant.ResetToPool();
                filters.ResetToPool();
                backpacks.ResetToPool();
                entityTypes.ResetToPool();
                removeByNetworkId.ResetToPool();
                removeByEntityType.ResetToPool();
            }

            public bool Add(EntityType type)
            {
                if (type == EntityType.Loot && !entityTypes.Contains(EntityType.Backpack))
                {
                    entityTypes.Add(EntityType.Backpack);
                }
                if (!entityTypes.Contains(type))
                {
                    entityTypes.Add(type);
                    return true;
                }
                return false;
            }

            public void Init(AdminRadar instance)
            {
                this.instance = instance;
                this.limitUp = new(0f, config.Limit.Height);
                this.instance._radars.Add(this);
                canBypassOverride = CanBypassOverride(userid);
                hasPermAllowed = HasPermission(userid, "adminradar.allowed");
                Extended = instance.data.Extended.Contains(userid);
                InvokeRepeating(Activity, 0f, 1f);
                Interface.CallHook("OnRadarActivated", player, username, userid, position);
                if (instance._radars.Count == 1)
                {
                    instance.Subscribe(nameof(OnPlayerRespawned));
                }
            }

            public void StopAll()
            {
                if (_radarCo != null)
                {
                    StopCoroutine(_radarCo);
                    _radarCo = null;
                }
                if (_updateCo != null)
                {
                    StopCoroutine(_updateCo);
                    _updateCo = null;
                }
                if (_groupCo != null)
                {
                    StopCoroutine(_groupCo);
                    _groupCo = null;
                }
                try { CancelInvoke(Activity); } catch { }
            }

            public bool GetBool(EntityType type)
            {
                return entityTypes.Contains(type);
            }

            private void Activity()
            {
                inactiveSeconds = position == player.transform.position ? inactiveSeconds + 1 : 0;
                position = source.transform.position;
                if (source != player)
                {
                    inactiveSeconds = 0;
                    return;
                }
                if (config.Settings.DeactivateSeconds > 0 && ++activatedSeconds >= config.Settings.DeactivateSeconds)
                {
                    isEnabled = false;
                    Destroy(this);
                }
                if (config.Settings.InactiveSeconds > 0 && inactiveSeconds >= config.Settings.InactiveSeconds)
                {
                    isEnabled = false;
                    Destroy(this);
                }
            }

            private class Idle
            {
                public BasePlayer player;
                public Vector3 lastPosition;
                public float lastMovementTime;
            }

            private Dictionary<ulong, Idle> _idle = new();

            private double GetIdleTime(BasePlayer target)
            {
                Vector3 currPosition = target.transform.position;
                if (!_idle.TryGetValue(target.userID, out var idle))
                {
                    _idle[target.userID] = idle = new();
                    idle.lastPosition = currPosition;
                    idle.lastMovementTime = Time.time;
                    idle.player = target;
                    return 0;
                }
                if (idle.lastPosition != currPosition)
                {
                    idle.lastPosition = currPosition;
                    idle.lastMovementTime = Time.time;
                    return 0;
                }
                double time = Math.Round((Time.time - idle.lastMovementTime) / 60.0, config.Settings.IdleRoundDigits);
                return time > 0 ? time : 0;
            }

            private void RemoveIdleTime()
            {
                if (_idle.Count > 0)
                {
                    foreach (var pair in _idle)
                    {
                        if (pair.Value.player == null || !pair.Value.player.IsConnected)
                        {
                            _idle.Remove(pair.Key);
                            break;
                        }
                    }
                }
            }

            private void SetupFilter(EntityType type, Action action)
            {
                if (entityTypes.Contains(type))
                {
                    if (_radarCo != null)
                    {
                        action();
                    }
                    filters[type] = action;
                }
                else if (filters.Remove(type))
                {
                    RemoveByEntityType(type);
                }
            }

            public void SetupFilters(bool barebones)
            {
                if (_updateCo != null)
                {
                    StopCoroutine(_updateCo);
                }
                SetupFilter(EntityType.Active, ShowActive);
                SetupFilter(EntityType.Sleeper, ShowSleepers);
                if (!barebones)
                {
                    SetupFilters();
                }
                if (_radarCo == null)
                {
                    CheckNetworkGroupChange();

                    _radarCo = StartCoroutine(DoRadarRoutine());
                }
                if (_groupCo == null && config.Limit.Enabled)
                {
                    _groupCo = StartCoroutine(DoGroupLimitRoutine());
                }
                DoRemoves();
            }

            private void SetupFilters()
            {
                SetupFilter(EntityType.TC, ShowTC);
                SetupFilter(EntityType.Bag, ShowBags);
                SetupFilter(EntityType.Box, ShowBox);
                SetupFilter(EntityType.Ore, ShowOre);
                SetupFilter(EntityType.Npc, ShowNPC);
                SetupFilter(EntityType.CCTV, ShowCCTV);
                SetupFilter(EntityType.Dead, ShowDead);
                SetupFilter(EntityType.Drop, ShowDrops);
                SetupFilter(EntityType.Heli, ShowHeli);
                SetupFilter(EntityType.Loot, ShowLoot);
                SetupFilter(EntityType.Stash, ShowStash);
                SetupFilter(EntityType.Turret, ShowTurrets);
                SetupFilter(EntityType.Bradley, ShowBradley);
                SetupFilter(EntityType.Col, ShowCollectibles);
                SetupFilter(EntityType.Airdrop, ShowAirdrops);
                SetupFilter(EntityType.Car, () => ShowEntity(EntityType.Car, Cache.Cars));
                SetupFilter(EntityType.CH47, () => ShowEntity(EntityType.CH47, Cache.CH47));
                SetupFilter(EntityType.MLRS, () => ShowEntity(EntityType.MLRS, Cache.MLRS));
                SetupFilter(EntityType.RHIB, () => ShowEntity(EntityType.RHIB, Cache.RHIB));
                SetupFilter(EntityType.Boat, () => ShowEntity(EntityType.Boat, Cache.Boats));
                SetupFilter(EntityType.Trap, () => ShowEntity(EntityType.Trap, Cache.Traps));
                SetupFilter(EntityType.Mini, () => ShowEntity(EntityType.Mini, Cache.MiniCopter));
                SetupFilter(EntityType.Horse, () => ShowEntity(EntityType.Horse, Cache.RidableHorse));
                SetupFilter(EntityType.CargoShip, () => ShowEntity(EntityType.CargoShip, Cache.CargoShips));
                SetupFilter(EntityType.CargoPlane, () => ShowEntity(EntityType.CargoPlane, Cache.CargoPlanes));
            }

            private IEnumerator DoGroupLimitRoutine()
            {
                while (isEnabled)
                {
                    ShowGroupLimits();

                    yield return CoroutineEx.waitForSeconds(invokeTime);
                }
            }

            private IEnumerator DoUpdateRoutine()
            {
                SetEnabledDataObjects();

                foreach (var filter in filters)
                {
                    filter.Value();

                    if (checks >= 100)
                    {
                        checks = 0;
                        yield return CoroutineEx.waitForFixedUpdate;
                    }
                }
            }

            private IEnumerator DoRadarRoutine()
            {
                while (isEnabled)
                {
                    if (player == null || !player.IsConnected || instance.isUnloading)
                    {
                        isEnabled = false;
                        Destroy(this);
                        yield break;
                    }

                    if (!SetSource())
                    {
                        yield return CoroutineEx.waitForSeconds(0.1f);
                        continue;
                    }

                    DoRemoves();
                    DirectDrawAll();
                    CheckNetworkGroupChange();

                    checks = 0;

                    yield return CoroutineEx.waitForSeconds(invokeTime);
                }
            }

            private void DoRemoves()
            {
                if (data.Count != 0)
                {
                    foreach (var pair in data)
                    {
                        if (pair.Value.ei == null || !pair.Value.ei.entity.IsValid())
                        {
                            removeByNetworkId.Add(pair.Key);
                            pair.Value.disabled = true;
                        }
                    }
                }
                if (removeByEntityType.Count != 0)
                {
                    foreach (var type in removeByEntityType)
                    {
                        RemoveByEntityType(type);
                        entityTypes.Remove(type);
                        filters.Remove(type);
                    }
                    removeByEntityType.Clear();
                }
                if (removeByNetworkId.Count != 0)
                {
                    foreach (var nid in removeByNetworkId)
                    {
                        RemoveByNetworkId(nid);
                    }
                    removeByNetworkId.Clear();
                }
            }

            private void CheckNetworkGroupChange()
            {
                if (group == player.net.group)
                {
                    return;
                }
                group = player.net.group;
                if (_updateCo != null)
                {
                    StopCoroutine(_updateCo);
                }
                if (filters.ContainsKey(EntityType.Npc))
                {
                    RemoveByEntityType(EntityType.Npc);
                    DoRemoves();
                }
                _updateCo = StartCoroutine(DoUpdateRoutine());
            }

            public void SetEnabledDataObjects()
            {
                foreach (var pair in data)
                {
                    pair.Value.SetEnabled(group, position, maxDistance);
                }
            }

            public void RemoveByEntityType(EntityType type)
            {
                foreach (var pair in data)
                {
                    if (pair.Value.IsOfType(type))
                    {
                        removeByNetworkId.Add(pair.Key);
                        pair.Value.disabled = true;
                    }
                }
            }

            public void RemoveByNetworkId(NetworkableId nid)
            {
                if (data.Remove(nid, out var obj))
                {
                    if (obj != null)
                    {
                        Pool.Free(ref obj);
                    }
                }
            }

            public void TryCacheByType(EntityType type, EntityInfo ei)
            {
                try
                {
                    if (!entityTypes.Contains(type) || !ei.entity.IsValid())
                    {
                        return;
                    }
                    switch (type)
                    {
                        case EntityType.Airdrop: { CacheAirdrop(ei); break; }
                        case EntityType.Backpack: { CacheBackpack(ei); break; }
                        case EntityType.Bag: { CacheSleepingBag(ei); break; }
                        case EntityType.Box: { CacheContainer(ei); break; }
                        case EntityType.Bradley: { CacheBradley(ei); break; }
                        case EntityType.CCTV: { CacheCCTV(ei); break; }
                        case EntityType.Col: { CacheCol(ei); break; }
                        case EntityType.Dead: { CacheDead(ei); break; }
                        case EntityType.Heli: { CacheHeli(ei); break; }
                        case EntityType.Loot: { CacheLoot(ei); break; }
                        case EntityType.Npc: { CacheNpc(ei); break; }
                        case EntityType.Ore: { CacheOre(ei); break; }
                        case EntityType.Stash: { CacheStash(ei); break; }
                        case EntityType.TC: { CacheTC(ei); break; }
                        case EntityType.Turret: { CacheTurret(ei); break; }
                        default: { CacheEntity(ei, type); break; }
                    }
                }
                catch (Exception ex)
                {
                    currType = type;
                    HandleException(ex);
                }
            }

            private DataObject cobj;
            private DrawFlags cflag;

            private void DirectDrawAll()
            {
                float delay = this.delay;

                foreach (var pair in data)
                {
                    cobj = pair.Value;
                    if (cobj == null || cobj.ei == null || cobj.disabled)
                    {
                        continue;
                    }
                    if (cobj.ei.type == EntityType.Ore && OreWhitelist.Count > 0 && !IsOreWhitelisted(cobj.ei))
                    {
                        continue;
                    }
                    cflag = DrawFlags.Arrow;
                    if (cobj.HasFlag(DrawFlags.Arrow))
                    {
                        instance.SendRadarDraw(player, "ddraw.arrow", delay, cobj.ei.color, cobj.ei.from, cobj.ei.to, cobj.ei.size);
                    }
                    cflag = DrawFlags.Box;
                    if (cobj.HasFlag(DrawFlags.Box))
                    {
                        instance.SendRadarDraw(player, "ddraw.box", delay, cobj.ei.color, cobj.ei.from, cobj.ei.size);
                    }
                    cflag = DrawFlags.Text;
                    if (cobj.HasFlag(DrawFlags.Text))
                    {
                        try { cobj.action(); } catch (Exception ex) { HandleException(pair.Key, ex); continue; }
                        if (cobj.ei.info == null) { continue; }
                        instance.SendRadarDraw(player, "ddraw.text", delay, cobj.ei.color, cobj.ei.from, cobj.ei.i

heya, this is a known issue and will be fixed in the next update =]
I can confirm the fix is to remove all of the temporary admin code

Thanks for taking the time to read through all of that and confirm the fix! I'll test the update as soon as it's released and let you know how it goes. Thanks again for your work on the plugin 🙂