catch erorr

This commit is contained in:
MidnightTale 2023-04-13 14:50:09 +07:00
commit 866151f1af

View file

@ -56,7 +56,6 @@ public class FoliaFlow extends JavaPlugin implements Listener {
} catch (NullPointerException block) { } catch (NullPointerException block) {
getServer().getLogger().info("Region Scheduler erorr (likly chunky it not load)"); getServer().getLogger().info("Region Scheduler erorr (likly chunky it not load)");
} }
try {
AsyncScheduler scheduler = getServer().getAsyncScheduler(); AsyncScheduler scheduler = getServer().getAsyncScheduler();
task = scheduler.runAtFixedRate(this, (scheduledTask) -> getScheduler().runTask(this, () -> { task = scheduler.runAtFixedRate(this, (scheduledTask) -> getScheduler().runTask(this, () -> {
for (World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
@ -66,21 +65,24 @@ public class FoliaFlow extends JavaPlugin implements Listener {
if (loc.getBlockX() == 100 && loc.getBlockY() == 48.5 && loc.getBlockZ() == 0) { if (loc.getBlockX() == 100 && loc.getBlockY() == 48.5 && loc.getBlockZ() == 0) {
// 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 {
int index = counter % 4; int index = counter % 4;
counter++; counter++;
Vector velocity = velocities[index]; Vector velocity = velocities[index];
entity.setVelocity(velocity); entity.setVelocity(velocity);
velocitiesMap.put(entity, velocity); // Store the velocity in the map velocitiesMap.put(entity, velocity); // Store the velocity in the map
movingBlocks.add(entity.getLocation()); // Add the location to the set movingBlocks.add(entity.getLocation()); // Add the location to the set
} catch (NullPointerException e) {
// Handle the exception here, for example:
e.printStackTrace();
getServer().getLogger().info("An error occurred: " + e.getMessage());
}
} }
} }
} }
} }
} }
}), 0L, 1L, TimeUnit.MILLISECONDS); }), 0L, 1L, TimeUnit.MILLISECONDS);
} catch (NullPointerException entity) {
getServer().getLogger().info("AsyncScheduler erorr (likly chunky it not load)");
}
getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(this, this);
getServer().getConsoleSender().sendMessage(""); getServer().getConsoleSender().sendMessage("");
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ______________ "); getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ______________ ");