diff options
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java b/src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java new file mode 100644 index 0000000..53f3f9c --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java @@ -0,0 +1,24 @@ +package net.tylermurphy.hideAndSeek.util.packet; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.wrappers.BlockPosition; +import com.comphenix.protocol.wrappers.WrappedBlockData; +import org.bukkit.Location; +import org.bukkit.Material; +import org.jetbrains.annotations.NotNull; + +public class BlockChangePacket extends AbstractPacket { + + public BlockChangePacket(){ + super(PacketType.Play.Server.BLOCK_CHANGE); + } + + public void setBlockPosition(@NotNull Location location){ + super.packet.getBlockPositionModifier().write(0, new BlockPosition(location.toVector())); + } + + public void setMaterial(Material material){ + super.packet.getBlockData().write(0, WrappedBlockData.createData(material)); + } + +} |