mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add closeForm api method
This commit is contained in:
parent
7121da70cd
commit
7675d91124
2 changed files with 19 additions and 5 deletions
|
|
@ -60,6 +60,16 @@ public interface GeyserConnection extends Connection, CommandSource {
|
||||||
*/
|
*/
|
||||||
@NonNull EntityData entities();
|
@NonNull EntityData entities();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current ping of the connection.
|
||||||
|
*/
|
||||||
|
int ping();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the currently open form on the client.
|
||||||
|
*/
|
||||||
|
void closeForm();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param javaId the Java entity ID to look up.
|
* @param javaId the Java entity ID to look up.
|
||||||
* @return a {@link GeyserEntity} if present in this connection's entity tracker.
|
* @return a {@link GeyserEntity} if present in this connection's entity tracker.
|
||||||
|
|
@ -132,9 +142,4 @@ public interface GeyserConnection extends Connection, CommandSource {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@NonNull
|
@NonNull
|
||||||
Set<String> fogEffects();
|
Set<String> fogEffects();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current ping of the connection.
|
|
||||||
*/
|
|
||||||
int ping();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.BiomeDefinitionListPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.BiomeDefinitionListPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.CameraPresetsPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.CameraPresetsPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.ChunkRadiusUpdatedPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.ChunkRadiusUpdatedPacket;
|
||||||
|
import org.cloudburstmc.protocol.bedrock.packet.ClientboundCloseFormPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.CreativeContentPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.CreativeContentPacket;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.EmoteListPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.EmoteListPacket;
|
||||||
|
|
@ -2114,6 +2115,14 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
return (int) Math.floor(rakSessionCodec.getPing());
|
return (int) Math.floor(rakSessionCodec.getPing());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeForm() {
|
||||||
|
// TODO remove once 1.21.2 is lowest supported version
|
||||||
|
if (upstream.getProtocolVersion() >= 686) {
|
||||||
|
sendUpstreamPacket(new ClientboundCloseFormPacket());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addCommandEnum(String name, String enums) {
|
public void addCommandEnum(String name, String enums) {
|
||||||
softEnumPacket(name, SoftEnumUpdateType.ADD, enums);
|
softEnumPacket(name, SoftEnumUpdateType.ADD, enums);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue