@Listener
  public void onPlayerKilled(DestructEntityEvent.Death event) {
    if (event.getCause().first(DamageSource.class).isPresent()) {
      DamageSource dmgSource = event.getCause().first(DamageSource.class).get();

      if (dmgSource instanceof EntityDamageSource) {
        EntityDamageSource entityDmgSource = (EntityDamageSource) dmgSource;
        Entity entity = entityDmgSource.getSource();
        Living entityTarget = event.getTargetEntity();

        if (entity instanceof Player && entityTarget instanceof Player) {
          Player player = (Player) entity;
          Player target = (Player) entityTarget;

          if (this.teamA.contains(player) && this.teamB.contains(target)) {
            this.teamAPoints++;
          } else if (this.teamB.contains(player) && this.teamA.contains(target)) {
            this.teamBPoints++;
          }
        }
      }
    }
  }
  @Listener(order = Order.PRE)
  public void onDestructEntityEventDeathPlayer(
      DestructEntityEvent.Death event, @First EntityDamageSource damageSrc) {
    if (!(event.getTargetEntity() instanceof Player)) {
      return;
    }
    Player player = (Player) event.getTargetEntity();

    WorldSettings settings = WorldSettings.get(player.getWorld());

    DeathReason reason = DeathReason.GENERIC;

    Entity src = damageSrc.getSource();

    if (src instanceof Player) {
      reason = DeathReason.PLAYER;
    } else if (src instanceof Projectile) {
      Projectile projectile = (Projectile) src;

      Optional<UUID> optionalUUID = projectile.getCreator();

      if (!optionalUUID.isPresent()) {
        return;
      }

      Optional<Player> optionalPlayer = Sponge.getServer().getPlayer(optionalUUID.get());

      if (optionalPlayer.isPresent()) {
        reason = DeathReason.PLAYER;
      } else {
        reason = DeathReason.PROJECTILE;
      }
    } else {
      DamageType cause = damageSrc.getType();
      reason = DeathReason.valueOf(cause.getName().toUpperCase());
    }

    Optional<EconomyService> optionalEconomy =
        Sponge.getServiceManager().provide(EconomyService.class);

    if (!optionalEconomy.isPresent()) {
      Main.instance().getLog().error("Economy plugin not found");
      return;
    }
    EconomyService economy = optionalEconomy.get();

    BigDecimal balance =
        economy
            .getOrCreateAccount(player.getUniqueId())
            .get()
            .getBalance(WorldSettings.get(player.getWorld()).getCurrency());

    PlayerWallet wallet = settings.getPlayerWallet();

    BigDecimal amount = wallet.getAmount(reason, balance);

    WalletDropEvent walletDropEvent = new WalletDropEvent(amount, player);

    if (walletDropEvent.getAmount().compareTo(BigDecimal.ZERO) != 0
        && (!Sponge.getEventManager().post(walletDropEvent))) {
      WalletDrop.depositOrWithdraw(
          player, walletDropEvent.getAmount().multiply(BigDecimal.valueOf(-1)));

      if (settings.isDropsEnabled()) {
        for (MoneyStack moneyStack : walletDropEvent.getMoneyStacks()) {
          moneyStack.drop(walletDropEvent.getLocation());
        }
      }

      WalletDrop.sendDeathMessage(
          WorldSettings.get(player.getWorld()), player, walletDropEvent.getAmount());
    }
  }