-
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.
- Loading branch information
1 parent
8659b37
commit cb8320e
Showing
12 changed files
with
413 additions
and
70 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,69 @@ | ||
using CommandSystem; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UncomplicatedCustomRoles.Commands; | ||
using UncomplicatedCustomTeams.Interfaces; | ||
using Exiled.API.Extensions; | ||
using Exiled.Permissions.Extensions; | ||
|
||
namespace UncomplicatedCustomTeams.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
internal class CommandParent : ParentCommand | ||
{ | ||
public CommandParent() => LoadGeneratedCommands(); | ||
|
||
public override string Command { get; } = "uct"; | ||
|
||
public override string[] Aliases { get; } = new string[] { }; | ||
|
||
public override string Description { get; } = "Manage the UCT features"; | ||
|
||
public override void LoadGeneratedCommands() | ||
{ | ||
RegisteredCommands.Add(new Spawn()); | ||
RegisteredCommands.Add(new Owner()); | ||
} | ||
|
||
public List<IUCTCommand> RegisteredCommands { get; } = new(); | ||
|
||
protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (arguments.Count() == 0) | ||
{ | ||
// Help page | ||
response = $"\n>> UncomplicatedCustomTeams v{Plugin.Instance.Version} <<\nby FoxWorn3365\n\nAvailable commands:"; | ||
|
||
foreach (IUCTCommand Command in RegisteredCommands) | ||
{ | ||
response += $"\n- uct {Command.Name} -> {Command.Description}"; | ||
} | ||
|
||
return true; | ||
} | ||
else | ||
{ | ||
// Arguments compactor: | ||
List<string> Arguments = new(); | ||
foreach (string Argument in arguments.Where(arg => arg != arguments.At(0))) | ||
{ | ||
Arguments.Add(Argument); | ||
} | ||
|
||
IUCTCommand Command = RegisteredCommands.Where(command => command.Name == arguments.At(0)).FirstOrDefault(); | ||
|
||
if (Command is not null && sender.CheckPermission(Command.RequiredPermission)) | ||
{ | ||
// Let's call the command | ||
return Command.Executor(Arguments, sender, out response); | ||
} | ||
else | ||
{ | ||
response = "Command not found"; | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} |
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,47 @@ | ||
using CommandSystem; | ||
using Exiled.API.Features; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UncomplicatedCustomTeams.API.Features; | ||
using UncomplicatedCustomTeams.API.Storage; | ||
|
||
namespace UncomplicatedCustomTeams.Commands | ||
{ | ||
internal class ForceNextWave | ||
{ | ||
public string Name { get; } = "force_next_wave"; | ||
|
||
public string Description { get; } = "Force the next wave to be a custom Team"; | ||
|
||
public string RequiredPermission { get; } = "uct.force_next_wave"; | ||
|
||
public bool Executor(List<string> arguments, ICommandSender _, out string response) | ||
{ | ||
if (arguments.Count != 1) | ||
{ | ||
response = "Usage: uct force_next_wave <TeamId>"; | ||
return false; | ||
} | ||
|
||
Team Team = Team.List.Where(team => team.Id == uint.Parse(arguments[0])).FirstOrDefault(); | ||
|
||
if (Team is null) | ||
{ | ||
response = $"Team {uint.Parse(arguments[0])} is not registered!"; | ||
return false; | ||
} | ||
else | ||
{ | ||
Bucket.SpawnBucket = new(); | ||
foreach (Player Player in Player.List.Where(p => !p.IsAlive && p.Role.Type is PlayerRoles.RoleTypeId.Spectator && !p.IsOverwatchEnabled)) | ||
Bucket.SpawnBucket.Add(Player.Id); | ||
|
||
Plugin.NextTeam = SummonedTeam.Summon(Team, Player.List.Where(p => !p.IsAlive && p.Role.Type is PlayerRoles.RoleTypeId.Spectator && !p.IsOverwatchEnabled)); | ||
|
||
response = $"Successfully forced the team {Team.Name} to be the next respawn wave!"; | ||
|
||
return true; | ||
} | ||
} | ||
} | ||
} |
100 changes: 50 additions & 50 deletions
100
...icatedCustomTeams/Commands/UCTLogShare.cs → ...mplicatedCustomTeams/Commands/LogShare.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 |
---|---|---|
@@ -1,50 +1,50 @@ | ||
using CommandSystem; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using System.Net; | ||
using UncomplicatedCustomTeams.Utilities; | ||
|
||
namespace UncomplicatedCustomTeams.Commands | ||
{ | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
internal class UCTLogShare : ParentCommand | ||
{ | ||
public UCTLogShare() => LoadGeneratedCommands(); | ||
|
||
public override string Command { get; } = "uctlogs"; | ||
|
||
public override string[] Aliases { get; } = new string[] { }; | ||
|
||
public override string Description { get; } = "Share the UCT Debug logs with the developers"; | ||
|
||
public override void LoadGeneratedCommands() { } | ||
|
||
protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (sender.LogName is not "SERVER CONSOLE") | ||
{ | ||
response = "Sorry but this command is reserved to the game console!"; | ||
return false; | ||
} | ||
|
||
long Start = DateTimeOffset.Now.ToUnixTimeMilliseconds(); | ||
|
||
HttpStatusCode Response = LogManager.SendReport(out HttpContent Content); | ||
Dictionary<string, string> Data = JsonConvert.DeserializeObject<Dictionary<string, string>>(Plugin.HttpManager.RetriveString(Content)); | ||
|
||
if (Response is HttpStatusCode.OK && Data.ContainsKey("id")) | ||
{ | ||
response = $"Successfully shared the UCT logs with the developers!\nSend this Id to the developers: {Data["id"]}\n\nTook {DateTimeOffset.Now.ToUnixTimeMilliseconds() - Start}ms"; | ||
} | ||
else | ||
{ | ||
response = $"Failed to share the UCT logs with the developers: Server says: {Response}"; | ||
} | ||
|
||
|
||
return true; | ||
} | ||
} | ||
} | ||
using CommandSystem; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using System.Net; | ||
using UncomplicatedCustomTeams.Utilities; | ||
|
||
namespace UncomplicatedCustomTeams.Commands | ||
{ | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
internal class LogShare : ParentCommand | ||
{ | ||
public LogShare() => LoadGeneratedCommands(); | ||
|
||
public override string Command { get; } = "uctlogs"; | ||
|
||
public override string[] Aliases { get; } = new string[] { }; | ||
|
||
public override string Description { get; } = "Share the UCT Debug logs with the developers"; | ||
|
||
public override void LoadGeneratedCommands() { } | ||
|
||
protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (sender.LogName is not "SERVER CONSOLE") | ||
{ | ||
response = "Sorry but this command is reserved to the game console!"; | ||
return false; | ||
} | ||
|
||
long Start = DateTimeOffset.Now.ToUnixTimeMilliseconds(); | ||
|
||
HttpStatusCode Response = LogManager.SendReport(out HttpContent Content); | ||
Dictionary<string, string> Data = JsonConvert.DeserializeObject<Dictionary<string, string>>(Plugin.HttpManager.RetriveString(Content)); | ||
|
||
if (Response is HttpStatusCode.OK && Data.ContainsKey("id")) | ||
{ | ||
response = $"Successfully shared the UCT logs with the developers!\nSend this Id to the developers: {Data["id"]}\n\nTook {DateTimeOffset.Now.ToUnixTimeMilliseconds() - Start}ms"; | ||
} | ||
else | ||
{ | ||
response = $"Failed to share the UCT logs with the developers: Server says: {Response}"; | ||
} | ||
|
||
|
||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.