예제 #1
0
  @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;
  }
예제 #2
0
 /** Sends a translated Message via the Translation API. */
 public void sendTranslatedMessage(String tag, String... replacements) {
   if (!isOnline()) return;
   LanguageAPI.sendTranslatedMessage(getPlayer(), tag, replacements);
 }
예제 #3
0
 /** Sends a translated Message via the Translation API. */
 public void sendTranslatedMessage(String tag) {
   if (!isOnline()) return;
   LanguageAPI.sendTranslatedMessage(getPlayer(), tag);
 }