Fix color output on mcrcon
This commit is contained in:
parent
8861ac7ac0
commit
25bd47bf12
1 changed files with 2 additions and 3 deletions
|
|
@ -20,14 +20,13 @@ class VouchersController < ApplicationController
|
|||
def create
|
||||
# Logic for creating a voucher
|
||||
output = ""
|
||||
whitelist = `mcrcon -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist list" | sed 's/There are*.*whitelisted players: //g'`.gsub('[0m', "").gsub("\n", "")
|
||||
whitelist = whitelist.split(", ")
|
||||
whitelist = `mcrcon -c -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist list" | sed 's/There are*.*whitelisted players: //g'`.split(", ")
|
||||
|
||||
if Voucher.exists?(vouchee: params[:voucher]) && params[:voucher].in?(whitelist)
|
||||
@voucher = Voucher.new(voucher_params)
|
||||
|
||||
if @voucher.save
|
||||
output = `mcrcon -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist add #{params[:vouchee]}"`
|
||||
output = `mcrcon -c -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist add #{params[:vouchee]}"`
|
||||
render json: { :message => output }.to_json, status: :created, location: @voucher
|
||||
else
|
||||
render json: @voucher.errors, status: :unprocessable_entity
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue