Search in sources :

Example 1 with Direction

use of pl.themolka.arcade.spawn.Direction in project Arcade2 by ShootGame.

the class PortalParser method parseDestination.

protected SpawnApply parseDestination(Node node, String name, String value) throws ParserException {
    Spawn destination = (Spawn) this.destinationParser.parse(node.property("destination")).orFail().get();
    boolean smooth = this.smoothParser.parse(node.property("smooth")).orDefault(false);
    Direction yaw = this.yawDirectionParser.parse(node.property("yaw")).orDefault(Direction.ENTITY);
    Direction pitch = this.pitchDirectionParser.parse(node.property("pitch")).orDefault(Direction.ENTITY);
    return new SpawnApply(destination, new SpawnApply.AgentFactory() {

        @Override
        public SpawnAgent createAgent(Spawn spawn, GamePlayer player, Player bukkit) {
            if (smooth) {
                return SmoothSpawnAgent.create(spawn, player.getBukkit(), yaw, pitch);
            } else {
                return SpawnAgent.create(spawn, player.getBukkit(), yaw, pitch);
            }
        }
    });
}
Also used : GamePlayer(pl.themolka.arcade.game.GamePlayer) Player(org.bukkit.entity.Player) SpawnApply(pl.themolka.arcade.spawn.SpawnApply) GamePlayer(pl.themolka.arcade.game.GamePlayer) SmoothSpawnAgent(pl.themolka.arcade.spawn.SmoothSpawnAgent) SpawnAgent(pl.themolka.arcade.spawn.SpawnAgent) Spawn(pl.themolka.arcade.spawn.Spawn) Direction(pl.themolka.arcade.spawn.Direction)

Aggregations

Player (org.bukkit.entity.Player)1 GamePlayer (pl.themolka.arcade.game.GamePlayer)1 Direction (pl.themolka.arcade.spawn.Direction)1 SmoothSpawnAgent (pl.themolka.arcade.spawn.SmoothSpawnAgent)1 Spawn (pl.themolka.arcade.spawn.Spawn)1 SpawnAgent (pl.themolka.arcade.spawn.SpawnAgent)1 SpawnApply (pl.themolka.arcade.spawn.SpawnApply)1