@@ -2257,31 +2257,32 @@ sealed class BlockDBUndoArgs {
22572257
22582258 // parses and checks command parameters (for both UndoPlayer and UndoArea)
22592259 [ CanBeNull ]
2260- static BlockDBUndoArgs ParseBlockDBUndoParams ( Player player , CommandReader cmd , string cmdName , bool not ) {
2260+ static BlockDBUndoArgs ParseBlockDBUndoParams ( Player player , CommandReader cmd , CommandDescriptor cmdDesc , bool not ) {
22612261 // check if command's being called by a worldless player (e.g. console)
22622262 World playerWorld = player . World ;
22632263 if ( playerWorld == null ) PlayerOpException . ThrowNoWorld ( player ) ;
22642264
22652265 // ensure that BlockDB is enabled
22662266 if ( ! BlockDB . IsEnabledGlobally ) {
2267- player . Message ( "&W{0}: BlockDB is disabled on this server." , cmdName ) ;
2267+ player . Message ( "&W{0}: BlockDB is disabled on this server." , cmdDesc . Name ) ;
22682268 return null ;
22692269 }
22702270 if ( ! playerWorld . BlockDB . IsEnabled ) {
2271- player . Message ( "&W{0}: BlockDB is disabled in this world." , cmdName ) ;
2271+ player . Message ( "&W{0}: BlockDB is disabled in this world." , cmdDesc . Name ) ;
22722272 return null ;
22732273 }
2274+ string action = cmdDesc == CdHighlight ? "highlight" : "undo" ;
22742275
22752276 // parse the first parameter - either numeric or time limit
22762277 string range = cmd . Next ( ) ;
22772278 if ( range == null ) {
2278- CdUndoPlayer . PrintUsage ( player ) ;
2279+ cmdDesc . PrintUsage ( player ) ;
22792280 return null ;
22802281 }
22812282 int countLimit ;
22822283 TimeSpan ageLimit = TimeSpan . Zero ;
22832284 if ( ! Int32 . TryParse ( range , out countLimit ) && ! range . TryParseMiniTimespan ( out ageLimit ) ) {
2284- player . Message ( "{0}: First parameter should be a number or a timespan." , cmdName ) ;
2285+ player . Message ( "{0}: First parameter should be a number or a timespan." , cmdDesc . Name ) ;
22852286 return null ;
22862287 }
22872288 if ( ageLimit > DateTimeUtil . MaxTimeSpan ) {
@@ -2299,11 +2300,11 @@ static BlockDBUndoArgs ParseBlockDBUndoParams( Player player, CommandReader cmd,
22992300 } else if ( name == "*" ) {
23002301 // all players
23012302 if ( not ) {
2302- player . Message ( "{0}: \" *\" not allowed (cannot undo \" everyone except everyone\" )" , cmdName ) ;
2303+ player . Message ( "{0}: \" *\" not allowed (cannot {1} \" everyone except everyone\" )" , cmdDesc . Name , action ) ;
23032304 return null ;
23042305 }
23052306 if ( allPlayers ) {
2306- player . Message ( "{0}: \" *\" was listed twice." , cmdName ) ;
2307+ player . Message ( "{0}: \" *\" was listed twice." , cmdDesc . Name ) ;
23072308 return null ;
23082309 }
23092310 allPlayers = true ;
@@ -2316,15 +2317,15 @@ static BlockDBUndoArgs ParseBlockDBUndoParams( Player player, CommandReader cmd,
23162317 }
23172318 if ( targets . Contains ( target ) ) {
23182319 player . Message ( "{0}: Player {1}&S was listed twice." ,
2319- target . ClassyName , cmdName ) ;
2320+ target . ClassyName , cmdDesc . Name ) ;
23202321 return null ;
23212322 }
23222323 // make sure player has the permission
23232324 if ( ! not &&
23242325 player . Info != target && ! player . Can ( Permission . UndoAll ) &&
23252326 ! player . Can ( Permission . UndoOthersActions , target . Rank ) ) {
2326- player . Message ( "&W{0}: You may only undo actions of players ranked {1 }&S or lower." ,
2327- cmdName ,
2327+ player . Message ( "&W{0}: You may only {1} actions of players ranked {2 }&S or lower." ,
2328+ cmdDesc . Name , action ,
23282329 player . Info . Rank . GetLimit ( Permission . UndoOthersActions ) . ClassyName ) ;
23292330 player . Message ( "Player {0}&S is ranked {1}" ,
23302331 target . ClassyName , target . Rank . ClassyName ) ;
@@ -2334,11 +2335,11 @@ static BlockDBUndoArgs ParseBlockDBUndoParams( Player player, CommandReader cmd,
23342335 }
23352336 }
23362337 if ( targets . Count == 0 && ! allPlayers ) {
2337- player . Message ( "{0}: Specify at least one player name, or \" *\" to undo everyone." , cmdName ) ;
2338+ player . Message ( "{0}: Specify at least one player name, or \" *\" to {1} everyone." , cmdDesc . Name , action ) ;
23382339 return null ;
23392340 }
23402341 if ( targets . Count > 0 && allPlayers ) {
2341- player . Message ( "{0}: Cannot mix player names and \" *\" ." , cmdName ) ;
2342+ player . Message ( "{0}: Cannot mix player names and \" *\" ." , cmdDesc . Name ) ;
23422343 return null ;
23432344 }
23442345
@@ -2481,7 +2482,7 @@ static void UndoLookup( BlockDBUndoArgs args, string cmdName, string action,
24812482 } ;
24822483
24832484 static void UndoAreaHandler ( Player player , CommandReader cmd ) {
2484- BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , "UndoArea" , false ) ;
2485+ BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , CdUndoArea , false ) ;
24852486 if ( args == null ) return ;
24862487
24872488 Permission permission ;
@@ -2509,7 +2510,7 @@ static void UndoAreaHandler( Player player, CommandReader cmd ) {
25092510 } ;
25102511
25112512 static void UndoAreaNotHandler ( Player player , CommandReader cmd ) {
2512- BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , "UndoAreaNot" , true ) ;
2513+ BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , CdUndoAreaNot , true ) ;
25132514 if ( args == null ) return ;
25142515
25152516 player . SelectionStart ( 2 , UndoAreaSelectionCallback , args , CdUndoAreaNot . Permissions ) ;
@@ -2572,7 +2573,7 @@ static BlockDBEntry[] UndoAreaGetChanges( BlockDBUndoArgs args ) {
25722573 } ;
25732574
25742575 static void UndoPlayerHandler ( Player player , CommandReader cmd ) {
2575- BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , "UndoPlayer" , false ) ;
2576+ BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , CdUndoPlayer , false ) ;
25762577 if ( args == null ) return ;
25772578 Scheduler . NewBackgroundTask ( UndoPlayerLookup )
25782579 . RunOnce ( args , TimeSpan . Zero ) ;
@@ -2591,7 +2592,7 @@ static void UndoPlayerHandler( Player player, CommandReader cmd ) {
25912592 } ;
25922593
25932594 static void UndoPlayerNotHandler ( Player player , CommandReader cmd ) {
2594- BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , "UndoPlayerNot" , true ) ;
2595+ BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , CdUndoPlayerNot , true ) ;
25952596 if ( args == null ) return ;
25962597 Scheduler . NewBackgroundTask ( UndoPlayerLookup )
25972598 . RunOnce ( args , TimeSpan . Zero ) ;
@@ -2635,15 +2636,15 @@ static BlockDBEntry[] UndoPlayerGetChanges( BlockDBUndoArgs args ) {
26352636 Name = "Highlight" ,
26362637 Category = CommandCategory . Moderation ,
26372638 Permissions = new [ ] { Permission . UndoOthersActions } ,
2638- Usage = "/UndoPlayer (TimeSpan|BlockCount) PlayerName [AnotherName]" ,
2639+ Usage = "/Highlight (TimeSpan|BlockCount) PlayerName [AnotherName]" ,
26392640 Help = "Highlights changes made by a given player in the current world. " +
26402641 "More than one player name can be given at a time. " +
2641- "Players with UndoAll permission can use '*' in place of player name to undo everyone's changes at once." ,
2642+ "Players with UndoAll permission can use '*' in place of player name to highlight everyone's changes at once." ,
26422643 Handler = HighlightHandler
26432644 } ;
26442645
26452646 static void HighlightHandler ( Player player , CommandReader cmd ) {
2646- BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , "Highlight" , false ) ;
2647+ BlockDBUndoArgs args = ParseBlockDBUndoParams ( player , cmd , CdHighlight , false ) ;
26472648 if ( args == null ) return ;
26482649 Scheduler . NewBackgroundTask ( HighlightLookup )
26492650 . RunOnce ( args , TimeSpan . Zero ) ;
0 commit comments