本文整理匯總了Java中org.bukkit.Effect.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java Effect.getType方法的具體用法?Java Effect.getType怎麽用?Java Effect.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.Effect
的用法示例。
在下文中一共展示了Effect.getType方法的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 );
}
}
}