コード例 #1
0
 @Override
 protected Location getLocation(Event event) {
   if (DependencyUtils.hasDeathTpPlus() && event instanceof DeathStreakEvent) {
     return ((DeathStreakEvent) event).getPlayer().getLocation();
   } else if (DependencyUtils.hasDeathTpPlus() && event instanceof KillStreakEvent) {
     return ((KillStreakEvent) event).getPlayer().getLocation();
   } else {
     throw new IllegalArgumentException();
   }
 }
コード例 #2
0
  @Override
  public double getMultiplier(Player player) {
    double multiplier = NO_GAIN;

    if (DependencyUtils.hasPermission(player, "gain.environment")
        && getMultipliers().containsKey(player.getWorld().getEnvironment())) {
      multiplier = getMultipliers().get(player.getWorld().getEnvironment());
      LoggerUtil.getInstance().debug(this.getClass(), "Environment multiplier: " + multiplier);
    }

    return multiplier;
  }
コード例 #3
0
  private boolean hasRewardSource(EntityKilledEvent event) {
    Player killer = event.getKiller();
    LivingEntity entity = event.getEntity();

    if (DependencyUtils.hasPermission(killer, "reward." + entity.getType().getName())) {
      if (hasRewardSource(entity.getType()) && !isRuleBroken(event)) {
        return true;
      }
    } else {
      LoggerUtil.getInstance()
          .debug(
              this.getClass(),
              "No reward for "
                  + killer.getName()
                  + " due to lack of permission for "
                  + entity.getType().getName());
    }

    return false;
  }