Example #1
0
        private object CanCraft(ItemCrafter itemCrafter, ItemBlueprint bp, int amount)
        {
            var player = itemCrafter.GetComponent <BasePlayer>();
            var item   = bp.GetComponent <ItemDefinition>();

            if (permission.UserHasPermission(player.UserIDString, Perm))
            {
                return(null);
            }

            if (CFile.BlockAll.Enabled)
            {
                if (CFile.BlockAll.SendMessage)
                {
                    PrintToChat(player, Lang(Msg.CraftingDisabled, player.UserIDString));
                }
                return(false);
            }

            if (CFile.BlockedItems.ContainsKey(item.shortname))
            {
                if (CFile.BlockedItems[item.shortname])
                {
                    PrintToChat(player, Lang(Msg.CantCraft, player.UserIDString, item.displayName.english));
                }
                return(false);
            }

            return(null);
        }
Example #2
0
        bool CanCraft(ItemCrafter itemCrafter, ItemBlueprint bp, int amount)
        {
            var player = itemCrafter.GetComponent <BasePlayer>();
            var item   = bp.GetComponent <ItemDefinition>();

            if (player == null || item == null)
            {
                return(false);
            }

            if (permission.UserHasPermission(player.UserIDString, perm1))
            {
                return(true);
            }

            if (permission.UserHasPermission(player.UserIDString, perm2))
            {
                SendReply(player, "You are not allowed to craft at all");
                return(false);
            }

            if (blacklist.Contains(item.shortname))
            {
                SendReply(player, "You are not allowed to craft <color=#eb4034>" + item.shortname + "</color>");
                return(false);
            }

            return(true);
        }