本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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();
}
}