mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-14 19:32:17 +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 {
|
} else {
|
||||||
// Try to infer the type from the fields present.
|
// Try to infer the type from the fields present.
|
||||||
Set<String> keys = compound.keySet();
|
Set<String> keys = compound.keySet();
|
||||||
if (keys.contains("text")) {
|
if (keys.isEmpty()) {
|
||||||
|
return Component.empty();
|
||||||
|
} else if (keys.contains("text")) {
|
||||||
builder = deserializeTextComponent(compound);
|
builder = deserializeTextComponent(compound);
|
||||||
} else if (keys.contains("translate")) {
|
} else if (keys.contains("translate")) {
|
||||||
builder = deserializeTranslatableComponent(compound);
|
builder = deserializeTranslatableComponent(compound);
|
||||||
@ -79,6 +81,9 @@ final class NbtComponentSerializerImpl implements NbtComponentSerializer {
|
|||||||
builder = deserializeKeybindComponent(compound);
|
builder = deserializeKeybindComponent(compound);
|
||||||
} else if (keys.contains("nbt")) {
|
} else if (keys.contains("nbt")) {
|
||||||
builder = deserializeNbtComponent(compound);
|
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");
|
} 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.
|
* It closes the player inventory (when opened) if {@link #getOpenInventory()} returns null.
|
||||||
*/
|
*/
|
||||||
public void closeInventory() {
|
public void closeInventory() {
|
||||||
closeInventory(false);
|
closeInventory(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
|
Loading…
Reference in New Issue
Block a user