()
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | public void initGui() { |
| 36 | PartyManager partyManager = The5zigMod.getPartyManager(); |
| 37 | Party party = partyManager.getParty(); |
| 38 | if (party != null) { |
| 39 | for (GroupMember groupMember : party.getMembers()) { |
| 40 | groupMember.setMaxWidth(98); |
| 41 | } |
| 42 | |
| 43 | chatList = The5zigMod.getVars().createGuiListChat(getWidth(), getHeight(), 54, getHeight() - 30, 0, getWidth() - 110, getWidth() - 115, chatLines, new GuiListChatCallback() { |
| 44 | @Override |
| 45 | public boolean drawDefaultBackground() { |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public Object getResourceLocation() { |
| 51 | return null; |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public int getImageWidth() { |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public int getImageHeight() { |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public void chatLineClicked(Row row, int mouseX, int y, int minY, int left) { |
| 66 | ChatLine chatLine = (ChatLine) row; |
| 67 | List<String> lines = The5zigMod.getVars().splitStringToWidth(chatLine.getMessage().toString(), chatLine.getMaxMessageWidth()); |
| 68 | int yy = 0; |
| 69 | for (int i1 = 0, linesSize = lines.size(); i1 < linesSize; i1++) { |
| 70 | String line = lines.get(i1); |
| 71 | int minChatLineX = chatLine.getMessage().getMessageType() == Message.MessageType.LEFT ? left + 4 : getWidth() - 22 - The5zigMod.getVars().getStringWidth(line); |
| 72 | if (i1 == linesSize - 1) { |
| 73 | String time = ChatColor.GRAY + Utils.convertToTimeWithMinutes(chatLine.getMessage().getTime()); |
| 74 | int timeWidth = (int) (The5zigMod.getVars().getStringWidth(time) * chatLine.STATUS_SCALE); |
| 75 | if (chatLine.getMessage().getMessageType() == Message.MessageType.RIGHT) |
| 76 | minChatLineX -= timeWidth + 6; |
| 77 | } |
| 78 | int maxChatLineX = minChatLineX + The5zigMod.getVars().getStringWidth(line); |
| 79 | int minChatLineY = minY + yy; |
| 80 | int maxChatLineY = minChatLineY + 9; |
| 81 | if (mouseX >= minChatLineX && mouseX <= maxChatLineX && y > minChatLineY && y <= maxChatLineY) { |
| 82 | String[] words = line.split(" "); // Split the Line into Words |
| 83 | StringBuilder builder = new StringBuilder(); |
| 84 | for (String word : words) { |
| 85 | builder.append(word); |
| 86 | int wordX = The5zigMod.getVars().getStringWidth(builder.toString()) + minChatLineX; |
| 87 | if (wordX >= mouseX && wordX <= mouseX + The5zigMod.getVars().getStringWidth(word)) { |
| 88 | // loop through all urls that have been found in the message and look, if it contains the current word. |
| 89 | for (String url : Utils.matchURL(chatLine.getMessage().toString())) { |
| 90 | if (url.contains(ChatColor.stripColor(word))) { |
| 91 | Utils.openURL(url); |
nothing calls this directly
no test coverage detected