private void Load(String path)
 {
     try
     {
         this.Items = XObject <ZoneCollection> .Load(path);
     }
     catch
     {
     }
 }
Esempio n. 2
0
 public static ConfigPlugin Load()
 {
     try
     {
         return(XObject <ConfigPlugin> .Load(ConfigPlugin.ConfigFolder + ConfigPlugin.ConfigFile));
     }
     catch (Exception)
     {
         return(new ConfigPlugin());
     }
 }
Esempio n. 3
0
 public static StartupActions Load(String path)
 {
     try
     {
         return(XObject <StartupActions> .Load(path));
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 4
0
 public static XClass Load(String path)
 {
     try
     {
         return(XObject <XClass> .Load(path));
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 5
0
 public static BlockCollection Load(String path)
 {
     try
     {
         return(XObject <BlockCollection> .Load(path));
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 6
0
 protected void Load(String path)
 {
     try
     {
         this.Items = XObject <UserCollection> .Load(path);
     }
     catch
     {
         this.Items = new UserCollection();
     }
 }
Esempio n. 7
0
 public static ConfigLotto Load()
 {
     try
     {
         return(XObject <ConfigLotto> .Load(ConfigLotto.ConfigFolder + ConfigLotto.ConfigFile));
     }
     catch (Exception)
     {
         return(new ConfigLotto());
     }
 }
Esempio n. 8
0
 public static XPosition Load(String path)
 {
     try
     {
         return(XObject <XPosition> .Load(path));
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 9
0
 public static LottoUserCollection Load()
 {
     try
     {
         return(XObject <LottoUserCollection> .Load(ConfigLotto.ConfigFolder + ConfigLotto.LottoFile));
     }
     catch (Exception)
     {
         return(new LottoUserCollection());
     }
 }
Esempio n. 10
0
        public User(String name)
        {
            _name = name;
            try
            {
                Config cfg = XObject <Config> .Load(Config.ConfigFolder + Config.ConfigFile);

                balance = cfg.InitialCurrencyAmount;
            }
            catch
            {
            }
        }
Esempio n. 11
0
        public User(String name, bool generated)
        {
            _name          = name;
            this.Generated = generated;
            try
            {
                Config cfg = XObject <Config> .Load(Config.ConfigFolder + Config.ConfigFile);

                balance = cfg.InitialCurrencyAmount;
            }
            catch
            {
            }
        }
Esempio n. 12
0
        /// <summary>
        /// this is the execution method which gets executed later
        /// to get more arguments use the internal regArgs variable
        /// </summary>
        /// <param name="arg1">first argument after the command in the string</param>
        /// <param name="arg2">second argument after the command in the string</param>
        /// <param name="arg3">third argument after the command in the string</param>
        /// <param name="arg4">fourth argument after the command in the string</param>
        /// <returns>remember to set the command result in every return case</returns>
        public override CommandResult Execute(String arg1, String arg2, String arg3, String arg4)
        {
            try
            {
                ConfigLotto         config      = ConfigLotto.Load();
                LottoUserCollection _lottoUsers = XObject <LottoUserCollection> .Load(ConfigLotto.ConfigFolder + ConfigLotto.LottoFile);

                UserCollectionSingletone users = UserCollectionSingletone.GetInstance();
                return(new CommandResult(true, string.Format("The current Jackpot is §6{0} {1}", _lottoUsers.Jackpot, MinecraftHandler.Config.CurrencySymbol)));
            }
            catch
            {
                return(new CommandResult(true, string.Format("Lotto User list not found")));
            }
        }
Esempio n. 13
0
        public MinecraftHandler(String rules, String kits, String banlist, String playerlist, String adminlist, String config)
        {
            _strRulesList  = rules;
            _strBanList    = banlist;
            _strPlayerList = playerlist;
            try
            {
                Config = XObject <Config> .Load(Config.ConfigFolder + Config.ConfigFile);
            }
            catch
            {
                Config = new Config();
            }
            try
            {
                PricedBlocks = BlockCollection.Load(Config.ConfigFolder + BlockCollection.PricedBlocksFile);
                if (PricedBlocks == null)
                {
                    PricedBlocks = new BlockCollection();
                }
            }
            catch
            {
                PricedBlocks = new BlockCollection();
            }
            String badBlocksFile = Path.Combine(Config.ConfigFolder, BlockCollection.BadBlocksFile);

            if (!File.Exists(badBlocksFile))
            {
                new BlockCollection().Save(badBlocksFile);
            }

            Plugins = AddonLoader.GetInstance(this).Plugins;
            timerCommandReader.Interval = 1000;
            timerCommandReader.Enabled  = true;
        }
Esempio n. 14
0
        /// <summary>
        /// this is the execution method which gets executed later
        /// to get more arguments use the internal regArgs variable
        /// </summary>
        /// <param name="arg1">first argument after the command in the string</param>
        /// <param name="arg2">second argument after the command in the string</param>
        /// <param name="arg3">third argument after the command in the string</param>
        /// <param name="arg4">fourth argument after the command in the string</param>
        /// <returns>remember to set the command result in every return case</returns>
        public override CommandResult Execute(String arg1, String arg2, String arg3, String arg4)
        {
            try
            {
                ConfigLotto         config      = ConfigLotto.Load();
                LottoUserCollection _lottoUsers = XObject <LottoUserCollection> .Load(ConfigLotto.ConfigFolder + ConfigLotto.LottoFile);

                UserCollectionSingletone users = UserCollectionSingletone.GetInstance();

                if (ClientUser != null && ClientUser.LevelID != 0)
                {
                    if (!_lottoUsers.IsInList(TriggerPlayer))
                    {
                        if (ClientUser.Balance >= config.Price)
                        {
                            try
                            {
                                ClientUser.Balance -= config.Price;
                                int zahl = Convert.ToInt32(arg1);
                                if (zahl >= config.Min && zahl <= config.Max)
                                {
                                    LottoUser lottouser = new LottoUser(TriggerPlayer, zahl);
                                    _lottoUsers.Add(lottouser);
                                    _lottoUsers.Jackpot += config.Price;
                                    _lottoUsers.Save();
                                    Server.SendExecuteResponse(TriggerPlayer, string.Format("§{0}Your lucky number is §6{1}", MinecraftHandler.Config.ResponseColorChar, zahl));
                                    return(new CommandResult(true, string.Format("{0} participates lotto!", TriggerPlayer)));
                                }
                                else
                                {
                                    Server.SendExecuteResponse(TriggerPlayer, string.Format("Number must be between {0} - {1}", config.Min, config.Max));
                                }
                            }
                            catch
                            {
                                Server.SendExecuteResponse(TriggerPlayer, string.Format("Entered a wrong number!"));
                            }
                        }
                        else
                        {
                            Server.SendExecuteResponse(TriggerPlayer, string.Format("Not enough money!"));
                        }
                    }
                    else
                    {
                        Server.SendExecuteResponse(TriggerPlayer, string.Format("Allready participated!"));
                    }
                }
                else
                {
                    Server.SendExecuteResponse(TriggerPlayer, string.Format("You have no giro account!"));
                }
            }
            catch
            {
                Server.SendExecuteResponse(TriggerPlayer, string.Format("Lotto User list not found"));
            }


            return(new CommandResult(true, string.Format("{0} executed by {1}", Name, TriggerPlayer)));
        }