From 4b354f806d28c663646b3201414158a3c822bde0 Mon Sep 17 00:00:00 2001 From: Hugo Kerstens Date: Sat, 26 Mar 2016 15:38:15 +0100 Subject: [PATCH] Check if user is indeed using 1.9 to 1.8 protocol conversion --- .../protocol1_9to1_8/listeners/BlockListener.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/BlockListener.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/BlockListener.java index 3dd5fef31..09cd8044a 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/BlockListener.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/BlockListener.java @@ -7,19 +7,24 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import us.myles.ViaVersion.ViaVersionPlugin; +import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.minecraft.Position; +import us.myles.ViaVersion.protocols.base.ProtocolInfo; +import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8; import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker; @RequiredArgsConstructor -public class BlockListener implements Listener{ +public class BlockListener implements Listener { private final ViaVersionPlugin plugin; @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void placeBlock(BlockPlaceEvent e) { if(plugin.isPorted(e.getPlayer())) { + UserConnection c = plugin.getConnection(e.getPlayer()); + if (!c.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) return; Block b = e.getBlockPlaced(); - plugin.getConnection(e.getPlayer()).get(EntityTracker.class).addBlockInteraction(new Position((long)b.getX(), (long)b.getY(), (long)b.getZ())); + plugin.getConnection(e.getPlayer()).get(EntityTracker.class).addBlockInteraction(new Position((long) b.getX(), (long) b.getY(), (long) b.getZ())); } } }