using Oxide.Core.Plugins; namespace Oxide.Plugins { [Info("DropCleaner", "Crunchy", "1.0.4")] [Description("Automatically removes dropped items from the ground to prevent lag.")] public class DropCleaner : RustPlugin { private float cleanupDelay = 10f; protected override void LoadDefaultConfig() { PrintWarning("Creating a new configuration file with default settings."); Config["CleanupDelay"] = cleanupDelay; SaveConfig(); } private void OnServerInitialized() { cleanupDelay = GetConfig("CleanupDelay", cleanupDelay); Puts($"Drop cleanup delay set to {cleanupDelay} seconds."); } private void OnItemDropped(Item item, BaseEntity entity) { if (entity == null) return; timer.Once(cleanupDelay, () => { if (entity != null && !entity.IsDestroyed) entity.Kill(); }); } private T GetConfig(string key, T defaultValue) { if (Config[key] is T value) return value; Config[key] = defaultValue; SaveConfig(); return defaultValue; } } }