Class PlayerManager

    • Constructor Detail

      • PlayerManager

        public PlayerManager​(IEventManager eventManager)
    • Method Detail

      • count

        public int count()
        Specified by:
        count in interface IPlayerManager
        Returns:
        the number of all current players' instance (include NPC or BOT)
      • countPlayers

        public int countPlayers()
        Specified by:
        countPlayers in interface IPlayerManager
        Returns:
        the number of all current players that have connections (without NPC or BOT)
      • contain

        public boolean contain​(java.lang.String name)
        Description copied from interface: IPlayerManager
        Determine if the player has existed or not.
        Specified by:
        contain in interface IPlayerManager
        Parameters:
        name - the player's name (unique ID)
        Returns:
        true if the player has existed, false otherwise
      • get

        public AbstractPlayer get​(java.lang.String name)
        Description copied from interface: IPlayerManager
        Retrieve a player by the player's name.
        Specified by:
        get in interface IPlayerManager
        Parameters:
        name - the player's name (unique ID)
        Returns:
        the player's instance if that player has existed, null otherwise
      • add

        public void add​(AbstractPlayer player)
        Description copied from interface: IPlayerManager
        Add a new player to your server (this player is known as one NCP or a BOT) without a attached connection.
        Specified by:
        add in interface IPlayerManager
        Parameters:
        player - that is created from your server, see: AbstractPlayer
      • clean

        public void clean​(AbstractPlayer player)
        Description copied from interface: IPlayerManager
        Make sure one player is removed from this management (as well as your server). It is used when you don't want your player can re-connect with any interruption's reason.
        Specified by:
        clean in interface IPlayerManager
        Parameters:
        player - that is removed, see AbstractPlayer