use of thpmc.vanilla_source.nms.PacketHandler in project VanillaSource by TheHollowPlanetMC.
the class PlayerJoinQuitListener method onJoin.
@EventHandler
public void onJoin(PlayerJoinEvent event) {
// Inject packet handler
Player player = event.getPlayer();
EnginePlayer enginePlayer = ImplEnginePlayer.onPlayerJoin(player);
ParallelUniverse universe = VanillaSourceAPI.getInstance().createUniverse(player.getUniqueId().toString());
universe.addPlayer(enginePlayer);
Object wrappedParallelPlayer = ChiyogamiManager.getWrappedParallelPlayer(player);
if (wrappedParallelPlayer != null)
ChiyogamiManager.setCheckFunction(enginePlayer, wrappedParallelPlayer);
PacketHandler packetHandler = new PacketHandler(enginePlayer);
try {
ChannelPipeline pipeline = NMSManager.getNMSHandler().getChannel(player).pipeline();
pipeline.addBefore("packet_handler", VanillaSource.getPlugin().getName() + "PacketInjector:" + player.getName(), packetHandler);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations