distance in y 48.5

This commit is contained in:
MidnightTale 2023-04-13 14:54:53 +07:00
commit 2f6cf3536b

View file

@ -39,6 +39,7 @@ public class FoliaFlow extends JavaPlugin implements Listener {
@Override @Override
public void onEnable() { public void onEnable() {
super.onEnable(); super.onEnable();
// Get the region scheduler for the server // Get the region scheduler for the server
try { try {
RegionScheduler schedulerblock = getServer().getRegionScheduler(); RegionScheduler schedulerblock = getServer().getRegionScheduler();
@ -61,8 +62,9 @@ public class FoliaFlow extends JavaPlugin implements Listener {
for (World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
for (Entity entity : world.getEntities()) { for (Entity entity : world.getEntities()) {
if (entity.getType() == EntityType.FALLING_BLOCK && entity.getWorld().getEnvironment() == World.Environment.THE_END) { if (entity.getType() == EntityType.FALLING_BLOCK && entity.getWorld().getEnvironment() == World.Environment.THE_END) {
Location centerLoc = new Location(entity.getWorld(), 100, 48.5, 0);
Location loc = entity.getLocation(); Location loc = entity.getLocation();
if (loc.getBlockX() == 100 && loc.getBlockY() == 48.5 && loc.getBlockZ() == 0) { if (loc.distance(centerLoc) <= 1) {
// Set the initial velocity of the falling block only if it doesn't have a velocity stored // Set the initial velocity of the falling block only if it doesn't have a velocity stored
if (!velocitiesMap.containsKey(entity)) { if (!velocitiesMap.containsKey(entity)) {
try { try {