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

Commit ab92ceb

Browse files
authored
v2.1 (#4)
* v2.1 fix * v2.1 * v2.1
1 parent 5fee3a3 commit ab92ceb

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed

plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: ProfileUI
22
author: Infernus101
33
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]
44
main: Infernus101\Main
5-
version: 2.0
5+
version: 2.1
66
commands:
77
profile:
88
description: Player profile UI!

src/Infernus101/Main.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public function onCommand(CommandSender $sender, Command $cmd, String $label, ar
4242
return false;
4343
}
4444
$noob = $this->getServer()->getOfflinePlayer($args[0]);
45-
if(!$noob instanceof OfflinePlayer and !$noob instanceof Player){
46-
$sender->sendMessage(TextFormat::RED."> Player not found!");
47-
return false;
45+
if(!is_numeric($noob->getFirstPlayed())){
46+
$sender->sendMessage(TextFormat::RED."Error > Player not found");
47+
return false;
4848
}
4949
$handler = new Handler();
5050
$packet = new ModalFormRequestPacket();

src/Infernus101/window/ProfileWindow.php

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,69 +12,92 @@
1212

1313
class ProfileWindow extends Window {
1414
public function process(): void {
15+
1516
$flag = true;
1617
$name = $this->args->getName();
1718
$manager = $this->pl->getServer()->getPluginManager();
19+
1820
if($this->pl->config->get("rank") == 1){
19-
$pp = $manager->getPlugin("PurePerms");
20-
$rank = $pp->getUserDataMgr()->getGroup($this->args)->getName();
21+
$pp = $manager->getPlugin("PurePerms");
22+
if(!is_null($func = $pp->getUserDataMgr()->getGroup($this->args))){
23+
$rank = $func->getName();
24+
}
25+
else{
26+
$rank = '-';
2127
}
28+
}
29+
2230
if($this->pl->config->get("money") == 1){
23-
$eco = $manager->getPlugin("EconomyAPI");
24-
$money = $eco->myMoney($name);
31+
$eco = $manager->getPlugin("EconomyAPI");
32+
$money = $eco->myMoney($name);
33+
if($money == false){
34+
$money = '-';
35+
}
2536
}
37+
2638
if($this->pl->config->get("faction") == 1){
27-
$f = $manager->getPlugin("FactionsPro");
28-
if($f->isInFaction($name)){
29-
$fac = $f->getPlayerFaction($name);
30-
}
39+
$f = $manager->getPlugin("Sell");
40+
if($f->isInFaction($name)){
41+
$fac = $f->getPlayerFaction($name);
42+
}
3143
else{
32-
$fac = '-';
44+
$fac = '-';
3345
}
3446
}
47+
3548
if($this->pl->config->get("last-seen") == 1){
36-
if($this->args instanceof Player){
37-
$status = 'Online';
38-
$flag = true;
39-
}
49+
if($this->args instanceof Player){
50+
$status = 'Online';
51+
$flag = true;
52+
}
4053
else{
4154
$status = 'Offline';
4255
$date = date("l, F j, Y", ($last = $this->args->getLastPlayed() / 1000));
4356
$time = date("h:ia", $last);
4457
$flag = false;
4558
}
4659
}
60+
4761
if($this->pl->config->get("first-played") == 1){
4862
$date2 = date("l, F j, Y", ($first = $this->args->getFirstPlayed() / 1000));
4963
$time2 = date("h:ia", $first);
5064
}
65+
66+
$name2 = ucfirst($name);
5167
$this->data = [
5268
"type" => "custom_form",
53-
"title" => TextFormat::AQUA."$name"."'s Profile",
69+
"title" => TextFormat::AQUA.TextFormat::BOLD."$name2"."'s Profile",
5470
"content" => []
5571
];
56-
$this->data["content"][] = ["type" => "label", "text" => "Name: $name"];
72+
73+
$this->data["content"][] = ["type" => "label", "text" => "Name: $name2"];
74+
5775
if($this->pl->config->get("rank") == 1){
5876
$this->data["content"][] = ["type" => "label", "text" => "Rank: $rank"];
5977
}
78+
6079
if($this->pl->config->get("money") == 1){
6180
$this->data["content"][] = ["type" => "label", "text" => "Money: $money"];
6281
}
82+
6383
if($this->pl->config->get("faction") == 1){
6484
$this->data["content"][] = ["type" => "label", "text" => "Faction: $fac"];
6585
}
86+
6687
if($this->pl->config->get("first-played") == 1){
6788
$this->data["content"][] = ["type" => "label", "text" => "First Played: $date2 at $time2"];
6889
}
90+
6991
if($this->pl->config->get("last-seen") == 1){
70-
if($flag == true){
71-
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
72-
}
73-
if($flag == false){
74-
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
75-
$this->data["content"][] = ["type" => "label", "text" => "Last seen: $date at $time"];
76-
}
92+
if($flag == true){
93+
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
94+
}
95+
if($flag == false){
96+
$this->data["content"][] = ["type" => "label", "text" => "Status: $status"];
97+
$this->data["content"][] = ["type" => "label", "text" => "Last seen: $date at $time"];
98+
}
7799
}
100+
78101
}
79102
private function select($index){
80103
$handler = new Handler();

0 commit comments

Comments
 (0)