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

[server] Add plane create CLI command

This commit is contained in:
Starbeamrainbowlabs 2017-12-16 11:00:26 +00:00
parent 80da550b08
commit 3486a28759
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 19 additions and 1 deletions

View file

@ -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}.");

View file

@ -131,7 +131,6 @@ namespace Nibriboard.RippleSpace
await Task.Delay(MaintenanceInternal);
}
}
public async Task Save()