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


Java Player.setFireTicks方法代码示例

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


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

示例1: resetPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
    player.setLevel(0);
    player.setExp(0);
    player.setFoodLevel(20);
    player.setHealth(20);
    player.setHealthScale(20);
    player.setExhaustion(0);
    player.getInventory().clear();
    ItemStack blankItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
    ItemMeta blankMeta = blankItem.getItemMeta();
    blankMeta.setDisplayName("" + ChatColor.RED);
    blankItem.setItemMeta(blankMeta);
    for(int i=9; i<=35; i++) {
        player.getInventory().setItem(i, blankItem);
    }
    player.getInventory().setHelmet(new ItemStack(Material.AIR, 1));
    player.getInventory().setChestplate(new ItemStack(Material.AIR, 1));
    player.getInventory().setLeggings(new ItemStack(Material.AIR, 1));
    player.getInventory().setBoots(new ItemStack(Material.AIR, 1));
    for(PotionEffect potionEffect : player.getActivePotionEffects()) {
        player.removePotionEffect(potionEffect.getType());
    }
    player.setFireTicks(0);
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:25,代码来源:Utils.java

示例2: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void reset() {
    final Player bukkit = getBukkit();
    bukkit.closeInventory();
    clearInventory();
    bukkit.setExhaustion(0);
    bukkit.setFallDistance(0);
    bukkit.setFireTicks(0);
    bukkit.setFoodLevel(20); // full
    bukkit.setMaxHealth(20);
    bukkit.setHealth(bukkit.getMaxHealth());
    bukkit.setAbsorption(0);
    bukkit.setLevel(0);
    bukkit.setExp(0); // clear xp
    bukkit.setSaturation(5); // default
    bukkit.setFastNaturalRegeneration(false);
    bukkit.setSlowNaturalRegeneration(true);
    bukkit.setAllowFlight(false);
    bukkit.setFlying(false);
    bukkit.setSneaking(false);
    bukkit.setSprinting(false);
    bukkit.setFlySpeed(0.1f);
    bukkit.setKnockbackReduction(0);
    bukkit.setWalkSpeed(WalkSpeedKit.BUKKIT_DEFAULT);
    AttributeUtils.removeAllModifiers(bukkit);
    resetPotions();

    // we only reset bed spawn here so people don't have to see annoying messages when they respawn
    bukkit.setBedSpawnLocation(null);

    match.callEvent(new PlayerResetEvent(this));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:32,代码来源:MatchPlayer.java

示例3: onDamage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onDamage(EntityDamageEvent e){
    if(!(e.getEntity() instanceof Player)) return;
    Player p = (Player) e.getEntity();

    if (plugin.getGm().isInLobby()) e.setCancelled(true);

    switch (e.getCause()) {
        case LAVA:
            e.setCancelled(true);
            p.teleport(plugin.getAm().getRandomSpawn());
            //RageGames.getPlayer(p).resetPlayer();
            p.setHealth(20d);
            p.setFireTicks(0);
            break;
        case FALL:
            e.setCancelled(true);
            break;
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:21,代码来源:PlayerEvents.java

示例4: loadData

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void loadData(Player player) {
	player.setFireTicks(0);
	player.setHealth(20);
	player.setLevel(level.get(player.getName()));
	player.setExp(exp.get(player.getName()));
	playerLocation.remove(player.getName());
	testing.remove(player.getName());
	armor.remove(player.getName());
	inventory.remove(player.getName());
	killsLeft.remove(player.getName());
	exp.remove(player.getName());
	level.remove(player.getName());
	plugin.getPlayerFile().createConfig(player);
	plugin.getPlayerFile().removeChallenge();
	plugin.getPlayerFile().saveConfig();
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:17,代码来源:Challenge.java

示例5: onEntityDamage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
	if(event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
		Player damager = (Player) event.getDamager();
		if(damager.getInventory().getItemInMainHand() == null)
			return;
		if(!damager.getInventory().getItemInMainHand().hasItemMeta())
			return;
		if(damager.getInventory().getItemInMainHand().getItemMeta().getLore() == null)
			return;
		Player victim = (Player) event.getEntity();
		if(!Utility.canAttack(damager, victim)) 
			return;
		List<String> lore = damager.getInventory().getItemInMainHand().getItemMeta().getLore();
		if(contains(lore, "Wither Damage")) {
			victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 200, 1));
		}
		if(contains(lore,"Fire Damage")) {
			victim.setFireTicks(100);
		}
		if(contains(lore,"Poison Damage")) {
			victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 200, 0));
		}
	}
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:26,代码来源:CustomEnchantsListener.java

示例6: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void reset(Player player, boolean heal) {
    if (heal) player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    player.setFoodLevel(20);
    player.setSaturation(20);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)});
    player.setItemOnCursor(new ItemStack(Material.AIR));

    player.getActivePotionEffects().forEach(potionEffect -> {
        try {
            player.removePotionEffect(potionEffect.getType());
        } catch (NullPointerException ignored) {}
    });

    player.setFireTicks(0);
    player.setFallDistance(0);
    player.setTotalExperience(0);
    player.setExp(0);
    player.setLevel(0);
    player.setWalkSpeed(0.2F);
    player.setFlySpeed(0.1F);

    player.setSneaking(false);
    player.setInvulnerable(false);
    player.setCanPickupItems(true);
    player.setCollidable(true);
    player.setFlying(false);
    player.setAllowFlight(false);

    player.resetTitle();

    for (Attribute attribute : Attribute.values()) {
        if (player.getAttribute(attribute) == null) continue;
        for (AttributeModifier modifier : player.getAttribute(attribute).getModifiers()) {
            player.getAttribute(attribute).removeModifier(modifier);
        }
    }
    player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).addModifier(new AttributeModifier(UUID.randomUUID(), "generic.attackSpeed", 24.000D, AttributeModifier.Operation.ADD_SCALAR));

    player.updateInventory();
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:42,代码来源:Players.java

示例7: customDeathNonPlayerFallback

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.LOWEST)
public void customDeathNonPlayerFallback(EntityDamageEvent e){
	if(e.getCause().equals(DamageCause.FALL)) return;
	if(e.getEntity() instanceof Player){
		Player p = (Player) e.getEntity();
		if(e.getCause().equals(DamageCause.ENTITY_ATTACK)){
			// no need to do anything here, this part is controlled in the customDeath method
		}else{
			if(e.getFinalDamage() >= p.getHealth()){
				e.setCancelled(true);
				Bukkit.getServer().broadcastMessage(ChatColor.GRAY + p.getName() + " died");
				// Set statistics
				//p.setStatistic(Statistic.DEATHS, p.getStatistic(Statistic.DEATHS) + 1);
				// Reset health, so they dont die
				p.setHealth(p.getMaxHealth());
				// Inventory clearing
				p.getInventory().clear();
				ItemStack air = new ItemStack(Material.AIR);
				p.getInventory().setHelmet(air);
				p.getInventory().setChestplate(air);
				p.getInventory().setLeggings(air);
				p.getInventory().setBoots(air);
				// Clear potion effects
				for(PotionEffect pe : p.getActivePotionEffects()){
					p.removePotionEffect(pe.getType());
				}
				// Stop infinite kill glitch
				p.setGameMode(GameMode.SPECTATOR);
				p.setGameMode(GameMode.ADVENTURE);
				// send them to the SPAWN of the world
				p.teleport(p.getWorld().getSpawnLocation());
				p.setFireTicks(0);
			}
		}
	}
}
 
开发者ID:OverloadedCore,项目名称:kaosEssentials,代码行数:37,代码来源:Core.java

示例8: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onCommand(CommandSender sender, String[] args) {
    Player p = (Player) sender;
    if (p.getFireTicks() < 0) {
        sender.sendMessage(ChatColor.GRAY + "You are not on fire.");
        return;
    }

    p.setFireTicks(0);
    p.playSound(p.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1F, 1F);
    sender.sendMessage(ChatColor.GRAY + "The fire has been extinguished.");
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:13,代码来源:CommandExtinguish.java

示例9: handleFlame

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void handleFlame(Player damager, Player target) {
	if(target.getFireTicks() > 0)
		return;
	
	target.setFireTicks(100);
	target.sendMessage(Lang.HEADERS_TOKENS.toString()
			+ Lang.TOKENS_FLAMED.toString()
				.replaceAll("%s", damager.getName()));
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:10,代码来源:AbilityListener.java

示例10: onRespawn

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
	Player player = event.getPlayer();
       player.setGameMode(GameMode.SURVIVAL);
       player.setHealth(20.0);
       player.setFoodLevel(20);
       player.setAllowFlight(false);
       player.setFlying(false);
       player.setFireTicks(0);
       player.getActivePotionEffects().forEach(potionEffect -> player.removePotionEffect(potionEffect.getType()));
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:12,代码来源:PlayerRespawnListener.java

示例11: resetPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
    player.setCanPickupItems(false);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[4]);
    player.setHealth(20.0);
    player.setFoodLevel(20);
    player.setFireTicks(1);
    player.getActivePotionEffects().forEach(effect -> player.removePotionEffect(effect.getType()));
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:10,代码来源:GameUtils.java

示例12: onEat

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onEat(PlayerItemConsumeEvent e) {
	if (e.getItem() != null) {
		final Player p = e.getPlayer();
		ItemStack item = e.getItem();
		if (Slimefun.hasUnlocked(p, item, true)) {
			if (SlimefunManager.isItemSimiliar(item, SlimefunItems.MONSTER_JERKY, true)) {
				e.setCancelled(true);
				if (SlimefunManager.isItemSimiliar(p.getInventory().getItemInOffHand(), SlimefunItems.MONSTER_JERKY, true)) {
					p.getInventory().setItemInOffHand(InvUtils.decreaseItem(p.getInventory().getItemInOffHand(), 1));
				}
				else{
					p.getInventory().setItemInMainHand(InvUtils.decreaseItem(p.getInventory().getItemInMainHand(), 1));
				}
				PlayerInventory.update(p);
				p.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 5, 0));
			}
			else if (SlimefunManager.isItemSimiliar(item, SlimefunItems.FORTUNE_COOKIE, true)) p.sendMessage(ChatColor.translateAlternateColorCodes('&', Messages.local.getTranslation("messages.fortune-cookie").get(CSCoreLib.randomizer().nextInt(Messages.local.getTranslation("messages.fortune-cookie").size()))));
			else if (SlimefunManager.isItemSimiliar(item, SlimefunItems.BEEF_JERKY, true)) p.setSaturation((Integer) Slimefun.getItemValue("BEEF_JERKY", "Saturation"));
			else if (SlimefunManager.isItemSimiliar(item, SlimefunItems.MEDICINE, true)) {
				if (p.hasPotionEffect(PotionEffectType.POISON)) p.removePotionEffect(PotionEffectType.POISON);
				if (p.hasPotionEffect(PotionEffectType.WITHER)) p.removePotionEffect(PotionEffectType.WITHER);
				if (p.hasPotionEffect(PotionEffectType.SLOW)) p.removePotionEffect(PotionEffectType.SLOW);
				if (p.hasPotionEffect(PotionEffectType.SLOW_DIGGING)) p.removePotionEffect(PotionEffectType.SLOW_DIGGING);
				if (p.hasPotionEffect(PotionEffectType.WEAKNESS)) p.removePotionEffect(PotionEffectType.WEAKNESS);
				if (p.hasPotionEffect(PotionEffectType.CONFUSION)) p.removePotionEffect(PotionEffectType.CONFUSION);
				if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) p.removePotionEffect(PotionEffectType.BLINDNESS);
				p.setFireTicks(0);
			}
			else if (item.getType() == Material.POTION) {
				SlimefunItem sfItem = SlimefunItem.getByItem(item);
				if (sfItem != null && sfItem instanceof Juice) {
					int mode = 0;
					
					if (SlimefunManager.isItemSimiliar(item, p.getInventory().getItemInMainHand(), true)) {
						if (p.getInventory().getItemInMainHand().getAmount() == 1) {
							mode = 0;
						}
						else {
							mode = 2;
						}
					}
					else if (SlimefunManager.isItemSimiliar(item, p.getInventory().getItemInOffHand(), true)) {
						if (p.getInventory().getItemInOffHand().getAmount() == 1) {
							mode = 1;
						}
						else {
							mode = 2;
						}
					}
					
					final int m = mode;
					
					Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
						
						
		                @Override
		                public void run() {
		                    if (m == 0) {
		                    	p.getInventory().setItemInMainHand(null);
		                    }
		                    else if (m == 1) {
		                    	p.getInventory().setItemInOffHand(null);
		                    }
		                    else if (m == 2) {
		                    	p.getInventory().removeItem(new ItemStack(Material.GLASS_BOTTLE, 1));
		                    }
		                }
		                
		            }, 1L);
				}
			}
		}
		else e.setCancelled(true);
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:77,代码来源:ItemListener.java

示例13: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run() {
	for (final Player player : Bukkit.getOnlinePlayers()) {
		// Only affect survival and adventure mode players
		if (player.getGameMode() != GameMode.SURVIVAL && player.getGameMode() != GameMode.ADVENTURE) {
			continue;
		}

		// If the player has sunscreen
		if (settings.hasSunscreen(player)) {
			continue;
		}

		// Skip if disabled world.
		final World world = player.getWorld();
		if (settings.isDisabledWorld(world)) {
			continue;
		}

		// If it is raining.
		if (world.hasStorm() || world.isThundering()) {
			continue;
		}

		// If there is a block above them.
		final Location locHead = player.getLocation().add(0, 1, 0);
		final Location locFeet = player.getLocation();

		if (locHead.getY() <= world.getHighestBlockAt(locHead).getY()) {
			continue;
		}

		// If the player is in water
		final Block blockFeet = locFeet.getBlock();
		final Block blockHead = locHead.getBlock();
		if (blockFeet.getType() == Material.WATER || blockFeet.getType() == Material.STATIONARY_WATER
				|| blockHead.getType() == Material.WATER || blockHead.getType() == Material.STATIONARY_WATER) {
			continue;
		}

		// If the light level at the location isn't bright enough
		if (locHead.getBlock().getLightLevel() < 15 && locFeet.getBlock().getLightLevel() < 15) {
			continue;
		}

		// If the player is wearing a helmet.
		if (player.getInventory().getHelmet() != null
				&& player.getInventory().getHelmet().getType() != Material.AIR) {
			continue;
		}

		// Set the player on fire.
		player.setFireTicks(80);
	}
}
 
开发者ID:homiedion,项目名称:Sunscreen,代码行数:55,代码来源:PlayerCombustTask.java

示例14: customDeath

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void customDeath(EntityDamageByEntityEvent e){
	if(e.isCancelled())return;
	if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){
		Player p = (Player) e.getEntity();
		if(e.getFinalDamage() >= p.getHealth()){
			Player killer = (Player) e.getDamager();
			String uuid2 = killer.getUniqueId().toString();
			e.setCancelled(true);
			if(! p.getName().equals(killer.getName())){ // if they were killed by someone else, not themselves
				setTokens(uuid2, getTokens(uuid2)+2);
				killer.sendMessage(tag + ChatColor.BLUE + "You have received " + ChatColor.GOLD + "2" +
						ChatColor.BLUE + " tokens for killing " + p.getName());
			}
			Bukkit.getServer().broadcastMessage(ChatColor.GRAY + killer.getName() + " destroyed " + p.getName());
			// Set statistics
			//killer.setStatistic(Statistic.KILL_ENTITY, killer.getStatistic(Statistic.KILL_ENTITY) + 1);
			//p.setStatistic(Statistic.DEATHS, p.getStatistic(Statistic.DEATHS) + 1);
			// Reset health, so they dont die
			p.setHealth(p.getMaxHealth());
			// Inventory clearing
			p.getInventory().clear();
			ItemStack air = new ItemStack(Material.AIR);
			p.getInventory().setHelmet(air);
			p.getInventory().setChestplate(air);
			p.getInventory().setLeggings(air);
			p.getInventory().setBoots(air);
			// Drop emerald at death location
			ItemStack reward = new ItemStack(Material.EMERALD);
			p.getWorld().dropItemNaturally(p.getLocation(), reward);
			// Clear potion effects
			for(PotionEffect pe : p.getActivePotionEffects()){
				p.removePotionEffect(pe.getType());
			}
			// Stop infinite kill glitch
			p.setGameMode(GameMode.SPECTATOR);
			p.setGameMode(GameMode.ADVENTURE);
			// Send them to the SPAWN of the world
			p.teleport(p.getWorld().getSpawnLocation());
			p.setFireTicks(0);
		}
	}
}
 
开发者ID:OverloadedCore,项目名称:kaosEssentials,代码行数:44,代码来源:Core.java


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