From 3486a287590db9a9ab17d5d3b3fe2e0a09ddd27c Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 16 Dec 2017 11:00:26 +0000 Subject: [PATCH] [server] Add plane create CLI command --- Nibriboard/CommandConsole.cs | 19 +++++++++++++++++++ Nibriboard/RippleSpace/RippleSpaceManager.cs | 1 - 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Nibriboard/CommandConsole.cs b/Nibriboard/CommandConsole.cs index 6a1c490..f615e6b 100644 --- a/Nibriboard/CommandConsole.cs +++ b/Nibriboard/CommandConsole.cs @@ -64,6 +64,7 @@ namespace Nibriboard await destination.WriteLineAsync(" help Show this message"); await destination.WriteLineAsync(" save Save the ripplespace to disk"); await destination.WriteLineAsync(" plane list List all the currently loaded planes"); + await destination.WriteLineAsync(" plane create {new-plane-name} [{chunkSize}] Create a new named plane, optionally with the specified chunk size."); break; case "save": await destination.WriteAsync("Saving ripple space - "); @@ -85,6 +86,24 @@ namespace Nibriboard 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; + case "create": + if(commandParts.Length < 3) { + await destination.WriteLineAsync("Error: No name specified for the new plane!"); + return; + } + string newPlaneName = commandParts[2].Trim(); + int chunkSize = server.PlaneManager.DefaultChunkSize; + if(commandParts.Length >= 4) + chunkSize = int.Parse(commandParts[3]); + + server.PlaneManager.CreatePlane(new PlaneInfo( + newPlaneName, + chunkSize + )); + + await destination.WriteLineAsync($"Created plane with name {newPlaneName} and chunk size {chunkSize}."); + break; default: await destination.WriteLineAsync($"Error: Unknown sub-action {subAction}."); diff --git a/Nibriboard/RippleSpace/RippleSpaceManager.cs b/Nibriboard/RippleSpace/RippleSpaceManager.cs index 33d650d..648ce54 100644 --- a/Nibriboard/RippleSpace/RippleSpaceManager.cs +++ b/Nibriboard/RippleSpace/RippleSpaceManager.cs @@ -131,7 +131,6 @@ namespace Nibriboard.RippleSpace await Task.Delay(MaintenanceInternal); } - } public async Task Save()