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

Commit ddeb222

Browse files
committed
BasicHUD-1.0.4
1 parent 140a530 commit ddeb222

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

BasicHUD/README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ The default variables are:
5555
* {yaw}
5656
* {pitch}
5757
* {bearing}
58-
* {SPACING}
5958
* {10SPACE}
6059
* {20SPACE}
6160
* {30SPACE}
61+
* {40SPACE}
62+
* {50SPACE}
6263
* {NL}
6364
* {BLACK}
6465
* {DARK_BLUE}
@@ -104,7 +105,7 @@ configured, you can configure multiple, like this example:
104105

105106
````YAML
106107
[CODE]
107-
format:
108+
format:
108109
lv3: '{GREEN}{BasicHUD} {YELLOW}Lv3 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
109110
lv2: '{GREEN}{BasicHUD} {GREEN}Lv2 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
110111
lv1: '{GREEN}{BasicHUD} {BLUE}Lv1 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
@@ -152,6 +153,10 @@ if (($hud = $this->getServer()->getPluginManager()->getPlugin("BasicHUD")) !== n
152153

153154
# Changes
154155

156+
* 1.0.4: Performance tweaks
157+
* Cache permissions for selecting formats
158+
* An empty vars.php yields an empty functin (saving a comparison)
159+
* Constant vars are calculated once.
155160
* 1.0.3: First public release
156161
* Added a "use" permission.
157162
* More correct use of permission

BasicHUD/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: BasicHUD
2-
version: 1.0.3
2+
version: 1.0.4
33
main: aliuly\hud\Main
44
api: 1.12.0
55
load: POSTWORLD

BasicHUD/src/aliuly/hud/Main.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private function changePermission($player,$perm,$bool) {
127127
}
128128
$attach = $this->perms[$n];
129129
$attach->setPermission($perm,$bool);
130-
if (isset($this->perms_cache[$n])) unset($this->perms_cache[$n])
130+
if (isset($this->perms_cache[$n])) unset($this->perms_cache[$n]);
131131
}
132132

133133
public function getMessage($player) {
@@ -138,8 +138,8 @@ public function getMessage($player) {
138138
public function getVars($player) {
139139
$vars = $this->consts;
140140
foreach ([
141-
"{tps}"] => $this->getServer()->getTicksPerSecond(),
142-
"{player}"] => $player->getName(),
141+
"{tps}" => $this->getServer()->getTicksPerSecond(),
142+
"{player}" => $player->getName(),
143143
"{world}" => $player->getLevel()->getName(),
144144
"{x}" => (int)$player->getX(),
145145
"{y}" => (int)$player->getY(),
@@ -281,7 +281,7 @@ public function onEnable(){
281281
// We clear the permissions cache in the event of a command
282282
// next time we schedule to fetch the HUD message it will be recomputed
283283
private function onCmdEvent() {
284-
$this->perms_cache = []
284+
$this->perms_cache = [];
285285
}
286286
public function onPlayerCmd(PlayerCommandPreprocessEvent $ev) {
287287
$this->onCmdEvent();
@@ -294,7 +294,7 @@ public function onConsoleCmd(ServerCommandEvent $ev) {
294294
}
295295
public function onQuit(PlayerQuitEvent $ev) {
296296
$n = strtolower($ev->getPlayer()->getName());
297-
if (isset($this->perms_cache[$n])) unset($this->perms_cache[$n])
297+
if (isset($this->perms_cache[$n])) unset($this->perms_cache[$n]);
298298
if (isset($this->sendPopup[$n])) unset($this->sendPopup[$n]);
299299
if (isset($this->disabled[$n])) unset($this->disabled[$n]);
300300
if (isset($this->perms[$n])) {

0 commit comments

Comments
 (0)