Skip to content

Commit 4b54b2f

Browse files
authored
Changes GodTuts (Exiled-Team#85)
1 parent 119a848 commit 4b54b2f

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

AdminTools/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Config : IConfig
1111
[Description("Whether or not to show logs used for debugging.")]
1212
public bool Debug { get; set; } = false;
1313

14-
[Description("Should the tutorial class be in God Mode? Default: false")]
14+
[Description("Should Staff be in God Mode when they forceclass to Tutorial?? Default: false")]
1515
public bool GodTuts { get; set; } = false;
1616

1717
[Description("Extending Command use for Getting a player (such as candy command and other parts of AdminTools). View the README on github for more info.")]

AdminTools/EventHandlers.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace AdminTools
1111
using Log = Exiled.API.Features.Log;
1212
using PlayerStatsSystem;
1313
using Handlers = Exiled.Events.Handlers;
14+
using Exiled.API.Enums;
1415

1516
public class EventHandlers
1617
{
@@ -28,7 +29,6 @@ public EventHandlers(Main main)
2829
Handlers.Server.RoundStarted += OnRoundStarted;
2930
Handlers.Player.Destroying += OnPlayerDestroying;
3031
Handlers.Player.InteractingDoor += OnPlayerInteractingDoor;
31-
3232
if (plugin.Config.GodTuts)
3333
Handlers.Player.ChangingRole += OnChangingRole;
3434
}
@@ -44,6 +44,8 @@ public EventHandlers(Main main)
4444
Handlers.Server.RoundStarted -= OnRoundStarted;
4545
Handlers.Player.Destroying -= OnPlayerDestroying;
4646
Handlers.Player.InteractingDoor -= OnPlayerInteractingDoor;
47+
if (plugin.Config.GodTuts)
48+
Handlers.Player.ChangingRole -= OnChangingRole;
4749
}
4850

4951
public void OnInteractingDoor(InteractingDoorEventArgs ev)
@@ -127,7 +129,12 @@ public void OnTriggeringTesla(TriggeringTeslaEventArgs ev)
127129
ev.IsAllowed = false;
128130
}
129131

130-
public void OnChangingRole(ChangingRoleEventArgs ev) => ev.Player.IsGodModeEnabled = ev.NewRole is RoleTypeId.Tutorial;
132+
public void OnChangingRole(ChangingRoleEventArgs ev)
133+
{
134+
if (plugin.Config.GodTuts && ev.Player.RemoteAdminAccess && ev.Reason == SpawnReason.ForceClass)
135+
ev.Player.IsGodModeEnabled = ev.NewRole == RoleTypeId.Tutorial;
136+
}
137+
131138

132139
public void OnWaitingForPlayers()
133140
{

0 commit comments

Comments
 (0)