Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Fix double disconnect bug and minor code cleanups
Dieser Commit ist enthalten in:
Ursprung
de78c93b72
Commit
295d8d5256
@ -158,8 +158,7 @@ public class GeyserSession implements PlayerSession, Player {
|
||||
public void disconnected(DisconnectedEvent event) {
|
||||
loggedIn = false;
|
||||
connector.getLogger().info(authenticationData.getName() + " has disconnected from remote java server on address " + remoteServer.getAddress() + " because of " + event.getReason());
|
||||
event.getCause().printStackTrace();
|
||||
disconnect(event.getReason());
|
||||
// upstream.disconnect(event.getReason());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,14 +95,13 @@ import org.geysermc.connector.network.translators.java.entity.spawn.JavaSpawnPla
|
||||
import org.geysermc.connector.network.translators.java.scoreboard.JavaDisplayScoreboardTranslator;
|
||||
import org.geysermc.connector.network.translators.java.scoreboard.JavaScoreboardObjectiveTranslator;
|
||||
import org.geysermc.connector.network.translators.java.scoreboard.JavaUpdateScoreTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaChunk;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaChunkDataPacket;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaNotifyClientTranslator;
|
||||
import org.geysermc.connector.network.translators.java.window.JavaOpenWindowTranslator;
|
||||
import org.geysermc.connector.network.translators.java.window.JavaSetSlotTranslator;
|
||||
import org.geysermc.connector.network.translators.java.JavaTitleTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaUpdateTimeTranslator;
|
||||
import org.geysermc.connector.network.translators.java.window.JavaWindowItemsTranslator;
|
||||
import org.geysermc.connector.utils.Chunks;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -161,7 +160,7 @@ public class TranslatorsInit {
|
||||
Registry.registerJava(ServerPlayerHealthPacket.class, new JavaPlayerHealthTranslator());
|
||||
|
||||
Registry.registerJava(ServerNotifyClientPacket.class, new JavaNotifyClientTranslator());
|
||||
Registry.registerJava(ServerChunkDataPacket.class, new JavaChunk());
|
||||
Registry.registerJava(ServerChunkDataPacket.class, new JavaChunkDataPacket());
|
||||
Registry.registerJava(ServerEntityDestroyPacket.class, new JavaEntityDestroyTranslator());
|
||||
Registry.registerJava(ServerWindowItemsPacket.class, new JavaWindowItemsTranslator());
|
||||
Registry.registerJava(ServerOpenWindowPacket.class, new JavaOpenWindowTranslator());
|
||||
|
@ -78,7 +78,6 @@ public class ItemTranslator {
|
||||
|
||||
public static BedrockItem getBedrockItem(ItemStack stack) {
|
||||
Map<String, Object> m = Remapper.JAVA_TO_BEDROCK.get(stack.getId());
|
||||
System.out.println(stack.getId());
|
||||
return new BedrockItem((String) m.get("name"), (Integer) m.get("id"), (Integer) m.get("data"));
|
||||
}
|
||||
|
||||
@ -89,7 +88,6 @@ public class ItemTranslator {
|
||||
|
||||
public static BedrockItem getBedrockBlock(BlockState stack) {
|
||||
Map<String, Object> m = Remapper.JAVA_TO_BEDROCK_BLOCKS.get(stack.getId());
|
||||
System.out.println(stack.getId());
|
||||
return new BedrockItem((String) m.get("name"), (Integer) m.get("id"), (Integer) m.get("data"));
|
||||
}
|
||||
|
||||
|
@ -3,26 +3,23 @@ package org.geysermc.connector.network.translators.java.world;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket;
|
||||
import org.geysermc.connector.console.GeyserLogger;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.utils.Chunks;
|
||||
|
||||
public class JavaChunk extends PacketTranslator<ServerChunkDataPacket> {
|
||||
public class JavaChunkDataPacket extends PacketTranslator<ServerChunkDataPacket> {
|
||||
@Override
|
||||
public void translate(ServerChunkDataPacket packet, GeyserSession session) {
|
||||
LevelChunkPacket p = new LevelChunkPacket();
|
||||
LevelChunkPacket levelChunkPacket = new LevelChunkPacket();
|
||||
|
||||
Chunks.ChunkData data = Chunks.getData(packet.getColumn());
|
||||
levelChunkPacket.setSubChunksLength(data.count);
|
||||
levelChunkPacket.setData(data.bytes);
|
||||
levelChunkPacket.setChunkX(packet.getColumn().getX());
|
||||
levelChunkPacket.setChunkZ(packet.getColumn().getZ());
|
||||
|
||||
p.setSubChunksLength(data.count);
|
||||
|
||||
p.setData(data.bytes);
|
||||
|
||||
p.setChunkX(packet.getColumn().getX());
|
||||
p.setChunkZ(packet.getColumn().getZ());
|
||||
|
||||
System.out.println("sent");
|
||||
|
||||
session.getUpstream().sendPacketImmediately(p);
|
||||
GeyserLogger.DEFAULT.info("Sent chunk packet!");
|
||||
session.getUpstream().sendPacket(levelChunkPacket);
|
||||
}
|
||||
}
|
1
pom.xml
1
pom.xml
@ -134,7 +134,6 @@
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>aggregate</goal>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren