mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed two synchronization issues
This commit is contained in:
parent
fd10f2ea4c
commit
397f194029
@ -121,14 +121,18 @@ public final class TeleportationManager {
|
||||
|
||||
PaperLib.teleportAsync(p, destination).thenAccept(teleported -> {
|
||||
if (teleported.booleanValue()) {
|
||||
if (resistance) {
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "machines.TELEPORTER.invulnerability");
|
||||
}
|
||||
// This needs to run on the main Thread so we force it, as the
|
||||
// async teleportation might happen on a seperate Thread.
|
||||
Slimefun.runSync(() -> {
|
||||
if (resistance) {
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "machines.TELEPORTER.invulnerability");
|
||||
}
|
||||
|
||||
destination.getWorld().spawnParticle(Particle.PORTAL, new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()), progress * 2, 0.2F, 0.8F, 0.2F);
|
||||
destination.getWorld().playSound(destination, Sound.BLOCK_BEACON_ACTIVATE, 1F, 1F);
|
||||
teleporterUsers.remove(uuid);
|
||||
destination.getWorld().spawnParticle(Particle.PORTAL, new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()), progress * 2, 0.2F, 0.8F, 0.2F);
|
||||
destination.getWorld().playSound(destination, Sound.BLOCK_BEACON_ACTIVATE, 1F, 1F);
|
||||
teleporterUsers.remove(uuid);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class ElevatorPlate extends SimpleSlimefunItem<BlockUseHandler> {
|
||||
Location destination = new Location(player.getWorld(), block.getX() + 0.5, block.getY() + 0.4, block.getZ() + 0.5, yaw, player.getEyeLocation().getPitch());
|
||||
PaperLib.teleportAsync(player, destination).thenAccept(teleported -> {
|
||||
if (teleported.booleanValue()) {
|
||||
player.sendTitle(ChatColor.WHITE + ChatColors.color(floor), " ", 20, 60, 20);
|
||||
Slimefun.runSync(() -> player.sendTitle(ChatColor.WHITE + ChatColors.color(floor), " ", 20, 60, 20));
|
||||
}
|
||||
});
|
||||
})));
|
||||
|
Loading…
Reference in New Issue
Block a user