3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

Fix AIOOBE and remove PlayerSession usage.

Dieser Commit ist enthalten in:
SupremeMortal 2019-09-13 15:45:55 +01:00
Ursprung ab55050d11
Commit c9be13d487
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: DDBB25F8EE4FA29A
3 geänderte Dateien mit 3 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -109,6 +109,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
Player player = connector.getPlayers().get(bedrockServerSession.getAddress());
if (player != null) {
player.disconnect(disconnectReason.name());
connector.removePlayer(player);
}
});
bedrockServerSession.setPacketCodec(GeyserConnector.BEDROCK_PACKET_CODEC);

Datei anzeigen

@ -38,8 +38,6 @@ import com.github.steveice10.packetlib.event.session.PacketReceivedEvent;
import com.github.steveice10.packetlib.event.session.SessionAdapter;
import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
import com.nukkitx.network.util.DisconnectReason;
import com.nukkitx.protocol.PlayerSession;
import com.nukkitx.protocol.bedrock.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
import com.nukkitx.protocol.bedrock.data.GameRule;
@ -64,7 +62,7 @@ import java.net.InetSocketAddress;
import java.util.UUID;
@Getter
public class GeyserSession implements PlayerSession, Player {
public class GeyserSession implements Player {
private final GeyserConnector connector;
private final BedrockServerSession upstream;
@ -188,27 +186,14 @@ public class GeyserSession implements PlayerSession, Player {
closed = true;
}
@Override
public boolean isClosed() {
return closed;
}
@Override
public void close() {
disconnect("Server closed.");
}
@Override
public void onDisconnect(DisconnectReason disconnectReason) {
downstream.getSession().disconnect("Disconnected from server. Reason: " + disconnectReason);
}
@Override
public void onDisconnect(String reason) {
downstream.getSession().disconnect("Disconnected from server. Reason: " + reason);
connector.removePlayer(this);
}
public void setAuthenticationData(AuthData authData) {
authenticationData = authData;
}

Datei anzeigen

@ -40,7 +40,7 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
ChunkSection[] sections = chunkData.sections;
int sectionCount = sections.length - 1;
while (sections[sectionCount].isEmpty()) {
while (sectionCount >= 0 && sections[sectionCount].isEmpty()) {
sectionCount--;
}
sectionCount++;