当前位置: 首页>>代码示例>>Java>>正文


Java Firework.remove方法代码示例

本文整理汇总了Java中org.bukkit.entity.Firework.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Firework.remove方法的具体用法?Java Firework.remove怎么用?Java Firework.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Firework的用法示例。


在下文中一共展示了Firework.remove方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makePacket

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
/**
 * Make a packet object
 *
 * @param location       Location to play firework effect at
 * @param fireworkEffect FireworkEffect to play
 * @return Packet constructed by the parameters
 */
private static Object makePacket(Location location, FireworkEffect fireworkEffect) {
    try {
        Firework firework = location.getWorld().spawn(location, Firework.class);
        FireworkMeta data = firework.getFireworkMeta();
        data.clearEffects();
        data.setPower(1);
        data.addEffect(fireworkEffect);
        firework.setFireworkMeta(data);
        Object nmsFirework = ReflectionUtil.getHandle(firework);
        firework.remove();
        return PACKET_PLAY_OUT_ENTITY_STATUS.newInstance(nmsFirework, (byte) 17);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:ModernDayPlayer,项目名称:SurvivalGamesX,代码行数:24,代码来源:FireworkEffectPlayer.java

示例2: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
public void playFirework(Location loc, FireworkEffect fe) throws Exception {
	World world = loc.getWorld();
	Firework fw = (Firework) world.spawn(loc, Firework.class);
	Object nms_world = null;
	Object nms_firework = null;
	if (world_getHandle == null) {
		world_getHandle = getMethod(world.getClass(), "getHandle");
		firework_getHandle = getMethod(fw.getClass(), "getHandle");
	}
	nms_world = world_getHandle.invoke(world, (Object[]) null);
	nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
	if (nms_world_broadcastEntityEffect == null) {
		nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(),
				"broadcastEntityEffect");
	}
	FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
	data.clearEffects();
	data.setPower(1);
	data.addEffect(fe);
	fw.setFireworkMeta(data);
	nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {
			nms_firework, (byte) 17 });
	fw.remove();
}
 
开发者ID:MeRPG2,项目名称:EndHQ-Libraries,代码行数:25,代码来源:FireworkParticles.java

示例3: fire

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
protected final Firework fire(Location location, IConsumableDetails details, Object userObject) {
	final Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
	FireworkMeta meta = firework.getFireworkMeta();
	final FireworkPlayerDetails fDetails = FireworkPlayerDetails.fromConsumableDetails(details, firework, userObject);
	if (!onFire(fDetails, meta)) {
		firework.remove();
		return null;
	}
	firework.setFireworkMeta(meta);

	final BukkitTask[] task = new BukkitTask[1];
	task[0] = Bukkit.getScheduler().runTaskTimer(getPlugin(), new Runnable() {
		@Override
		public void run() {
			if (firework.isDead()) {
				onExplode(fDetails);
				task[0].cancel();
			}
			firework.setTicksLived(Integer.MAX_VALUE);
		}
	}, 10 * (1 + meta.getPower()), 2);
	return firework;
}
 
开发者ID:goncalomb,项目名称:NBTEditor,代码行数:24,代码来源:CustomFirework.java

示例4: playEffect

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
public static void playEffect(Location l, Color color) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
	Firework fw = l.getWorld().spawn(l, Firework.class);
	Object worldObject = ReflectionUtils.getMethod(l.getWorld().getClass(), "getHandle").invoke(l.getWorld(),(Object[]) null);
	
	FireworkMeta meta = fw.getFireworkMeta();
	meta.addEffect(FireworkEffect.builder().with(Type.BURST).flicker(false).trail(false).withColor(color).withFade(Color.WHITE).build());
	fw.setFireworkMeta(meta);
	
	ReflectionUtils.getMethod(worldObject.getClass(), "broadcastEntityEffect").invoke(worldObject, new Object[] {ReflectionUtils.getMethod(fw.getClass(), "getHandle").invoke(fw, (Object[]) null), (byte) 17});
	fw.remove();
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:12,代码来源:FireworkShow.java

示例5: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
void playFirework(Location loc) throws Exception {
    Firework fw = loc.getWorld().spawn(loc, Firework.class);
    if (dataStore[0] == null)
        dataStore[0] = getMethod(loc.getWorld().getClass(), "getHandle");
    if (dataStore[2] == null)
        dataStore[2] = getMethod(fw.getClass(), "getHandle");
    dataStore[3] = ((Method) dataStore[0]).invoke(loc.getWorld(), (Object[]) null);
    dataStore[4] = ((Method) dataStore[2]).invoke(fw, (Object[]) null);
    if (dataStore[1] == null)
        dataStore[1] = getMethod(dataStore[3].getClass(), "addParticle");
    ((Method) dataStore[1]).invoke(dataStore[3], "fireworksSpark", loc.getX(), loc.getY(), loc.getZ(), gen.nextGaussian() * 0.05D, -(loc.getZ() * 1.15D) * 0.5D, gen.nextGaussian() * 0.05D);
    fw.remove();
}
 
开发者ID:SurvivalGamesDevTeam,项目名称:TheSurvivalGames,代码行数:14,代码来源:RailGun.java

示例6: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
/**
 * Play a pretty firework at the location with the FireworkEffect when called
 * @param world
 * @param loc
 * @param fe
 * @throws Exception
 */
public static void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {
    // Bukkity load (CraftFirework)
    Firework fw = (Firework) world.spawn(loc, Firework.class);
    // the net.minecraft.server.World
    Object nms_world = null;
    Object nms_firework = null;
    /*
     * The reflection part, this gives us access to funky ways of messing around with things
     */
    if(world_getHandle == null) {
        // get the methods of the craftbukkit objects
        world_getHandle = getMethod(world.getClass(), "getHandle");
        firework_getHandle = getMethod(fw.getClass(), "getHandle");
    }
    // invoke with no arguments
    nms_world = world_getHandle.invoke(world, (Object[]) null);
    nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
    // null checks are fast, so having this seperate is ok
    if(nms_world_broadcastEntityEffect == null) {
        // get the method of the nms_world
        nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
    }
    /*
     * Now we mess with the metadata, allowing nice clean spawning of a pretty firework (look, pretty lights!)
     */
    // metadata load
    FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
    // clear existing
    data.clearEffects();
    // power of one
    data.setPower(1);
    // add the effect
    data.addEffect(fe);
    // set the meta
    fw.setFireworkMeta(data);
    /*
     * Finally, we broadcast the entity effect then kill our fireworks object
     */
    // invoke with arguments
    nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17});
    // remove from the game
    fw.remove();
}
 
开发者ID:frostythedev,项目名称:COD-Warfare,代码行数:51,代码来源:SpawnInstantFireworks.java

示例7: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
/**
 * Play a pretty firework at the location with the FireworkEffect when called
 * @param world
 * @param loc
 * @param fe
 * @throws Exception
 */
public void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {
    // Bukkity load (CraftFirework)
    Firework fw = (Firework) world.spawn(loc, Firework.class);
    // the net.minecraft.server.World
    Object nms_world = null;
    Object nms_firework = null;
    /*
     * The reflection part, this gives us access to funky ways of messing around with things
     */
    if(world_getHandle == null) {
        // get the methods of the craftbukkit objects
        world_getHandle = getMethod(world.getClass(), "getHandle");
        firework_getHandle = getMethod(fw.getClass(), "getHandle");
    }
    // invoke with no arguments
    nms_world = world_getHandle.invoke(world, (Object[]) null);
    nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
    // null checks are fast, so having this seperate is ok
    if(nms_world_broadcastEntityEffect == null) {
        // get the method of the nms_world
        nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
    }
    /*
     * Now we mess with the metadata, allowing nice clean spawning of a pretty firework (look, pretty lights!)
     */
    // metadata load
    FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
    // clear existing
    data.clearEffects();
    // power of one
    data.setPower(1);
    // add the effect
    data.addEffect(fe);
    // set the meta
    fw.setFireworkMeta(data);
    /*
     * Finally, we broadcast the entity effect then kill our fireworks object
     */
    // invoke with arguments
    nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17});
    // remove from the game
   // fw.
    fw.remove();
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:52,代码来源:FireworkEffectPlayer.java

示例8: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
/**
 * Play a firework effect at the specified location.
 *
 * @param world the bukkit world the effect will be displayed
 * @param loc   the location in the world the effect will be displayed
 * @param fe    the {@link org.bukkit.FireworkEffect} what will be used
 * @throws Exception the exception
 */
public void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {

    Firework fw = world.spawn(loc, Firework.class);

    Object nmsWorld = null;
    Object nmsFirework = null;

    if (worldHandler == null) {

        worldHandler = getMethod(world.getClass(), "getHandle");
        fireworkHandler = getMethod(fw.getClass(), "getHandle");
    }

    nmsWorld = worldHandler.invoke(world, (Object[]) null);
    nmsFirework = fireworkHandler.invoke(fw, (Object[]) null);

    if (nmsWorldBroadcastEntityEffect == null) {

        nmsWorldBroadcastEntityEffect = getMethod(nmsWorld.getClass(), "broadcastEntityEffect");
    }

    //Load firework metadata
    FireworkMeta data = fw.getFireworkMeta();

    //clear firework effects to allow reuse
    data.clearEffects();
    //Set power of firework to 1
    data.setPower((random.nextInt(200) + 101) / 100);
    //add the effect
    data.addEffect(fe);

    fw.setFireworkMeta(data);

    /*
     * Now broadcast the firework and kill the firework object
     *
     */

    nmsWorldBroadcastEntityEffect.invoke(nmsWorld, nmsFirework, (byte) 17);

    //Remove the object from game
    fw.remove();
}
 
开发者ID:Relicum,项目名称:Ipsum,代码行数:52,代码来源:FireworkEffects.java

示例9: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
public void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {
       // Bukkity load (CraftFirework)
	Firework fw = (Firework) world.spawn(loc, Firework.class);
	// the net.minecraft.server.World
	Object nms_world = null;
	Object nms_firework = null;
	/*
	 * The reflection part, this gives us access to funky ways of messing
	 * around with things
	 */
	if (world_getHandle == null) {
		// get the methods of the craftbukkit objects
		world_getHandle = getMethod(world.getClass(), "getHandle");
		firework_getHandle = getMethod(fw.getClass(), "getHandle");
	}
	// invoke with no arguments
	nms_world = world_getHandle.invoke(world, (Object[]) null);
	nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
	// null checks are fast, so having this seperate is ok
	if (nms_world_broadcastEntityEffect == null) {
		// get the method of the nms_world
		nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
	}
	/*
	 * Now we mess with the metadata, allowing nice clean spawning of a
	 * pretty firework (look, pretty lights!)
	 */
	// metadata load
	FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
	// clear existing
	data.clearEffects();
	// power of one
	data.setPower(1);
	// add the effect
	data.addEffect(fe);
	// set the meta
	fw.setFireworkMeta(data);
	/*
	 * Finally, we broadcast the entity effect then kill our fireworks
	 * object
	 */
	// invoke with arguments
	nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] { nms_firework, (byte) 17 });
	// remove from the game
	fw.remove();
}
 
开发者ID:SurvivalGamesDevTeam,项目名称:TheSurvivalGames,代码行数:47,代码来源:FireworkEffectPlayer.java

示例10: playFirework

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
/**
 * Play a pretty firework at the location with the FireworkEffect when
 * called
 * 
 * @param world
 * @param loc
 * @param fe
 * @throws Exception
 */
public void playFirework(World world, Location loc, FireworkEffect fe)
		throws Exception {
	// Bukkity load (CraftFirework)
	Firework fw = (Firework) world.spawn(loc, Firework.class);
	// the net.minecraft.server.World
	Object nms_world = null;
	Object nms_firework = null;
	/*
	 * The reflection part, this gives us access to funky ways of messing
	 * around with things
	 */
	if (world_getHandle == null) {
		// get the methods of the craftbukkit objects
		world_getHandle = getMethod(world.getClass(), "getHandle");
		firework_getHandle = getMethod(fw.getClass(), "getHandle");
	}
	// invoke with no arguments
	nms_world = world_getHandle.invoke(world, (Object[]) null);
	nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
	// null checks are fast, so having this seperate is ok
	if (nms_world_broadcastEntityEffect == null) {
		// get the method of the nms_world
		nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(),
				"broadcastEntityEffect");
	}
	/*
	 * Now we mess with the metadata, allowing nice clean spawning of a
	 * pretty firework (look, pretty lights!)
	 */
	// metadata load
	FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
	// clear existing
	data.clearEffects();
	// power of one
	data.setPower(1);
	// add the effect
	data.addEffect(fe);
	// set the meta
	fw.setFireworkMeta(data);
	/*
	 * Finally, we broadcast the entity effect then kill our fireworks
	 * object
	 */
	// invoke with arguments
	nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {
			nms_firework, (byte) 17 });
	// remove from the game
	fw.remove();
}
 
开发者ID:ProjectRixor,项目名称:Rixor,代码行数:59,代码来源:FireworkUtil.java

示例11: sendParticleEffect

import org.bukkit.entity.Firework; //导入方法依赖的package包/类
public static void sendParticleEffect(final Location location, final int reinforcementValue, final int reinforcementValueCoefficient) {
    World world = location.getWorld();

    Firework firework = world.spawn(new Location(world, location.getBlockX() + 0.5d, location.getBlockY() + 0.5d, location.getBlockZ() + 0.5d), Firework.class);
    FireworkMeta fireworkMeta = firework.getFireworkMeta();
    fireworkMeta.clearEffects();
    fireworkMeta.setPower(1);
    Color color;

    // Normalize the RV so that the change from RVC to 0 is gradual.
    int numberOfColors = 6;
    double fadeInterval = reinforcementValueCoefficient / numberOfColors;
    int fadeStage = (int) Math.floor(reinforcementValue / fadeInterval);

    switch (fadeStage) {
        case 0:
            // If the block is not reinforced, but has just been damaged as a reinforced block (presumably due to the grace period), then we play the "nearly broken" effect.
            color = Color.RED;
            break;
        case 1:
            color = Color.ORANGE;
            break;
        case 2:
            color = Color.YELLOW;
            break;
        case 3:
            color = Color.GREEN;
            break;
        case 4:
            color = Color.BLUE;
            break;
        default:
            color = Color.PURPLE;
            break;
    }

    fireworkMeta.addEffects(FireworkEffect.builder().withColor(color).with(FireworkEffect.Type.BALL).build());
    firework.setFireworkMeta(fireworkMeta);

    try {
        Object nms_world = getMethod(world.getClass(), "getHandle").invoke(world);
        getMethod(nms_world.getClass(), "broadcastEntityEffect").invoke(nms_world, getMethod(firework.getClass(), "getHandle").invoke(firework), (byte) 17);
        firework.remove();
    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        e.printStackTrace();
    }

}
 
开发者ID:MinerAp,项目名称:block-saver,代码行数:49,代码来源:BlockSaverUtil.java


注:本文中的org.bukkit.entity.Firework.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。