mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-21 07:59:19 +00:00
移除viaversion判断
This commit is contained in:
@@ -137,7 +137,6 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
|||||||
private static final String PACKET_DECODER = "craftengine_decoder";
|
private static final String PACKET_DECODER = "craftengine_decoder";
|
||||||
|
|
||||||
private final boolean hasModelEngine;
|
private final boolean hasModelEngine;
|
||||||
private final boolean hasViaVersion;
|
|
||||||
|
|
||||||
private int[] blockStateRemapper;
|
private int[] blockStateRemapper;
|
||||||
private int[] modBlockStateRemapper;
|
private int[] modBlockStateRemapper;
|
||||||
@@ -148,7 +147,6 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
|||||||
this.s2cGamePacketListeners = new ByteBufferPacketListenerHolder[PlayPacketIdHelper.count(PacketFlow.CLIENTBOUND)];
|
this.s2cGamePacketListeners = new ByteBufferPacketListenerHolder[PlayPacketIdHelper.count(PacketFlow.CLIENTBOUND)];
|
||||||
this.c2sGamePacketListeners = new ByteBufferPacketListenerHolder[PlayPacketIdHelper.count(PacketFlow.SERVERBOUND)];
|
this.c2sGamePacketListeners = new ByteBufferPacketListenerHolder[PlayPacketIdHelper.count(PacketFlow.SERVERBOUND)];
|
||||||
this.hasModelEngine = Bukkit.getPluginManager().getPlugin("ModelEngine") != null;
|
this.hasModelEngine = Bukkit.getPluginManager().getPlugin("ModelEngine") != null;
|
||||||
this.hasViaVersion = Bukkit.getPluginManager().getPlugin("ViaVersion") != null;
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
// set up packet id
|
// set up packet id
|
||||||
this.packetIds = VersionHelper.isOrAbove1_20_5() ? new PacketIds1_20_5() : new PacketIds1_20();
|
this.packetIds = VersionHelper.isOrAbove1_20_5() ? new PacketIds1_20_5() : new PacketIds1_20();
|
||||||
@@ -534,13 +532,9 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
|||||||
return hasModelEngine;
|
return hasModelEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasViaVersion() {
|
|
||||||
return hasViaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void simulatePacket(@NotNull NetWorkUser player, Object packet) {
|
public void simulatePacket(@NotNull NetWorkUser player, Object packet) {
|
||||||
Channel channel = player.nettyChannel();
|
Channel channel = player.nettyChannel();
|
||||||
if (channel.isOpen()) {
|
if (channel != null && channel.isOpen()) {
|
||||||
List<String> handlerNames = channel.pipeline().names();
|
List<String> handlerNames = channel.pipeline().names();
|
||||||
if (handlerNames.contains("via-encoder")) {
|
if (handlerNames.contains("via-encoder")) {
|
||||||
channel.pipeline().context("via-decoder").fireChannelRead(packet);
|
channel.pipeline().context("via-decoder").fireChannelRead(packet);
|
||||||
@@ -673,9 +667,7 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
|||||||
String encoderName = pipeline.names().contains("outbound_config") ? "outbound_config" : "encoder";
|
String encoderName = pipeline.names().contains("outbound_config") ? "outbound_config" : "encoder";
|
||||||
pipeline.addBefore(encoderName, PACKET_ENCODER, new PluginChannelEncoder(user));
|
pipeline.addBefore(encoderName, PACKET_ENCODER, new PluginChannelEncoder(user));
|
||||||
|
|
||||||
channel.closeFuture().addListener((ChannelFutureListener) future -> {
|
channel.closeFuture().addListener((ChannelFutureListener) future -> handleDisconnection(user.nettyChannel()));
|
||||||
handleDisconnection(user.nettyChannel());
|
|
||||||
});
|
|
||||||
setUser(channel, user);
|
setUser(channel, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +925,7 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
|
|||||||
private void decompress(ChannelHandlerContext ctx, ByteBuf input, ByteBuf output) {
|
private void decompress(ChannelHandlerContext ctx, ByteBuf input, ByteBuf output) {
|
||||||
ChannelHandler decompressor = ctx.pipeline().get("decompress");
|
ChannelHandler decompressor = ctx.pipeline().get("decompress");
|
||||||
if (decompressor != null) {
|
if (decompressor != null) {
|
||||||
ByteBuf temp = (ByteBuf) callDecode(decompressor, ctx, input).get(0);
|
ByteBuf temp = (ByteBuf) callDecode(decompressor, ctx, input).getFirst();
|
||||||
try {
|
try {
|
||||||
output.clear().writeBytes(temp);
|
output.clear().writeBytes(temp);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Project settings
|
# Project settings
|
||||||
# Rule: [major update].[feature update].[bug fix]
|
# Rule: [major update].[feature update].[bug fix]
|
||||||
project_version=0.0.63.2
|
project_version=0.0.63.3
|
||||||
config_version=45
|
config_version=45
|
||||||
lang_version=29
|
lang_version=29
|
||||||
project_group=net.momirealms
|
project_group=net.momirealms
|
||||||
|
|||||||
Reference in New Issue
Block a user