Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Bump version to try and fix deploying; other nitpicks
Dieser Commit ist enthalten in:
Ursprung
ea8f4b854b
Commit
b9541505af
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -20,7 +20,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*stage ('Deploy') {
|
stage ('Deploy') {
|
||||||
when {
|
when {
|
||||||
branch "master"
|
branch "master"
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ pipeline {
|
|||||||
serverId: "opencollab-artifactory"
|
serverId: "opencollab-artifactory"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>ap</artifactId>
|
<artifactId>ap</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-bungeecord</artifactId>
|
<artifactId>bootstrap-bungeecord</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Used for better working with internals without reflection -->
|
<!-- Used for better working with internals without reflection -->
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>ap</artifactId>
|
<artifactId>ap</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-spigot</artifactId>
|
<artifactId>bootstrap-spigot</artifactId>
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-sponge</artifactId>
|
<artifactId>bootstrap-sponge</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-standalone</artifactId>
|
<artifactId>bootstrap-standalone</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-velocity</artifactId>
|
<artifactId>bootstrap-velocity</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
|
|
||||||
@ -21,13 +21,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>ap</artifactId>
|
<artifactId>ap</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Jackson JSON and YAML serialization -->
|
<!-- Jackson JSON and YAML serialization -->
|
||||||
@ -115,7 +115,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
||||||
<artifactId>bedrock-v448</artifactId>
|
<artifactId>bedrock-v448</artifactId>
|
||||||
<version>690a545d</version>
|
<version>6ce2f6e</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
@ -80,7 +80,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
session.setBlockMappings(BlockRegistries.BLOCKS.forVersion(loginPacket.getProtocolVersion()));
|
session.setBlockMappings(BlockRegistries.BLOCKS.forVersion(loginPacket.getProtocolVersion()));
|
||||||
session.setItemMappings(Registries.ITEMS.forVersion(loginPacket.getProtocolVersion()));
|
session.setItemMappings(Registries.ITEMS.forVersion(loginPacket.getProtocolVersion()));
|
||||||
|
|
||||||
LoginEncryptionUtils.encryptPlayerConnection(connector, session, loginPacket);
|
LoginEncryptionUtils.encryptPlayerConnection(session, loginPacket);
|
||||||
|
|
||||||
PlayStatusPacket playStatus = new PlayStatusPacket();
|
PlayStatusPacket playStatus = new PlayStatusPacket();
|
||||||
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
|
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
|
||||||
|
@ -29,6 +29,6 @@ import org.geysermc.connector.network.session.GeyserSession;
|
|||||||
|
|
||||||
public abstract class PacketTranslator<T> {
|
public abstract class PacketTranslator<T> {
|
||||||
|
|
||||||
public abstract void translate(T packet, GeyserSession session);
|
public abstract void translate(GeyserSession session, T packet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class PacketTranslatorRegistry<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
translator.translate(packet, session);
|
translator.translate(session, packet);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex);
|
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockAdventureSettingsTranslator extends PacketTranslator<AdventureSettingsPacket> {
|
public class BedrockAdventureSettingsTranslator extends PacketTranslator<AdventureSettingsPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(AdventureSettingsPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, AdventureSettingsPacket packet) {
|
||||||
boolean isFlying = packet.getSettings().contains(AdventureSetting.FLYING);
|
boolean isFlying = packet.getSettings().contains(AdventureSetting.FLYING);
|
||||||
if (!isFlying && session.getGameMode() == GameMode.SPECTATOR) {
|
if (!isFlying && session.getGameMode() == GameMode.SPECTATOR) {
|
||||||
// We should always be flying in spectator mode
|
// We should always be flying in spectator mode
|
||||||
|
@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
|
public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(AnimatePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, AnimatePacket packet) {
|
||||||
// Stop the player sending animations before they have fully spawned into the server
|
// Stop the player sending animations before they have fully spawned into the server
|
||||||
if (!session.isSpawned()) {
|
if (!session.isSpawned()) {
|
||||||
return;
|
return;
|
||||||
|
@ -39,7 +39,7 @@ import org.geysermc.connector.utils.SignUtils;
|
|||||||
public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEntityDataPacket> {
|
public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEntityDataPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(BlockEntityDataPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, BlockEntityDataPacket packet) {
|
||||||
NbtMap tag = packet.getData();
|
NbtMap tag = packet.getData();
|
||||||
if (tag.getString("id").equals("Sign")) {
|
if (tag.getString("id").equals("Sign")) {
|
||||||
// This is the reason why this all works - Bedrock sends packets every time you update the sign, Java only wants the final packet
|
// This is the reason why this all works - Bedrock sends packets every time you update the sign, Java only wants the final packet
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.utils.InventoryUtils;
|
|||||||
public class BedrockBlockPickRequestTranslator extends PacketTranslator<BlockPickRequestPacket> {
|
public class BedrockBlockPickRequestTranslator extends PacketTranslator<BlockPickRequestPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(BlockPickRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, BlockPickRequestPacket packet) {
|
||||||
Vector3i vector = packet.getBlockPosition();
|
Vector3i vector = packet.getBlockPosition();
|
||||||
int blockToPick = session.getConnector().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ());
|
int blockToPick = session.getConnector().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ());
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class BedrockBookEditTranslator extends PacketTranslator<BookEditPacket>
|
|||||||
private static final int MAXIMUM_TITLE_LENGTH = 128 * 4;
|
private static final int MAXIMUM_TITLE_LENGTH = 128 * 4;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(BookEditPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, BookEditPacket packet) {
|
||||||
if (packet.getText() != null && !packet.getText().isEmpty() && packet.getText().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PAGE_LENGTH) {
|
if (packet.getText() != null && !packet.getText().isEmpty() && packet.getText().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PAGE_LENGTH) {
|
||||||
session.getConnector().getLogger().warning("Page length greater than server allowed!");
|
session.getConnector().getLogger().warning("Page length greater than server allowed!");
|
||||||
return;
|
return;
|
||||||
|
@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockCommandBlockUpdateTranslator extends PacketTranslator<CommandBlockUpdatePacket> {
|
public class BedrockCommandBlockUpdateTranslator extends PacketTranslator<CommandBlockUpdatePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(CommandBlockUpdatePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, CommandBlockUpdatePacket packet) {
|
||||||
String command = packet.getCommand();
|
String command = packet.getCommand();
|
||||||
boolean outputTracked = packet.isOutputTracked();
|
boolean outputTracked = packet.isOutputTracked();
|
||||||
if (packet.isBlock()) {
|
if (packet.isBlock()) {
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator;
|
|||||||
public class BedrockCommandRequestTranslator extends PacketTranslator<CommandRequestPacket> {
|
public class BedrockCommandRequestTranslator extends PacketTranslator<CommandRequestPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(CommandRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, CommandRequestPacket packet) {
|
||||||
String command = packet.getCommand().replace("/", "");
|
String command = packet.getCommand().replace("/", "");
|
||||||
CommandManager commandManager = GeyserConnector.getInstance().getCommandManager();
|
CommandManager commandManager = GeyserConnector.getInstance().getCommandManager();
|
||||||
if (session.getConnector().getPlatformType() == PlatformType.STANDALONE && command.trim().startsWith("geyser ") && commandManager.getCommands().containsKey(command.split(" ")[1])) {
|
if (session.getConnector().getPlatformType() == PlatformType.STANDALONE && command.trim().startsWith("geyser ") && commandManager.getCommands().containsKey(command.split(" ")[1])) {
|
||||||
|
@ -38,7 +38,7 @@ import org.geysermc.connector.utils.InventoryUtils;
|
|||||||
public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerClosePacket> {
|
public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerClosePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ContainerClosePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ContainerClosePacket packet) {
|
||||||
byte windowId = packet.getId();
|
byte windowId = packet.getId();
|
||||||
|
|
||||||
//Client wants close confirmation
|
//Client wants close confirmation
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockEmoteListTranslator extends PacketTranslator<EmoteListPacket> {
|
public class BedrockEmoteListTranslator extends PacketTranslator<EmoteListPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(EmoteListPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, EmoteListPacket packet) {
|
||||||
if (session.getConnector().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) {
|
if (session.getConnector().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ import org.geysermc.connector.utils.InventoryUtils;
|
|||||||
public class BedrockEntityPickRequestTranslator extends PacketTranslator<EntityPickRequestPacket> {
|
public class BedrockEntityPickRequestTranslator extends PacketTranslator<EntityPickRequestPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(EntityPickRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, EntityPickRequestPacket packet) {
|
||||||
if (session.getGameMode() != GameMode.CREATIVE) return; // Apparently Java behavior
|
if (session.getGameMode() != GameMode.CREATIVE) return; // Apparently Java behavior
|
||||||
Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId());
|
Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId());
|
||||||
if (entity == null) return;
|
if (entity == null) return;
|
||||||
|
@ -41,7 +41,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockFilterTextTranslator extends PacketTranslator<FilterTextPacket> {
|
public class BedrockFilterTextTranslator extends PacketTranslator<FilterTextPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(FilterTextPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, FilterTextPacket packet) {
|
||||||
if (session.getOpenInventory() instanceof CartographyContainer) {
|
if (session.getOpenInventory() instanceof CartographyContainer) {
|
||||||
// We don't want to be able to rename in the cartography table
|
// We don't want to be able to rename in the cartography table
|
||||||
return;
|
return;
|
||||||
|
@ -70,7 +70,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
|||||||
private static final float MAXIMUM_BLOCK_DESTROYING_DISTANCE = 36f;
|
private static final float MAXIMUM_BLOCK_DESTROYING_DISTANCE = 36f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(InventoryTransactionPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, InventoryTransactionPacket packet) {
|
||||||
// Send book updates before opening inventories
|
// Send book updates before opening inventories
|
||||||
session.getBookEditCache().checkForSend();
|
session.getBookEditCache().checkForSend();
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockItemFrameDropItemTranslator extends PacketTranslator<ItemFrameDropItemPacket> {
|
public class BedrockItemFrameDropItemTranslator extends PacketTranslator<ItemFrameDropItemPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ItemFrameDropItemPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ItemFrameDropItemPacket packet) {
|
||||||
Entity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition());
|
Entity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition());
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
||||||
|
@ -39,7 +39,7 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
|
|||||||
public class BedrockItemStackRequestTranslator extends PacketTranslator<ItemStackRequestPacket> {
|
public class BedrockItemStackRequestTranslator extends PacketTranslator<ItemStackRequestPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ItemStackRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ItemStackRequestPacket packet) {
|
||||||
Inventory inventory = session.getOpenInventory();
|
Inventory inventory = session.getOpenInventory();
|
||||||
if (inventory == null)
|
if (inventory == null)
|
||||||
return;
|
return;
|
||||||
|
@ -45,7 +45,7 @@ import org.geysermc.connector.utils.InventoryUtils;
|
|||||||
public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpdatePacket> {
|
public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpdatePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(LecternUpdatePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, LecternUpdatePacket packet) {
|
||||||
if (packet.isDroppingBook()) {
|
if (packet.isDroppingBook()) {
|
||||||
// Bedrock drops the book outside of the GUI. Java drops it in the GUI
|
// Bedrock drops the book outside of the GUI. Java drops it in the GUI
|
||||||
// So, we enter the GUI and then drop it! :)
|
// So, we enter the GUI and then drop it! :)
|
||||||
|
@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class BedrockMapInfoRequestTranslator extends PacketTranslator<MapInfoRequestPacket> {
|
public class BedrockMapInfoRequestTranslator extends PacketTranslator<MapInfoRequestPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(MapInfoRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, MapInfoRequestPacket packet) {
|
||||||
long mapId = packet.getUniqueMapId();
|
long mapId = packet.getUniqueMapId();
|
||||||
|
|
||||||
ClientboundMapItemDataPacket mapPacket = session.getStoredMaps().remove(mapId);
|
ClientboundMapItemDataPacket mapPacket = session.getStoredMaps().remove(mapId);
|
||||||
|
@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class BedrockMobEquipmentTranslator extends PacketTranslator<MobEquipmentPacket> {
|
public class BedrockMobEquipmentTranslator extends PacketTranslator<MobEquipmentPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(MobEquipmentPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, MobEquipmentPacket packet) {
|
||||||
if (!session.isSpawned() || packet.getHotbarSlot() > 8 ||
|
if (!session.isSpawned() || packet.getHotbarSlot() > 8 ||
|
||||||
packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) {
|
packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) {
|
||||||
// For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention
|
// For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEntityAbsolutePacket> {
|
public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEntityAbsolutePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(MoveEntityAbsolutePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, MoveEntityAbsolutePacket packet) {
|
||||||
session.setLastVehicleMoveTimestamp(System.currentTimeMillis());
|
session.setLastVehicleMoveTimestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
float y = packet.getPosition().getY();
|
float y = packet.getPosition().getY();
|
||||||
|
@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<NetworkStackLatencyPacket> {
|
public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<NetworkStackLatencyPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(NetworkStackLatencyPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, NetworkStackLatencyPacket packet) {
|
||||||
long pingId;
|
long pingId;
|
||||||
// so apparently, as of 1.16.200
|
// so apparently, as of 1.16.200
|
||||||
// PS4 divides the network stack latency timestamp FOR US!!!
|
// PS4 divides the network stack latency timestamp FOR US!!!
|
||||||
|
@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockPacketViolationWarningTranslator extends PacketTranslator<PacketViolationWarningPacket> {
|
public class BedrockPacketViolationWarningTranslator extends PacketTranslator<PacketViolationWarningPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(PacketViolationWarningPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, PacketViolationWarningPacket packet) {
|
||||||
// Not translated since this is something that the developers need to know
|
// Not translated since this is something that the developers need to know
|
||||||
session.getConnector().getLogger().error("Packet violation warning sent from client! " + packet.toString());
|
session.getConnector().getLogger().error("Packet violation warning sent from client! " + packet.toString());
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockPlayerInputTranslator extends PacketTranslator<PlayerInputPacket> {
|
public class BedrockPlayerInputTranslator extends PacketTranslator<PlayerInputPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(PlayerInputPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, PlayerInputPacket packet) {
|
||||||
ClientSteerVehiclePacket clientSteerVehiclePacket = new ClientSteerVehiclePacket(
|
ClientSteerVehiclePacket clientSteerVehiclePacket = new ClientSteerVehiclePacket(
|
||||||
packet.getInputMotion().getX(), packet.getInputMotion().getY(), packet.isJumping(), packet.isSneaking()
|
packet.getInputMotion().getX(), packet.getInputMotion().getY(), packet.isJumping(), packet.isSneaking()
|
||||||
);
|
);
|
||||||
|
@ -42,7 +42,7 @@ import org.geysermc.connector.utils.LoadstoneTracker;
|
|||||||
public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator<PositionTrackingDBClientRequestPacket> {
|
public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator<PositionTrackingDBClientRequestPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(PositionTrackingDBClientRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, PositionTrackingDBClientRequestPacket packet) {
|
||||||
PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket();
|
PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket();
|
||||||
broadcastPacket.setTrackingId(packet.getTrackingId());
|
broadcastPacket.setTrackingId(packet.getTrackingId());
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockRespawnTranslator extends PacketTranslator<RespawnPacket> {
|
public class BedrockRespawnTranslator extends PacketTranslator<RespawnPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(RespawnPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, RespawnPacket packet) {
|
||||||
if (packet.getState() == RespawnPacket.State.CLIENT_READY) {
|
if (packet.getState() == RespawnPacket.State.CLIENT_READY) {
|
||||||
// Previously we only sent the respawn packet before the server finished loading
|
// Previously we only sent the respawn packet before the server finished loading
|
||||||
// The message included was 'Otherwise when immediate respawn is on the client never loads'
|
// The message included was 'Otherwise when immediate respawn is on the client never loads'
|
||||||
|
@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Translator(packet = ServerSettingsRequestPacket.class)
|
@Translator(packet = ServerSettingsRequestPacket.class)
|
||||||
public class BedrockServerSettingsRequestTranslator extends PacketTranslator<ServerSettingsRequestPacket> {
|
public class BedrockServerSettingsRequestTranslator extends PacketTranslator<ServerSettingsRequestPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSettingsRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerSettingsRequestPacket packet) {
|
||||||
CustomForm window = SettingsUtils.buildForm(session);
|
CustomForm window = SettingsUtils.buildForm(session);
|
||||||
int windowId = session.getFormCache().addForm(window);
|
int windowId = session.getFormCache().addForm(window);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.skin.SkullSkinManager;
|
|||||||
@Translator(packet = SetLocalPlayerAsInitializedPacket.class)
|
@Translator(packet = SetLocalPlayerAsInitializedPacket.class)
|
||||||
public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator<SetLocalPlayerAsInitializedPacket> {
|
public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator<SetLocalPlayerAsInitializedPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(SetLocalPlayerAsInitializedPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) {
|
||||||
if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {
|
if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {
|
||||||
if (!session.getUpstream().isInitialized()) {
|
if (!session.getUpstream().isInitialized()) {
|
||||||
session.getUpstream().setInitialized(true);
|
session.getUpstream().setInitialized(true);
|
||||||
|
@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket;
|
|||||||
public class BedrockShowCreditsTranslator extends PacketTranslator<ShowCreditsPacket> {
|
public class BedrockShowCreditsTranslator extends PacketTranslator<ShowCreditsPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ShowCreditsPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ShowCreditsPacket packet) {
|
||||||
if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) {
|
if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) {
|
||||||
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
|
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
|
||||||
session.sendDownstreamPacket(javaRespawnPacket);
|
session.sendDownstreamPacket(javaRespawnPacket);
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator;
|
|||||||
public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
|
public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(TextPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, TextPacket packet) {
|
||||||
String message = packet.getMessage();
|
String message = packet.getMessage();
|
||||||
|
|
||||||
if (MessageTranslator.isTooLong(message, session)) {
|
if (MessageTranslator.isTooLong(message, session)) {
|
||||||
|
@ -43,7 +43,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class BedrockEntityEventTranslator extends PacketTranslator<EntityEventPacket> {
|
public class BedrockEntityEventTranslator extends PacketTranslator<EntityEventPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(EntityEventPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, EntityEventPacket packet) {
|
||||||
switch (packet.getType()) {
|
switch (packet.getType()) {
|
||||||
case EATING_ITEM:
|
case EATING_ITEM:
|
||||||
// Resend the packet so we get the eating sounds
|
// Resend the packet so we get the eating sounds
|
||||||
|
@ -54,7 +54,7 @@ import java.util.ArrayList;
|
|||||||
public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> {
|
public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(PlayerActionPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, PlayerActionPacket packet) {
|
||||||
SessionPlayerEntity entity = session.getPlayerEntity();
|
SessionPlayerEntity entity = session.getPlayerEntity();
|
||||||
|
|
||||||
// Send book update before any player action
|
// Send book update before any player action
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.utils.BlockUtils;
|
|||||||
public class BedrockEmoteTranslator extends PacketTranslator<EmotePacket> {
|
public class BedrockEmoteTranslator extends PacketTranslator<EmotePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(EmotePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, EmotePacket packet) {
|
||||||
if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) {
|
if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) {
|
||||||
// Activate the workaround - we should trigger the offhand now
|
// Activate the workaround - we should trigger the offhand now
|
||||||
ClientPlayerActionPacket swapHandsPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO,
|
ClientPlayerActionPacket swapHandsPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO,
|
||||||
|
@ -46,7 +46,7 @@ import org.geysermc.connector.utils.InteractiveTagManager;
|
|||||||
public class BedrockInteractTranslator extends PacketTranslator<InteractPacket> {
|
public class BedrockInteractTranslator extends PacketTranslator<InteractPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(InteractPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, InteractPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getRuntimeEntityId() == session.getPlayerEntity().getGeyserId()) {
|
if (packet.getRuntimeEntityId() == session.getPlayerEntity().getGeyserId()) {
|
||||||
//Player is not in entity cache
|
//Player is not in entity cache
|
||||||
|
@ -53,7 +53,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(MovePlayerPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, MovePlayerPacket packet) {
|
||||||
SessionPlayerEntity entity = session.getPlayerEntity();
|
SessionPlayerEntity entity = session.getPlayerEntity();
|
||||||
if (!session.isSpawned()) return;
|
if (!session.isSpawned()) return;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
@Translator(packet = RiderJumpPacket.class)
|
@Translator(packet = RiderJumpPacket.class)
|
||||||
public class BedrockRiderJumpTranslator extends PacketTranslator<RiderJumpPacket> {
|
public class BedrockRiderJumpTranslator extends PacketTranslator<RiderJumpPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(RiderJumpPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, RiderJumpPacket packet) {
|
||||||
Entity vehicle = session.getRidingVehicleEntity();
|
Entity vehicle = session.getRidingVehicleEntity();
|
||||||
if (vehicle instanceof AbstractHorseEntity) {
|
if (vehicle instanceof AbstractHorseEntity) {
|
||||||
ClientPlayerStatePacket playerStatePacket = new ClientPlayerStatePacket((int) vehicle.getEntityId(), PlayerState.START_HORSE_JUMP, packet.getJumpStrength());
|
ClientPlayerStatePacket playerStatePacket = new ClientPlayerStatePacket((int) vehicle.getEntityId(), PlayerState.START_HORSE_JUMP, packet.getJumpStrength());
|
||||||
|
@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class BedrockSetPlayerGameTypeTranslator extends PacketTranslator<SetPlayerGameTypePacket> {
|
public class BedrockSetPlayerGameTypeTranslator extends PacketTranslator<SetPlayerGameTypePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(SetPlayerGameTypePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, SetPlayerGameTypePacket packet) {
|
||||||
// no
|
// no
|
||||||
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
||||||
playerGameTypePacket.setGamemode(session.getGameMode().ordinal());
|
playerGameTypePacket.setGamemode(session.getGameMode().ordinal());
|
||||||
|
@ -36,7 +36,7 @@ import org.geysermc.connector.utils.CooldownUtils;
|
|||||||
public class BedrockLevelSoundEventTranslator extends PacketTranslator<LevelSoundEventPacket> {
|
public class BedrockLevelSoundEventTranslator extends PacketTranslator<LevelSoundEventPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(LevelSoundEventPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, LevelSoundEventPacket packet) {
|
||||||
// lol what even :thinking:
|
// lol what even :thinking:
|
||||||
session.sendUpstreamPacket(packet);
|
session.sendUpstreamPacket(packet);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
@Translator(packet = ServerAdvancementTabPacket.class)
|
@Translator(packet = ServerAdvancementTabPacket.class)
|
||||||
public class JavaAdvancementsTabTranslator extends PacketTranslator<ServerAdvancementTabPacket> {
|
public class JavaAdvancementsTabTranslator extends PacketTranslator<ServerAdvancementTabPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerAdvancementTabPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerAdvancementTabPacket packet) {
|
||||||
AdvancementsCache advancementsCache = session.getAdvancementsCache();
|
AdvancementsCache advancementsCache = session.getAdvancementsCache();
|
||||||
advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId());
|
advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId());
|
||||||
advancementsCache.buildAndShowListForm();
|
advancementsCache.buildAndShowListForm();
|
||||||
|
@ -42,7 +42,7 @@ import java.util.Map;
|
|||||||
public class JavaAdvancementsTranslator extends PacketTranslator<ServerAdvancementsPacket> {
|
public class JavaAdvancementsTranslator extends PacketTranslator<ServerAdvancementsPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerAdvancementsPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerAdvancementsPacket packet) {
|
||||||
AdvancementsCache advancementsCache = session.getAdvancementsCache();
|
AdvancementsCache advancementsCache = session.getAdvancementsCache();
|
||||||
if (packet.isReset()) {
|
if (packet.isReset()) {
|
||||||
advancementsCache.getStoredAdvancements().clear();
|
advancementsCache.getStoredAdvancements().clear();
|
||||||
|
@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerBossBarPacke
|
|||||||
@Translator(packet = ServerBossBarPacket.class)
|
@Translator(packet = ServerBossBarPacket.class)
|
||||||
public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket> {
|
public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerBossBarPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerBossBarPacket packet) {
|
||||||
BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid());
|
BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid());
|
||||||
switch (packet.getAction()) {
|
switch (packet.getAction()) {
|
||||||
case ADD:
|
case ADD:
|
||||||
|
@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator;
|
|||||||
public class JavaChatTranslator extends PacketTranslator<ServerChatPacket> {
|
public class JavaChatTranslator extends PacketTranslator<ServerChatPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerChatPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerChatPacket packet) {
|
||||||
TextPacket textPacket = new TextPacket();
|
TextPacket textPacket = new TextPacket();
|
||||||
textPacket.setPlatformChatId("");
|
textPacket.setPlatformChatId("");
|
||||||
textPacket.setSourceName("");
|
textPacket.setSourceName("");
|
||||||
|
@ -96,7 +96,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator<ServerDeclar
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerDeclareCommandsPacket packet) {
|
||||||
// Don't send command suggestions if they are disabled
|
// Don't send command suggestions if they are disabled
|
||||||
if (!session.getConnector().getConfig().isCommandSuggestions()) {
|
if (!session.getConnector().getConfig().isCommandSuggestions()) {
|
||||||
session.getConnector().getLogger().debug("Not sending translated command suggestions as they are disabled.");
|
session.getConnector().getLogger().debug("Not sending translated command suggestions as they are disabled.");
|
||||||
|
@ -71,7 +71,7 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator<ServerDeclare
|
|||||||
);
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerDeclareRecipesPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerDeclareRecipesPacket packet) {
|
||||||
Map<RecipeType, List<CraftingData>> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion());
|
Map<RecipeType, List<CraftingData>> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion());
|
||||||
// Get the last known network ID (first used for the pregenerated recipes) and increment from there.
|
// Get the last known network ID (first used for the pregenerated recipes) and increment from there.
|
||||||
int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1;
|
int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1;
|
||||||
|
@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaDeclareTagsTranslator extends PacketTranslator<ServerDeclareTagsPacket> {
|
public class JavaDeclareTagsTranslator extends PacketTranslator<ServerDeclareTagsPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerDeclareTagsPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerDeclareTagsPacket packet) {
|
||||||
session.getTagCache().loadPacket(packet);
|
session.getTagCache().loadPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket;
|
|||||||
public class JavaDifficultyTranslator extends PacketTranslator<ServerDifficultyPacket> {
|
public class JavaDifficultyTranslator extends PacketTranslator<ServerDifficultyPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerDifficultyPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerDifficultyPacket packet) {
|
||||||
SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket();
|
SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket();
|
||||||
setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal());
|
setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal());
|
||||||
session.sendUpstreamPacket(setDifficultyPacket);
|
session.sendUpstreamPacket(setDifficultyPacket);
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator;
|
|||||||
public class JavaDisconnectPacket extends PacketTranslator<ServerDisconnectPacket> {
|
public class JavaDisconnectPacket extends PacketTranslator<ServerDisconnectPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerDisconnectPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerDisconnectPacket packet) {
|
||||||
session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale()));
|
session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
|
|||||||
private static final List<SkinPart> SKIN_PART_VALUES = Arrays.asList(SkinPart.values());
|
private static final List<SkinPart> SKIN_PART_VALUES = Arrays.asList(SkinPart.values());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerJoinGamePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerJoinGamePacket packet) {
|
||||||
PlayerEntity entity = session.getPlayerEntity();
|
PlayerEntity entity = session.getPlayerEntity();
|
||||||
entity.setEntityId(packet.getEntityId());
|
entity.setEntityId(packet.getEntityId());
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaKeepAliveTranslator extends PacketTranslator<ServerKeepAlivePacket> {
|
public class JavaKeepAliveTranslator extends PacketTranslator<ServerKeepAlivePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerKeepAlivePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerKeepAlivePacket packet) {
|
||||||
if (!session.getConnector().getConfig().isForwardPlayerPing()) {
|
if (!session.getConnector().getConfig().isForwardPlayerPing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator;
|
|||||||
public class JavaLoginDisconnectTranslator extends PacketTranslator<LoginDisconnectPacket> {
|
public class JavaLoginDisconnectTranslator extends PacketTranslator<LoginDisconnectPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(LoginDisconnectPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, LoginDisconnectPacket packet) {
|
||||||
// The client doesn't manually get disconnected so we have to do it ourselves
|
// The client doesn't manually get disconnected so we have to do it ourselves
|
||||||
session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale()));
|
session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale()));
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestP
|
|||||||
@Translator(packet = LoginPluginRequestPacket.class)
|
@Translator(packet = LoginPluginRequestPacket.class)
|
||||||
public class JavaLoginPluginRequestTranslator extends PacketTranslator<LoginPluginRequestPacket> {
|
public class JavaLoginPluginRequestTranslator extends PacketTranslator<LoginPluginRequestPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(LoginPluginRequestPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, LoginPluginRequestPacket packet) {
|
||||||
// A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either.
|
// A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either.
|
||||||
// Note: Fabric Networking API v1 will not let the client log in without sending this
|
// Note: Fabric Networking API v1 will not let the client log in without sending this
|
||||||
session.sendDownstreamPacket(
|
session.sendDownstreamPacket(
|
||||||
|
@ -38,7 +38,7 @@ import org.geysermc.connector.skin.SkinManager;
|
|||||||
public class JavaLoginSuccessTranslator extends PacketTranslator<LoginSuccessPacket> {
|
public class JavaLoginSuccessTranslator extends PacketTranslator<LoginSuccessPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(LoginSuccessPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, LoginSuccessPacket packet) {
|
||||||
PlayerEntity playerEntity = session.getPlayerEntity();
|
PlayerEntity playerEntity = session.getPlayerEntity();
|
||||||
AuthType remoteAuthType = session.getRemoteAuthType();
|
AuthType remoteAuthType = session.getRemoteAuthType();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaPingPacket extends PacketTranslator<ServerPingPacket> {
|
public class JavaPingPacket extends PacketTranslator<ServerPingPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPingPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPingPacket packet) {
|
||||||
session.sendDownstreamPacket(new ClientPongPacket(packet.getId()));
|
session.sendDownstreamPacket(new ClientPongPacket(packet.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
@Translator(packet = ServerPluginMessagePacket.class)
|
@Translator(packet = ServerPluginMessagePacket.class)
|
||||||
public class JavaPluginMessageTranslator extends PacketTranslator<ServerPluginMessagePacket> {
|
public class JavaPluginMessageTranslator extends PacketTranslator<ServerPluginMessagePacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPluginMessagePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPluginMessagePacket packet) {
|
||||||
// The only plugin messages it has to listen for are Floodgate plugin messages
|
// The only plugin messages it has to listen for are Floodgate plugin messages
|
||||||
if (session.getRemoteAuthType() != AuthType.FLOODGATE) {
|
if (session.getRemoteAuthType() != AuthType.FLOODGATE) {
|
||||||
return;
|
return;
|
||||||
|
@ -43,7 +43,7 @@ import org.geysermc.connector.utils.DimensionUtils;
|
|||||||
public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket> {
|
public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerRespawnPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerRespawnPacket packet) {
|
||||||
SessionPlayerEntity entity = session.getPlayerEntity();
|
SessionPlayerEntity entity = session.getPlayerEntity();
|
||||||
|
|
||||||
entity.setHealth(entity.getMaxHealth());
|
entity.setHealth(entity.getMaxHealth());
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.utils.StatisticsUtils;
|
|||||||
public class JavaStatisticsTranslator extends PacketTranslator<ServerStatisticsPacket> {
|
public class JavaStatisticsTranslator extends PacketTranslator<ServerStatisticsPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerStatisticsPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerStatisticsPacket packet) {
|
||||||
session.updateStatistics(packet.getStatistics());
|
session.updateStatistics(packet.getStatistics());
|
||||||
|
|
||||||
if (session.isWaitingForStatistics()) {
|
if (session.isWaitingForStatistics()) {
|
||||||
|
@ -40,7 +40,7 @@ import java.util.Arrays;
|
|||||||
public class JavaUnlockRecipesTranslator extends PacketTranslator<ServerUnlockRecipesPacket> {
|
public class JavaUnlockRecipesTranslator extends PacketTranslator<ServerUnlockRecipesPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerUnlockRecipesPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerUnlockRecipesPacket packet) {
|
||||||
if (packet.getAction() == UnlockRecipesAction.REMOVE) {
|
if (packet.getAction() == UnlockRecipesAction.REMOVE) {
|
||||||
session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes()));
|
session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.utils.DimensionUtils;
|
|||||||
public class JavaEntityAnimationTranslator extends PacketTranslator<ServerEntityAnimationPacket> {
|
public class JavaEntityAnimationTranslator extends PacketTranslator<ServerEntityAnimationPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityAnimationPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityAnimationPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -42,7 +42,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityAttachTranslator extends PacketTranslator<ServerEntityAttachPacket> {
|
public class JavaEntityAttachTranslator extends PacketTranslator<ServerEntityAttachPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityAttachPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityAttachPacket packet) {
|
||||||
|
|
||||||
Entity holderId;
|
Entity holderId;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
|
@ -44,7 +44,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityCollectItemTranslator extends PacketTranslator<ServerEntityCollectItemPacket> {
|
public class JavaEntityCollectItemTranslator extends PacketTranslator<ServerEntityCollectItemPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityCollectItemPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityCollectItemPacket packet) {
|
||||||
// Collected entity is the other entity
|
// Collected entity is the other entity
|
||||||
Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId());
|
Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId());
|
||||||
if (collectedEntity == null) return;
|
if (collectedEntity == null) return;
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.utils.EntityUtils;
|
|||||||
public class JavaEntityEffectTranslator extends PacketTranslator<ServerEntityEffectPacket> {
|
public class JavaEntityEffectTranslator extends PacketTranslator<ServerEntityEffectPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityEffectPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityEffectPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -39,7 +39,7 @@ import org.geysermc.connector.network.translators.item.ItemTranslator;
|
|||||||
public class JavaEntityEquipmentTranslator extends PacketTranslator<ServerEntityEquipmentPacket> {
|
public class JavaEntityEquipmentTranslator extends PacketTranslator<ServerEntityEquipmentPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityEquipmentPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityEquipmentPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityHeadLookTranslator extends PacketTranslator<ServerEntityHeadLookPacket> {
|
public class JavaEntityHeadLookTranslator extends PacketTranslator<ServerEntityHeadLookPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityHeadLookPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityHeadLookPacket packet) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -39,7 +39,7 @@ import org.geysermc.connector.utils.LanguageUtils;
|
|||||||
public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityMetadataPacket> {
|
public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityMetadataPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityMetadataPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityMetadataPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityPositionRotationTranslator extends PacketTranslator<ServerEntityPositionRotationPacket> {
|
public class JavaEntityPositionRotationTranslator extends PacketTranslator<ServerEntityPositionRotationPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityPositionRotationPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityPositionRotationPacket packet) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityPositionTranslator extends PacketTranslator<ServerEntityPositionPacket> {
|
public class JavaEntityPositionTranslator extends PacketTranslator<ServerEntityPositionPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityPositionPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityPositionPacket packet) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityPropertiesTranslator extends PacketTranslator<ServerEntityPropertiesPacket> {
|
public class JavaEntityPropertiesTranslator extends PacketTranslator<ServerEntityPropertiesPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityPropertiesPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityPropertiesPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.utils.EntityUtils;
|
|||||||
public class JavaEntityRemoveEffectTranslator extends PacketTranslator<ServerEntityRemoveEffectPacket> {
|
public class JavaEntityRemoveEffectTranslator extends PacketTranslator<ServerEntityRemoveEffectPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityRemoveEffectPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityRemoveEffectPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityRotationTranslator extends PacketTranslator<ServerEntityRotationPacket> {
|
public class JavaEntityRotationTranslator extends PacketTranslator<ServerEntityRotationPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityRotationPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityRotationPacket packet) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -43,7 +43,7 @@ import java.util.Arrays;
|
|||||||
public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEntitySetPassengersPacket> {
|
public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEntitySetPassengersPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntitySetPassengersPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntitySetPassengersPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -43,7 +43,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
|
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityStatusPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityStatusPacket packet) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -37,7 +37,7 @@ import com.nukkitx.math.vector.Vector3f;
|
|||||||
public class JavaEntityTeleportTranslator extends PacketTranslator<ServerEntityTeleportPacket> {
|
public class JavaEntityTeleportTranslator extends PacketTranslator<ServerEntityTeleportPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityTeleportPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityTeleportPacket packet) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket;
|
|||||||
public class JavaEntityVelocityTranslator extends PacketTranslator<ServerEntityVelocityPacket> {
|
public class JavaEntityVelocityTranslator extends PacketTranslator<ServerEntityVelocityPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerEntityVelocityPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerEntityVelocityPacket packet) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
entity = session.getPlayerEntity();
|
entity = session.getPlayerEntity();
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaRemoveEntitiesTranslator extends PacketTranslator<ServerRemoveEntitiesPacket> {
|
public class JavaRemoveEntitiesTranslator extends PacketTranslator<ServerRemoveEntitiesPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerRemoveEntitiesPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerRemoveEntitiesPacket packet) {
|
||||||
for (int entityId : packet.getEntityIds()) {
|
for (int entityId : packet.getEntityIds()) {
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(entityId);
|
Entity entity = session.getEntityCache().getEntityByJavaId(entityId);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
|
@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaPlayerAbilitiesTranslator extends PacketTranslator<ServerPlayerAbilitiesPacket> {
|
public class JavaPlayerAbilitiesTranslator extends PacketTranslator<ServerPlayerAbilitiesPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerAbilitiesPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerAbilitiesPacket packet) {
|
||||||
session.setCanFly(packet.isCanFly());
|
session.setCanFly(packet.isCanFly());
|
||||||
session.setFlying(packet.isFlying());
|
session.setFlying(packet.isFlying());
|
||||||
session.sendAdventureSettings();
|
session.sendAdventureSettings();
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.utils.ChunkUtils;
|
|||||||
public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayerActionAckPacket> {
|
public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayerActionAckPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerActionAckPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerActionAckPacket packet) {
|
||||||
ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition());
|
ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition());
|
||||||
if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) {
|
if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) {
|
||||||
LevelEventPacket stopBreak = new LevelEventPacket();
|
LevelEventPacket stopBreak = new LevelEventPacket();
|
||||||
|
@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator<ServerPlayerChangeHeldItemPacket> {
|
public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator<ServerPlayerChangeHeldItemPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerChangeHeldItemPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerChangeHeldItemPacket packet) {
|
||||||
PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket();
|
PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket();
|
||||||
hotbarPacket.setContainerId(0);
|
hotbarPacket.setContainerId(0);
|
||||||
hotbarPacket.setSelectedHotbarSlot(packet.getSlot());
|
hotbarPacket.setSelectedHotbarSlot(packet.getSlot());
|
||||||
|
@ -41,7 +41,7 @@ import java.util.List;
|
|||||||
public class JavaPlayerHealthTranslator extends PacketTranslator<ServerPlayerHealthPacket> {
|
public class JavaPlayerHealthTranslator extends PacketTranslator<ServerPlayerHealthPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerHealthPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerHealthPacket packet) {
|
||||||
SessionPlayerEntity entity = session.getPlayerEntity();
|
SessionPlayerEntity entity = session.getPlayerEntity();
|
||||||
|
|
||||||
int health = (int) Math.ceil(packet.getHealth());
|
int health = (int) Math.ceil(packet.getHealth());
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.connector.skin.SkinManager;
|
|||||||
@Translator(packet = ServerPlayerListEntryPacket.class)
|
@Translator(packet = ServerPlayerListEntryPacket.class)
|
||||||
public class JavaPlayerListEntryTranslator extends PacketTranslator<ServerPlayerListEntryPacket> {
|
public class JavaPlayerListEntryTranslator extends PacketTranslator<ServerPlayerListEntryPacket> {
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerListEntryPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerListEntryPacket packet) {
|
||||||
if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER)
|
if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ import org.geysermc.connector.utils.LanguageUtils;
|
|||||||
public class JavaPlayerPositionRotationTranslator extends PacketTranslator<ServerPlayerPositionRotationPacket> {
|
public class JavaPlayerPositionRotationTranslator extends PacketTranslator<ServerPlayerPositionRotationPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerPositionRotationPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerPositionRotationPacket packet) {
|
||||||
if (!session.isLoggedIn())
|
if (!session.isLoggedIn())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import java.util.Arrays;
|
|||||||
public class JavaPlayerSetExperienceTranslator extends PacketTranslator<ServerPlayerSetExperiencePacket> {
|
public class JavaPlayerSetExperienceTranslator extends PacketTranslator<ServerPlayerSetExperiencePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerPlayerSetExperiencePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerPlayerSetExperiencePacket packet) {
|
||||||
SessionPlayerEntity entity = session.getPlayerEntity();
|
SessionPlayerEntity entity = session.getPlayerEntity();
|
||||||
|
|
||||||
AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience());
|
AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience());
|
||||||
|
@ -46,7 +46,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
public class JavaSpawnEntityTranslator extends PacketTranslator<ServerSpawnEntityPacket> {
|
public class JavaSpawnEntityTranslator extends PacketTranslator<ServerSpawnEntityPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSpawnEntityPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerSpawnEntityPacket packet) {
|
||||||
|
|
||||||
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
||||||
Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ());
|
Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ());
|
||||||
|
@ -39,7 +39,7 @@ import com.nukkitx.math.vector.Vector3f;
|
|||||||
public class JavaSpawnExpOrbTranslator extends PacketTranslator<ServerSpawnExpOrbPacket> {
|
public class JavaSpawnExpOrbTranslator extends PacketTranslator<ServerSpawnExpOrbPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSpawnExpOrbPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerSpawnExpOrbPacket packet) {
|
||||||
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
||||||
|
|
||||||
Entity entity = new ExpOrbEntity(
|
Entity entity = new ExpOrbEntity(
|
||||||
|
@ -42,7 +42,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
public class JavaSpawnLivingEntityTranslator extends PacketTranslator<ServerSpawnLivingEntityPacket> {
|
public class JavaSpawnLivingEntityTranslator extends PacketTranslator<ServerSpawnLivingEntityPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSpawnLivingEntityPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerSpawnLivingEntityPacket packet) {
|
||||||
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
||||||
Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ());
|
Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ());
|
||||||
Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getHeadYaw());
|
Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getHeadYaw());
|
||||||
|
@ -37,7 +37,7 @@ import org.geysermc.connector.utils.PaintingType;
|
|||||||
public class JavaSpawnPaintingTranslator extends PacketTranslator<ServerSpawnPaintingPacket> {
|
public class JavaSpawnPaintingTranslator extends PacketTranslator<ServerSpawnPaintingPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSpawnPaintingPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerSpawnPaintingPacket packet) {
|
||||||
Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ());
|
Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ());
|
||||||
|
|
||||||
PaintingEntity entity = new PaintingEntity(packet.getEntityId(),
|
PaintingEntity entity = new PaintingEntity(packet.getEntityId(),
|
||||||
|
@ -39,7 +39,7 @@ import org.geysermc.connector.skin.SkinManager;
|
|||||||
public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlayerPacket> {
|
public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlayerPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSpawnPlayerPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerSpawnPlayerPacket packet) {
|
||||||
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
|
||||||
Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw());
|
Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw());
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerD
|
|||||||
public class JavaDisplayScoreboardTranslator extends PacketTranslator<ServerDisplayScoreboardPacket> {
|
public class JavaDisplayScoreboardTranslator extends PacketTranslator<ServerDisplayScoreboardPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerDisplayScoreboardPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerDisplayScoreboardPacket packet) {
|
||||||
session.getWorldCache().getScoreboard()
|
session.getWorldCache().getScoreboard()
|
||||||
.displayObjective(packet.getName(), packet.getPosition());
|
.displayObjective(packet.getName(), packet.getPosition());
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerS
|
|||||||
public class JavaScoreboardObjectiveTranslator extends PacketTranslator<ServerScoreboardObjectivePacket> {
|
public class JavaScoreboardObjectiveTranslator extends PacketTranslator<ServerScoreboardObjectivePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerScoreboardObjectivePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerScoreboardObjectivePacket packet) {
|
||||||
WorldCache worldCache = session.getWorldCache();
|
WorldCache worldCache = session.getWorldCache();
|
||||||
Scoreboard scoreboard = worldCache.getScoreboard();
|
Scoreboard scoreboard = worldCache.getScoreboard();
|
||||||
Objective objective = scoreboard.getObjective(packet.getName());
|
Objective objective = scoreboard.getObjective(packet.getName());
|
||||||
|
@ -47,7 +47,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
|
|||||||
private static final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger();
|
private static final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerTeamPacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerTeamPacket packet) {
|
||||||
if (LOGGER.isDebug()) {
|
if (LOGGER.isDebug()) {
|
||||||
LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers()));
|
LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers()));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator<ServerUpdateScor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerUpdateScorePacket packet, GeyserSession session) {
|
public void translate(GeyserSession session, ServerUpdateScorePacket packet) {
|
||||||
WorldCache worldCache = session.getWorldCache();
|
WorldCache worldCache = session.getWorldCache();
|
||||||
Scoreboard scoreboard = worldCache.getScoreboard();
|
Scoreboard scoreboard = worldCache.getScoreboard();
|
||||||
int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond();
|
int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond();
|
||||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren