@@ -27,6 +27,7 @@ internal static void Init() {
27
27
CommandManager . RegisterCommand ( CdSave ) ;
28
28
CommandManager . RegisterCommand ( CdCheckUpdate ) ;
29
29
CommandManager . RegisterCommand ( CdAutoRankCheck ) ;
30
+ CommandManager . RegisterCommand ( CdSoftware ) ;
30
31
}
31
32
#region DumpStats
32
33
@@ -1406,5 +1407,47 @@ static void AutoRankCheckHandler( Player player, CommandReader cmd ) {
1406
1407
}
1407
1408
1408
1409
#endregion
1410
+ #region Software
1411
+ static readonly CommandDescriptor CdSoftware = new CommandDescriptor
1412
+ {
1413
+ Name = "Software" ,
1414
+ Aliases = new [ ] { "SetSoftware" , "SW" } ,
1415
+ Category = CommandCategory . New | CommandCategory . Maintenance ,
1416
+ Permissions = new [ ] { Permission . EditPlayerDB } ,
1417
+ IsConsoleSafe = true ,
1418
+ Help = "Set the colors of the server software name on the server list. &NOnly console may change the actual software name. &NUse reset/default/normal to change it back to &cP&4R&6O&eC&aR&2A&bF&3T" ,
1419
+ Usage = "/Software <new software name>" ,
1420
+ Handler = SoftwareHandler
1421
+ } ;
1422
+
1423
+ static void SoftwareHandler ( Player player , CommandReader cmd ) {
1424
+
1425
+
1426
+ string newSW = cmd . NextAll ( ) . Replace ( '%' , '&' ) ;
1427
+ string oldSW = Server . Software ;
1428
+ if ( String . IsNullOrEmpty ( newSW ) ) {
1429
+ player . Message ( "The current software name is \" &F{0}&S\" " , Server . Software ) ;
1430
+ return ;
1431
+ }
1432
+ if ( newSW . CaselessEquals ( "reset" ) || newSW . CaselessEquals ( "default" ) || newSW . CaselessEquals ( "normal" ) ) {
1433
+ newSW = "&cP&4R&6O&eC&aR&2A&bF&3T" ;
1434
+ }
1435
+
1436
+ if ( newSW == oldSW ) {
1437
+ player . Message ( "Server software is already set to \" &F{1}&S\" " , newSW ) ;
1438
+ return ;
1439
+ } else if ( ! Color . StripColors ( newSW , true ) . CaselessEquals ( Server . Software ) && player != Player . Console ) {
1440
+ player . Message ( "&COnly console may change the actual name of the software." ) ;
1441
+ return ;
1442
+ }
1443
+ if ( ! cmd . IsConfirmed ) {
1444
+ player . Confirm ( cmd , "This will change how the server software shows up on the server list from \" &F{0}&S\" to \" &F{1}&S\" " , oldSW , newSW ) ;
1445
+ return ;
1446
+ }
1447
+
1448
+ Server . Software = newSW ;
1449
+ player . Message ( "Server software was changed from \" &F{0}&S\" to \" &F{1}&S\" " , oldSW , newSW ) ;
1450
+ }
1451
+ #endregion
1409
1452
}
1410
1453
}
0 commit comments