Package org.mctourney.autoreferee

Examples of org.mctourney.autoreferee.AutoRefMatch$MatchReportSaver


  }

  @EventHandler(priority=EventPriority.HIGHEST)
  public void vehicleDamageDealt(VehicleDamageEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getVehicle().getWorld());
    if (match == null || !match.getCurrentState().inProgress()) return;

    if (match.getCurrentState().inProgress() && event.getAttacker() != null)
    {
      Player damager = entityToPlayer(event.getAttacker());

      if (!match.getPlayer(damager).isInsideLane())
      { event.setCancelled(true); return; }

      // spectators cannot cause damage to any vehicle
      if (match.getCurrentState().inProgress() &&
        null != damager && match.isSpectator(damager))
      { event.setCancelled(true); return; }

      AutoRefPlayer apl = match.getPlayer(damager);
      if (apl != null)
      {
        Location loc = event.getVehicle().getLocation();
        if (!apl.isInsideLane() || apl.getTeam().hasFlag(loc, Flag.NO_ACCESS))
        { event.setCancelled(true); return; }
View Full Code Here


  }

  @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
  public void damageDealtMonitor(EntityDamageEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (match == null || !match.getCurrentState().inProgress()) return;

    // save player data if the damaged entity was a player
    if (event.getEntityType() == EntityType.PLAYER)
    {
      AutoRefPlayer pdata = match.getPlayer((Player) event.getEntity());
      if (pdata != null)
      {
        Player damager = (event instanceof EntityDamageByEntityEvent) ?
          entityToPlayer(((EntityDamageByEntityEvent) event).getDamager()) : null;
        pdata.registerDamage(event, damager);
View Full Code Here

  }

  @EventHandler(priority=EventPriority.MONITOR)
  public void entityDeath(EntityDeathEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (match == null || !match.getCurrentState().inProgress()) return;

    EntityDamageEvent cause = event.getEntity().getLastDamageCause();
    if (cause instanceof EntityDamageByEntityEvent)
    {
      Player dmgr = entityToPlayer(((EntityDamageByEntityEvent) cause).getDamager());
      AchievementPoints ach = AchievementPoints.getMonsterKill(event.getEntityType());
      if (match.isPlayer(dmgr)) match.getPlayer(dmgr).addPoints(ach);
    }
  }
View Full Code Here

  {
    // if the entity is not a player, we don't care
    if (event.getEntityType() != EntityType.PLAYER) return;

    Player player = (Player) event.getEntity();
    AutoRefMatch match = plugin.getMatch(player.getWorld());
    if (match == null || !match.getCurrentState().inProgress()) return;

    AutoRefPlayer apl = match.getPlayer(player);
    if (apl != null) apl.incrementShotsFired();

    shotArrows.put((Projectile) event.getProjectile(),
      event.getEntity().getLocation().clone());
  }
View Full Code Here

  }

  @EventHandler(priority=EventPriority.HIGHEST)
  public void hungerChange(FoodLevelChangeEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (match != null && !match.getCurrentState().inProgress())
      event.setFoodLevel(20);
  }
View Full Code Here

  }

  @EventHandler(priority=EventPriority.MONITOR)
  public void explosionPrime(ExplosionPrimeEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (!SportBukkitUtil.hasSportBukkitApi() || match == null) return;

    if (event.getEntityType() == EntityType.PRIMED_TNT)
    {
      Location tntLocation = event.getEntity().getLocation().getBlock().getLocation();
      AutoRefPlayer apl = tntPropagation.remove(tntLocation);

      // if there was no propagation chain
      if (apl == null)
      {
        // try to determine if this was the first tnt in a chain
        if ((apl = match.getNearestPlayer(tntLocation)) == null) return;

        Location plLocation = apl.getLocation();
        if (plLocation.distanceSquared(tntLocation) > TNT_PRIME_RANGE * TNT_PRIME_RANGE) return;
      }

View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.AutoRefMatch$MatchReportSaver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.