本文整理汇总了Java中org.bukkit.Effect.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Effect.getData方法的具体用法?Java Effect.getData怎么用?Java Effect.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Effect
的用法示例。
在下文中一共展示了Effect.getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playEffect
import org.bukkit.Effect; //导入方法依赖的package包/类
@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" );
net.minecraft.network.Packet packet;
if ( effect.getType() != Effect.Type.PARTICLE )
{
int packetData = effect.getId();
packet = new net.minecraft.network.play.server.S28PacketEffect( 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( net.minecraft.block.material.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 net.minecraft.network.play.server.S2APacketParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount );
}
int distance;
radius *= radius;
for ( Player player : getPlayers() )
{
if ( ( (CraftPlayer) player ).getHandle().playerNetServerHandler == null )
{
continue;
}
if ( !location.getWorld().equals( player.getWorld() ) )
{
continue;
}
distance = (int) player.getLocation().distanceSquared( location );
if ( distance <= radius )
{
( (CraftPlayer) player ).getHandle().playerNetServerHandler.sendPacket( packet );
}
}
}