本文整理汇总了Java中org.bukkit.Material.ELYTRA属性的典型用法代码示例。如果您正苦于以下问题:Java Material.ELYTRA属性的具体用法?Java Material.ELYTRA怎么用?Java Material.ELYTRA使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.ELYTRA属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerGlide
@EventHandler
public void onPlayerGlide(EntityToggleGlideEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!SamaGamesAPI.get().getPermissionsManager().hasPermission(event.getEntity(), "network.vipplus"))
if (((Player) event.getEntity()).isFlying() && ((Player) event.getEntity()).getInventory().getChestplate().getType() == Material.ELYTRA)
((Player) event.getEntity()).getInventory().setChestplate(null);
if (event.isGliding() && RestrictedVersion.isLoggedInPost19((Player) event.getEntity()))
{
ItemStack stack = new ItemStack(Material.FEATHER);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Ventilateur" + ChatColor.RESET + "" + ChatColor.GRAY + " (Clic-droit)");
stack.setItemMeta(meta);
stack.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
((Player) event.getEntity()).getInventory().setItem(3, stack);
}
else
{
((Player) event.getEntity()).getInventory().setItem(3, new ItemStack(Material.AIR));
}
}
示例2: onPlayerMove
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
if (!event.getPlayer().getLocation().subtract(0, 0.1, 0).getBlock().getType().equals(Material.AIR)
&& event.getPlayer().getInventory().getChestplate() != null
&& event.getPlayer().getInventory().getChestplate().getType() == Material.ELYTRA)
{
this.checkElytra(event.getPlayer());
}
if (this.hub.getCosmeticManager().getClothManager().isPreviewing(event.getPlayer()))
event.setCancelled(true);
this.hub.getTaskManager().getPlayersAwayFromKeyboardTask().resetPlayer(event.getPlayer().getUniqueId());
}
示例3: doInteraction
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()));
}
}
示例4: setInventoryToPlayer
public void setInventoryToPlayer(Player player)
{
for (int slot : this.items.keySet())
{
if (this.items.get(slot).getType() == Material.SKULL_ITEM)
{
SkullMeta meta = (SkullMeta) this.items.get(slot).getItemMeta();
meta.setOwner(player.getName());
this.items.get(slot).setItemMeta(meta);
}
player.getInventory().setItem(slot, this.items.get(slot));
}
if (RestrictedVersion.isLoggedInPost19(player))
{
if (SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "network.vipplus") && SamaGamesAPI.get().getSettingsManager().getSettings(player.getUniqueId()).isElytraActivated())
{
ItemStack itemStack;
if (player.getInventory().getChestplate() != null && player.getInventory().getChestplate().getType() == Material.ELYTRA)
{
itemStack = buildItemStack(Material.ELYTRA, 1, 0, createTitle("Désactiver les ailes"), null);
GlowEffect.addGlow(itemStack);
}
else
{
itemStack = buildItemStack(Material.ELYTRA, 1, 0, createTitle("Activer les ailes"), null);
}
player.getInventory().setItem(4, itemStack);
}
else
{
player.getInventory().setItem(4, new ItemStack(Material.AIR));
}
}
player.getInventory().setHeldItemSlot(0);
}
示例5: registerAbilities
/**
* Registers all the abilities
*/
private void registerAbilities() {
abilities = new ArrayList<>();
Ability ability;
// Haste
ability = new Ability("Haste", Material.GOLD_BOOTS, 10, 100);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE, ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Gives Haste Effect");
ability.addDescription(ChatColor.GRAY + "Haste Level: " + ChatColor.RED + "I");
abilities.add(ability);
// Poison
ability = new Ability("Poison", Material.BEETROOT, 15, 150);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE));
ability.addDescription(ChatColor.GRAY + "Poisons target enemy");
ability.addDescription(ChatColor.GRAY + "Poison Level: " + ChatColor.RED + "I");
ability.addDescription(ChatColor.GRAY + "Poison Duration: " + ChatColor.RED + "3 seconds");
abilities.add(ability);
// AoE (4 blocks)
ability = new Ability("AoE", Material.GOLD_PICKAXE, 20, 750);
ability.setItems(Arrays.asList(ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Destroys 4 blocks instead of 1");
abilities.add(ability);
// Magnet
ability = new Ability("Magnet", Material.DETECTOR_RAIL, 25, 250);
ability.setItems(Arrays.asList(ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Small chance to get crate key");
ability.addDescription(ChatColor.GRAY + "Chance: " + ChatColor.RED + "0.01%");
abilities.add(ability);
// Flame
ability = new Ability("Flame", Material.BLAZE_POWDER, 15, 750);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE));
ability.addDescription(ChatColor.GRAY + "Sets target on fire");
ability.addDescription(ChatColor.GRAY + "Fire Duration: " + ChatColor.RED + "3 seconds");
abilities.add(ability);
// High Jump
ability = new Ability("High Jump", Material.ELYTRA, 20, 200);
ability.setItems(Arrays.asList(ItemType.BOOTS, ItemType.LEGGINGS, ItemType.CHESTPLATE, ItemType.HELMET));
ability.addDescription(ChatColor.GRAY + "Jump 2 blocks high");
ability.addDescription(ChatColor.GRAY + "Jump Level: " + ChatColor.RED + "II");
abilities.add(ability);
// Speed
ability = new Ability("Speed", Material.FEATHER, 15, 150);
ability.setItems(Arrays.asList(ItemType.BOOTS, ItemType.LEGGINGS, ItemType.CHESTPLATE, ItemType.HELMET));
ability.addDescription(ChatColor.GRAY + "Gives speed boost");
ability.addDescription(ChatColor.GRAY + "Speed Level: " + ChatColor.RED + "I");
abilities.add(ability);
// Lucky Repair
ability = new Ability("Lucky Repair", Material.ANVIL, 25, 250);
ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE, ItemType.PICKAXE));
ability.addDescription(ChatColor.GRAY + "Small chance to repair item");
ability.addDescription(ChatColor.GRAY + "Chance: " + ChatColor.RED + "0.01%");
abilities.add(ability);
}