@@ -16,35 +16,31 @@ public class RemoveDummy : ICommand
1616
1717 public bool Execute ( ArraySegment < string > arguments , ICommandSender sender , out string response )
1818 {
19- if ( arguments . Count > 1 || arguments . Count < 1 )
19+ if ( arguments . Count != 1 )
2020 {
2121 response = "Insufficient arguments. Usage: removedummy [dummyID]" ;
2222 return false ;
2323 }
24- string dummyID = arguments . At ( 0 ) ;
24+ Player Dummy = Player . Get ( arguments . At ( 0 ) ) ;
2525
26- if ( Player . Get ( dummyID ) == null )
26+ if ( Dummy == null )
2727 {
28- response = $ "The player ID, '{ dummyID } ', dosent exist!";
28+ response = $ "The player with the specified ID, '{ arguments . At ( 0 ) } ', dosent exist!";
2929 return false ;
3030 }
31- if ( Plugin . Instance . DumRef . Contains ( Player . Get ( dummyID ) . ReferenceHub ) )
31+ if ( Plugin . Instance . DumRef . Contains ( Dummy . ReferenceHub ) )
3232 {
33- Player dummy = Player . Get ( dummyID ) ;
34-
35- Player . Dictionary . Remove ( Plugin . Instance . spawning . PlayerPrefabs [ dummy ] ) ;
36- Plugin . Instance . DumRef . Remove ( dummy . ReferenceHub ) ;
37- dummy . Disconnect ( ) ;
38- NetworkServer . DestroyPlayerForConnection ( Plugin . Instance . spawning . PlayerConnIDs [ dummy ] ) ;
39- NetworkServer . Destroy ( dummy . GameObject ) ;
40- response = $ "Removed { dummy . Nickname } !";
33+ Player . Dictionary . Remove ( Plugin . Instance . spawning . PlayerPrefabs [ Dummy ] ) ;
34+ Plugin . Instance . DumRef . Remove ( Dummy . ReferenceHub ) ;
35+ Dummy . Disconnect ( ) ;
36+ NetworkServer . DestroyPlayerForConnection ( Plugin . Instance . spawning . PlayerConnIDs [ Dummy ] ) ;
37+ NetworkServer . Destroy ( Dummy . GameObject ) ;
38+ response = $ "Removed { Dummy . Nickname } !";
4139 return true ;
4240 }
4341 else
4442 {
45- Player InvalidDummy = Player . Get ( dummyID ) ;
46-
47- response = $ "ID : '{ InvalidDummy . Id } ', Nickname : '{ InvalidDummy . Nickname } ' is not a dummy or you entered a incorrect ID!";
43+ response = $ "ID : '{ Dummy . Id } ', Nickname : '{ Dummy . Nickname } ' is not a dummy or you entered a incorrect ID!";
4844 return false ;
4945 }
5046 }
0 commit comments