[Bleeding] Check visibility API for sounds. Fixes BUKKIT-2210
This implementation of a visibility API check for sounds was created by adding extra methods carrying the source entity in WorldManager and ServerConfigurationManagerAbstract and adding a test for canSee in the SCMA sendPacketNearby method. This approach involves no logic copying, just method addition. I opted to cast to WorldManager as: 1) IWorldAccess is not in CraftBukkit at the moment 2) There is no other IWorldAccess implemented in CraftBukkit, nor is there likely to be one soon. If that day comes, easy fix.
This commit is contained in:
@@ -22,6 +22,12 @@ public class WorldManager implements IWorldAccess {
|
||||
this.world.getTracker().untrackEntity(entity);
|
||||
}
|
||||
|
||||
// CraftBukkit start - Add source entity for a sound.
|
||||
public void a(String s, double d0, double d1, double d2, float f, float f1, Entity sourceentity) {
|
||||
this.server.getServerConfigurationManager().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1), sourceentity);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void a(String s, double d0, double d1, double d2, float f, float f1) {
|
||||
// CraftBukkit - this.world.dimension
|
||||
this.server.getServerConfigurationManager().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
|
||||
|
||||
Reference in New Issue
Block a user