private void frmCmdLevels_Load(object sender, EventArgs e) { parent = (frmMain)this.Owner; int ypos = 0; foreach (KeyValuePair<string, Command> kvp in Program.commands) { Label lblCommand = new Label(); lblCommand.Text = kvp.Key; lblCommand.Parent = panelCommands; lblCommand.Location = new Point(0, ypos + 3); lblCommand.Size = new Size(50, 25); lblCommand.Anchor = AnchorStyles.Left | AnchorStyles.Top; ComboBox cbCommandRank = new ComboBox(); cbCommandRank.Parent = panelCommands; cbCommandRank.Location = new Point(60, ypos); cbCommandRank.Size = new Size(400, 25); cbCommandRank.DropDownStyle = ComboBoxStyle.DropDownList; foreach (KeyValuePair<string, int> kv in Program.ranklevels) { if (kv.Key == "banned") continue; cbCommandRank.Items.Add(kv.Value.ToString() + " (" + kv.Key + ")"); if (kv.Value == kvp.Value.minlevel) { cbCommandRank.SelectedIndex = cbCommandRank.Items.Count - 1; } } cbCommandRank.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; curRanks.Add(kvp.Key, cbCommandRank); ypos += 25; } }
private void frmIPBans_Load(object sender, EventArgs e) { parent = (frmMain)this.Owner; Program.LoadBannedIPs(); foreach (string str in Program.bannedIPs) lbIPBans.Items.Add(str); }
private void frmBlocksMangement_Load(object sender, EventArgs e) { parent = (frmMain)this.Owner; Program.LoadBlockList(); rbWhitelist.Checked = Program.blockLevelsIsWhitelist; foreach (KeyValuePair<int, int> kvp in Program.blockLevels) { lvBlocks.Items.Add(new ListViewItem(new string[] { kvp.Key.ToString(), Program.blockIDEnum[kvp.Key], kvp.Value.ToString() })); } }
private void frmKitItemAddEdit_Load(object sender, EventArgs e) { parentparent = (frmMain)this.Owner.Owner; parent = (frmKits)this.Owner; foreach (string item in Program.blockEnum.Keys) { cbItem.Items.Add(item); } if (boundItem != null) { cbItem.Text = boundItem.SubItems[1].Text; numAmount.Value = Convert.ToInt32(boundItem.SubItems[2].Text); } }
private void frmBlockManegementAdd_Load(object sender, EventArgs e) { parentparent = (frmMain)this.Owner.Owner; parent = (frmBlocksMangement)this.Owner; foreach (string item in Program.blockEnum.Keys) { cbItem.Items.Add(item); } foreach (KeyValuePair<string, int> kv in Program.ranklevels) { if (kv.Key == "banned") continue; cbRank.Items.Add(kv.Value.ToString() + " (" + kv.Key + ")"); if (kv.Key == Program.GetServerProperty("default-rank","guest")) { cbRankDef = cbRank.Items.Count - 1; } if (boundItem != null && kv.Value.ToString() == boundItem.SubItems[2].Text) { cbRank.SelectedIndex = cbRank.Items.Count - 1; } } if (boundItem != null) { cbItem.Text = boundItem.SubItems[1].Text; } else { cbRank.SelectedIndex = cbRankDef; } }
private void frmProperties_Load(object sender, EventArgs e) { parent = (frmMain)this.Owner; Program.ReloadServerProperties(); tbPort.Text = Program.GetServerProperty("server-port-real","25565"); tbLevel.Text = Program.GetServerProperty("level-name","world"); tbIntPort.Text = Program.GetServerProperty("server-port", "25566"); tbSrvName.Text = Program.GetServerProperty("server-name", "MCAdmin Server"); numMemory.Value = Convert.ToInt32(Program.GetServerProperty("assigned-memory", "1024")); numAS.Value = Convert.ToInt32(Program.GetServerProperty("autosave-delay", "60")); numBackup.Value = Convert.ToInt32(Program.GetServerProperty("backup-delay", "120")); numMaxPlayers.Value = Convert.ToInt32(Program.GetServerProperty("max-players", "20")); tbRCONPass.Text = Program.GetServerProperty("rcon-pass", "changeme"); tbRCONPort.Text = Program.GetServerProperty("rcon-port", "25567"); cbRCONEnable.Checked = (Program.GetServerProperty("rcon-enable", "false").ToLower() == "true"); cbMonsters.Checked = (Program.GetServerProperty("monsters", "false").ToLower() == "true"); cbHellworld.Checked = (Program.GetServerProperty("hellworld", "false").ToLower() == "true"); foreach (string rankname in Program.ranklevels.Keys) { cbDefRank.Items.Add(rankname); } cbDefRank.Text = Program.GetServerProperty("default-rank", "guest"); cbIP.Items.Add("0.0.0.0"); cbOnline.Checked = (Program.GetServerProperty("online-mode", "true").ToLower() == "true"); foreach(NetworkInterface iface in NetworkInterface.GetAllNetworkInterfaces()) { foreach (IPAddressInformation ipaddrinfo in iface.GetIPProperties().UnicastAddresses) { IPAddress ipaddr = ipaddrinfo.Address; if ((!IPAddress.IsLoopback(ipaddr)) && ipaddr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { cbIP.Items.Add(ipaddr.ToString()); } } } cbIP.Text = Program.GetServerProperty("server-ip-real", "0.0.0.0"); if (cbIP.Text == "") cbIP.Text = "0.0.0.0"; cbRCONEnable_CheckedChanged(null, null); }
private void frmKitShare_Load(object sender, EventArgs e) { parentparent = (frmMain)this.Owner; //parent = (frmKits)this.Owner; btnRefresh_Click(null, null); }
private void frmRanks_Load(object sender, EventArgs e) { parent = (frmMain)this.Owner; string tmptag = ""; foreach (KeyValuePair<string, int> kv in Program.ranklevels) { if (Program.ranktags.ContainsKey(kv.Key)) tmptag = Program.ranktags[kv.Key]; else tmptag = ""; lvRanks.Items.Add(new ListViewItem(new string[] { kv.Key, kv.Value.ToString(), tmptag })); } }
private void frmKits_Load(object sender, EventArgs e) { SetExtended(false); parent = (frmMain)this.Owner; foreach (KeyValuePair<string, int> kv in Program.ranklevels) { if (kv.Key == "banned") continue; cbReqLevel.Items.Add(kv.Value.ToString() + " (" + kv.Key + ")"); if (kv.Key == Program.GetServerProperty("default-rank", "guest")) { cbReqLevelDef = cbReqLevel.Items.Count - 1; cbReqLevel.SelectedIndex = cbReqLevelDef; } } foreach (Kit k in Program.kits) { cbKit.Items.Add(k); } }
static void Main(string[] args) { MCAdmin.Heartbeats.PostRequest.DisableCertValidation(); try { lineBorder = "=".PadLeft(Console.BufferWidth, '='); } catch { } foreach (string arg in args) { string argtl = arg.Trim().ToLower(); if (argtl.Contains("noupdate")) dontUpdate = true; else if (argtl.Contains("nojarupdate")) dontUpdateJAR = true; else if (argtl.Contains("console")) consoleOnly = true; else if (argtl.Contains("autostart") || argtl.Contains("autorun")) autoStartServer = true; } Console.Title = "MCAdmin (c) by Doridian 2010"; Console.Out.WriteLine("Welcome to MCAdmin!"); Console.Out.Write(lineBorder); Console.Out.WriteLine("You can use \"start\" to start the server, \"stop\" to stop the server, \"kill\" to kill the server, \"exit\" to exit MCAdmin. Any other commands gets forwarded to the server console."); Console.Out.WriteLine(lineBorder); new Thread(new ThreadStart(BootThread)).Start(); if (!consoleOnly) { try { IntPtr conWnd = GetConsoleWindow(); if (conWnd != IntPtr.Zero) { ShowWindow(conWnd, 0); } } catch { } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); mainFrm = new frmMain(); Application.Run(mainFrm); return; } frmMainReady = true; PlayerConsole ply = new PlayerConsole(); char[] splitter = new char[] { ' ' }; while (true) { try { string line = Console.In.ReadLine().Trim(); string[] ltls = line.Split(splitter); string ltl = ltls[0].ToLower(); if (ltl == "start") StartServer(); else if (ltl == "stop") StopServer(); else if (ltl == "kill") KillServer(); else if (ltl == "exit") { KillServer(); Environment.Exit(0); } else if (commands.ContainsKey(ltl)) commands[ltl].Run(ply, ltls); else SendServerCommand(line); } catch { Console.Out.WriteLine("Command error!"); } } }
private void frmRanks_Load(object sender, EventArgs e) { parent = (frmMain)this.Owner; foreach (KeyValuePair<string, string> kv in Program.plyranks) { lvRanks.Items.Add(new ListViewItem(new string[] { kv.Key, kv.Value })); } foreach (string rankname in Program.ranklevels.Keys) { cbRank.Items.Add(rankname); } if (Program.minecraftFirewall != null) { foreach (Player ply in Program.minecraftFirewall.players) { if (ply.name == null || ply.name == "") continue; cbPlayer.Items.Add(ply.name); } } cbRank.SelectedIndex = 0; }