Advertisement
Guest User

ParticleAPi

a guest
Oct 21st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package mc.cubegames.piratesvsnavy.api;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
  6. import org.bukkit.entity.Player;
  7.  
  8. import net.minecraft.server.v1_10_R1.EnumParticle;
  9. import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
  10.  
  11. public class Particul {
  12.  
  13. private PacketPlayOutWorldParticles packet;
  14.  
  15. public Particul(EnumParticle particle, Location loc, Float xOffset, Float yOffset, Float zOffset, Float speed, Integer count){
  16.  
  17. Float x = (float) loc.getX();
  18. Float y = (float) loc.getY();
  19. Float z = (float) loc.getZ();
  20.  
  21. this.packet = new PacketPlayOutWorldParticles(particle, true, x, y, z, xOffset, yOffset, zOffset, speed, count, null);
  22. }
  23.  
  24. public void sendParticleToAllPlayers(){
  25. for(Player pls : Bukkit.getOnlinePlayers()){
  26. ((CraftPlayer)pls).getHandle().playerConnection.sendPacket(this.packet);
  27. }
  28. }
  29.  
  30. public void sendParticleToPlayer(Player player){
  31. ((CraftPlayer)player).getHandle().playerConnection.sendPacket(this.packet);
  32. }
  33.  
  34. public PacketPlayOutWorldParticles getPacket() {
  35. return packet;
  36. }
  37.  
  38. public void setPacket(PacketPlayOutWorldParticles packet) {
  39. this.packet = packet;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement