diff options
Diffstat (limited to 'app/controllers/statics_controller.rb')
-rw-r--r-- | app/controllers/statics_controller.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/statics_controller.rb b/app/controllers/statics_controller.rb index f2891f3..70d3bd8 100644 --- a/app/controllers/statics_controller.rb +++ b/app/controllers/statics_controller.rb @@ -1,5 +1,7 @@ class StaticsController < ApplicationController + caches_action :online, expires_in: 10.seconds + def index if current_user redirect_to blogposts_path @@ -14,4 +16,8 @@ class StaticsController < ApplicationController def donate end + def online + @players = JSON.parse(File.read("/etc/minecraft/redstoner/plugins/JavaUtils/players.json"))["players"] + @players.collect!{ |p| User.find_by(uuid: p["uuid"].tr("-", "")) or User.new(name: p["name"], ign: p["name"], uuid: p["uuid"].tr("-", ""), role: Role.get("normal"), confirmed: true) }.sort_by!(&:role).reverse! + end end |