From aeccce24a916e0b433c61881b34ab2a6fbbb1f3d Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 16 Dec 2020 17:38:15 +0000 Subject: [PATCH] fix #550 --- .../com/boydti/fawe/wrappers/AsyncPlayer.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/wrappers/AsyncPlayer.java b/worldedit-core/src/main/java/com/boydti/fawe/wrappers/AsyncPlayer.java index baca0fa1f..1001d64bd 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/wrappers/AsyncPlayer.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/wrappers/AsyncPlayer.java @@ -143,23 +143,27 @@ public class AsyncPlayer extends PlayerProxy { @Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { - RuntimeException caught = null; - try { - EditSession edit = new EditSessionBuilder(WorldWrapper.unwrap(getWorld())) - .player(unwrap(getBasePlayer())).build(); - edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS); - edit.flushQueue(); - LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this); - if (session != null) { - session.remember(edit, true, getBasePlayer().getLimit().MAX_HISTORY); + if (alwaysGlass || !isAllowedToFly()) { + RuntimeException caught = null; + try { + EditSession edit = + new EditSessionBuilder(WorldWrapper.unwrap(getWorld())).player(unwrap(getBasePlayer())).build(); + edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS); + edit.flushQueue(); + LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this); + if (session != null) { + session.remember(edit, true, getBasePlayer().getLimit().MAX_HISTORY); + } + } catch (RuntimeException e) { + caught = e; } - } catch (RuntimeException e) { - caught = e; - } - setPosition(Vector3.at(x + 0.5, y, z + 0.5)); - if (caught != null) { - throw caught; + if (caught != null) { + throw caught; + } + } else { + setFlying(true); } + trySetPosition(Vector3.at(x + 0.5, y, z + 0.5)); } @Override