예제 #1
0
        /// <summary>
        /// Creates a function which runs on a player if they have they get a score of the given type
        /// </summary>
        /// <param name="objectiveType">The score objective type. (See <see cref="ID.Objective"/> for a list of objectives)</param>
        /// <param name="functionName">The name of the function</param>
        /// <param name="setting">The setting used for writing the function file</param>
        /// <param name="runForEachScore">True if it should run the function for each number in the score. False if it only should run the function once when the score is higher than 1.</param>
        /// <returns>The newly created function</returns>
        public Function EventFunction(string objectiveType, bool runForEachScore = false, string?functionName = null, BaseFile.WriteSetting setting = BaseFile.WriteSetting.LockedAuto)
        {
            Function outFunction = Function(functionName, setting);

            Datapack.GetItems <SharpCraftFiles>().AddObjectiveEventFunction(outFunction, objectiveType, runForEachScore);

            return(outFunction);
        }
예제 #2
0
 /// <summary>
 /// Creates a new namespace in a datapack
 /// </summary>
 /// <param name="datapack">The datapack to add the namespace to</param>
 /// <param name="namespaceName">the name of the namespace</param>
 public PackNamespace(BaseDatapack datapack, string namespaceName) : base(datapack, namespaceName)
 {
     Datapack.FileCreator.CreateDirectory(Datapack.GetDataPath() + Name);
 }