private static void updateSign(Sign sign, int placement, TopPlayers plugin) {
    OfflineRecord offlineRecord = OfflineRecord.getAtPlacement(placement, sign.getWorld(), plugin);
    String name = offlineRecord.getPlayer().getName();
    // 3600000 miliseconds = 1 hour.
    double time = offlineRecord.getAccumulatedTime() / 3600000;

    sign.setLine(0, ChatColor.DARK_BLUE + "Top Player:");
    sign.setLine(1, ChatColor.GREEN + name);
    sign.setLine(2, ChatColor.BLUE + "Placed " + ordinal(placement));
    sign.setLine(3, ChatColor.AQUA + "With " + time + " hours");
    sign.update(true);

    int radius = plugin.getConfig().getInt("head identification block radius");
    for (int yradius = 0; yradius < 2; yradius++) {
      for (int x = sign.getX() - radius; x <= sign.getX() + radius; x++) {
        for (int y = sign.getY() - radius + yradius; y <= sign.getY() + radius + yradius; y++) {
          for (int z = sign.getZ() - radius; z <= sign.getZ() + radius; z++) {
            Block block = sign.getWorld().getBlockAt(x, y, z);
            if (block.getType() == Material.SKULL) {
              Skull skull = (Skull) block.getState();
              skull.setSkullType(SkullType.PLAYER);
              if (!skull.setOwner(name)) {
                plugin
                    .getLogger()
                    .warning("Cannot connect to the web to find " + name + "'s head!");
              }
              skull.update();
            }
          }
        }
      }
    }
  }
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
 public void onBlockBreak(BlockBreakEvent e) {
   Player p = e.getPlayer();
   Block b = e.getBlock();
   if (p.getGameMode() == GameMode.CREATIVE) {
     if (b.getType() == Material.SKULL) {
       Skull skull = (Skull) e.getBlock().getState();
       String name = this.hasOwner(skull) ? skull.getOwner() : this.def;
       if (!this.hasTool(p)) {
         if (p.isSneaking()) {
           if (SkullWalls.getWallHandler().getWallFromBlock(b) != null) {
             if (p.hasPermission(perm) || p.isOp()) {
               p.sendMessage(this.des.replace("#", name));
               // Disable skull?
             } else {
               e.setCancelled(true);
               p.sendMessage(this.noperm);
             }
           }
         } else if (SkullWalls.getWallHandler().getWallFromBlock(b) != null) {
           this.sw.getActionWorker().executeQuery(p, name);
           if (p.hasPermission(perm)) {
             e.setCancelled(true);
             p.sendMessage(RED + "To destroy skull you must sneak and break");
           } else {
             e.setCancelled(true);
             p.sendMessage(this.noperm);
           }
         }
       } else if (p.isSneaking()) {
         e.setCancelled(true);
         this.sw.getActionWorker().executeQuery(p.getPlayer(), name);
       } else {
         e.setCancelled(true);
         ItemStack s = p.getItemInHand();
         this.onBlockDamage(new BlockDamageEvent(p, b, s, false));
         if (SkullWalls.getWallHandler().getWallFromBlock(b) != null) {
           p.sendMessage(RED + "Block selected is already a part of a skull wall");
           p.sendMessage(RED + "Overlapping walls will not perform as expected!");
         }
       }
     }
   } else if (this.sw.getConfiguration().isProtecting()
       && e.getBlock().getType() == Material.SKULL
       && !p.hasPermission(perm))
     e.setCancelled(SkullWalls.getWallHandler().hasPermission(b, p, this.noperm));
 }
 @EventHandler(priority = EventPriority.LOWEST)
 public void onBlockDamage(BlockDamageEvent e) {
   if (e.getBlock().getType().equals(Material.SKULL)) {
     Player player = e.getPlayer();
     Skull skull = (Skull) e.getBlock().getState();
     String name = this.hasOwner(skull) ? skull.getOwner() : this.def;
     if (e.getItemInHand().getTypeId() == this.sw.getConfiguration().getTool()) {
       this.sw.getActionWorker().executeCuboid(e);
     } else if (this.sw
         .getConfiguration()
         .getActionMap()
         .containsKey(e.getItemInHand().getTypeId())) {
       this.sw.getActionWorker().executeAction(e, name);
     } else if (skull.getSkullType() == SkullType.PLAYER)
       this.sw.getActionWorker().executeQuery(player, name);
   }
 }
  public static void generateHollowCube(Location location, int length, Material material) {
    final Block center = location.getBlock();
    for (int xOffset = -length; xOffset <= length; xOffset++) {
      for (int yOffset = -length; yOffset <= length; yOffset++) {
        for (int zOffset = -length; zOffset <= length; zOffset++) {
          // Hollow
          if (Math.abs(xOffset) != length
              && Math.abs(yOffset) != length
              && Math.abs(zOffset) != length) {
            continue;
          }

          final Block block = center.getRelative(xOffset, yOffset, zOffset);

          if (material != Material.SKULL) {
            // Glowstone light
            if (material != Material.GLASS && xOffset == 0 && yOffset == 2 && zOffset == 0) {
              block.setType(Material.GLOWSTONE);
              continue;
            }

            block.setType(material);
          } else // Darth mode
          {
            if (Math.abs(xOffset) == length
                && Math.abs(yOffset) == length
                && Math.abs(zOffset) == length) {
              block.setType(Material.GLOWSTONE);
              continue;
            }

            block.setType(Material.SKULL);
            final Skull skull = (Skull) block.getState();
            skull.setSkullType(SkullType.PLAYER);
            skull.setOwner("DarthSalamon");
            skull.update();
          }
        }
      }
    }
  }
 private boolean hasOwner(Skull skull) {
   return skull.hasOwner() && !skull.getOwner().equals("");
 }