Fix typo in MainUtil and switch out Consumer<Integer> to IntConsumer

This commit is contained in:
Alexander Söderberg 2020-04-09 11:23:39 +02:00
parent 254a0541cc
commit f717589074
4 changed files with 7 additions and 5 deletions

View file

@ -45,6 +45,7 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
@SuppressWarnings({"unused", "WeakerAccess"})
@ -301,7 +302,7 @@ public class BukkitUtil extends WorldUtil {
}
@Override public void getHighestBlock(@NonNull final String world, final int x, final int z,
final Consumer<Integer> result) {
final IntConsumer result) {
ensureLoaded(world, x, z, chunk -> {
final World bukkitWorld = getWorld(world);
// Skip top and bottom block

View file

@ -127,7 +127,7 @@ public class PlotCluster {
public void getHome(Consumer<Location> result) {
BlockLoc home = this.settings.getPosition();
Consumer<Location> locationConsumer = toReturn -> {
MainUtil.getHeighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(), max -> {
MainUtil.getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(), max -> {
if (max > toReturn.getY()) {
toReturn.setY(1 + max);
}

View file

@ -55,8 +55,8 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.IntConsumer;
import java.util.function.IntFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@ -591,7 +591,7 @@ public class MainUtil {
/**
* Get the highest block at a location.
*/
public static void getHeighestBlock(String world, int x, int z, Consumer<Integer> result) {
public static void getHighestBlock(String world, int x, int z, IntConsumer result) {
WorldUtil.IMP.getHighestBlock(world, x, z, highest -> {
if (highest == 0) {
result.accept(63);

View file

@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
@ -74,7 +75,7 @@ public abstract class WorldUtil {
@Deprecated
public abstract BlockState getBlockSynchronous(Location location);
public abstract void getHighestBlock(String world, int x, int z, final Consumer<Integer> result);
public abstract void getHighestBlock(String world, int x, int z, final IntConsumer result);
/**
* @deprecated May result in synchronous chunk loading