aboutsummaryrefslogtreecommitdiff
path: root/features/hud
diff options
context:
space:
mode:
Diffstat (limited to 'features/hud')
-rw-r--r--features/hud/HudTextElement.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index b56b350..5599b5c 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -16,7 +16,7 @@ class HudTextElement{
setText(text){
this.text = text
- if(this.locationSetting.shadowType === 2){
+ if(this.locationSetting && this.locationSetting.shadowType === 2){
this.blackText = "&0" + ChatLib.removeFormatting(text)
}
return this
@@ -28,6 +28,10 @@ class HudTextElement{
setLocationSetting(setting){
this.locationSetting = setting
setting.setParent(this)
+
+ if(this.locationSetting.shadowType === 2){
+ this.blackText = "&0" + ChatLib.removeFormatting(text)
+ }
return this
}
@@ -38,6 +42,13 @@ class HudTextElement{
this.renderRaw()
}
+ getWidth(){
+ return Math.max(...(this.getText()[0].map(a=>Renderer.getStringWidth(ChatLib.removeFormatting(a)))))
+ }
+ getHeight(){
+ return 9*this.getText()[0].length
+ }
+
getText(){
let text = this.text
let blackText = this.blackText