Compare commits
3 Commits
3992dcf356
...
6ab3e91622
Author | SHA1 | Date |
---|---|---|
Phillipp Glanz | 6ab3e91622 | |
Pierre Maurice Schwang | c239908aa3 | |
Phillipp Glanz | 087ba07bfd |
|
@ -261,6 +261,11 @@ public class BukkitUtil extends WorldUtil {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSmallBlock(Location location) {
|
||||
return adapt(location).getBlock().getBoundingBox().getHeight() < 0.25;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNegative
|
||||
public int getHighestBlockSynchronous(final @NonNull String world, final int x, final int z) {
|
||||
|
|
|
@ -577,6 +577,8 @@ public class Settings extends Config {
|
|||
public static boolean PER_WORLD_VISIT = false;
|
||||
@Comment("Search merged plots for having multiple owners when using the visit command")
|
||||
public static boolean VISIT_MERGED_OWNERS = true;
|
||||
@Comment("Allows to teleport based on block size instead to spawn on the highest block at the home command")
|
||||
public static boolean SIZED_BASED = true;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,10 @@ public class PlotListener {
|
|||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
// Don't attempt to heal dead players - they will get stuck in the abyss (#4406)
|
||||
if (PlotSquared.platform().worldUtil().getHealth(player) <= 0) {
|
||||
continue;
|
||||
}
|
||||
double level = PlotSquared.platform().worldUtil().getHealth(player);
|
||||
if (level != value.max) {
|
||||
PlotSquared.platform().worldUtil().setHealth(player, Math.min(level + value.amount, value.max));
|
||||
|
|
|
@ -1420,6 +1420,9 @@ public class Plot {
|
|||
);
|
||||
}
|
||||
Location location = toHomeLocation(bottom, home);
|
||||
if (Settings.Teleport.SIZED_BASED && this.worldUtil.isSmallBlock(location) && this.worldUtil.isSmallBlock(location.add(0,1,0))) {
|
||||
return location;
|
||||
}
|
||||
if (!this.worldUtil.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
||||
location = location.withY(
|
||||
Math.max(1 + this.worldUtil.getHighestBlockSynchronous(
|
||||
|
@ -1453,15 +1456,21 @@ public class Plot {
|
|||
}
|
||||
Location bottom = this.getBottomAbs();
|
||||
Location location = toHomeLocation(bottom, home);
|
||||
this.worldUtil.getBlock(location, block -> {
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
this.worldUtil.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
||||
y -> result.accept(location.withY(Math.max(1 + y, bottom.getY())))
|
||||
);
|
||||
} else {
|
||||
result.accept(location);
|
||||
}
|
||||
});
|
||||
if (Settings.Teleport.SIZED_BASED && this.worldUtil.isSmallBlock(location) && this.worldUtil.isSmallBlock(location.add(0,1,0))) {
|
||||
result.accept(location);
|
||||
} else {
|
||||
this.worldUtil.getBlock(location, block -> {
|
||||
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
this.worldUtil.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
||||
y -> result.accept(location.withY(Math.max(1 + y, bottom.getY())))
|
||||
);
|
||||
} else {
|
||||
result.accept(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,13 @@ public abstract class WorldUtil {
|
|||
*/
|
||||
public abstract void getBlock(@NonNull Location location, @NonNull Consumer<BlockState> result);
|
||||
|
||||
/**
|
||||
* Checks if the block smaller as a slab
|
||||
* @param location Block location
|
||||
* @return true if it smaller as a slab
|
||||
*/
|
||||
public abstract boolean isSmallBlock(@NonNull Location location);
|
||||
|
||||
/**
|
||||
* Get the block at a given location (synchronously)
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue