Skip to content

Commit 1f68e22

Browse files
committed
Fixed GUI.update() not registering change
1 parent 84492f1 commit 1f68e22

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/main/java/com/sentropic/guiapi/GUIAPI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ public void onDisable() {
4646
}
4747

4848
public static GUIAPI getPlugin() { return singleton; }
49+
4950
public static GUIManager getGUIManager() { return guiManager; }
5051
}

src/main/java/com/sentropic/guiapi/gui/Font.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ public void registerWidth(char character, int width) {
6060
}
6161

6262
public int getWidth(char character, boolean custom) {
63-
int result = this == DEFAULT ?
64-
widths.getOrDefault(character, 6) :
65-
widths.getOrDefault(character, DEFAULT.getWidth(character, custom));
63+
int result;
64+
if (this == DEFAULT) {
65+
result = widths.getOrDefault(character, 6);
66+
} else {
67+
result = widths == null ?
68+
DEFAULT.getWidth(character, custom) :
69+
widths.getOrDefault(character, DEFAULT.getWidth(character, custom));
70+
}
6671
if (!custom) {
6772
result = Math.round(result*height/8f); // Scale
6873
}

src/main/java/com/sentropic/guiapi/gui/GUI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public boolean update(@NotNull GUIComponent guiComponent) {
4545
GUIComponent component = iterator.next();
4646
if (component.getId().equals(id)) {
4747
iterator.set(guiComponent);
48+
changed = true;
4849
success = true;
4950
break;
5051
}

0 commit comments

Comments
 (0)