mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
fix: latest crash fixes (with latest hibiscus commons)
This commit is contained in:
@@ -91,7 +91,7 @@ allprojects {
|
|||||||
compileOnly("io.github.toxicity188:BetterCommand:1.3") //BetterCommand library
|
compileOnly("io.github.toxicity188:BetterCommand:1.3") //BetterCommand library
|
||||||
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
||||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||||
compileOnly("me.lojosho:HibiscusCommons:0.7.0-d301221e")
|
compileOnly("me.lojosho:HibiscusCommons:0.7.0-491f46f")
|
||||||
|
|
||||||
// Handled by Spigot Library Loader
|
// Handled by Spigot Library Loader
|
||||||
compileOnly("net.kyori:adventure-api:4.23.0")
|
compileOnly("net.kyori:adventure-api:4.23.0")
|
||||||
@@ -144,6 +144,7 @@ tasks {
|
|||||||
downloadPlugins {
|
downloadPlugins {
|
||||||
hangar("PlaceholderAPI", "2.11.6")
|
hangar("PlaceholderAPI", "2.11.6")
|
||||||
url("https://download.luckperms.net/1593/bukkit/loader/LuckPerms-Bukkit-5.5.8.jar")
|
url("https://download.luckperms.net/1593/bukkit/loader/LuckPerms-Bukkit-5.5.8.jar")
|
||||||
|
github("Test-Account666", "PlugManX", "2.4.1", "PlugManX-2.4.1.jar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,27 +27,32 @@ public class CosmeticPacketInterface implements PacketInterface {
|
|||||||
@Override
|
@Override
|
||||||
public PacketAction writeContainerContent(@NotNull Player player, @NotNull ContainerContentWrapper wrapper) {
|
public PacketAction writeContainerContent(@NotNull Player player, @NotNull ContainerContentWrapper wrapper) {
|
||||||
int windowId = wrapper.getWindowId();
|
int windowId = wrapper.getWindowId();
|
||||||
|
MessagesUtil.sendDebugMessages("writeContainerContent (windowid: " + windowId + " )");
|
||||||
if (windowId != 0) return PacketAction.NOTHING;
|
if (windowId != 0) return PacketAction.NOTHING;
|
||||||
List<ItemStack> slotData = wrapper.getSlotData();
|
List<ItemStack> slotData = wrapper.getSlotData();
|
||||||
|
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
if (user == null) return PacketAction.NOTHING;
|
if (user == null) return PacketAction.NOTHING;
|
||||||
|
|
||||||
HashMap<Integer, ItemStack> items = new HashMap<>();
|
HashMap<Integer, ItemStack> cosmeticItems = new HashMap<>();
|
||||||
|
|
||||||
if (!user.isInWardrobe()) for (Cosmetic cosmetic : user.getCosmetics()) if (cosmetic instanceof CosmeticArmorType armorType) {
|
if (!user.isInWardrobe()) {
|
||||||
boolean requireEmpty = Settings.getSlotOption(armorType.getEquipSlot()).isRequireEmpty();
|
for (Cosmetic cosmetic : user.getCosmetics()) {
|
||||||
boolean isAir = user.getPlayer().getInventory().getItem(armorType.getEquipSlot()).getType().isAir();
|
if (cosmetic instanceof CosmeticArmorType armorType) {
|
||||||
MessagesUtil.sendDebugMessages("Menu Fired (Checks) - " + armorType.getId() + " - " + requireEmpty + " - " + isAir);
|
boolean requireEmpty = Settings.getSlotOption(armorType.getEquipSlot()).isRequireEmpty();
|
||||||
if (requireEmpty && !isAir) continue;
|
boolean isAir = user.getPlayer().getInventory().getItem(armorType.getEquipSlot()).getType().isAir();
|
||||||
items.put(HMCCInventoryUtils.getPacketArmorSlot(armorType.getEquipSlot()), user.getUserCosmeticItem(armorType));
|
MessagesUtil.sendDebugMessages("Menu Fired (Checks) - " + armorType.getId() + " - " + requireEmpty + " - " + isAir);
|
||||||
|
if (requireEmpty && !isAir) continue;
|
||||||
|
cosmeticItems.put(HMCCInventoryUtils.getPacketArmorSlot(armorType.getEquipSlot()), user.getUserCosmeticItem(armorType));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int slot = 0; slot < 46; slot++) {
|
for (int slot = 0; slot < 46; slot++) {
|
||||||
if ((slot >= 5 && slot <= 8) || slot == 45) {
|
if ((slot >= 5 && slot <= 8) || slot == 45) {
|
||||||
if (!items.containsKey(slot)) continue;
|
if (!cosmeticItems.containsKey(slot)) continue;
|
||||||
slotData.set(slot, items.get(slot));
|
slotData.set(slot, cosmeticItems.get(slot));
|
||||||
if (Settings.isDebugMode()) MessagesUtil.sendDebugMessages("Set " + slot + " as " + items.get(slot));
|
if (Settings.isDebugMode()) MessagesUtil.sendDebugMessages("Set " + slot + " as " + cosmeticItems.get(slot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user