Re-add missing Player part of the particle API

This commit is contained in:
Thinkofdeath 2014-03-20 22:29:54 +00:00
parent 5e5315f541
commit 0d601be5dd
3 changed files with 65 additions and 11 deletions

View file

@ -1,4 +1,4 @@
From 7ea952d1568dfa1019fce2c49e5621fd672971c6 Mon Sep 17 00:00:00 2001
From 5d9420f4c83ca2ce32ec429a54e3f37c3bdcc0e6 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Fri, 20 Dec 2013 21:36:06 +0000
Subject: [PATCH] Particle API
@ -116,6 +116,60 @@ index 57dd4e7..948e81d 100644
};
public Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5fe8276..e6fce34 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1292,6 +1292,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false );
}
}
+
+ @Override
+ public void playEffect( Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius )
+ {
+ Validate.notNull( location, "Location cannot be null" );
+ Validate.notNull( effect, "Effect cannot be null" );
+ Validate.notNull( location.getWorld(), "World cannot be null" );
+ Packet packet;
+ if ( effect.getType() != Effect.Type.PARTICLE )
+ {
+ int packetData = effect.getId();
+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false );
+ } else
+ {
+ StringBuilder particleFullName = new StringBuilder();
+ particleFullName.append( effect.getName() );
+ if ( effect.getData() != null && ( effect.getData().equals( Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) )
+ {
+ particleFullName.append( '_' ).append( id );
+ }
+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) )
+ {
+ particleFullName.append( '_' ).append( data );
+ }
+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount );
+ }
+ int distance;
+ radius *= radius;
+ if ( getHandle().playerConnection == null )
+ {
+ return;
+ }
+ if ( !location.getWorld().equals( getWorld() ) )
+ {
+ return;
+ }
+
+ distance = (int) getLocation().distanceSquared( location );
+ if ( distance <= radius )
+ {
+ getHandle().playerConnection.sendPacket( packet );
+ }
+ }
};
public Player.Spigot spigot()
--
1.8.3.2
1.8.5.2.msysgit.0

View file

@ -1,4 +1,4 @@
From 271c82210bf71b7fe7d09c1cb50717100fec9f43 Mon Sep 17 00:00:00 2001
From dc9a69046656a4ddcc8d03f70b1c25c84895b099 Mon Sep 17 00:00:00 2001
From: Smove <jan@lavasurvival.net>
Date: Sat, 1 Feb 2014 18:12:16 +1100
Subject: [PATCH] Implement Locale Getter for Players
@ -18,11 +18,11 @@ index 9b853a9..95dbeb9 100644
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a717d34..53c8a0b 100644
index 6cec65a..1f685e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1292,6 +1292,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false );
@@ -1335,6 +1335,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().playerConnection.sendPacket( packet );
}
}
+
@ -35,5 +35,5 @@ index a717d34..53c8a0b 100644
public Player.Spigot spigot()
--
1.8.3.2
1.8.5.2.msysgit.0

View file

@ -1,14 +1,14 @@
From 86a0af23b1fbb0db74f8fe08f899902c06014eb5 Mon Sep 17 00:00:00 2001
From 86eef05ad745fa9e845d5449598bb05b450d95e9 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Sun, 9 Feb 2014 14:03:03 -0500
Subject: [PATCH] Add support for fetching hidden players
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 53c8a0b..db6e5b8 100644
index 1f685e1..8d87137 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1298,6 +1298,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1341,6 +1341,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
return getHandle().locale;
}
@ -22,5 +22,5 @@ index 53c8a0b..db6e5b8 100644
public Player.Spigot spigot()
--
1.8.3.2
1.8.5.2.msysgit.0