Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 12:32:53 +02:00
Fix AIOOBE and remove PlayerSession usage.
Dieser Commit ist enthalten in:
Ursprung
ab55050d11
Commit
c9be13d487
@ -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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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++;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren