Skip to content

Commit b576dd0

Browse files
committed
Fixed wrong text width calculation
1 parent 7872a9f commit b576dd0

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ public class GUIManager implements Listener {
1919
GUIManager() { task.runTaskTimer(GUIAPI.getPlugin(), 0, 1); }
2020

2121
void close() {
22-
try {
23-
task.cancel();
24-
} catch (IllegalStateException ignored) { }
22+
try { task.cancel(); }
23+
catch (IllegalStateException ignored) { }
2524
}
2625

2726
public GUI getGUI(Player player) {

src/main/java/com/sentropic/guiapi/command/ReloadCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
public class ReloadCommand implements CommandExecutor {
1414
@Override
1515
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
16+
if (!sender.hasPermission("misc.command.reload")) { return false; }
1617
if (args.length == 1 && args[0].equals("reload")) {
1718
GUIAPI.getPlugin().reloadConfig();
1819
sender.sendMessage(ChatColor.GREEN+"[GUIAPI] Reloaded config.yml");
@@ -21,7 +22,8 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
2122
if (sender instanceof Player) {
2223
GUI gui = GUIAPI.getGUIManager().getGUI((Player) sender);
2324
gui.setDebug(!gui.isDebugging());
24-
}
25+
return true;
26+
} else { sender.sendMessage("Command only runnable ingame"); }
2527
}
2628
return false;
2729
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ public int getWidth(char character, boolean scale) {
7070
DEFAULT.getWidth(character, scale) :
7171
widths.getOrDefault(character, DEFAULT.getWidth(character, scale));
7272
}
73-
if (!scale) {
74-
result = Math.round(result*height/8f); // Scale
75-
}
73+
if (scale) { result = (int) Math.ceil(result*height/8f); }
7674
return result;
7775
}
7876

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ public boolean remove(String id) {
9696
}
9797

9898
public boolean removeIf(Predicate<GUIComponent> predicate) {
99-
return guiComponents.removeIf(predicate);
99+
boolean success = guiComponents.removeIf(predicate);
100+
changed = success || changed;
101+
return success;
100102
}
101103

102104
public boolean isDebugging() { return debug; }

0 commit comments

Comments
 (0)