-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs, improve provisioning and command plugins.
- Loading branch information
Showing
29 changed files
with
379 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using BitMod.Events.Base; | ||
|
||
namespace BitMod.Events.Core; | ||
|
||
public class StandardInputEventArgs : IEventArgs | ||
{ | ||
public StandardInputEventArgs(string contents) | ||
{ | ||
Contents = contents; | ||
} | ||
|
||
public string Contents { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using BitMod.Commands.Attributes; | ||
using BitMod.Commands.Sources; | ||
|
||
namespace BitMod.Commands.Builtin; | ||
|
||
public class HelloCommand | ||
{ | ||
|
||
[BitCommand("hello", "Say Hello")] | ||
public async Task OnHello(ICommandSource source) | ||
=> source.Reply("[BitMod] Hello, there!"); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using BitMod.Attributes.Targets; | ||
using BitMod.Commands.Extensions; | ||
using BitMod.Commands.Handlers; | ||
using BitMod.Commands.Sources.Internal; | ||
using BitMod.Events.Core; | ||
using BitMod.Internal.Public; | ||
|
||
using Lilikoi.Standard; | ||
|
||
using Serilog; | ||
|
||
namespace BitMod.Commands.Hosts; | ||
|
||
public class StandardInputHost | ||
{ | ||
|
||
[Singleton] | ||
private ILogger _logger; | ||
|
||
[Singleton] | ||
private PluginInvoker _invoker; | ||
|
||
[BitEvent] | ||
public async Task OnStandardInput(StandardInputEventArgs ev) | ||
{ | ||
var source = new StandardInputSource(_logger); | ||
var input = CommandInput.FromString(source, ev.Contents); | ||
|
||
_invoker.Command(input); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
builtin/BitMod.Commands/Sources/Internal/StandardInputSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using BitMod.Compatibility; | ||
|
||
using Serilog; | ||
|
||
namespace BitMod.Commands.Sources.Internal; | ||
|
||
public class StandardInputSource : ICommandSource | ||
{ | ||
private readonly ILogger _logger; | ||
|
||
public StandardInputSource(ILogger logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public bool IsRemote => true; | ||
|
||
public bool IsAuthenticated => false; | ||
|
||
public bool IsAssociatedWithGameServer => false; | ||
|
||
public ulong Steam64 => ulong.MaxValue; | ||
|
||
public BitServer? GameServer => null; | ||
|
||
public BitPlayer? Player => null; | ||
|
||
public void Reply(string message) | ||
{ | ||
_logger.Information("[BitMod Commands] {@Msg}", message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using BitMod.Compatibility; | ||
using BitMod.Configuration.Model; | ||
|
||
namespace BitMod.Provision.Config; | ||
|
||
public class ProvisionConfigAdapter | ||
{ | ||
private IConfigObject _configObject; | ||
|
||
public ProvisionConfigAdapter(IConfigObject configObject) | ||
{ | ||
_configObject = configObject; | ||
} | ||
|
||
public ProvisionServerAdapter? GetServer(string server) | ||
{ | ||
var child = _configObject.Get<IConfigObject>(server); | ||
|
||
if (child == null) | ||
return null; | ||
|
||
return new ProvisionServerAdapter(child); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using BitMod.Configuration.Model; | ||
|
||
namespace BitMod.Provision.Config; | ||
|
||
public class ProvisionServerAdapter | ||
{ | ||
private const string MAPCYCLE = "mapcycle"; | ||
private const string GAMEMODES = "gamemodes"; | ||
private IConfigObject _configObject; | ||
|
||
public ProvisionServerAdapter(IConfigObject configObject) | ||
{ | ||
_configObject = configObject; | ||
} | ||
|
||
public bool HasMapcycle() | ||
=> _configObject.Get(MAPCYCLE) != null; | ||
|
||
public bool HasGamemodes() | ||
=> _configObject.Get(GAMEMODES) != null; | ||
|
||
public string[]? GetMapcycle() | ||
=> _configObject.Get<IConfigObject>(MAPCYCLE)?.AsList() | ||
?.Select(model => model as IConfigSymbol) | ||
?.Where(symbol => symbol != null) | ||
?.Select(symbol => symbol.Symbol) | ||
?.ToArray(); | ||
|
||
public string[]? GetGamemodes() | ||
=> _configObject.Get<IConfigObject>(GAMEMODES)?.AsList() | ||
?.Select(model => model as IConfigSymbol) | ||
?.Where(symbol => symbol != null) | ||
?.Select(symbol => symbol.Symbol) | ||
?.ToArray(); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.