Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
v3.1 (#11)
Browse files Browse the repository at this point in the history
* v3.1

- kdr ratio

* v3.1

- kdr option

* v3.1

- kdr ratio
  • Loading branch information
Infernus101 authored Oct 20, 2017
1 parent fe7dddb commit c55dabc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ProfileUI
author: Infernus101
api: [3.0.0-ALPHA1, 3.0.0-ALPHA2, 3.0.0-ALPHA3, 3.0.0-ALPHA4, 3.0.0-ALPHA5, 3.0.0-ALPHA6, 3.0.0-ALPHA7, 3.0.0-ALPHA8, 3.0.0-ALPHA9]
main: Infernus101\Main
version: 3.0
version: 3.1
commands:
profile:
description: Player profile UI!
2 changes: 2 additions & 0 deletions resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ mining-record: 1
kill-record: 1
# keep death record of players
death-record: 1
# show kill/death ratio
kdr: 1
...
13 changes: 13 additions & 0 deletions src/Infernus101/window/ProfileWindow.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public function process(): void {
$stat = $this->pl->getStat($this->args);
$deaths = $stat["deaths"];
}

if($this->pl->config->get("kdr") == 1){
if($kills > 0 and $deaths > 0){
$kdr = round($kills/$deaths);
}
else{
$kdr = 'N/A';
}
}

$name2 = ucfirst($name);
$this->data = [
Expand Down Expand Up @@ -110,6 +119,10 @@ public function process(): void {
if($this->pl->config->get("death-record") == 1){
$this->data["content"][] = ["type" => "label", "text" => TextFormat::GOLD."Deaths: ".TextFormat::WHITE."$deaths"];
}

if($this->pl->config->get("kdr") == 1){
$this->data["content"][] = ["type" => "label", "text" => TextFormat::GOLD."Kills/Deaths: ".TextFormat::WHITE."$kdr"];
}

if($this->pl->config->get("first-played") == 1){
$this->data["content"][] = ["type" => "label", "text" => TextFormat::GOLD."First Played: ".TextFormat::WHITE."$date2 at $time2"];
Expand Down

0 comments on commit c55dabc

Please sign in to comment.