From 26d57c107e6537acaeebc62ada5ab0ed18d9204f Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 17 Mar 2021 12:46:31 +0200 Subject: [PATCH] GUI title length is limited in older versions. --- src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java index cb03e533..adf04bb3 100644 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java +++ b/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java @@ -20,6 +20,7 @@ import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIRows; import com.gamingmesh.jobs.CMIGUI.GUIManager.InvType; import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIMaterial; +import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.JobsCommands; import com.gamingmesh.jobs.stuff.PageInfo; @@ -159,8 +160,18 @@ public class CMIGui { } public void setTitle(String title) { + if (Version.isCurrentEqualOrHigher(Version.v1_16_R1)) { + if (CMIChatColor.stripColor(title).length() > 64) { + title = title.substring(0, 63) + "~"; + } + } else { + if (title.length() > 32) { + title = title.substring(0, 31) + "~"; + } + } this.title = title; } + public HashMap getButtons() { combineButtons();