Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if player became Operator.
        /// Returns false if player's Operator status was removed.
        /// </summary>
        /// <returns></returns>
        public bool ToggleOperatorStatus()
        {
            string savename = ServerSettings.OnlineMode ? Uuid : Username;

            IsOperator = OperatorLoader.Toggle(savename.ToLower());
            return(IsOperator);
        }
Ejemplo n.º 2
0
        internal void InitializePlayer()
        {
            if (!Loaded)
            {
                LoadPlayer();
                string savename = ServerSettings.OnlineMode ? Uuid : Username;
                IsOperator = OperatorLoader.IsOperator(savename);
            }

            var chunks = Level.Generator.GenerateChunks((ViewDistance * 21), _chunksUsed, this);

            new MapChunkBulk(Wrapper)
            {
                Chunks = chunks.ToArray()
            }.Write();

            new PlayerPositionAndLook(Wrapper)
            {
                X = KnownPosition.X, Y = KnownPosition.Y, Z = KnownPosition.Z, Yaw = KnownPosition.Yaw, Pitch = KnownPosition.Pitch
            }.Write();

            IsSpawned = true;
            Level.AddPlayer(this);
            Wrapper.Player.Inventory.SendToPlayer();
            BroadcastEquipment();
            SetGamemode(Gamemode, true);
            Globals.PluginManager.HandlePlayerJoin(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// </summary>
        /// <param name="assembly"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="assembly"/> is <see langword="null"/>.</para>
        /// </exception>
        public static OperatorsCache FromAssembly(Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            OperatorsCache cache = new OperatorsCache();

            cache._operators = OperatorLoader.LoadOperatorsFromAssembly(assembly);
            return(cache);
        }
Ejemplo n.º 4
0
        public void DescriptorTest()
        {
            Dictionary <String, OperatorDescriptor> operators = OperatorLoader.LoadOperatorsFromType(typeof(Operators));

            OperatorDescriptor addOperator = operators["+"];

            Assert.AreEqual("Add", addOperator.Name);
            Assert.AreEqual("+", addOperator.StringRepresentation);
            ParameterInfo[] paramsInfo = addOperator.GetInputParameters();
            Assert.AreEqual(addOperator.InputParameterCount, paramsInfo.Length);
            Assert.AreEqual(2, addOperator.InputParameterCount);

            OperatorDescriptor substractOperator = operators["-"];

            Assert.AreEqual("Substract", substractOperator.Name);
            Assert.AreEqual("-", substractOperator.StringRepresentation);
        }
Ejemplo n.º 5
0
 public EquationMaker()
 {
     // first get all operators available
     Operators = OperatorLoader.LoadOperators();
 }
Ejemplo n.º 6
0
        public void LoadOperatorsFromTypeTest()
        {
            Dictionary <String, OperatorDescriptor> operators = OperatorLoader.LoadOperatorsFromType(typeof(Operators));

            LoadOperatorsInternalTest(operators);
        }
Ejemplo n.º 7
0
        public void LoadOperatorsFromAssemblyTest()
        {
            Dictionary <String, OperatorDescriptor> operators = OperatorLoader.LoadOperatorsFromAssembly(Assembly.GetExecutingAssembly());

            LoadOperatorsInternalTest(operators);
        }
Ejemplo n.º 8
0
 public void LoadOperatorsFromAssemblyArgumentNullExceptionTest()
 {
     OperatorLoader.LoadOperatorsFromAssembly(null);
 }
Ejemplo n.º 9
0
 public void LoadOperatorsFromTypeArgumentNullExceptionTest()
 {
     OperatorLoader.LoadOperatorsFromType(null);
 }