Class: PalworldRcon::Client
- Inherits:
-
Object
- Object
- PalworldRcon::Client
- Defined in:
- lib/palworld_rcon/client.rb
Overview
Client
Instance Method Summary collapse
- #ban_player(player_id) ⇒ Object
- #broadcast(message) ⇒ Object
- #do_exit ⇒ Object
-
#initialize(host:, port:, password:) ⇒ Client
constructor
A new instance of Client.
- #kick_player(player_id) ⇒ Object
- #save ⇒ Object
- #server_info ⇒ Object
- #show_players ⇒ Object
- #shutdown(count_down, message) ⇒ Object
Constructor Details
#initialize(host:, port:, password:) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/palworld_rcon/client.rb', line 9 def initialize(host:, port:, password:) @rcon_client = Rcon::Client.new(host: host, port: port, password: password) @rcon_client.authenticate!(ignore_first_packet: false) end |
Instance Method Details
#ban_player(player_id) ⇒ Object
24 25 26 27 |
# File 'lib/palworld_rcon/client.rb', line 24 def ban_player(player_id) cmd = "BanPlayer #{player_id}" execute_command(cmd) end |
#broadcast(message) ⇒ Object
14 15 16 17 |
# File 'lib/palworld_rcon/client.rb', line 14 def broadcast() cmd = "Broadcast #{()}" execute_command(cmd) end |
#do_exit ⇒ Object
45 46 47 |
# File 'lib/palworld_rcon/client.rb', line 45 def do_exit execute_command("DoExit") end |
#kick_player(player_id) ⇒ Object
19 20 21 22 |
# File 'lib/palworld_rcon/client.rb', line 19 def kick_player(player_id) cmd = "KickPlayer #{player_id}" execute_command(cmd) end |
#save ⇒ Object
37 38 39 |
# File 'lib/palworld_rcon/client.rb', line 37 def save execute_command("Save") end |
#server_info ⇒ Object
41 42 43 |
# File 'lib/palworld_rcon/client.rb', line 41 def server_info execute_command("Info") end |
#show_players ⇒ Object
29 30 31 |
# File 'lib/palworld_rcon/client.rb', line 29 def show_players execute_command("ShowPlayers") end |
#shutdown(count_down, message) ⇒ Object
33 34 35 |
# File 'lib/palworld_rcon/client.rb', line 33 def shutdown(count_down, ) execute_command("Shutdown #{count_down} #{()}") end |