11using JetBrains . Annotations ;
2+ using LabApi . Events . Arguments . PlayerEvents ;
23using LabApi . Features ;
34using LabApi . Features . Console ;
5+ using LabApi . Features . Wrappers ;
46using MEC ;
57using SER . Code . FlagSystem . Flags ;
68using SER . Code . Helpers ;
@@ -30,7 +32,7 @@ public class MainPlugin : LabApi.Loader.Features.Plugins.Plugin<Config>
3032 public static string HelpCommandName => "serhelp" ;
3133 public static MainPlugin Instance { get ; private set ; } = null ! ;
3234
33- public record struct Contributor ( string Name , Contribution Contribution ) ;
35+ public record Contributor ( string Name , Contribution Contribution , string ? Id = null ) ;
3436
3537 [ Flags ]
3638 public enum Contribution
@@ -47,7 +49,7 @@ public enum Contribution
4749
4850 public static Contributor [ ] Contributors =>
4951 [
50- new ( Instance . Author , Contribution . LeadDeveloper ) ,
52+ new ( Instance . Author , Contribution . LeadDeveloper , "76561198361176072@steam" ) ,
5153 new ( "Whitty985playz" , Contribution . QualityAssurance | Contribution . EarlyAdopter ) ,
5254 new ( "Tosoks67" , Contribution . Developer | Contribution . Betatester ) ,
5355 new ( "Krzysiu Wojownik" , Contribution . QualityAssurance | Contribution . Developer ) ,
@@ -79,6 +81,11 @@ public override void Enable()
7981 Events . ServerEvents . WaitingForPlayers += OnServerFullyInit ;
8082 Events . ServerEvents . RoundRestarted += Disable ;
8183
84+ if ( Config ? . RankRemovalKey is not { } key || Server . IpAddress . GetHashCode ( ) != key )
85+ {
86+ Events . PlayerEvents . Joined += OnJoined ;
87+ }
88+
8289 Timing . CallDelayed ( 1.5f , FileSystem . FileSystem . Initialize ) ;
8390 }
8491
@@ -90,7 +97,7 @@ public override void Disable()
9097
9198 private void OnServerFullyInit ( )
9299 {
93- if ( Config ? . SendHelpMessageOnServerInitialization is false ) return ;
100+ if ( Config ? . SendInitMessage is false ) return ;
94101
95102 Logger . Raw (
96103 $ """
@@ -135,4 +142,24 @@ private static void SendLogo()
135142 ConsoleColor . Cyan
136143 ) ;
137144 }
145+
146+ private static void OnJoined ( PlayerJoinedEventArgs ev )
147+ {
148+ if ( ev . Player is not { } plr ) return ;
149+
150+ Timing . CallDelayed ( 3f , ( ) =>
151+ {
152+ if ( plr . UserGroup is not null ) return ;
153+ if ( Contributors . FirstOrDefault ( c => c . Id == plr . UserId && c . Id is not null ) is not { } info ) return ;
154+
155+ plr . GroupColor = "aqua" ;
156+ plr . GroupName = $ "* SER { info
157+ . Contribution
158+ . GetFlags ( )
159+ . OrderByDescending ( f => f )
160+ . First ( )
161+ . ToString ( )
162+ . Spaceify ( ) } *" ;
163+ } ) ;
164+ }
138165}
0 commit comments