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

Commit

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

fix

* v2.1

* v2.1
  • Loading branch information
Infernus101 authored Oct 13, 2017
1 parent 5fee3a3 commit ab92ceb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 26 deletions.
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: [2.0.0, 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: 2.0
version: 2.1
commands:
profile:
description: Player profile UI!
6 changes: 3 additions & 3 deletions src/Infernus101/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function onCommand(CommandSender $sender, Command $cmd, String $label, ar
return false;
}
$noob = $this->getServer()->getOfflinePlayer($args[0]);
if(!$noob instanceof OfflinePlayer and !$noob instanceof Player){
$sender->sendMessage(TextFormat::RED."> Player not found!");
return false;
if(!is_numeric($noob->getFirstPlayed())){
$sender->sendMessage(TextFormat::RED."Error > Player not found");
return false;
}
$handler = new Handler();
$packet = new ModalFormRequestPacket();
Expand Down
67 changes: 45 additions & 22 deletions src/Infernus101/window/ProfileWindow.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,69 +12,92 @@

class ProfileWindow extends Window {
public function process(): void {

$flag = true;
$name = $this->args->getName();
$manager = $this->pl->getServer()->getPluginManager();

if($this->pl->config->get("rank") == 1){
$pp = $manager->getPlugin("PurePerms");
$rank = $pp->getUserDataMgr()->getGroup($this->args)->getName();
$pp = $manager->getPlugin("PurePerms");
if(!is_null($func = $pp->getUserDataMgr()->getGroup($this->args))){
$rank = $func->getName();
}
else{
$rank = '-';
}
}

if($this->pl->config->get("money") == 1){
$eco = $manager->getPlugin("EconomyAPI");
$money = $eco->myMoney($name);
$eco = $manager->getPlugin("EconomyAPI");
$money = $eco->myMoney($name);
if($money == false){
$money = '-';
}
}

if($this->pl->config->get("faction") == 1){
$f = $manager->getPlugin("FactionsPro");
if($f->isInFaction($name)){
$fac = $f->getPlayerFaction($name);
}
$f = $manager->getPlugin("Sell");
if($f->isInFaction($name)){
$fac = $f->getPlayerFaction($name);
}
else{
$fac = '-';
$fac = '-';
}
}

if($this->pl->config->get("last-seen") == 1){
if($this->args instanceof Player){
$status = 'Online';
$flag = true;
}
if($this->args instanceof Player){
$status = 'Online';
$flag = true;
}
else{
$status = 'Offline';
$date = date("l, F j, Y", ($last = $this->args->getLastPlayed() / 1000));
$time = date("h:ia", $last);
$flag = false;
}
}

if($this->pl->config->get("first-played") == 1){
$date2 = date("l, F j, Y", ($first = $this->args->getFirstPlayed() / 1000));
$time2 = date("h:ia", $first);
}

$name2 = ucfirst($name);
$this->data = [
"type" => "custom_form",
"title" => TextFormat::AQUA."$name"."'s Profile",
"title" => TextFormat::AQUA.TextFormat::BOLD."$name2"."'s Profile",
"content" => []
];
$this->data["content"][] = ["type" => "label", "text" => "Name: $name"];

$this->data["content"][] = ["type" => "label", "text" => "Name: $name2"];

if($this->pl->config->get("rank") == 1){
$this->data["content"][] = ["type" => "label", "text" => "Rank: $rank"];
}

if($this->pl->config->get("money") == 1){
$this->data["content"][] = ["type" => "label", "text" => "Money: $money"];
}

if($this->pl->config->get("faction") == 1){
$this->data["content"][] = ["type" => "label", "text" => "Faction: $fac"];
}

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

if($this->pl->config->get("last-seen") == 1){
if($flag == true){
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
}
if($flag == false){
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
$this->data["content"][] = ["type" => "label", "text" => "Last seen: $date at $time"];
}
if($flag == true){
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
}
if($flag == false){
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
$this->data["content"][] = ["type" => "label", "text" => "Last seen: $date at $time"];
}
}

}
private function select($index){
$handler = new Handler();
Expand Down

0 comments on commit ab92ceb

Please sign in to comment.