@Override protected void magicSpellTriggered(RaCPlayer player, TraitResults result) { LivingEntity pushbackEntity = SearchEntity.inLineOfSight(30, player.getPlayer()); if (pushbackEntity != null && EnemyChecker.areEnemies(player.getPlayer(), pushbackEntity)) { String targetName = pushbackEntity.getType() == EntityType.PLAYER ? ((Player) pushbackEntity).getName() : pushbackEntity.getType().name(); LanguageAPI.sendTranslatedMessage(player, Keys.trait_pushaway_success, "target", targetName); Vector playerVector = player.getLocation().getDirection(); if (up) { playerVector.copy(new Vector()); playerVector.setY(blocks); } else { playerVector.setY(0); playerVector.multiply(this.blocks); playerVector.setY(0.2); } if (targetParticles != null) Vollotile.get().sendOwnParticleEffectToAll(targetParticles, pushbackEntity.getLocation()); pushbackEntity.setVelocity(playerVector); result.setTriggered(true); return; } result.setTriggered(false); return; }
@Override public TraitResults trigger(EventWrapper arg) { return TraitResults.False(); }