using Oxide.Core; using Oxide.Core.Configuration; using Oxide.Game.Rust.Libraries; using System.Collections.Generic; namespace Oxide.Plugins { [Info("Blueprint Only", "MiaygawaYuu", "0.5.4")] [Description("Blueprint Only Plugin")] public class BlueprintOnly : RustPlugin { protected override void LoadDefaultMessages() { lang.RegisterMessages(new Dictionary { ["BP Notify"] = "{0} learned {1}.", ["Workbench Block Notify"] = "The tech tree cannot be opened at the workbench.", ["ResearchTable Block Notify"] = "Research tables are not available." }, this); lang.RegisterMessages(new Dictionary { ["BP Notify"] = "{0} さんが {1} をおぼえました。", ["Workbench Block Notify"] = "ワークベンチでのテックツリーのカイホウはできません。", ["ResearchTable Block Notify"] = "リサーチテーブルはつかえません。" }, this, "ja"); } private void Init() { //Permissions permission.RegisterPermission("blueprintonly.notify.bypass", this); permission.RegisterPermission("blueprintonly.research.use", this); permission.RegisterPermission("blueprintonly.workbench.use", this); } //Use Research Table Block object CanResearchItem(BasePlayer player, Item targetItem) { if (!permission.UserHasPermission(player.UserIDString, "blueprintonly.research.use")) { string _message = lang.GetMessage("ResearchTable Block Notify", this, player.UserIDString); PrintToChat(player,_message); return false; }else{ return null; } } //Use Workbench Block object CanUnlockTechTreeNode(BasePlayer player, TechTreeData.NodeInstance node, TechTreeData techTree) { if (!permission.UserHasPermission(player.UserIDString, "blueprintonly.workbench.use")) { string _message = lang.GetMessage("Workbench Block Notify", this, player.UserIDString); PrintToChat(player,_message); return false; }else{ return null; } } //Use Blueprint Notify object OnItemAction(Item item, string action, BasePlayer player) { if (action == "study") { if (!player.PersistantPlayerInfo.unlockedItems.Contains(item.blueprintTargetDef.itemid)) { if (!permission.UserHasPermission(player.UserIDString, "blueprintonly.notify.bypass")) { string _message = lang.GetMessage("BP Notify", this, player.UserIDString); string message = string.Format(_message, player.displayName, item.blueprintTargetDef.displayName.english); PrintToChat(message); } } } return null; } } }