Ruby Gem for a Votifier Server and Client for Minecraft
This version is missing a lot of features.
Install via RubyGems:
gem install votifierrequire 'votifier'
# Initialize server with public key and host:port
public_key = File.expand_path('config/sample-public.key', __dir__)
server = MineVotifier::MinecraftServer.new(public_key, 'some.minecraft-server.com:8192')
# Create client with keyword arguments
client = MineVotifier::Client.new(
service_name: 'MineList.kr',
minecraft_server: server
)
# Send a vote with username only
client.send_vote(username: 'Notch')If you have IP address and timestamp:
client.send_vote(
username: 'Notch',
ip_address: voter_ip, # defaults to "127.0.0.1" if omitted
timestamp: vote_timestamp # defaults to Time.now.to_i if omitted
)You can pass a Key object directly to MinecraftServer initializer:
raw_key = 'KEY STRING'
key = MineVotifier::Key.from_key_content(raw_key, :public)
server = MineVotifier::MinecraftServer.new(
key,
'some.minecraft-server.com',
8192
)
client = MineVotifier::Client.new(
service_name: 'MineList.kr',
minecraft_server: server
)
client.send_vote(username: 'Notch')MineVotifier::MinecraftServer.new(public_key) # localhost:8192
MineVotifier::MinecraftServer.new(public_key, 'host.example.com') # host:8192
MineVotifier::MinecraftServer.new(public_key, 9999) # localhost:9999
MineVotifier::MinecraftServer.new(public_key, 'host:9999')
MineVotifier::MinecraftServer.new(public_key, 'host.example.com', 9999)require 'votifier'
MineVotifier::Server.new(private_key_file, '0.0.0.0:8193').listen- Unit tests
- Observer pattern for vote events
- Complete YARD documentation
- Server constructor improvements
- Add
MinecraftPlayerclass (username, ip_address) - Use
startinstead oflistenfor server loop
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request