Package org.mctourney.autoreferee

Examples of org.mctourney.autoreferee.AutoRefMatch$ItemElevatorDetectionTask


  }

  @EventHandler
  public void creatureTarget(EntityTargetEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (match == null || event.getTarget() == null) return;

    // if the target is a player that isn't on a team, get rid of the target
    if (event.getTarget().getType() == EntityType.PLAYER &&
      !match.isPlayer((Player) event.getTarget()))
    { event.setTarget(null); return; }

    if (!match.getCurrentState().inProgress() ||
      match.hasFlag(event.getTarget().getLocation(), AutoRefRegion.Flag.SAFE))
    { event.setTarget(null); return; }
  }
View Full Code Here


  }

  @EventHandler
  public void explosion(EntityExplodeEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (match == null) return;

    Iterator<Block> iter = event.blockList().iterator();
    blockloop: while (iter.hasNext())
    {
      Block b = iter.next();
      if (match.hasFlag(b.getLocation(), AutoRefRegion.Flag.NO_EXPLOSIONS))
      { iter.remove(); continue blockloop; }
    }
  }
View Full Code Here

  }

  @EventHandler
  public void endermanPickup(EntityChangeBlockEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getBlock().getWorld());
    if (match == null) return;

    // don't let endermen pick up blocks, as a rule
    if (event.getEntityType() == EntityType.ENDERMAN)
      event.setCancelled(true);
View Full Code Here

  }

  @EventHandler(priority=EventPriority.HIGHEST)
  public void weatherChange(WeatherChangeEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getWorld());

    // cancels event if weather is changing to 'storm'
    if (match != null && event.toWeatherState())
      event.setCancelled(true);
  }
View Full Code Here

      // if this player cannot be found, skip
      Player invited = plugin.getServer().getPlayer(args[i]);
      if (invited == null) continue;

      // if this player is already busy competing in a match, skip
      AutoRefMatch m = plugin.getMatch(invited.getWorld());
      if (m != null && m.isPlayer(invited) && m.getCurrentState().inProgress()) continue;

      // otherwise, invite them
      if (invited.getWorld() != match.getWorld())
        new Conversation(plugin, invited, new InvitationPrompt(match, from)).begin();
    }
View Full Code Here

  @EventHandler(priority=EventPriority.MONITOR)
  public void spectatorDeath(PlayerDeathEvent event)
  {
    World world = event.getEntity().getWorld();
    AutoRefMatch match = plugin.getMatch(world);

    if (match != null && !match.isPlayer(event.getEntity()))
    {
      deadSpectators.put(event.getEntity().getName(), match);
      event.getDrops().clear();
    }
  }
View Full Code Here

  @EventHandler(priority=EventPriority.MONITOR)
  public void spectatorDeath(EntityDamageEvent event)
  {
    World world = event.getEntity().getWorld();
    AutoRefMatch match = plugin.getMatch(world);

    if (event.getEntityType() != EntityType.PLAYER) return;
    Player player = (Player) event.getEntity();

    if (match != null && match.isSpectator(player))
    {
      Location loc = player.getLocation();
      event.setCancelled(true);

      if (loc.getY() < -64 && event.getCause() == DamageCause.VOID)
        player.teleport(match.getPlayerSpawn(player));
      player.setFallDistance(0);
    }
  }
View Full Code Here

  @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
  public void foreignInventoryEvent(InventoryClickEvent event)
  {
    Player player = (Player) event.getWhoClicked();
    AutoRefMatch match = plugin.getMatch(player.getWorld());

    if (match != null && !match.isPlayer(player))
      switch (event.getInventory().getType())
      {
        case PLAYER:
        case CREATIVE:
          break;
View Full Code Here

  @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
  public void projectileLaunch(ProjectileLaunchEvent event)
  {
    LivingEntity entity = event.getEntity().getShooter();
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (!(entity instanceof Player) || match == null) return;

    if (!match.isPlayer((Player) entity))
    { event.setCancelled(true); return; }
  }
View Full Code Here

  public void projectileLaunch(PlayerInteractEvent event)
  {
    Player player = event.getPlayer();
    ItemStack itemInHand = player.getItemInHand();

    AutoRefMatch match = plugin.getMatch(player.getWorld());
    if (match != null && itemInHand != null)
      switch (itemInHand.getType())
      {
        case EYE_OF_ENDER:
          event.setCancelled(true);
View Full Code Here

TOP

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

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.