private static bool Jail_OnCommand(CommandEventArgs e)
 {
     if (e.Length == 1 && e.GetInt32(0) != 0)
     {
         if (e.Target != null && e.Target is Character)
         {
             Jail.JailCharacter(e.Target as Character, 0, 0, e.GetInt32(0));
             e.Player.SendMessage(String.Format("Player '{0}' successfully jailed on {1} minutes.", (e.Target as Character).Name, e.GetInt32(0)));
             return(true);
         }
     }
     if (e.Length == 2 && e.GetInt32(0) != 0)
     {
         if (e.Target != null && e.Target is Character)
         {
             Jail.JailCharacter(e.Target as Character, 0, e.GetInt32(0), e.GetInt32(1));
             e.SendMessage(String.Format("Player '{0}' successfully jailed on {1} hours {2} minutes.", (e.Target as Character).Name, e.GetInt32(0), e.GetInt32(1)));
             return(true);
         }
     }
     if (e.Length == 3 && e.GetInt32(0) != 0)
     {
         if (e.Target != null && e.Target is Character)
         {
             Jail.JailCharacter(e.Target as Character, e.GetInt32(0), e.GetInt32(1), e.GetInt32(2));
             e.Player.SendMessage(String.Format("Player '{0}' successfully jailed on {1} days {2} hours {3} minutes.", (e.Target as Character).Name, e.GetInt32(0), e.GetInt32(1), e.GetInt32(3)));
             return(true);
         }
     }
     e.Player.SendMessage("Usage : .Jail <Minutes>");
     e.Player.SendMessage("Usage : .Jail <Hours> <Minutes>");
     e.Player.SendMessage("Usage : .Jail <Days> <Hours> <Minutes>");
     return(false);
 }
        private static bool UnJail_OnCommand(CommandEventArgs e)
        {
            Character m = e.Target as Character;

            foreach (JailInfo info in Jail.JailInfo)
            {
                if (info.Character == m)
                {
                    Jail.UnJailCharacter(m);
                    return(true);
                }
            }
            e.SendMessage("Character '{0}' isn't jailed.", m.Name);
            return(true);
        }
 public override void OnTick()
 {
     if (Jail.JailInfo.Count > 0)
     {
         for (int i = 0; i < Jail.JailInfo.Count; i++)
         {
             JailInfo info = Jail.JailInfo[i] as JailInfo;
             if (info.Character != null)
             {
                 if (info.Character.Distance(Jail.X, Jail.Y, Jail.Z) > (Jail.Range * Jail.Range) || info.Character.MapId != Jail.MapId)
                 {
                     if (World.allConnectedChars.Contains(info.Character))
                     {
                         info.Character.Teleport(Jail.X, Jail.Y, Jail.Z, Jail.MapId);
                     }
                     else
                     {
                         info.Character.X     = Jail.X;
                         info.Character.Y     = Jail.Y;
                         info.Character.Z     = Jail.Z;
                         info.Character.MapId = Jail.MapId;
                     }
                     info.Character.SendMessage("Where are you going?");
                     info.Character.SendMessage(String.Format("You have been jailed {0}.{1}.{2} {3}:{4}:{5} on {6} days, {7} hours, {8} minutes", info.JailedDate.Day, info.JailedDate.Month, info.JailedDate.Year, info.JailedDate.Hour, info.JailedDate.Minute, info.JailedDate.Second, info.JailTime.Days, info.JailTime.Hours, info.JailTime.Minutes));
                 }
                 if ((info.JailedDate + info.JailTime) <= DateTime.Now)
                 {
                     Jail.UnJailCharacter(info.Character);
                     i--;
                 }
             }
             else
             {
                 Jail.JailInfo.RemoveAt(i);
                 i--;
             }
         }
     }
     if (Jail.JailInfo.Count <= 0)
     {
         this.Stop();
     }
 }