Exemplo n.º 1
0
        private static void OnCreate(Player p, Command cmd)
        {
            LifeHandler handler = new LifeHandler();

            if (!handler.CheckAndGetLifeZone(p, cmd))
            {
                return;
            }

            if (!handler.CheckWorldPermissions(p))
            {
                return;
            }

            if (handler.Life != null)
            {
                p.Message("&WLife with such name exists already, choose another");

                return;
            }

            p.SelectionStart(2, handler.LifeCreateCallback, null, Permission.DrawAdvanced);

            p.MessageNow("Select life zone: place/remove a block or type /Mark to use your location.");
        }
Exemplo n.º 2
0
        private static void OnSet(Player p, Command cmd)
        {
            LifeHandler handler = GetCheckedLifeHandler(p, cmd);

            if (handler == null)
            {
                return;
            }

            if (!handler.CheckChangePermissions(p))
            {
                return;
            }

            string paramStr = cmd.Next();

            if (String.IsNullOrWhiteSpace(paramStr))
            {
                p.Message("&WEmpty parameter name. &hAccepted names are " +
                          AllParams.ToString());

                return;
            }

            Param param = null;

            if (!Params.TryGetValue(paramStr, out param))
            {
                p.Message("&WUknown parameter name" + paramStr + ". " +
                          "&hAccepted names are " + AllParams.ToString());

                return;
            }

            string val = cmd.Next();

            if (String.IsNullOrWhiteSpace(val))
            {
                p.Message("&WEmpty value.");

                return;
            }

            param.SetValue(p, handler.Life, val);
        }
Exemplo n.º 3
0
        private static void OnStop(Player p, Command cmd)
        {
            LifeHandler handler = GetCheckedLifeHandler(p, cmd);

            if (handler == null)
            {
                return;
            }

            if (!handler.CheckChangePermissions(p))
            {
                return;
            }

            handler.Life.Stop();

            p.Message("&yLife " + handler.Life.Name + " is stopped");
        }
Exemplo n.º 4
0
        private static LifeHandler GetCheckedLifeHandler(Player p, Command cmd)
        {
            LifeHandler handler = new LifeHandler();

            if (!handler.CheckAndGetLifeZone(p, cmd))
            {
                return(null);
            }

            if (handler.Life == null)
            {
                p.Message("&WLife " + handler.Name + " does not exist.");

                return(null);
            }

            return(handler);
        }
Exemplo n.º 5
0
        private static void OnPrint(Player p, Command cmd)
        {
            LifeHandler handler = GetCheckedLifeHandler(p, cmd);

            if (handler == null)
            {
                return;
            }

            Life2DZone l = handler.Life;

            p.Message("&y" + l.Name + ": " + (l.Stopped ? "stopped" : "started") +
                      ", delay " + l.Delay +
                      ", intermediate delay " + l.HalfStepDelay + ", is" + (l.Torus ? "" : " not") + " on torus, " +
                      "auto reset strategy is " + Enum.GetName(typeof(AutoResetMethod), l.AutoReset) +
                      ", owner is " + l.CreatorName +
                      ", changable by " + l.MinRankToChange +
                      ", block types: " + l.Normal + " is normal, " + l.Empty + " is empty, " + l.Dead + " is dead, " + l.Newborn + " is newborn");
        }