22using Rocket . API ;
33using System . Collections . Generic ;
44using System . Linq ;
5- using Rocket . Unturned . Chat ;
65using Rocket . Core . Utils ;
76using Rocket . Unturned . Player ;
87using SDG . Unturned ;
1110using System ;
1211using RestoreMonarchy . MoreHomes . Helpers ;
1312using UnityEngine ;
14- using System . Threading ;
1513
1614namespace RestoreMonarchy . MoreHomes . Commands
1715{
@@ -26,17 +24,18 @@ public void Execute(IRocketPlayer caller, string[] command)
2624
2725 if ( home == null )
2826 {
29- UnturnedChat . Say ( caller , pluginInstance . Translate ( "NoHome" ) , pluginInstance . MessageColor ) ;
27+ pluginInstance . SendMessageToPlayer ( caller , "NoHome" ) ;
3028 return ;
3129 }
3230
3331 if ( ! ValidateTeleportation ( player , home ) )
32+ {
3433 return ;
34+ }
3535
3636 if ( pluginInstance . PlayerCooldowns . TryGetValue ( caller . Id , out DateTime cooldownExpire ) && cooldownExpire > DateTime . Now )
3737 {
38- UnturnedChat . Say ( caller , pluginInstance . Translate ( "HomeCooldown" , System . Math . Round ( ( cooldownExpire - DateTime . Now ) . TotalSeconds ) ) ,
39- pluginInstance . MessageColor ) ;
38+ pluginInstance . SendMessageToPlayer ( caller , "HomeCooldown" , Math . Round ( ( cooldownExpire - DateTime . Now ) . TotalSeconds ) ) ;
4039 return ;
4140 }
4241
@@ -46,7 +45,7 @@ public void Execute(IRocketPlayer caller, string[] command)
4645
4746 if ( delay > 0 )
4847 {
49- UnturnedChat . Say ( caller , pluginInstance . Translate ( "HomeDelayWarn" , delay ) , pluginInstance . MessageColor ) ;
48+ pluginInstance . SendMessageToPlayer ( caller , "HomeDelayWarn" , delay ) ;
5049 }
5150
5251 bool shouldCancel = false ;
@@ -56,9 +55,9 @@ public void Execute(IRocketPlayer caller, string[] command)
5655 pluginInstance . MovementDetector . AddPlayer ( player . Player , ( ) =>
5756 {
5857 shouldCancel = true ;
59- UnturnedChat . Say ( player , pluginInstance . Translate ( "HomeCanceledYouMoved" ) , pluginInstance . MessageColor ) ;
58+ pluginInstance . SendMessageToPlayer ( player , "HomeCanceledYouMoved" ) ;
6059 } ) ;
61- }
60+ }
6261
6362 TaskDispatcher . QueueOnMainThread ( ( ) =>
6463 {
@@ -80,11 +79,11 @@ public void Execute(IRocketPlayer caller, string[] command)
8079
8180 if ( ! player . Player . teleportToLocation ( home . LivePosition + new Vector3 ( 0f , pluginInstance . Configuration . Instance . TeleportHeight , 0f ) , player . Rotation ) )
8281 {
83- UnturnedChat . Say ( caller , pluginInstance . Translate ( "HomeTeleportationFailed" , home . Name ) , pluginInstance . MessageColor ) ;
82+ pluginInstance . SendMessageToPlayer ( caller , "HomeTeleportationFailed" , home . Name ) ;
8483 pluginInstance . PlayerCooldowns . Remove ( caller . Id ) ;
8584 return ;
8685 }
87- UnturnedChat . Say ( caller , pluginInstance . Translate ( "HomeSuccess" , home . Name ) , pluginInstance . MessageColor ) ;
86+ pluginInstance . SendMessageToPlayer ( caller , "HomeSuccess" , home . Name ) ;
8887 } , delay ) ;
8988 }
9089
@@ -93,13 +92,13 @@ private bool ValidateTeleportation(UnturnedPlayer player, PlayerHome home)
9392 if ( home . InteractableBed == null || ! home . InteractableBed . isActiveAndEnabled || home . InteractableBed . owner != player . CSteamID )
9493 {
9594 HomesHelper . RemoveHome ( player . CSteamID , home ) ;
96- UnturnedChat . Say ( player , pluginInstance . Translate ( "BedDestroyed" ) , pluginInstance . MessageColor ) ;
95+ pluginInstance . SendMessageToPlayer ( player , "BedDestroyed" ) ;
9796 return false ;
9897 }
9998
10099 if ( player . Stance == EPlayerStance . DRIVING )
101100 {
102- UnturnedChat . Say ( player , pluginInstance . Translate ( "WhileDriving" ) , pluginInstance . MessageColor ) ;
101+ pluginInstance . SendMessageToPlayer ( player , "WhileDriving" ) ;
103102 return false ;
104103 }
105104
@@ -116,18 +115,18 @@ private bool ValitedateRaidAndCombat(UnturnedPlayer player)
116115 TeleportationPlugin teleportation = pluginInstance . TeleportationPlugin as TeleportationPlugin ;
117116 if ( teleportation . IsPlayerInCombat ( player . CSteamID ) )
118117 {
119- UnturnedChat . Say ( player , pluginInstance . Translate ( "WhileCombat" ) , pluginInstance . MessageColor ) ;
118+ pluginInstance . SendMessageToPlayer ( player , "WhileCombat" ) ;
120119 return false ;
121120 }
122121
123122 if ( teleportation . IsPlayerInRaid ( player . CSteamID ) )
124123 {
125- UnturnedChat . Say ( player , pluginInstance . Translate ( "WhileRaid" ) , pluginInstance . MessageColor ) ;
124+ pluginInstance . SendMessageToPlayer ( player , "WhileRaid" ) ;
126125 return false ;
127126 }
128127 return true ;
129128 }
130-
129+
131130 public AllowedCaller AllowedCaller => AllowedCaller . Player ;
132131
133132 public string Name => "home" ;
@@ -140,4 +139,4 @@ private bool ValitedateRaidAndCombat(UnturnedPlayer player)
140139
141140 public List < string > Permissions => new List < string > ( ) ;
142141 }
143- }
142+ }
0 commit comments