Example #1
0
 private static void LifeHandlerFunc(Player p, Command cmd)
 {
     try {
         if (!cmd.HasNext)
         {
             p.Message("&H/Life <command> <params>. Commands are Help, Create, Delete, Start, Stop, Set, List, Print");
             p.Message("Type /Life help <command> for more information");
             return;
         }
         LifeHandler.ProcessCommand(p, cmd);
     } catch (Exception e) {
         p.Message("Error: " + e.Message);
     }
 }
Example #2
0
        private static void OnStop(Player p, Command cmd)
        {
            LifeHandler handler = GetCheckedLifeHandler(p, cmd);

            if (null == handler)
            {
                return;
            }
            if (!handler.CheckChangePermissions(p))
            {
                return;
            }
            handler._life.Stop();
            p.Message("&yLife " + handler._life.Name + " is stopped");
        }
Example #3
0
        private static LifeHandler GetCheckedLifeHandler(Player p, Command cmd)
        {
            LifeHandler handler = new LifeHandler();

            if (!handler.CheckAndGetLifeZone(p, cmd))
            {
                return(null);
            }
            if (null == handler._life)
            {
                p.Message("&WLife " + handler._name + " does not exist.");
                return(null);
            }
            return(handler);
        }
Example #4
0
        private static void OnPrint(Player p, Command cmd)
        {
            LifeHandler handler = GetCheckedLifeHandler(p, cmd);

            if (null == handler)
            {
                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");
        }
Example #5
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 (null != handler._life)
            {
                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.");
        }
Example #6
0
        private static void OnSet(Player p, Command cmd)
        {
            LifeHandler handler = GetCheckedLifeHandler(p, cmd);

            if (null == handler)
            {
                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;

            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);
        }
Example #7
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 (null!=handler._life)
            {
                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.");
        }
Example #8
0
 private static LifeHandler GetCheckedLifeHandler(Player p, Command cmd)
 {
     LifeHandler handler = new LifeHandler();
     if (!handler.CheckAndGetLifeZone(p, cmd))
         return null;
     if (null == handler._life)
     {
         p.Message("&WLife " + handler._name + " does not exist.");
         return null;
     }
     return handler;
 }