Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-17 05:40:06 +01:00
Improve handling of large chunk data request
Dieser Commit ist enthalten in:
Ursprung
5181280b7d
Commit
206df15067
@ -1,6 +1,7 @@
|
|||||||
package com.moulberry.axiom.packet;
|
package com.moulberry.axiom.packet;
|
||||||
|
|
||||||
import com.moulberry.axiom.AxiomPaper;
|
import com.moulberry.axiom.AxiomPaper;
|
||||||
|
import com.moulberry.axiom.VersionHelper;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||||
@ -61,7 +62,8 @@ public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
|
|||||||
} else if (identifier.equals(UPLOAD_BLUEPRINT)) {
|
} else if (identifier.equals(UPLOAD_BLUEPRINT)) {
|
||||||
ServerPlayer player = connection.getPlayer();
|
ServerPlayer player = connection.getPlayer();
|
||||||
if (AxiomPaper.PLUGIN.canUseAxiom(player.getBukkitEntity())) {
|
if (AxiomPaper.PLUGIN.canUseAxiom(player.getBukkitEntity())) {
|
||||||
uploadBlueprint.onReceive(player, buf);
|
player.getServer().execute(() -> uploadBlueprint.onReceive(player, buf));
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
in.skipBytes(in.readableBytes());
|
in.skipBytes(in.readableBytes());
|
||||||
return;
|
return;
|
||||||
@ -69,8 +71,12 @@ public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
|
|||||||
} else if (requestChunkDataPacketListener != null && identifier.equals(REQUEST_CHUNK_DATA)) {
|
} else if (requestChunkDataPacketListener != null && identifier.equals(REQUEST_CHUNK_DATA)) {
|
||||||
ServerPlayer player = connection.getPlayer();
|
ServerPlayer player = connection.getPlayer();
|
||||||
if (AxiomPaper.PLUGIN.canUseAxiom(player.getBukkitEntity())) {
|
if (AxiomPaper.PLUGIN.canUseAxiom(player.getBukkitEntity())) {
|
||||||
requestChunkDataPacketListener.onPluginMessageReceived(identifier.toString(), player.getBukkitEntity(),
|
byte[] bytes = new byte[buf.writerIndex() - buf.readerIndex()];
|
||||||
buf.array());
|
buf.getBytes(buf.readerIndex(), bytes);
|
||||||
|
|
||||||
|
player.getServer().execute(() -> requestChunkDataPacketListener.onPluginMessageReceived(
|
||||||
|
identifier.toString(), player.getBukkitEntity(), bytes));
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
in.skipBytes(in.readableBytes());
|
in.skipBytes(in.readableBytes());
|
||||||
return;
|
return;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren