-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from UncomplicatedCustomServer/dev-main
Update for version v2.2.0 for EXILED v8.9.4 - Candidate I
- Loading branch information
Showing
15 changed files
with
338 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
<br><br> | ||
</div> | ||
|
||
**EXILED** >= `v8.8.1` | ||
**EXILED** >= `v8.9.4` | ||
<br><br> | ||
|
||
## README tradotti | ||
|
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
<br><br> | ||
</div> | ||
|
||
**EXILED** >= `v8.8.1` | ||
**EXILED** >= `v8.9.4` | ||
<br><br> | ||
|
||
## Localized READMEs | ||
|
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,52 @@ | ||
using CommandSystem; | ||
using System; | ||
using Exiled.Permissions.Extensions; | ||
using Exiled.API.Features; | ||
using System.Net; | ||
using UncomplicatedCustomRoles.Manager; | ||
using System.Net.Http; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace UncomplicatedCustomRoles.Commands | ||
{ | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
internal class UCRLogShare : ParentCommand | ||
{ | ||
public UCRLogShare() => LoadGeneratedCommands(); | ||
|
||
public override string Command { get; } = "ucrlogs"; | ||
|
||
public override string[] Aliases { get; } = new string[] { }; | ||
|
||
public override string Description { get; } = "Share the UCR 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 UCR 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 UCR logs with the developers: Server says: {Response}"; | ||
} | ||
|
||
|
||
return true; | ||
} | ||
} | ||
} |
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,97 @@ | ||
using CommandSystem; | ||
using Exiled.API.Features; | ||
using System.Collections.Generic; | ||
using UncomplicatedCustomRoles.Elements; | ||
using UncomplicatedCustomRoles.Interfaces; | ||
using UncomplicatedCustomRoles.Manager; | ||
|
||
namespace UncomplicatedCustomRoles.Commands | ||
{ | ||
public class UCRReload : IUCRCommand | ||
{ | ||
public string Name { get; } = "reload"; | ||
|
||
public string Description { get; } = "Reload every custom role loaded and search for new"; | ||
|
||
public string RequiredPermission { get; } = "ucr.reload"; | ||
|
||
public bool Executor(List<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!Round.IsStarted) | ||
{ | ||
response = "Sorry but you can't use this command if the round is not started!"; | ||
return false; | ||
} | ||
|
||
// Create a copy of the custom roles Dictionary | ||
Dictionary<int, ICustomRole> Roles = new(); | ||
|
||
Plugin.FileConfigs.LoadAction((CustomRole Role) => | ||
{ | ||
if (!SpawnManager.SubclassValidator(Role)) | ||
{ | ||
LogManager.Warn($"[RL] Failed to register the UCR role with the ID {Role.Id} due to the validator check!"); | ||
return; | ||
} | ||
if (!Roles.ContainsKey(Role.Id)) | ||
{ | ||
Roles.Add(Role.Id, Role); | ||
if (Plugin.Instance.Config.EnableBasicLogs) | ||
{ | ||
LogManager.Info($"[RL] Successfully registered the UCR role with the ID {Role.Id} and {Role.Name} as name!"); | ||
} | ||
return; | ||
} | ||
LogManager.Warn($"[RL] Failed to register the UCR role with the ID {Role.Id}: apparently there's already another role with the same Id!\nId fixer deactivated [!]"); | ||
}); | ||
|
||
Plugin.FileConfigs.LoadAction((CustomRole Role) => | ||
{ | ||
if (!SpawnManager.SubclassValidator(Role)) | ||
{ | ||
LogManager.Warn($"[RL] Failed to register the UCR role with the ID {Role.Id} due to the validator check!"); | ||
return; | ||
} | ||
if (!Roles.ContainsKey(Role.Id)) | ||
{ | ||
Roles.Add(Role.Id, Role); | ||
if (Plugin.Instance.Config.EnableBasicLogs) | ||
{ | ||
LogManager.Info($"[RL] Successfully registered the UCR role with the ID {Role.Id} and {Role.Name} as name!"); | ||
} | ||
return; | ||
} | ||
LogManager.Warn($"[RL] Failed to register the UCR role with the ID {Role.Id}: apparently there's already another role with the same Id!\nId fixer deactivated [!]"); | ||
}, Server.Port.ToString()); | ||
|
||
if (Roles.Count < Plugin.CustomRoles.Count) | ||
{ | ||
response = $"The reload command found a role that is loaded in the plugin but has not been loaded by the reload!\nYou can't remove custom roles without restarting the server!\nExpected {Plugin.CustomRoles.Count} roles, found {Roles.Count}"; | ||
return true; | ||
} | ||
|
||
foreach (ICustomRole Role in Plugin.CustomRoles.Values) | ||
{ | ||
if (!Roles.ContainsKey(Role.Id)) | ||
{ | ||
response = $"The reload command found a role that is loaded in the plugin but has not been loaded by the reload!\nYou can't remove custom roles without restarting the server!\nMissing role: {Role.Id}"; | ||
return true; | ||
} | ||
} | ||
|
||
// Ok now we can push the dictionary | ||
Plugin.CustomRoles = Roles; | ||
|
||
response = $"\n>> UCR Reload Report <<\nReloaded {Roles.Count} custom roles.\nFound {Plugin.CustomRoles.Count - Roles.Count} new roles.\n⚠ WARNING ⚠\nIf you have modified something like the health or the name the players that currently have this custom roles won't be affected by these changes!"; | ||
return true; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.