1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Sete up infrastructure for sub-actions to the plane action in the command console

This commit is contained in:
Starbeamrainbowlabs 2017-12-15 23:40:38 +00:00
parent 8b602f1aed
commit 80da550b08
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -61,9 +61,9 @@ namespace Nibriboard
await destination.WriteLineAsync("Nibriboard Server Command Console"); await destination.WriteLineAsync("Nibriboard Server Command Console");
await destination.WriteLineAsync("================================="); await destination.WriteLineAsync("=================================");
await destination.WriteLineAsync("Available commands:"); await destination.WriteLineAsync("Available commands:");
await destination.WriteLineAsync(" help Show this message"); await destination.WriteLineAsync(" help Show this message");
await destination.WriteLineAsync(" save Save the ripplespace to disk"); await destination.WriteLineAsync(" save Save the ripplespace to disk");
await destination.WriteLineAsync(" planes List all the currently loaded planes"); await destination.WriteLineAsync(" plane list List all the currently loaded planes");
break; break;
case "save": case "save":
await destination.WriteAsync("Saving ripple space - "); await destination.WriteAsync("Saving ripple space - ");
@ -71,12 +71,25 @@ namespace Nibriboard
await destination.WriteLineAsync("done."); await destination.WriteLineAsync("done.");
await destination.WriteLineAsync($"Save is now {BytesToString(server.PlaneManager.LastSaveFileSize)} in size."); await destination.WriteLineAsync($"Save is now {BytesToString(server.PlaneManager.LastSaveFileSize)} in size.");
break; break;
case "planes": case "plane":
await destination.WriteLineAsync("Planes:"); if(commandParts.Length < 2) {
foreach(Plane plane in server.PlaneManager.Planes) await destination.WriteLineAsync("Error: No sub-action specified.");
await destination.WriteLineAsync($" {plane.Name} @ {plane.ChunkSize} ({plane.LoadedChunks} / ~{plane.SoftLoadedChunkLimit} chunks loaded, {plane.UnloadableChunks} inactive)"); break;
await destination.WriteLineAsync(); }
await destination.WriteLineAsync($"Total {server.PlaneManager.Planes.Count}"); string subAction = commandParts[1].Trim();
switch(subAction)
{
case "list":
await destination.WriteLineAsync("Planes:");
foreach(Plane plane in server.PlaneManager.Planes)
await destination.WriteLineAsync($" {plane.Name} @ {plane.ChunkSize} ({plane.LoadedChunks} / ~{plane.SoftLoadedChunkLimit} chunks loaded, {plane.UnloadableChunks} inactive)");
await destination.WriteLineAsync();
await destination.WriteLineAsync($"Total {server.PlaneManager.Planes.Count}");
break;
default:
await destination.WriteLineAsync($"Error: Unknown sub-action {subAction}.");
break;
}
break; break;
default: default: