Search in sources :

Example 11 with EnginePlayer

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();
    }
}
Also used : ImplEnginePlayer(thpmc.engine.impl.ImplEnginePlayer) Player(org.bukkit.entity.Player) EnginePlayer(thpmc.engine.api.player.EnginePlayer) PacketHandler(thpmc.engine.nms.PacketHandler) ParallelUniverse(thpmc.engine.api.world.parallel.ParallelUniverse) ImplEnginePlayer(thpmc.engine.impl.ImplEnginePlayer) EnginePlayer(thpmc.engine.api.player.EnginePlayer) ChannelPipeline(io.netty.channel.ChannelPipeline) EventHandler(org.bukkit.event.EventHandler)

Aggregations

EnginePlayer (thpmc.engine.api.player.EnginePlayer)11 Player (org.bukkit.entity.Player)6 INMSHandler (thpmc.engine.api.nms.INMSHandler)3 NMSEntityPlayer (thpmc.engine.api.nms.entity.NMSEntityPlayer)3 ParallelUniverse (thpmc.engine.api.world.parallel.ParallelUniverse)3 be4rjp.artgui.button (be4rjp.artgui.button)1 Artist (be4rjp.artgui.frame.Artist)1 ArtMenu (be4rjp.artgui.menu.ArtMenu)1 IncompleteRegionException (com.sk89q.worldedit.IncompleteRegionException)1 LocalSession (com.sk89q.worldedit.LocalSession)1 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)1 Region (com.sk89q.worldedit.regions.Region)1 SessionManager (com.sk89q.worldedit.session.SessionManager)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 Material (org.bukkit.Material)1 World (org.bukkit.World)1 EventHandler (org.bukkit.event.EventHandler)1 Vector (org.bukkit.util.Vector)1 THPEngine (thpmc.engine.THPEngine)1 THPEngineAPI (thpmc.engine.api.THPEngineAPI)1