Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.NullWorld;
import io.papermc.lib.PaperLib;

import java.lang.ref.WeakReference;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -76,7 +77,12 @@ public Location getLocation() {
public boolean setLocation(Location location) {
org.bukkit.entity.Entity entity = entityRef.get();
if (entity != null) {
return entity.teleport(BukkitAdapter.adapt(location));
if (WorldEditPlugin.getInstance().isFolia()) {
var unused = PaperLib.teleportAsync(entity, BukkitAdapter.adapt(location));
return true;
} else {
return entity.teleport(BukkitAdapter.adapt(location));
}
} else {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -146,8 +147,14 @@ 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));
Location location = new Location(player.getWorld(), pos.x(), pos.y(),
pos.z(), yaw, pitch);
if (WorldEditPlugin.getInstance().isFolia()) {
var unused = PaperLib.teleportAsync(player, location);
return true;
} else {
return player.teleport(location);
}
}

@Override
Expand Down Expand Up @@ -224,7 +231,12 @@ public com.sk89q.worldedit.util.Location getLocation() {

@Override
public boolean setLocation(com.sk89q.worldedit.util.Location location) {
return player.teleport(BukkitAdapter.adapt(location));
if (WorldEditPlugin.getInstance().isFolia()) {
var unused = PaperLib.teleportAsync(player, BukkitAdapter.adapt(location));
return true;
} else {
return player.teleport(BukkitAdapter.adapt(location));
}
}

@SuppressWarnings("deprecation") // Paper's deprecation, we need to support Spigot still
Expand Down
Loading