mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-14 03:11:25 +01:00
fix: do not send close inventory packet when opening a new inventory while one is open
This commit is contained in:
parent
c4af024bd5
commit
2920cee2f6
@ -67,7 +67,9 @@ final class NbtComponentSerializerImpl implements NbtComponentSerializer {
|
||||
} else {
|
||||
// Try to infer the type from the fields present.
|
||||
Set<String> keys = compound.keySet();
|
||||
if (keys.contains("text")) {
|
||||
if (keys.isEmpty()) {
|
||||
return Component.empty();
|
||||
} else if (keys.contains("text")) {
|
||||
builder = deserializeTextComponent(compound);
|
||||
} else if (keys.contains("translate")) {
|
||||
builder = deserializeTranslatableComponent(compound);
|
||||
@ -79,6 +81,9 @@ final class NbtComponentSerializerImpl implements NbtComponentSerializer {
|
||||
builder = deserializeKeybindComponent(compound);
|
||||
} else if (keys.contains("nbt")) {
|
||||
builder = deserializeNbtComponent(compound);
|
||||
} else if (keys.contains("")) {
|
||||
//todo This feels like a bug, im not sure why this is created.
|
||||
builder = Component.text().content(compound.getString(""));
|
||||
} else throw new UnsupportedOperationException("Unable to infer component type");
|
||||
}
|
||||
|
||||
|
@ -1767,7 +1767,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
* It closes the player inventory (when opened) if {@link #getOpenInventory()} returns null.
|
||||
*/
|
||||
public void closeInventory() {
|
||||
closeInventory(false);
|
||||
closeInventory(true);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
Loading…
Reference in New Issue
Block a user