Skip to content

Commit

Permalink
Version 1.3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EssentialGGBot committed May 3, 2024
1 parent 7dc5d5c commit 34c4b33
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/release-1.3.2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Title: Bug Patch
Summary: Minor bug fixes

## Bug Fixes
- Fixed Gifting modal incorrectly claiming that all friends already own the item
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ org.gradle.configureondemand=true
org.gradle.parallel.threads=128
org.gradle.jvmargs=-Xmx16G
minecraftVersion=11202
version=1.3.2+g8cdc70f906
version=1.3.2.1+gb6bc6abcb6
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ModCore Inc. All rights reserved.
*
* This code is part of ModCore Inc.'s Essential Mod repository and is protected
* under copyright registration # TX0009138511. For the full license, see:
* https://github.com/EssentialGG/Essential/blob/main/LICENSE
*
* You may not use, copy, reproduce, modify, sell, license, distribute,
* commercialize, or otherwise exploit, or create derivative works based
* upon, this file or any other in this repository, all of which is reserved by Essential.
*/
package gg.essential.connectionmanager.common.packet.cosmetic;

import gg.essential.connectionmanager.common.packet.Packet;
import gg.essential.lib.gson.annotations.SerializedName;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.Map;
import java.util.UUID;

public class ServerCosmeticBulkRequestUnlockStateResponsePacket extends Packet {

private final @NotNull @SerializedName("unlock_states") Map<UUID, Boolean> unlockStates;

public ServerCosmeticBulkRequestUnlockStateResponsePacket(final @NotNull Map<UUID, Boolean> unlockStates) {
this.unlockStates = unlockStates;
}

public @NotNull Map<UUID, Boolean> getUnlockStates() {
return Collections.unmodifiableMap(this.unlockStates);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import gg.essential.Essential
import gg.essential.api.gui.NotificationType
import gg.essential.api.gui.Slot
import gg.essential.connectionmanager.common.packet.cosmetic.ClientCosmeticBulkRequestUnlockStatePacket
import gg.essential.connectionmanager.common.packet.cosmetic.ServerCosmeticBulkRequestUnlockStateResponsePacket
import gg.essential.connectionmanager.common.packet.response.ResponseActionPacket
import gg.essential.elementa.components.UIContainer
import gg.essential.elementa.constraints.ChildBasedMaxSizeConstraint
Expand All @@ -28,6 +29,7 @@ import gg.essential.gui.common.modal.EssentialModal
import gg.essential.gui.common.modal.configure
import gg.essential.gui.elementa.state.v2.MutableState
import gg.essential.gui.elementa.state.v2.add
import gg.essential.gui.elementa.state.v2.addAll
import gg.essential.gui.elementa.state.v2.combinators.map
import gg.essential.gui.elementa.state.v2.combinators.not
import gg.essential.gui.elementa.state.v2.isNotEmpty
Expand Down Expand Up @@ -117,7 +119,9 @@ fun openGiftModal(item: Item.CosmeticOrEmote, state: WardrobeState) {
val loadingFriends = mutableStateOf(allFriends.isNotEmpty())

connectionManager.send(ClientCosmeticBulkRequestUnlockStatePacket(allFriends.toSet(), item.cosmetic.id)) { maybePacket ->
ServerCosmeticBulkRequestUnlockStateResponsePacket::class.java // FIXME workaround for feature-flag-processor eating the packet
when (val packet = maybePacket.orElse(null)) {
is ServerCosmeticBulkRequestUnlockStateResponsePacket -> validFriends.addAll(packet.unlockStates.filter { !it.value }.keys.toList())
else -> {
showErrorToast("Something went wrong, please try again.")
val prefix = (packet as? ResponseActionPacket)?.let { "$it - " } ?: ""
Expand Down

0 comments on commit 34c4b33

Please sign in to comment.