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


Java Player.isSleeping方法代码示例

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


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

示例1: checkNoFall

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void checkNoFall(Player player) {
    if(player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping() && !Utilities.isInWater(player) && !Utilities.isInWeb(player) && !isMovingExempt
            (player)) {
        if(player.getFallDistance() == 0) {
            if(nofallViolation.get(player) == null) {
                nofallViolation.put(player,1);
            } else {
                nofallViolation.put(player, nofallViolation.get(player) + 1);
            }

            int i = nofallViolation.get(player);
            if(i >= MagicNumbers.NOFALL_LIMIT) {
                for(Player pla : DynamicAC.instance.onlinestaff) {
                    pla.sendMessage(DynamicAC.prefix + player.getName() + " failed No Fall!");
                }
                DACManager.getUserManager().incrementUser(DACManager.getUserManager().getUser(player.getName()),
                        "No Fall");
            }
        } else {
            nofallViolation.put(player,0);
        }
    }
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:24,代码来源:BackendChecks.java

示例2: call

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void call(Event event) {
	if (event instanceof InventoryClickEvent) {
		// The player has clicked.

		final Player player = profile.getPlayer();

		if (player.isSprinting() || player.isSneaking() || player.isBlocking() || player.isSleeping()
				|| player.isConversing()) {
			// The player has clicked in their inventory impossibly.
			callback(true);
		}
	}
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:15,代码来源:InventoryTweaksA.java

示例3: call

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void call(Event event) {
	if (event instanceof PlayerMoveEvent) {
		final PlayerMoveEvent pme = (PlayerMoveEvent) event;

		final Player player = profile.getPlayer();

		/*
		 * Players cannot take fall damage when in creative or spectator
		 * mode.
		 */
		if (!profile.getBehaviour().isInCreativeOrSpectator()) {

			final Material from = pme.getFrom().getBlock().getRelative(BlockFace.DOWN).getType();
			final Material to = pme.getTo().getBlock().getRelative(BlockFace.DOWN).getType();

			final double fallDistance = profile.getBehaviour().getMotion().getFallDistance();

			if (fallDistance < 4.0) {
				/*
				 * The player has not fallen enough distance to take fall
				 * damage.
				 */
				return;
			}

			// The player has fallen far enough to take damage.

			final Behaviour behaviour = profile.getBehaviour();

			// Check if player has moved from air to ground.
			if (from == Material.AIR && to != Material.AIR) {

				if (!behaviour.isInWater() && !behaviour.isInWeb() && !player.isInsideVehicle()
						&& !player.isSleeping()) {

					/*
					 * Their expected health cannot be higher than their
					 * maximum allowed health and cannot be lower then zero.
					 */
					final double expected = Math
							.max(Math.min(player.getHealth() - getExpectedDamage(profile, fallDistance),
									player.getMaxHealth()), 0.0);

					/*
					 * Check a bit later if their health is higher than it
					 * is expected to be.
					 */
					Bukkit.getScheduler().runTaskLater(Crescent.getInstance(), () -> {
						callback(!fallCancelled && player.getHealth() > expected);
					}, 5L);

				}
			}
		}
	} else if (event instanceof EntityDamageEvent) {
		final EntityDamageEvent ede = (EntityDamageEvent) event;

		fallCancelled = ede.getCause() == DamageCause.FALL && ede.isCancelled();
	}
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:62,代码来源:NoFallA.java


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