This commit is contained in:
parent
b3a36c75bb
commit
8be844b59f
|
@ -26,7 +26,6 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
|
@ -350,7 +349,14 @@ public class WarpSignsManager {
|
|||
float yaw = Util.blockFaceToFloat(directionFacing);
|
||||
final Location actualWarp = new Location(inFront.getWorld(), inFront.getBlockX() + 0.5D, inFront.getBlockY(),
|
||||
inFront.getBlockZ() + 0.5D, yaw, 30F);
|
||||
Util.teleportAsync(user.getPlayer(), actualWarp, TeleportCause.COMMAND);
|
||||
//BentoBox prevents people from teleporting to an island when
|
||||
//the user is banned from the island for example.
|
||||
//By checking if the teleport succeeded before sending the messages,
|
||||
//we prevent issues where no one teleported, but people still
|
||||
//get messages about it.
|
||||
Util.teleportAsync(user.getPlayer(), actualWarp, TeleportCause.COMMAND).thenAccept(tpResult -> {
|
||||
if(!tpResult) return;
|
||||
|
||||
User warpOwner = Objects.requireNonNull(User.getInstance(signOwner));
|
||||
// Hide invisible players
|
||||
if (warpOwner.isOnline() && !warpOwner.getPlayer().canSee(user.getPlayer())) {
|
||||
|
@ -370,6 +376,7 @@ public class WarpSignsManager {
|
|||
|
||||
warpOwner.sendMessage("warps.player-warped", "[name]", user.getName(), "[gamemode]", gameMode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -428,6 +428,7 @@ public class WarpSignsManagerTest {
|
|||
when(p.getLocation()).thenReturn(location);
|
||||
@Nullable
|
||||
User u = User.getInstance(p);
|
||||
PowerMockito.when(Util.teleportAsync(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(true));
|
||||
wsm.warpPlayer(world, u, uuid);
|
||||
PowerMockito.verifyStatic(Util.class);
|
||||
Util.teleportAsync(eq(p), any(), eq(TeleportCause.COMMAND));
|
||||
|
|
Loading…
Reference in New Issue