use of thpmc.engine.api.player.EnginePlayer in project THP-Engine 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 = THPEngineAPI.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", THPEngine.getPlugin().getName() + "PacketInjector:" + player.getName(), packetHandler);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations