-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I haven't tested it yet but, I've added the PainballHandler class for Spigot 1.11.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/ovh/tgrhavoc/mvpgadgets/gadgets/paintballgun/nms/v1_11_R1/PaintballHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ovh.tgrhavoc.mvpgadgets.gadgets.paintballgun.nms.v1_11_R1; | ||
|
||
import java.util.Collection; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld; | ||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; | ||
import org.bukkit.craftbukkit.v1_11_R1.util.CraftMagicNumbers; | ||
import org.bukkit.entity.Player; | ||
|
||
import net.minecraft.server.v1_11_R1.BlockPosition; | ||
import net.minecraft.server.v1_11_R1.PacketPlayOutBlockChange; | ||
import ovh.tgrhavoc.mvpgadgets.gadgets.paintballgun.nms.AbstractPaintHandler; | ||
|
||
public class PaintballHandler extends AbstractPaintHandler{ | ||
|
||
@Override | ||
public void sendChangeBlock(Player player, Block newBlock, Material material, byte data) { | ||
PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange( | ||
((CraftWorld)newBlock.getWorld()).getHandle(), new BlockPosition( | ||
newBlock.getLocation().getX(), newBlock.getLocation().getY(), newBlock.getLocation().getZ())); | ||
packet.block = CraftMagicNumbers.getBlock(material).fromLegacyData(data); | ||
CraftPlayer cP = (CraftPlayer)player; | ||
cP.getHandle().playerConnection.sendPacket(packet); | ||
} | ||
|
||
@Override | ||
public void updateBlock(Collection<? extends Player> players, Block block, Material material, byte data) { | ||
for (Player player : players) { | ||
sendChangeBlock(player, block, material, data); | ||
} | ||
} | ||
|
||
} |