public override void Use(Player p, string message) { switch (message) { case "": // To prevent '/server' from causing an error message Help(p); break; case "restart": case "update": case "shutdown": Command.all.Find(message).Use(p, ""); //Will use other options later. break; case "public": Server.pub = true; Player.SendMessage(p, "Server is now public!"); Server.s.Log("Server is now public!"); break; case "private": Server.pub = false; Player.SendMessage(p, "Server is now private!"); Server.s.Log("Server is now private!"); break; case "reset": //made so ONLY the owner or console can use this command. if (p != null && !Server.server_owner.ToLower().Equals(p.name.ToLower()) || Server.server_owner.Equals("Notch")) { p.SendMessage("Sorry. You must be the Server Owner or Console to reset the server."); return; } //restting to default properties is dangerous... but recoverable. //We save the old files to <name>.bkp, then delete them. //Files needed: // Property files // Group // Server // Rank // Command Player.SendMessage(p, "Backing up and deleting current property files."); foreach (string name in Directory.GetFiles("properties")) { File.Copy(name, name + ".bkp"); // create backup first. File.Delete(name); } Player.SendMessage(p, "Done! Restoring defaults..."); //We set he defaults here, then go to reload the settings. setToDefault(); goto case "reload"; case "reload": // For security, only the owner and Console can use this. if (p != null && !Server.server_owner.ToLower().Equals(p.name.ToLower()) || Server.server_owner.Equals("Notch")) { p.SendMessage("Sorry. You must be the Server Owner or Console to reload the server settings."); return; } Player.SendMessage(p, "Reloading settings..."); Server.LoadAllSettings(); Player.SendMessage(p, "Settings reloaded! You may need to restart the server, however."); break; case "backup": case "backup all": // Backup Everything. // Create SQL statements for this. The SQL will assume the settings for the current configuration are correct. // This means we use the currently defined port, database, user, password, and pooling. // Also important to save everything to a .zip file (Though we can rename the extention.) // When backing up, one option is to save all non-main program files. // This means all folders, and files in these folders. Player.SendMessage(p, "Server backup (Everything): Started.\n\tPlease wait while backup finishes."); Save(true, p); break; case "backup db": // Backup database only. // Create SQL statements for this. The SQL will assume the settings for the current configuration are correct. // This means we use the currently defined port, database, user, password, and pooling. // Also important to save everything to a .zip file (Though we can rename the extention.) // When backing up, one option is to save all non-main program files. // This means all folders, and files in these folders. Player.SendMessage(p, "Server backup (Database): Started.\n\tPlease wait while backup finishes."); Save(false, true, p); break; case "backup allbutdb": // Important to save everything to a .zip file (Though we can rename the extention.) // When backing up, one option is to save all non-main program files. // This means all folders, and files in these folders. Player.SendMessage(p, "Server backup (Everything but Database): Started.\n\tPlease wait while backup finishes."); Save(false, p); break; case "restore": if (p != null && !Server.server_owner.ToLower().Equals(p.name.ToLower()) || Server.server_owner.Equals("Notch")) { p.SendMessage("Sorry. You must be the defined Server Owner or Console to restore the server."); return; } Thread extract = new Thread(new ParameterizedThreadStart(ExtractPackage)); extract.Start(p); break; default: Player.SendMessage(p, "/server " + message + " is not currently implemented."); goto case ""; //case "help": // Help(p); // break; } }