Provides data for Player.Connected event. StartingWorld property may be changed. Make sure to check IsFake property.
Inheritance: System.EventArgs, IPlayerEvent
Exemple #1
0
 static World RaisePlayerConnectedEvent([NotNull] Player player, [NotNull] World world) {
     var h = Connected;
     if (h == null) return world;
     var e = new PlayerConnectedEventArgs(player, world);
     h(null, e);
     return e.StartingWorld;
 }
Exemple #2
0
 /// <summary>
 /// Player connected successfully to the server event
 /// </summary>
 public static void PlayerConnected( object sender, PlayerConnectedEventArgs e )
 {
     PlayerInfo info = e.Player.Info;
     //if the player left due to a kick
     if ( info.LeaveReason == LeaveReason.Kick && Settings.AnnounceWarnKick ) {
         if ( info.LastKickReason != null ) {
             if ( info.LastKickReason.Length > 0 ) {
                 Methods.SendMessage( e.Player, info.Name + Color.PM + " you were kicked by a staff member. Please follow the /Rules next time! Kick Reason: " + info.LastKickReason, MessageChannel.PM );
             } else {
                 Methods.SendMessage( e.Player, info.Name + Color.PM + " you were kicked by a staff member. Please follow the /Rules next time!", MessageChannel.PM );
             }
         } else {
             Methods.SendMessage( e.Player, info.Name + Color.PM + " you were kicked by a staff member. Please follow the /Rules next time!", MessageChannel.PM );
         }
     }
         ///<summary>
         /// Player logging in for first time
         /// <summary>
     else if ( info.TimesVisited == 1 && Settings.AnnounceGreeting ) {
         //should pick out all the admins online
         Player[] OnlineStaff = Server.Players.Where( p => p.Can( Permission.ReadStaffChat ) ).ToArray();
         if ( OnlineStaff.Count() != 0 ) {
             Methods.SendStaff( info.ClassyName + Color.PM + " just logged on for the first time! Welcome them to the server!" );
         }
     }
         ///<summary>
         /// Suspicious behavoir
         /// <summary>
     else if ( info.BlocksBuilt + info.BlocksDrawn < info.BlocksDeleted && Settings.AnnounceSuggestBan ) {
         Methods.SendStaff( info.ClassyName + Color.PM + " is matching suspicious behavior! (Blocks deleted > Blocks Placed) Please address the issue." );
     }
 }
Exemple #3
0
        //Used if the server starts prophunt on launch. This brings the player to the world that the game is in.
        public void PlayerConnectedHandler(object sender, Events.PlayerConnectedEventArgs e)
        {
            PropHuntPlayers.Add(e.Player);
            e.StartingWorld = _world;
            if (StartMode != Game.StartMode.PropHunt)
            {
                return;
            }
            if (PropHuntPlayers.Count() < 2)
            {
                e.Player.Message("&WThere are not enough players online to being PropHunt. Please try again later.");
                Logger.Log(LogType.Warning,
                           "There are not enough players online to being PropHunt. Please try again later.");
            }
            else
            {
                BeginGame(e.Player);
                if (PropHuntPlayers.Count(player => player.IsPropHuntSeeker) == 0)
                {
                    ChooseSeeker();
                }
                if (RoundStarted && TimeDelay == 0)
                {
                    e.Player.Message("&cYou connected while a round was in progress. You have been made a seeker.");
                    Logger.Log(LogType.SystemActivity,
                               "{0} connected while a round was in progress. They have been made a seeker.", e.Player);
                    e.Player.IsPropHuntSeeker = true;
                }
                foreach (Player p in PropHuntPlayers)
                {
                    if (!p.IsPropHuntSeeker)
                    {
                        p.Model = blockId[randBlock.Next(0, blockId.Length)];
                        string blockName = Map.GetBlockByName(p.Model).ToString();
                        p.Message("&HYou are disgused as {0}.", blockName);
                        p.iName = null;
                    }
                }
                //Handlers for various things
                Player.Moving += PlayerMovingHandler;

                _checkIdlesTask = Scheduler.NewTask(CheckIdles).RunForever(TimeSpan.FromMilliseconds(100));
                _task           = new SchedulerTask(Interval, true).RunForever(TimeSpan.FromMilliseconds(500));

#if DEBUG
                Logger.Log(LogType.Warning, "It is on and stuff...");
#endif
            }
        }
Exemple #4
0
 internal static World RaisePlayerConnectedEvent( [NotNull] Player player, World world ) {
     if( player == null ) throw new ArgumentNullException( "player" );
     var h = Connected;
     if( h == null ) return world;
     var e = new PlayerConnectedEventArgs( player, world );
     h( null, e );
     return e.StartingWorld;
 }
Exemple #5
0
 internal static World RaisePlayerConnectedEvent( Player player, World world ) {
     var h = PlayerConnected;
     if( h == null ) return world;
     var e = new PlayerConnectedEventArgs( player, world );
     h( null, e );
     return e.StartingWorld;
 }
Exemple #6
0
 internal static World RaisePlayerConnectedEvent( [NotNull] Player player, World world, bool isFake ) {
     if( player == null ) throw new ArgumentNullException( "player" );
     var e = new PlayerConnectedEventArgs( player, world, isFake );
     ConnectedEvent.Raise( e );
     return e.StartingWorld;
 }
Exemple #7
0
 private static void Player_Connected( object sender, PlayerConnectedEventArgs e )
 {
     if ( e.Player != null ) {
         if ( e.StartingWorld != null ) {
             Scheduler.NewTask( t => SendPlayerConnectedMsg( e.Player ) ).RunOnce( TimeSpan.FromSeconds( 20 ) );
         }
     }
 }