|
12 | 12 |
|
13 | 13 | class ProfileWindow extends Window { |
14 | 14 | public function process(): void { |
| 15 | + |
15 | 16 | $flag = true; |
16 | 17 | $name = $this->args->getName(); |
17 | 18 | $manager = $this->pl->getServer()->getPluginManager(); |
| 19 | + |
18 | 20 | 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 = '-'; |
21 | 27 | } |
| 28 | + } |
| 29 | + |
22 | 30 | 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 | + } |
25 | 36 | } |
| 37 | + |
26 | 38 | 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 | + } |
31 | 43 | else{ |
32 | | - $fac = '-'; |
| 44 | + $fac = '-'; |
33 | 45 | } |
34 | 46 | } |
| 47 | + |
35 | 48 | 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 | + } |
40 | 53 | else{ |
41 | 54 | $status = 'Offline'; |
42 | 55 | $date = date("l, F j, Y", ($last = $this->args->getLastPlayed() / 1000)); |
43 | 56 | $time = date("h:ia", $last); |
44 | 57 | $flag = false; |
45 | 58 | } |
46 | 59 | } |
| 60 | + |
47 | 61 | if($this->pl->config->get("first-played") == 1){ |
48 | 62 | $date2 = date("l, F j, Y", ($first = $this->args->getFirstPlayed() / 1000)); |
49 | 63 | $time2 = date("h:ia", $first); |
50 | 64 | } |
| 65 | + |
| 66 | + $name2 = ucfirst($name); |
51 | 67 | $this->data = [ |
52 | 68 | "type" => "custom_form", |
53 | | - "title" => TextFormat::AQUA."$name"."'s Profile", |
| 69 | + "title" => TextFormat::AQUA.TextFormat::BOLD."$name2"."'s Profile", |
54 | 70 | "content" => [] |
55 | 71 | ]; |
56 | | - $this->data["content"][] = ["type" => "label", "text" => "Name: $name"]; |
| 72 | + |
| 73 | + $this->data["content"][] = ["type" => "label", "text" => "Name: $name2"]; |
| 74 | + |
57 | 75 | if($this->pl->config->get("rank") == 1){ |
58 | 76 | $this->data["content"][] = ["type" => "label", "text" => "Rank: $rank"]; |
59 | 77 | } |
| 78 | + |
60 | 79 | if($this->pl->config->get("money") == 1){ |
61 | 80 | $this->data["content"][] = ["type" => "label", "text" => "Money: $money"]; |
62 | 81 | } |
| 82 | + |
63 | 83 | if($this->pl->config->get("faction") == 1){ |
64 | 84 | $this->data["content"][] = ["type" => "label", "text" => "Faction: $fac"]; |
65 | 85 | } |
| 86 | + |
66 | 87 | if($this->pl->config->get("first-played") == 1){ |
67 | 88 | $this->data["content"][] = ["type" => "label", "text" => "First Played: $date2 at $time2"]; |
68 | 89 | } |
| 90 | + |
69 | 91 | 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 | + } |
77 | 99 | } |
| 100 | + |
78 | 101 | } |
79 | 102 | private function select($index){ |
80 | 103 | $handler = new Handler(); |
|
0 commit comments