-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- /kick, /promote - group stuff should work with names with spaces i think maybe
- Loading branch information
Showing
12 changed files
with
206 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#region | ||
using Chaos.Collections.Common; | ||
using Chaos.Extensions.Common; | ||
using Chaos.Messaging.Abstractions; | ||
using Chaos.Models.World; | ||
using Chaos.Networking.Abstractions; | ||
using Chaos.Services.Other.Abstractions; | ||
#endregion | ||
|
||
namespace Chaos.Messaging; | ||
|
||
[Command("kick", false, "<targetName>")] | ||
public class KickCommand(IGroupService groupService, IClientRegistry<IChaosWorldClient> clientRegistry) : ICommand<Aisling> | ||
{ | ||
private readonly IClientRegistry<IChaosWorldClient> ClientRegistry = clientRegistry; | ||
private readonly IGroupService GroupService = groupService; | ||
|
||
/// <inheritdoc /> | ||
public ValueTask ExecuteAsync(Aisling source, ArgumentCollection args) | ||
{ | ||
if (!args.TryGetNext<string>(out var targetName)) | ||
return default; | ||
|
||
targetName = targetName.ReplaceI("_", " "); | ||
|
||
var targetClient = ClientRegistry.FirstOrDefault(c => c.Aisling.Name.EqualsI(targetName)); | ||
|
||
if ((targetClient == null) || (source.IsAdmin != targetClient.Aisling.IsAdmin)) | ||
{ | ||
source.SendOrangeBarMessage($"{targetName} can not be found"); | ||
|
||
return default; | ||
} | ||
|
||
GroupService.Kick(source, targetClient.Aisling); | ||
|
||
return default; | ||
} | ||
} |
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,39 @@ | ||
#region | ||
using Chaos.Collections.Common; | ||
using Chaos.Extensions.Common; | ||
using Chaos.Messaging.Abstractions; | ||
using Chaos.Models.World; | ||
using Chaos.Networking.Abstractions; | ||
using Chaos.Services.Other.Abstractions; | ||
#endregion | ||
|
||
namespace Chaos.Messaging; | ||
|
||
[Command("promote", false, "<targetName>")] | ||
public class PromoteLeaderCommand(IGroupService groupService, IClientRegistry<IChaosWorldClient> clientRegistry) : ICommand<Aisling> | ||
{ | ||
private readonly IClientRegistry<IChaosWorldClient> ClientRegistry = clientRegistry; | ||
private readonly IGroupService GroupService = groupService; | ||
|
||
/// <inheritdoc /> | ||
public ValueTask ExecuteAsync(Aisling source, ArgumentCollection args) | ||
{ | ||
if (!args.TryGetNext<string>(out var targetName)) | ||
return default; | ||
|
||
targetName = targetName.ReplaceI("_", " "); | ||
|
||
var targetClient = ClientRegistry.FirstOrDefault(c => c.Aisling.Name.EqualsI(targetName)); | ||
|
||
if ((targetClient == null) || (source.IsAdmin != targetClient.Aisling.IsAdmin)) | ||
{ | ||
source.SendOrangeBarMessage($"{targetName} can not be found"); | ||
|
||
return default; | ||
} | ||
|
||
GroupService.Promote(source, targetClient.Aisling); | ||
|
||
return default; | ||
} | ||
} |
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
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,7 @@ | ||
{ | ||
"default": { | ||
"entries": { | ||
"mink": 4 | ||
} | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"default": { | ||
"entries": { | ||
"mink": 3 | ||
} | ||
} | ||
} |
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