fix async
This commit is contained in:
parent
60faeba3d3
commit
7f00245206
1 changed files with 9 additions and 9 deletions
|
|
@ -32,15 +32,15 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
private final Set<Location> movingBlocks = new HashSet<>();
|
private final Set<Location> movingBlocks = new HashSet<>();
|
||||||
private final Map<Entity, Vector> velocitiesMap = new HashMap<>();
|
private final Map<Entity, Vector> velocitiesMap = new HashMap<>();
|
||||||
private ScheduledTask task;
|
private ScheduledTask Foliaflow_Setblock_Task;
|
||||||
private ScheduledTask blockktask;
|
private ScheduledTask Foliaflow_Blockvelocity_Task;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
super.onEnable();
|
super.onEnable();
|
||||||
try {
|
try {
|
||||||
RegionScheduler schedulerblock = getServer().getRegionScheduler();
|
RegionScheduler Foliaflow_Setblock = getServer().getRegionScheduler();
|
||||||
blockktask = schedulerblock.runAtFixedRate(this, Objects.requireNonNull(Bukkit.getWorld("world_the_end")), 1, 1, (schedulerTask) -> {
|
Foliaflow_Setblock_Task = Foliaflow_Setblock.runAtFixedRate(this, Objects.requireNonNull(Bukkit.getWorld("world_the_end")), 1, 1, (schedulerTask) -> {
|
||||||
Block block = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getBlockAt(100, 48, 0);
|
Block block = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getBlockAt(100, 48, 0);
|
||||||
if (block.getType() == Material.OBSIDIAN) {
|
if (block.getType() == Material.OBSIDIAN) {
|
||||||
block.setType(Material.COBBLED_DEEPSLATE_SLAB);
|
block.setType(Material.COBBLED_DEEPSLATE_SLAB);
|
||||||
|
|
@ -55,8 +55,8 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
getServer().getLogger().info("Region Scheduler erorr (likly chunky it not load)");
|
getServer().getLogger().info("Region Scheduler erorr (likly chunky it not load)");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
AsyncScheduler scheduler = getServer().getAsyncScheduler();
|
AsyncScheduler Foliaflow_Blockvelocity = getServer().getAsyncScheduler();
|
||||||
task = scheduler.runAtFixedRate(this, (scheduledTask) -> getScheduler().runTask(this, () -> {
|
Foliaflow_Blockvelocity_Task = Foliaflow_Blockvelocity.runAtFixedRate(this, (scheduledTask) -> getServer().getScheduler().runTaskAsynchronously(this, () -> {
|
||||||
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) {
|
||||||
|
|
@ -84,8 +84,8 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
try {
|
try {
|
||||||
task.cancel();
|
Foliaflow_Setblock_Task.cancel();
|
||||||
blockktask.cancel();
|
Foliaflow_Blockvelocity_Task.cancel();
|
||||||
} catch (UnsupportedOperationException ignored) {
|
} catch (UnsupportedOperationException ignored) {
|
||||||
}
|
}
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
|
|
@ -119,7 +119,7 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
dummy.setVelocity(dummyVel);
|
dummy.setVelocity(dummyVel);
|
||||||
}
|
}
|
||||||
} catch (NullPointerException dummy) {
|
} catch (NullPointerException dummy) {
|
||||||
getServer().getLogger().info("onFallingBlockToBlock erorr (likly chunky it not load)");
|
getServer().getLogger().info("onFallingBlockToBlock error (likly chunky it not load)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue