Class: Australium::PlayerJoinTeam

Inherits:
Event
  • Object
show all
Defined in:
lib/australium/events/player_join_team.rb

Constant Summary collapse

LOG_REGEX =
/"(?<player>.+)" joined team "(?<team>.+)"/

Constants inherited from Event

Event::PROPERTY_REGEX, Event::TIMESTAMP_REGEX

Instance Attribute Summary collapse

Attributes inherited from Event

#raw

Instance Method Summary collapse

Methods inherited from Event

inherited, #to_s

Constructor Details

#initialize(data) ⇒ PlayerJoinTeam

Returns a new instance of PlayerJoinTeam.



11
12
13
14
15
16
17
# File 'lib/australium/events/player_join_team.rb', line 11

def initialize(data)
  super(data)
  unless state.nil?
    player = state.players.find { |p| p.nick == self.player.nick }
    player.team = team
  end
end

Instance Attribute Details

#playerPlayer

Returns the Australium::Player who joined the team.

Returns:



11
12
13
14
15
16
17
# File 'lib/australium/events/player_join_team.rb', line 11

def initialize(data)
  super(data)
  unless state.nil?
    player = state.players.find { |p| p.nick == self.player.nick }
    player.team = team
  end
end

#teamString

Returns the name of the team the player joined.

Returns:

  • (String)

    the name of the team the player joined.



11
12
13
14
15
16
17
# File 'lib/australium/events/player_join_team.rb', line 11

def initialize(data)
  super(data)
  unless state.nil?
    player = state.players.find { |p| p.nick == self.player.nick }
    player.team = team
  end
end