1- using Rocket . API ;
1+ using System ;
2+ using System . Collections . Generic ;
3+
4+ using Rocket . API ;
5+ using Rocket . Core ;
6+ using Rocket . Core . Logging ;
7+ using Rocket . Core . Serialisation ;
28using Rocket . Unturned ;
3- using Rocket . Unturned . Logging ;
9+ using Rocket . Unturned . Chat ;
410using Rocket . Unturned . Player ;
511using SDG . Unturned ;
612using Steamworks ;
713using UnityEngine ;
8- using System ;
9- using System . Collections . Generic ;
1014
1115namespace Zamirathe_HomeCommand
1216{
13- public class HomePlayer : RocketPlayerComponent
17+ public class HomePlayer : UnturnedPlayerComponent
1418 {
1519 private bool GoingHome ;
1620 private DateTime LastCalledHomeCommand ;
@@ -21,17 +25,17 @@ public class HomePlayer : RocketPlayerComponent
2125 private bool cangohome ;
2226 private Vector3 bedPos ;
2327 private byte bedRot ;
24- private RocketPlayer p ;
28+ private UnturnedPlayer p ;
2529
2630 private void Load ( )
2731 {
2832 this . GoingHome = false ;
2933 this . cangohome = false ;
3034 }
31- public void GoHome ( Vector3 bedPos , byte bedRot , RocketPlayer player )
35+ public void GoHome ( Vector3 bedPos , byte bedRot , UnturnedPlayer player )
3236 {
33- this . waitrestricted = HomeCommand . Instance . Configuration . TeleportWait ;
34- this . movementrestricted = HomeCommand . Instance . Configuration . MovementRestriction ;
37+ this . waitrestricted = HomeCommand . Instance . Configuration . Instance . TeleportWait ;
38+ this . movementrestricted = HomeCommand . Instance . Configuration . Instance . MovementRestriction ;
3539 this . p = player ;
3640 this . bedPos = Vector3 . up + bedPos ;
3741 this . bedRot = bedRot ;
@@ -53,15 +57,16 @@ public void GoHome(Vector3 bedPos, byte bedRot, RocketPlayer player)
5357 else
5458 {
5559 // Either not an admin or they don't get special wait restrictions.
56- List < Rocket . Core . Permissions . Group > hg = player . GetGroups ( true ) ;
60+ List < RocketPermissionsGroup > hg = R . Permissions . GetGroups ( player , true ) ;
5761 if ( hg . Count <= 0 )
5862 {
5963 Logger . Log ( "There was an error as a player has no groups!" ) ;
6064 }
6165 byte [ ] time2 = new byte [ hg . Count ] ;
6266 for ( byte g = 0 ; g < hg . Count ; g ++ )
6367 {
64- Rocket . Core . Permissions . Group hgr = hg [ g ] ;
68+
69+ RocketPermissionsGroup hgr = hg [ g ] ;
6570 HomeCommand . Instance . WaitGroups . TryGetValue ( hgr . Id , out time2 [ g ] ) ;
6671 if ( time2 [ g ] <= 0 )
6772 {
@@ -76,11 +81,11 @@ public void GoHome(Vector3 bedPos, byte bedRot, RocketPlayer player)
7681 if ( this . movementrestricted )
7782 {
7883 this . LastCalledHomePos = this . transform . position ;
79- RocketChat . Say ( player , String . Format ( HomeCommand . Instance . Configuration . FoundBedWaitNoMoveMsg , player . CharacterName , this . waittime ) ) ;
84+ UnturnedChat . Say ( player , String . Format ( HomeCommand . Instance . Configuration . Instance . FoundBedWaitNoMoveMsg , player . CharacterName , this . waittime ) ) ;
8085 }
8186 else
8287 {
83- RocketChat . Say ( player , String . Format ( HomeCommand . Instance . Configuration . FoundBedNowWaitMsg , player . CharacterName , this . waittime ) ) ;
88+ UnturnedChat . Say ( player , String . Format ( HomeCommand . Instance . Configuration . Instance . FoundBedNowWaitMsg , player . CharacterName , this . waittime ) ) ;
8489 }
8590 }
8691 else
@@ -93,7 +98,7 @@ public void GoHome(Vector3 bedPos, byte bedRot, RocketPlayer player)
9398 private void DoGoHome ( )
9499 {
95100 if ( ! this . cangohome ) return ;
96- RocketChat . Say ( this . p , String . Format ( HomeCommand . Instance . Configuration . TeleportMsg , this . p . CharacterName ) ) ;
101+ UnturnedChat . Say ( this . p , String . Format ( HomeCommand . Instance . Configuration . Instance . TeleportMsg , this . p . CharacterName ) ) ;
97102 this . p . Teleport ( this . bedPos , this . bedRot ) ;
98103 this . cangohome = false ;
99104 this . GoingHome = false ;
@@ -104,7 +109,7 @@ public void FixedUpdate()
104109 if ( this . p . Dead )
105110 {
106111 // Abort teleport, they died.
107- RocketChat . Say ( this . p , String . Format ( HomeCommand . Instance . Configuration . NoTeleportDiedMsg , this . p . CharacterName ) ) ;
112+ UnturnedChat . Say ( this . p , String . Format ( HomeCommand . Instance . Configuration . Instance . NoTeleportDiedMsg , this . p . CharacterName ) ) ;
108113 this . GoingHome = false ;
109114 this . cangohome = false ;
110115 return ;
@@ -114,7 +119,7 @@ public void FixedUpdate()
114119 if ( Vector3 . Distance ( this . p . Position , this . LastCalledHomePos ) > 0.1 )
115120 {
116121 // Abort teleport, they moved.
117- RocketChat . Say ( this . p , String . Format ( HomeCommand . Instance . Configuration . UnableMoveSinceMoveMsg , this . p . CharacterName ) ) ;
122+ UnturnedChat . Say ( this . p , String . Format ( HomeCommand . Instance . Configuration . Instance . UnableMoveSinceMoveMsg , this . p . CharacterName ) ) ;
118123 this . GoingHome = false ;
119124 this . cangohome = false ;
120125 return ;
0 commit comments