forked from GeyserMC/Geyser
Fix AIOOBE and remove PlayerSession usage.
This commit is contained in:
parent
ab55050d11
commit
c9be13d487
3 changed files with 3 additions and 17 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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++;
|
||||
|
|
Loading…
Reference in a new issue