Paste #16421: Edit of P#16402 - Repo Script debugboard

Date: 2015/06/11 17:10:03 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


debugboard_events:
  type: world
  debug: false
  events:
    on debugboard command:
    - flag <player> debug_board:<player.flag[debug_board].not||true>
    - narrate "toggling debug board"
    - if <player.flag[debug_board]||false> { 
      - run debug_board instantly
      } else {
      - scoreboard id:empty viewers:<player>
      }
    - determine fulfilled
    on player quit:
    - if <player.flag[debug_board]||false> flag <player> debug_board:false
    on server start:
    - flag server start_time:<server.current_time_millis>
debug_board:
  type: task
  debug: false
  script:
  - if !<player.is_online> || !<player.flag[debug_board]||false> queue clear
  - define ID <server.current_time_millis><player.name>debugboard
  - define OBJ "<&4>Debug board"
  # displaying the amount of players online
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>online players<&co><&e> <server.list_online_players.size>' score:-1
  # displays your ping to the server
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>player ping<&co><&e> <player.ping>' score:-2
  # shows the server's TPS. NOTE: This uses spigot's built in /tps command to get the TPS
  - execute as_server "tps" silent save:TPS
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>server TPS<&co><&e> <entry[TPS].output.after[<&co>].before[,].strip_colors>' score:-3
  # returns the amount of ram (used/max)
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>server RAM<&co><&e> <server.ram_max.sub[<server.ram_free>].div[1048576].round_up>MB/<server.ram_max.div[1048576].round_up>MB' score:-4
  # tells you the available processors for the server
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>processors available<&co><&e> <server.available_processors>' score:-5
  # shows how many denizen queues are currently running
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>queues running<&co><&e> <queue.list.size>' score:-6
  # displays the amount of YAML files loaded in through denizen
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>YAML files loaded<&co><&e> <yaml.list.size>' score:-7
  # shows how long the server has been up for in hours
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>server uptime<&co><&e> <server.current_time_millis.sub[<server.flag[start_time]>].div[3600000].mul[100].round.div[100]> hours' score:-8
  # shows the worldguard regions that you are in (requires the plugins depenizen and worldguard!)
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>regions<&co><&e> <player.location.regions.formatted>' score:-9
  # shows the dRegions regions that you are standing in
  - if <server.list_scripts.contains[s@dRegions]> {
    - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>dRegions<&co><&e> <player.location.cuboids.parse[notable_name].filter[starts_with[dRegions_]].parse[after[dregions_<player.world.name>_]].include[__global__].comma_separated>' score:-10
    }
  # displays the denizen cuboids you're in
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>cuboids<&co><&e> <player.location.cuboids.parse[notable_name].formatted>' score:-11
  # tells you what you're currently looking at, whether it's an entity or a block
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>target<&co> <&e><player.target.name||<player.target.entity_type||<player.location.cursor_on.material>>>' score:-12
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" 'lines:<&c>precise<&co> <&e><player.target||<player.location.cursor_on.simple>>' score:-13
  - scoreboard id:<def[ID]> "objective:<&4>Debug board" viewers:<player>
  - run debug_board delay:2s instantly
  - wait 2s
  - scoreboard remove id:<def[ID]>