3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +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()); Player player = connector.getPlayers().get(bedrockServerSession.getAddress());
if (player != null) { if (player != null) {
player.disconnect(disconnectReason.name()); player.disconnect(disconnectReason.name());
connector.removePlayer(player);
} }
}); });
bedrockServerSession.setPacketCodec(GeyserConnector.BEDROCK_PACKET_CODEC); 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.event.session.SessionAdapter;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpSessionFactory; 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.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.GamePublishSetting; import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
import com.nukkitx.protocol.bedrock.data.GameRule; import com.nukkitx.protocol.bedrock.data.GameRule;
@ -64,7 +62,7 @@ import java.net.InetSocketAddress;
import java.util.UUID; import java.util.UUID;
@Getter @Getter
public class GeyserSession implements PlayerSession, Player { public class GeyserSession implements Player {
private final GeyserConnector connector; private final GeyserConnector connector;
private final BedrockServerSession upstream; private final BedrockServerSession upstream;
@ -188,27 +186,14 @@ public class GeyserSession implements PlayerSession, Player {
closed = true; closed = true;
} }
@Override
public boolean isClosed() { public boolean isClosed() {
return closed; return closed;
} }
@Override
public void close() { public void close() {
disconnect("Server closed."); 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) { public void setAuthenticationData(AuthData authData) {
authenticationData = authData; authenticationData = authData;
} }

Datei anzeigen

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