Attempt to fix packet injector issues

This commit is contained in:
filoghost 2024-01-27 11:15:30 +01:00
parent 3f067145b7
commit 563df95561
18 changed files with 234 additions and 36 deletions

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_10_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_11_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_12_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_13_R2;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_14_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -100,8 +101,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -110,7 +115,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_15_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -100,8 +101,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -110,7 +115,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_16_R3;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -100,8 +101,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -110,7 +115,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_17_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.k; Channel channel = networkManager.k;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_18_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.k; Channel channel = networkManager.k;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_18_R2;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.m; Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_19_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.m; Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_19_R2;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.m; Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_19_R3;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -106,8 +107,12 @@ public class VersionNMSManager implements NMSManager {
return; return;
} }
Channel channel = networkManager.m; Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -116,7 +121,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_20_R1;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -106,8 +107,12 @@ public class VersionNMSManager implements NMSManager {
return; return;
} }
Channel channel = networkManager.m; Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -116,7 +121,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_20_R2;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -107,8 +108,12 @@ public class VersionNMSManager implements NMSManager {
return; return;
} }
Channel channel = networkManager.n; Channel channel = networkManager.n;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -117,7 +122,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_20_R3;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -107,8 +108,12 @@ public class VersionNMSManager implements NMSManager {
return; return;
} }
Channel channel = networkManager.n; Channel channel = networkManager.n;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -117,7 +122,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_8_R3;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -112,8 +113,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -122,7 +127,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_9_R2;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector; import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a(); NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel; Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> { Runnable safeModifierTask = () -> {
if (!player.isOnline()) { if (!player.isOnline()) {
return; return;
} }
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) { } catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e); Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
} }
}); };
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
} }
} }