diff --git a/gradle.properties b/gradle.properties index f31191ec65..e42cafe4f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.sk89q.worldedit -version=7.4.0-SNAPSHOT +version=7.3.0-SNAPSHOT org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 15f20828dd..8478955012 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -61,7 +61,7 @@ dependencies { "implementation"("org.bstats:bstats-bukkit:2.2.1") "implementation"("it.unimi.dsi:fastutil") "testImplementation"("org.mockito:mockito-core:1.9.0-rc1") - "implementation"("com.github.Euphillya:Energie:1.1.4") + "implementation"("com.github.Euphillya:Energie:1.1.7") project.project(":worldedit-bukkit:adapters").subprojects.forEach { "adapters"(project(it.path)) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java index e719902862..edc5519814 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java @@ -27,6 +27,10 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; +import fr.euphyllia.energie.Energie; +import fr.euphyllia.energie.model.SchedulerType; +import fr.euphyllia.energie.utils.EntityUtils; +import org.bukkit.event.player.PlayerTeleportEvent; import java.lang.ref.WeakReference; import javax.annotation.Nullable; @@ -74,7 +78,10 @@ public Location getLocation() { public boolean setLocation(Location location) { org.bukkit.entity.Entity entity = entityRef.get(); if (entity != null) { - return entity.teleport(BukkitAdapter.adapt(location)); + WorldEditPlugin.getEnergieTask().getScheduler(Energie.SchedulerSoft.MINECRAFT).runTask(SchedulerType.SYNC, entity, schedulerTaskInter -> { + EntityUtils.teleportAsync(entity, BukkitAdapter.adapt(location), PlayerTeleportEvent.TeleportCause.PLUGIN); + }, null); + return true; } else { return false; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index ea4a3214e7..0d54952350 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -45,6 +45,9 @@ import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; +import fr.euphyllia.energie.Energie; +import fr.euphyllia.energie.model.SchedulerType; +import fr.euphyllia.energie.utils.EntityUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -146,8 +149,12 @@ public void print(Component component) { @Override public boolean trySetPosition(Vector3 pos, float pitch, float yaw) { - return player.teleport(new Location(player.getWorld(), pos.x(), pos.y(), - pos.z(), yaw, pitch)); + WorldEditPlugin.getEnergieTask().getScheduler(Energie.SchedulerSoft.MINECRAFT) + .runTask(SchedulerType.SYNC, player, schedulerTaskInter -> { + EntityUtils.teleportAsync(player, new Location(player.getWorld(), pos.x(), pos.y(), + pos.z(), yaw, pitch)); + }, null); + return true; } @Override @@ -224,7 +231,10 @@ public com.sk89q.worldedit.util.Location getLocation() { @Override public boolean setLocation(com.sk89q.worldedit.util.Location location) { - return player.teleport(BukkitAdapter.adapt(location)); + WorldEditPlugin.getEnergieTask().getScheduler(Energie.SchedulerSoft.MINECRAFT).runTask(SchedulerType.SYNC, player, schedulerTaskInter -> { + EntityUtils.teleportAsync(player, BukkitAdapter.adapt(location)); + }, null); + return true; } @SuppressWarnings("deprecation") // Paper's deprecation, we need to support Spigot still