public List<Block> getBlocks() { List<Block> blocks = new ArrayList<Block>(); if (loc1 == null || loc2 == null) return blocks; for (int x = (int) Math.min(loc1.getX(), loc2.getX()); x <= (int) Math.max(loc1.getX(), loc2.getX()); x++) { for (int y = (int) Math.min(loc1.getY(), loc2.getY()); y <= (int) Math.max(loc1.getY(), loc2.getY()); y++) { for (int z = (int) Math.min(loc1.getZ(), loc2.getZ()); z <= (int) Math.max(loc1.getZ(), loc2.getZ()); z++) { if (loc1.getWorld().getBlockAt(x, y, z).getType() == Material.AIR) { blocks.add(loc1.getWorld().getBlockAt(x, y, z)); } } } } return blocks; }
@Override public List<Player> matchPlayer(String string) { List<Player> matches = new ArrayList<Player>(); for (Player player : players) { if (player .getName() .substring(0, Math.min(player.getName().length(), string.length())) .equalsIgnoreCase(string)) { matches.add(player); } } return matches; }
public static void addSeconds(final Player player, final int seconds) { if (!b******g.fdsjfhkdsjfdsjhk().getServerHandler().isEOTW() && DTRBitmaskType.SAFE_ZONE.appliesAt(player.getLocation())) { return; } if (isTagged(player)) { final int secondsTaggedFor = (int) ((SpawnTagHandler.spawnTags.get(player.getName()) - System.currentTimeMillis()) / 1000L); final int newSeconds = Math.min(secondsTaggedFor + seconds, 60); SpawnTagHandler.spawnTags.put( player.getName(), System.currentTimeMillis() + newSeconds * 1000L); } else { player.sendMessage( ChatColor.YELLOW + "You have been spawn-tagged for §c" + seconds + " §eseconds!"); SpawnTagHandler.spawnTags.put(player.getName(), System.currentTimeMillis() + seconds * 1000L); } }
@Override public void setMaxHealth(double amount) { super.setMaxHealth(amount); this.health = Math.min(this.health, health); getHandle().func_71118_n(); }