diff --git a/AdminTools/Enums.cs b/AdminTools/Enums.cs index b089103..154fa64 100644 --- a/AdminTools/Enums.cs +++ b/AdminTools/Enums.cs @@ -1,16 +1,45 @@ namespace AdminTools { + /// + /// Represents the possible axes in a 3D space. + /// public enum VectorAxis { + /// + /// The X-axis. + /// X, + + /// + /// The Y-axis. + /// Y, + + /// + /// The Z-axis. + /// Z } + /// + /// Specifies the type of modification applied to a position. + /// public enum PositionModifier { + /// + /// Sets a position. + /// Set, + + /// + /// Retrieves a position. + /// Get, - Add, + + /// + /// Adds to a position. + /// + Add } + } diff --git a/AdminTools/EventHandlers.cs b/AdminTools/EventHandlers.cs index 95e7538..d57f670 100644 --- a/AdminTools/EventHandlers.cs +++ b/AdminTools/EventHandlers.cs @@ -4,6 +4,8 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Interfaces; +using Exiled.CustomModules; +using Exiled.CustomModules.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; using PlayerRoles; @@ -18,7 +20,7 @@ public class EventHandlers { private readonly Main plugin; - public EventHandlers(Main main) + internal EventHandlers(Main main) { plugin = main; @@ -47,19 +49,19 @@ public EventHandlers(Main main) Handlers.Player.ChangingRole -= OnChangingRole; } - public void OnInteractingDoor(InteractingDoorEventArgs ev) + internal void OnInteractingDoor(InteractingDoorEventArgs ev) { if (Main.PryGate.Contains(ev.Player) && ev.Door is Gate gate) gate.TryPry(); } - public static void OnHurting(HurtingEventArgs ev) + internal static void OnHurting(HurtingEventArgs ev) { if (ev.Attacker != ev.Player && Main.InstantKill.Contains(ev.Attacker)) ev.Amount = StandardDamageHandler.KillValue; } - public void OnPlayerDestroying(DestroyingEventArgs ev) + internal void OnPlayerDestroying(DestroyingEventArgs ev) { if (Main.RoundStartMutes.Remove(ev.Player)) { @@ -69,7 +71,7 @@ public void OnPlayerDestroying(DestroyingEventArgs ev) ev.Player.SavingPlayerData(); } - public void OnPlayerVerified(VerifiedEventArgs ev) + internal void OnPlayerVerified(VerifiedEventArgs ev) { if (Main.JailedPlayers.ContainsKey(ev.Player.UserId)) Jail.DoJail(ev.Player, true); @@ -88,7 +90,7 @@ public void OnPlayerVerified(VerifiedEventArgs ev) } } - public void OnRoundStarted() + internal void OnRoundStarted() { foreach (Player ply in Main.RoundStartMutes) { @@ -100,7 +102,7 @@ public void OnRoundStarted() Main.RoundStartMutes.Clear(); } - public void OnRoundEnded(RoundEndedEventArgs ev) + internal void OnRoundEnded(RoundEndedEventArgs ev) { // Update all the jails that it is no longer the current round, so when they are unjailed they don't teleport into the void. foreach (Jailed jail in Main.JailedPlayers.Values) @@ -115,19 +117,19 @@ public void OnRoundEnded(RoundEndedEventArgs ev) File.WriteAllLines(plugin.OverwatchFilePath, Main.Overwatch); } - public void OnTriggeringTesla(TriggeringTeslaEventArgs ev) + internal void OnTriggeringTesla(TriggeringTeslaEventArgs ev) { if (ev.Player.IsGodModeEnabled) ev.IsAllowed = false; } - public void OnChangingRole(ChangingRoleEventArgs ev) + internal void OnChangingRole(ChangingRoleEventArgs ev) { if (plugin.Config.GodTuts && (ev.Reason == SpawnReason.ForceClass || ev.Reason == SpawnReason.None)) - ev.Player.IsGodModeEnabled = ev.NewRole == RoleTypeId.Tutorial; + ev.Player.IsGodModeEnabled = ev.NewRole == RoleTypeId.Tutorial && !ev.Player.Is(out Pawn _); } - public void OnWaitingForPlayers() + internal void OnWaitingForPlayers() { Main.InstantKill.Clear(); Main.BreakDoors.Clear(); @@ -143,7 +145,7 @@ public void OnWaitingForPlayers() } } - public void OnPlayerInteractingDoor(InteractingDoorEventArgs ev) + internal void OnPlayerInteractingDoor(InteractingDoorEventArgs ev) { if (Main.BreakDoors.Contains(ev.Player) && ev.Door is IDamageableDoor damageableDoor) damageableDoor.Break(); diff --git a/AdminTools/Extensions.cs b/AdminTools/Extensions.cs index c3d2799..5a9a068 100644 --- a/AdminTools/Extensions.cs +++ b/AdminTools/Extensions.cs @@ -10,8 +10,17 @@ namespace AdminTools { + /// + /// Provides extension methods for various game-related functionalities. + /// public static class Extensions { + /// + /// Formats the arguments of a sentence starting from the specified index. + /// + /// The array segment containing the sentence. + /// The starting index for formatting. + /// A formatted string of the sentence from the specified index. public static string FormatArguments(this ArraySegment sentence, int index) { StringBuilder sb = new(); @@ -24,8 +33,18 @@ public static string FormatArguments(this ArraySegment sentence, int ind return msg; } - public static string LogPlayers(this IEnumerable players) => string.Join("\n - ", players.Select(x => $"{x.Nickname}({x.Id})")); + /// + /// Logs the players with their nickname and ID. + /// + /// The collection of players to log. + /// A string containing player nicknames and IDs. + public static string LogPlayers(this IEnumerable players) => + string.Join("\n - ", players.Select(x => $"{x.Nickname}({x.Id})")); + /// + /// Saves the player's overwatch state to the configuration. + /// + /// The player whose data is being saved. public static void SavingPlayerData(this Player player) { List overwatchRead = Main.Overwatch; @@ -38,8 +57,17 @@ public static void SavingPlayerData(this Player player) Log.Debug($"{player.Nickname}({player.UserId}) has added their overwatch."); } else if (!player.IsOverwatchEnabled && overwatchRead.Remove(userId)) - Log.Debug($"{player.Nickname}({player.UserId}) has remove their overwatch."); + Log.Debug($"{player.Nickname}({player.UserId}) has removed their overwatch."); } + + /// + /// Spawns a workbench at the specified position, rotation, and size. + /// + /// The player who is spawning the workbench. + /// The position to spawn the workbench at. + /// The rotation of the workbench. + /// The size of the workbench. + /// The index of the spawned workbench in the player's workbench list. public static void SpawnWorkbench(Player ply, Vector3 position, Vector3 rotation, Vector3 size, out int benchIndex) { try diff --git a/AdminTools/Jailed.cs b/AdminTools/Jailed.cs index 57a12bf..b74da40 100644 --- a/AdminTools/Jailed.cs +++ b/AdminTools/Jailed.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.Items; -using PlayerRoles; using RelativePositioning; namespace AdminTools