@@ -31,6 +31,7 @@ internal static void Init() {
3131 CommandManager . RegisterCommand ( CdGenerateHeightMap ) ;
3232 CommandManager . RegisterCommand ( CdJoin ) ;
3333 CommandManager . RegisterCommand ( CdJoinr ) ;
34+ CommandManager . RegisterCommand ( CdMain ) ;
3435 CommandManager . RegisterCommand ( CdWorldLock ) ;
3536 CommandManager . RegisterCommand ( CdWorldUnlock ) ;
3637 CommandManager . RegisterCommand ( CdSpawn ) ;
@@ -1300,6 +1301,71 @@ private static void JoinrHandler([NotNull] Player player, [NotNull] CommandReade
13001301 player . Message ( "Cannot join {0}&S: world is full." , world . ClassyName ) ;
13011302 return ;
13021303 }
1304+ if ( cmd . IsConfirmed ) {
1305+ player . JoinWorldNow ( world , true , WorldChangeReason . ManualJoin ) ;
1306+ return ;
1307+ }
1308+ if ( player . World . Name . CaselessEquals ( "tutorial" ) && ! player . Info . HasRTR ) {
1309+ player . Confirm ( cmd ,
1310+ "&SYou are choosing to skip the rules, if you continue you will spawn here the next time you log in." ) ;
1311+ return ;
1312+ }
1313+ player . StopSpectating ( ) ;
1314+ if ( ! player . JoinWorldNow ( world , true , WorldChangeReason . ManualJoin ) ) {
1315+ player . Message ( "ERROR: Failed to join world. See log for details." ) ;
1316+ }
1317+ break ;
1318+ case SecurityCheckResult . BlackListed :
1319+ player . Message ( "Cannot join world {0}&S: you are blacklisted." , world . ClassyName ) ;
1320+ break ;
1321+ case SecurityCheckResult . RankTooLow :
1322+ player . Message ( "Cannot join world {0}&S: must be {1}+" , world . ClassyName ,
1323+ world . AccessSecurity . MinRank . ClassyName ) ;
1324+ break ;
1325+ }
1326+ } else {
1327+ player . Message ( "World was null, shouldn't happen, Why'd you break it?" ) ;
1328+ return ;
1329+ }
1330+ }
1331+
1332+ #endregion
1333+ #region Join Main
1334+
1335+ static readonly CommandDescriptor CdMain = new CommandDescriptor {
1336+ Name = "Main" ,
1337+ Aliases = new [ ] { "joinmain" , "joinlobby" , "lobby" } ,
1338+ Category = CommandCategory . World | CommandCategory . New ,
1339+ Usage = "/Main [@rank]" ,
1340+ Help = "Teleports the player to the main world of their rank or specified rank." ,
1341+ Handler = MainHandler
1342+ } ;
1343+
1344+ private static void MainHandler ( [ NotNull ] Player player , [ NotNull ] CommandReader cmd ) {
1345+ string rankStr = cmd . Next ( ) ?? player . Info . Rank . Name ;
1346+ Rank rank = RankManager . FindRank ( rankStr . Replace ( "@" , "" ) ) ;
1347+ if ( rank == null ) {
1348+ player . MessageNoRank ( rankStr . Replace ( "@" , "" ) ) ;
1349+ return ;
1350+ }
1351+ World world = WorldManager . FindMainWorld ( rank ) ;
1352+ if ( world != null ) { //'should' never be null, but whatever, null checks are always good
1353+ switch ( world . AccessSecurity . CheckDetailed ( player . Info ) ) {
1354+ case SecurityCheckResult . Allowed :
1355+ case SecurityCheckResult . WhiteListed :
1356+ if ( world . IsFull ) {
1357+ player . Message ( "Cannot join {0}&S: world is full." , world . ClassyName ) ;
1358+ return ;
1359+ }
1360+ if ( cmd . IsConfirmed ) {
1361+ player . JoinWorldNow ( world , true , WorldChangeReason . ManualJoin ) ;
1362+ return ;
1363+ }
1364+ if ( player . World . Name . CaselessEquals ( "tutorial" ) && ! player . Info . HasRTR ) {
1365+ player . Confirm ( cmd ,
1366+ "&SYou are choosing to skip the rules, if you continue you will spawn here the next time you log in." ) ;
1367+ return ;
1368+ }
13031369 player . StopSpectating ( ) ;
13041370 if ( ! player . JoinWorldNow ( world , true , WorldChangeReason . ManualJoin ) ) {
13051371 player . Message ( "ERROR: Failed to join world. See log for details." ) ;
0 commit comments