9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 04:19:28 +00:00

fix: shades not working between empty columns

This commit is contained in:
LoJoSho
2023-08-16 13:39:03 -05:00
parent 28a37848c8
commit 26361b833f
3 changed files with 25 additions and 13 deletions

View File

@@ -51,6 +51,7 @@ public class Settings {
private static final String SEQUENT_ROW_SHIFT_PATH = "sequent-row-shift";
private static final String INDIVIDUAL_COLUMN_SHIFT_PATH = "individual-column-shift";
private static final String BACKGROUND_PATH = "background";
private static final String CLEAR_BACKGROUND_PATH = "clear-background";
private static final String EQUIPPED_COSMETIC_COLOR_PATH = "equipped-cosmetic-color";
private static final String EQUIPABLE_COSMETIC_COLOR_PATH = "equipable-cosmetic-color";
private static final String LOCKED_COSMETIC_COLOR_PATH = "locked-cosmetic-color";
@@ -119,6 +120,8 @@ public class Settings {
@Getter
private static String background;
@Getter
private static String clearBackground;
@Getter
private static String equippedCosmeticColor;
@Getter
private static String equipableCosmeticColor;
@@ -170,6 +173,7 @@ public class Settings {
sequentRowShift = shadingSettings.node(SEQUENT_ROW_SHIFT_PATH).getString();
individualColumnShift = shadingSettings.node(INDIVIDUAL_COLUMN_SHIFT_PATH).getString();
background = shadingSettings.node(BACKGROUND_PATH).getString();
clearBackground = shadingSettings.node(CLEAR_BACKGROUND_PATH).getString();
equippedCosmeticColor = shadingSettings.node(EQUIPPED_COSMETIC_COLOR_PATH).getString();
equipableCosmeticColor = shadingSettings.node(EQUIPABLE_COSMETIC_COLOR_PATH).getString();
lockedCosmeticColor = shadingSettings.node(LOCKED_COSMETIC_COLOR_PATH).getString();

View File

@@ -172,23 +172,25 @@ public class Menu {
int row = 0;
if (shading) {
for (int i = 0; i < gui.getInventory().getSize(); i++) {
// Handles the title
if (i % 9 == 0) {
if (row == 0) {
title.append(Settings.getFirstRowShift()); // Goes back to the start of the gui
} else {
title.append(Settings.getSequentRowShift());
}
row += 1;
} else {
title.append(Settings.getIndividualColumnShift()); // Goes to the next slot
}
boolean occupied = false;
if (items.containsKey(i)) {
// Handles the items
MenuItem item = items.get(i);
updateItem(user, gui, item);
// Handles the title
if (i % 9 == 0) {
if (row == 0) {
title.append(Settings.getFirstRowShift()); // Goes back to the start of the gui
} else {
title.append(Settings.getSequentRowShift());
}
row += 1;
} else {
title.append(Settings.getIndividualColumnShift()); // Goes to the next slot
}
if (item.type().getId().equalsIgnoreCase("cosmetic")) {
Cosmetic cosmetic = Cosmetics.getCosmetic(item.itemConfig().node("cosmetic").getString(""));
if (cosmetic == null) continue;
@@ -201,9 +203,14 @@ public class Menu {
title.append(Settings.getLockedCosmeticColor());
}
}
title.append(Settings.getBackground().replaceAll("<row>", String.valueOf(row)));
occupied = true;
}
}
if (occupied) {
title.append(Settings.getBackground().replaceAll("<row>", String.valueOf(row)));
} else {
title.append(Settings.getClearBackground().replaceAll("<row>", String.valueOf(row)));
}
}
MessagesUtil.sendDebugMessages("Updated menu with title " + title);
gui.updateTitle(StringUtils.parseStringToString(Hooks.processPlaceholders(user.getPlayer(), title.toString())));