using Oxide.Core; using Oxide.Core.Libraries; using Rust; using System.Collections.Generic; using System.ComponentModel; using System.Numerics; using System.Runtime.InteropServices; using System.Security; using System.Xml.Linq; namespace Oxide.Plugins { [Info("DisableIndustrialConveyor", "Tacman", "1.5.2")] [Description("Disables placement of Industrial Conveyors on the server.")] public class DisableIndustrialConveyor : RustPlugin { private void OnServerInitialized() { permission.RegisterPermission("disableindustrialconveyor.bypass", this); // Define the translations for each language Dictionary> messages = new Dictionary> { ["en"] = new Dictionary { ["NotAllowed"] = "Industrial Conveyors are disabled on this server." }, ["fr"] = new Dictionary { ["NotAllowed"] = "Les transporteurs industriels sont désactivés sur ce serveur." }, ["de"] = new Dictionary { ["NotAllowed"] = "Industrieförderer sind auf diesem Server deaktiviert." }, ["es"] = new Dictionary { ["NotAllowed"] = "Los transportadores industriales están desactivados en este servidor." }, ["ru"] = new Dictionary { ["NotAllowed"] = "Промышленные конвейеры отключены на этом сервере." }, ["zh"] = new Dictionary { ["NotAllowed"] = "本服务器禁止使用工业传送带。" }, ["nl"] = new Dictionary { ["NotAllowed"] = "Industriële transportbanden zijn uitgeschakeld op deze server." }, ["pt"] = new Dictionary { ["NotAllowed"] = "Transportadores Industriais estão desativados neste servidor." }, ["ja"] = new Dictionary { ["NotAllowed"] = "このサーバーでは産業用コンベアを設置できません。" }, ["pt-br"] = new Dictionary { ["NotAllowed"] = "Transportadores Industriais estão desativados neste servidor." }, ["sv"] = new Dictionary { ["NotAllowed"] = "Industriella transportörer är inaktiverade på denna server." }, ["fi"] = new Dictionary { ["NotAllowed"] = "Teollisuusliukuhihnat ovat poistettu käytöstä tällä palvelimella." }, ["no"] = new Dictionary { ["NotAllowed"] = "Industrielle transportører er deaktivert på denne serveren." }, ["da"] = new Dictionary { ["NotAllowed"] = "Industrielle transportbånd er deaktiveret på denne server." } }; // Loop through each language and create the language file if it doesn't exist foreach (string code in messages.Keys) { string fileName = $"{code}.json"; string filePath = $"{Interface.Oxide.LangDirectory}/{Name}/{fileName}"; // Create the language file if it doesn't exist if (!Interface.Oxide.DataFileSystem.ExistsDatafile(filePath)) { lang.RegisterMessages(messages[code], this, code); Puts($"Created {code} language file."); } } } private object CanBuild(Planner planner, Construction prefab) { if (prefab.fullName.Contains("industrialconveyor")) { var player = planner.GetOwnerPlayer(); if (player != null && !permission.UserHasPermission(player.UserIDString, "disableindustrialconveyor.bypass")) { player.ChatMessage(lang.GetMessage("NotAllowed", this, player.UserIDString)); return false; } } return null; } } }