Package org.mctourney.autoreferee.util

Examples of org.mctourney.autoreferee.util.BlockData


          {
            int block = snap.getBlockTypeId(ix, py, iz);
            if (ArrayUtils.contains(interesting, block))
            {
              Vector pos = new Vector(baseX + ix, py, baseZ + iz);
              BlockData bd = new BlockData(Material.getMaterial(block), (byte) snap.getBlockData(ix, py, iz));
              for (BlockData data : goals)
                if (data.equals(bd))
                  master.found.add(new _Entry<BlockData, Vector>(data, pos));
            }
          }
View Full Code Here


      while ((entry = master.found.poll()) != null)
      {
        Vector vec = entry.getValue();
        if (master.team.canEnter(vec.toLocation(master.team.getMatch().getWorld())))
        {
          BlockData data = entry.getKey();
          newSearch.remove(data);
          // No safety - read-once
          master.results.put(data, vec);
        }
      }
View Full Code Here

    if (match == null) return;

    if (match.elevatedItem.containsKey(event.getItem().getUniqueId())
      && match.isPlayer(event.getPlayer()))
    {
      String itemname = new BlockData(event.getItem().getItemStack()).getDisplayName();
      String msg = match.getDisplayName(event.getPlayer()) + ChatColor.DARK_GRAY +
        " picked up " + itemname + ChatColor.DARK_GRAY + " from an item elevator.";
      match.setLastNotificationLocation(event.getItem().getLocation());

      for (Player ref : match.getReferees()) ref.sendMessage(msg);
View Full Code Here

    if (match == null) return;

    if (!(event.getWhoClicked() instanceof Player)) return;
    AutoRefTeam team = plugin.getTeam((Player) event.getWhoClicked());

    BlockData recipeTarget = BlockData.fromItemStack(event.getRecipe().getResult());
    if (team != null && !team.canCraft(recipeTarget)) event.setCancelled(true);

    // if this is on the blacklist, cancel
    if (!match.canCraft(recipeTarget)) event.setCancelled(true);
  }
View Full Code Here

            setLastNotificationLocation(curr);

            String coords = LocationUtil.toBlockCoords(curr);
            String msg = ChatColor.DARK_GRAY + String.format(
              "Possible Item Elevator @ (%s) [y%+d] %s", coords, Math.round(dy),
              new BlockData(item.getItemStack()).getDisplayName());

            for (Player ref : getReferees()) ref.sendMessage(msg);
            AutoReferee.log(msg);
          }
        }
View Full Code Here

          submitMatches(eq.getItemInHand(), ent, goals);
        }

        // these 3 should be obvious
        if (ent instanceof FallingBlock)
          submitMatches(new BlockData(((FallingBlock) ent).getMaterial(), ((FallingBlock) ent).getBlockData()), ent, goals);
        if (ent instanceof Item)
          submitMatches(((Item) ent).getItemStack(), ent, goals);
        if (ent instanceof ItemFrame)
          submitMatches(((ItemFrame) ent).getItem(), ent, goals);


        // drops wood when destroyed
        if (ent instanceof Boat)
          submitMatches(new BlockData(Material.WOOD), ent, goals);
        // endermen can carry blocks...possibly into other lane? interesting, investigate later
        if (ent instanceof Enderman)
        {
          MaterialData carried = ((Enderman) ent).getCarriedMaterial();
          submitMatches(new BlockData(carried.getItemType(), carried.getData()), ent, goals);
        }
        // break minecarts to get the blocks used to craft
        if (ent instanceof Minecart)
        {
          if (ent instanceof ExplosiveMinecart)
            submitMatches(new BlockData(Material.TNT), ent, goals);
          else if (ent instanceof HopperMinecart)
            submitMatches(new BlockData(Material.HOPPER), ent, goals);
          else if (ent instanceof PoweredMinecart)
            submitMatches(new BlockData(Material.FURNACE), ent, goals);
          // spawners can spawn entities with EntityEquipment on
          else if (ent instanceof SpawnerMinecart)
          {
            // XXX todo: spawners
          }
          else if (ent instanceof StorageMinecart)
            submitMatches(new BlockData(Material.CHEST), ent, goals);
        }
        // sheep can be sheared or killed for wool blocks
        if (ent instanceof Sheep)
          submitMatches(new BlockData(Material.WOOL, ((Sheep) ent).getColor().getWoolData()), ent, goals);
        // wither skele skulls
        if (ent instanceof Skeleton)
        {
          if (((Skeleton) ent).getSkeletonType() == SkeletonType.WITHER)
            submitMatches(new BlockData(Material.SKULL, (byte) SkullType.WITHER.ordinal()), ent, goals);
        }
        // trade for goal blocks
        if (ent instanceof Villager)
        {
          // FIXME https://github.com/Bukkit/Bukkit/pull/921
View Full Code Here

  private void submitMatches(ItemStack item, Entity ent, Set<BlockData> goals)
  {
    if (item == null)
      return;
    BlockData found = BlockData.fromItemStack(item);
    submitMatches(found, ent, goals);
  }
View Full Code Here

  private void checkInventory(Inventory inv, Set<BlockData> goals, Location loc)
  {
    for (ItemStack item : inv.getContents())
    {
      BlockData bd = BlockData.fromItemStack(item);
      for (BlockData data : goals)
        if (data.equals(bd))
          master.found.add(new _Entry<BlockData, Vector>(data, loc.toVector()));
    }
  }
View Full Code Here

    { return; }

    for (Map.Entry<BlockData, AutoRefGoal> entry :
        apl.getTeam().getGoalsByObjective().entrySet())
    {
      BlockData b = entry.getKey();
      AutoRefGoal g = entry.getValue();
      if (b.matchesBlock(block))
      {
        if (g.getItemStatus() != AutoRefGoal.ItemStatus.TARGET
            && g.isSatisfied(match)) {
          match.addEvent(new TranscriptEvent(match,
              TranscriptEvent.EventType.OBJECTIVE_PLACED, String.format(
              "%s has placed the %s on the Victory Monument!",
              apl.getDisplayName(), b.getDisplayName()), block.getLocation(), apl, b
          ));
        } else {
          // TranscriptEvent.ObjectiveDetailType.PLACE
          match.addEvent(new TranscriptEvent(match,
              TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
              // {player} has placed a {goal} block (@ {loc})
              "%s has placed a %s block (@ %s)", apl.getDisplayName(),
              b.getDisplayName(),
              LocationUtil.toBlockCoords(block.getLocation())),
              block.getLocation(), apl, b
          ));
        }
      }
View Full Code Here

    Player pl = event.getPlayer();

    if (dropSkipPlayers.contains(pl))
    { return; }

    BlockData item = new BlockData(event.getItemDrop().getItemStack());

    AutoRefMatch match = plugin.getMatch(pl.getWorld());
    AutoRefPlayer apl = match == null ? null : match.getPlayer(pl);

    if (match == null || apl == null)
View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.util.BlockData

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.