awkisopen/australium

View on GitHub
lib/australium/events/player_name_change.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Australium
  class PlayerNameChange < Event

    LOG_REGEX = /"(?<player>.+)" changed name to "(?<new_name>.+)"/

    # @!attribute player
    #   @return [Player] the {Player} whose name changed.
    # @!attribute new_name
    #   @return [String] the name the player changed to.

    def initialize(data)
      super(data)
      player.nick = new_name

      player[:connected?, timestamp] = true
      player[:in_game?, timestamp] = true
    end

  end
end