本文整理汇总了Java中org.bukkit.entity.Player.isGliding方法的典型用法代码示例。如果您正苦于以下问题:Java Player.isGliding方法的具体用法?Java Player.isGliding怎么用?Java Player.isGliding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.isGliding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: click
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void click(Player p, boolean left) {
if (p.isGliding())
return;
if (!casters.containsKey(p.getUniqueId()))
casters.put(p.getUniqueId(), new Caster());
PlayerDataRPG pd = plugin.getPD(p);
ItemStack item = p.getEquipment().getItemInMainHand();
boolean spellWep = false;
if (item != null)
spellWep = isSpellWeapon(item);
if (pd != null) {
if (lastPress.containsKey(p.getUniqueId())) {
if (System.currentTimeMillis() - lastPress.get(p.getUniqueId()) < 50)
return;
}
lastPress.put(p.getUniqueId(), System.currentTimeMillis());
final Caster c = casters.get(p.getUniqueId());
if (spellWep) {
c.press(left);
} else {
c.clear();
}
checkState(p, pd, c);
}
}
示例2: onPlayerFall
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onPlayerFall(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.playerIsLoaded(player) || player.isFlying()
|| player.getVehicle() != null) {
return;
}
PlayerWrapper playerWrapper = InventoryManager.get(player);
boolean endFalling = false;
if (!player.isOnGround()) {
if (playerIsSneakOnLadder(player) || isPlayerCanFall(player)) {
playerWrapper.onFall();
} else if (!player.isGliding()) {
endFalling = true;
}
} else if (playerWrapper.isFalling()) {
endFalling = true;
}
if (endFalling) {
playerWrapper.setFalling(false);
}
}
示例3: isImmune
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Is the player in a state or situation that we should deem them not flying?
* @param player
* @return immune
*/
private static boolean isImmune(Player player) {
return player.getGameMode() != GameMode.SURVIVAL
|| Utils.getRank(player).isAtLeast(EnumRank.MEDIA) // Don't bypass this check.
|| player.isGliding() // Not using Elytra
|| player.hasPotionEffect(PotionEffectType.LEVITATION) // Doesn't have a levitation potion
|| player.getVehicle() != null // Not in a vehicle
|| player.getVelocity().getY() > 0 // Not being launched up
|| player.getNearbyEntities(1, 2, 1).stream().anyMatch(e -> e.getType() == EntityType.BOAT) // Not standing on a boat.
|| player.getLocation().getBlock().isLiquid(); // Not in water.
}
示例4: doInteraction
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void doInteraction(Player player, ItemStack stack)
{
if (stack.getType() == Material.COMPASS)
{
this.hub.getGuiManager().openGui(player, new GuiMain(this.hub));
}
else if (stack.getType() == Material.SKULL_ITEM)
{
this.hub.getGuiManager().openGui(player, new GuiProfile(this.hub));
}
else if (stack.getType() == Material.ENDER_CHEST)
{
this.hub.getGuiManager().openGui(player, new GuiCosmetics(this.hub));
}
else if (stack.getType() == Material.GOLD_INGOT)
{
this.hub.getGuiManager().openGui(player, new GuiShop(this.hub));
}
else if (stack.getType() == Material.BARRIER && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
{
this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).quitPlayer(player);
}
else if (stack.getType() == Material.ENDER_PEARL && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
{
this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).failPlayer(player);
}
else if (player.getInventory().getHeldItemSlot() == 6)
{
this.hub.getServer().getScheduler().runTask(this.hub, () -> this.hub.getCosmeticManager().getGadgetManager().useSelectedCosmetic(player, stack));
}
else if (stack.getType() == Material.ELYTRA)
{
if (stack.getEnchantments().isEmpty())
{
ItemStack elytra = new ItemStack(Material.ELYTRA);
ItemMeta meta = elytra.getItemMeta();
meta.spigot().setUnbreakable(true);
elytra.setItemMeta(meta);
player.getInventory().setChestplate(elytra);
this.setInventoryToPlayer(player);
}
else
{
player.getInventory().setChestplate(null);
this.setInventoryToPlayer(player);
}
player.playSound(player.getLocation(), Sound.ENTITY_HORSE_SADDLE, 1F, 1F);
}
else if (stack.getType() == Material.FEATHER && player.isGliding() && player.getVelocity().lengthSquared() != 0)
{
if (!SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "network.vip"))
{
player.sendMessage(ChatColor.RED + "Devenez VIP pour utiliser le booster.");
return;
}
Vector velocity = player.getVelocity().add(player.getLocation().getDirection().normalize().multiply(1.5D));
((CraftPlayer)player).getHandle().motX = velocity.getX();
((CraftPlayer)player).getHandle().motY = velocity.getY();
((CraftPlayer)player).getHandle().motZ = velocity.getZ();
((CraftPlayer)player).getHandle().velocityChanged = true;
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 2F, 2F);
this.hub.getServer().getScheduler().runTask(this.hub, () -> SamaGamesAPI.get().getAchievementManager().getAchievementByID(5).unlock(player.getUniqueId()));
}
}