public static Inventory mainMenu() { Inventory i = Bukkit.createInventory(null, 54, Messager.color("&bMain Menu")); ItemStack pending = new ItemStack(Material.BARRIER); ItemMeta pendingMeta = pending.getItemMeta(); pendingMeta.setDisplayName(Messager.color("&cCurrent Ban Requests")); pendingMeta.setLore(Arrays.asList(Messager.color("&7Pending: " + Main.getPendingRequests()))); pending.setItemMeta(pendingMeta); i.setItem(20, pending); // Remove the archived ones for now. /** ItemStack archive = new ItemStack(Material.CHEST); ItemMeta archiveMeta = archive.getItemMeta(); archiveMeta.setDisplayName(Messager.color("&7Archived Requests")); archive.setItemMeta(archiveMeta); i.setItem(24, archive); **/ return i; }
public static boolean playerCanTakeBackpack(Player player) { if (BACKPACK_LIMIT == 0) { return true; } // Check vanilla inventory Inventory inventory = player.getInventory(); int count = 0; for (ItemStack item : inventory.getContents()) { if (isBackpack(item)) { count++; } } // Check RPGInventory slots inventory = InventoryManager.get(player).getInventory(); Slot backpackSlot = SlotManager.instance().getBackpackSlot(); if (BackpackManager.isBackpack(inventory.getItem(backpackSlot.getSlotId())) && !backpackSlot.isQuick()) { count++; } return count < BACKPACK_LIMIT; }
@Override public boolean isApplicableFor(Player player) { ItemStack helmet = player.getInventory().getHelmet(); if (helmet == null || helmet.getType() != Material.GOLD_HELMET) return false; ItemStack chestplate = player.getInventory().getChestplate(); if (chestplate == null || chestplate.getType() != Material.GOLD_CHESTPLATE) return false; ItemStack leggings = player.getInventory().getLeggings(); if (leggings == null || leggings.getType() != Material.GOLD_LEGGINGS) return false; ItemStack boots = player.getInventory().getBoots(); return !(boots == null || boots.getType() != Material.GOLD_BOOTS); }
private boolean hasEnoughRessource(Player player, VillagerTrade trade) { if (trade instanceof XPVillagerTrade) { return XPManager.hasEnoughXP(bedwars.getName(), player, ((XPVillagerTrade) trade).getXP()); } else { ItemStack item1 = trade.getItem1(); ItemStack item2 = trade.getItem2(); PlayerInventory inventory = player.getInventory(); if (item2 != null) { if ((!inventory.contains(item1.getType(), item1.getAmount())) || (!inventory.contains(item2.getType(), item2.getAmount()))) { return false; } } else if (!inventory.contains(item1.getType(), item1.getAmount())) { return false; } return true; } }
public static KillRewardModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException { ImmutableList.Builder<KillReward> rewards = ImmutableList.builder(); final ItemParser itemParser = context.needModule(ItemParser.class); final Optional<ItemModifyModule> itemModifier = context.module(ItemModifyModule.class); // Must allow top-level children for legacy support for(Element elKillReward : XMLUtils.flattenElements(doc.getRootElement(), ImmutableSet.of("kill-rewards"), ImmutableSet.of("kill-reward", "killreward"), 0)) { ImmutableList.Builder<ItemStack> items = ImmutableList.builder(); for(Element itemEl : elKillReward.getChildren("item")) { final ItemStack item = itemParser.parseItem(itemEl, false); itemModifier.ifPresent(imm -> imm.applyRules(item)); items.add(item.immutableCopy()); } Filter filter = context.needModule(FilterParser.class).property(elKillReward, "filter").optional(StaticFilter.ALLOW); Kit kit = context.needModule(KitParser.class).property(elKillReward, "kit").optional(KitNode.EMPTY); rewards.add(new KillReward(items.build(), filter, kit)); } ImmutableList<KillReward> list = rewards.build(); if(list.isEmpty()) { return null; } else { return new KillRewardModule(list); } }
/** * Give 64 bones, 64 rotten flesh and 64 wolf eggs to all the players * * @param game Game */ @Override public void onGameStart(SurvivalGame game) { ItemStack eggs = MojangShitUtils.getMonsterEgg(EntityType.WOLF); eggs.setAmount((int) this.moduleConfiguration.get("eggs")); for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values()) { Player p = player.getPlayerIfOnline(); if (p == null) continue; p.getInventory().addItem(new ItemStack(Material.BONE, (int) this.moduleConfiguration.get("bones"))); p.getInventory().addItem(new ItemStack(Material.ROTTEN_FLESH, (int) this.moduleConfiguration.get("rotten-flesh"))); p.getInventory().addItem(eggs); } }
/** * Checks if the proferred item is a gun. * * @param toCheck the item to check if this gun * @return true if gun, false otherwise */ @Override public boolean isGun(ItemStack toCheck) { if (!enabled || toCheck == null) return false; if (!gunExample.getType().equals(toCheck.getType())) return false; if (!toCheck.hasItemMeta()) return false; ItemMeta meta = toCheck.getItemMeta(); if (meta.hasLore() && meta.getLore().contains(tag)) return true; return false; }
@EventHandler public void onDeath(PlayerDeathEvent event) { Player player = event.getEntity(); PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player); if (profile.getStatus() != PlayerStatus.PLAYING) { return; } player.spigot().respawn(); IMatch match = profile.getCurrentMatch(); match.handleDeath(player, player.getLocation(), ChatColor.RED + player.getName() + ChatColor.GRAY + " has been slain."); event.setDeathMessage(null); player.setHealth(20.0); for (ItemStack i : event.getDrops()) { i.setType(Material.AIR); } }
@Nullable @Override protected Number[] get(Event e) { ItemStack i = item.getSingle(e); if (i == null) { return null; } if (PotionUtils.isPotionItem(i)) { PotionMeta meta = (PotionMeta) i.getItemMeta(); PotionEffect eff = PotionUtils.getEffectByEffectType(meta, effectType.getSingle(e)); if (eff == null) { return null; } return new Number[]{eff.getAmplifier()}; } return null; }
public ItemStack[] loadContent() { TribeFile.createConfig(getName()); if(TribeFile.getChest() != null) { List<?> list = TribeFile.getChest(); ItemStack[] turinys = new ItemStack[list.size()]; for (int i = 0; i < list.size(); i++) { Object o = list.get(i); if (o instanceof ItemStack) { turinys[i] = (ItemStack) o; } else { turinys[i] = new ItemStack(Material.AIR); } } return turinys; } return new ItemStack[0]; }
public static void syncInfoSlots(PlayerWrapper playerWrapper) { final Player player = (Player) playerWrapper.getPlayer(); for (Slot infoSlot : SlotManager.instance().getInfoSlots()) { ItemStack cup = infoSlot.getCup(); ItemMeta meta = cup.getItemMeta(); List<String> lore = meta.getLore(); for (int i = 0; i < lore.size(); i++) { String line = lore.get(i); lore.set(i, StringUtils.setPlaceholders(player, line)); } meta.setLore(lore); cup.setItemMeta(meta); playerWrapper.getInventory().setItem(infoSlot.getSlotId(), cup); } player.updateInventory(); }
private void setLayout(Inventory inv) { String title = getData().title(); int size = getData().size(); int lastLineFirstIndex = size - 9; ItemStack wall = new ItemBuilder(Material.STAINED_GLASS) .display("") .build(); for (int i = 0; i < 9; i++) { inv.setItem(i, wall); } for (int i = lastLineFirstIndex; i < size; i++) { inv.setItem(i, wall); } inv.setItem(4, new ItemBuilder(Material.NETHER_STAR).display(title).build()); inv.setItem(prevPageBtnIndex, new ItemBuilder(Material.WOOD_BUTTON).build()); inv.setItem(nextPageBtnIndex, new ItemBuilder(Material.WOOD_BUTTON).build()); }
@Override public ArrayList<ItemStack> contains(){ ArrayList<ItemStack> items = new ArrayList<>(); switch (getCrateType()){ case NORMAL: items.add(new ItemMaker(Material.APPLE).setDisplayName("An apple a day keeps the doctor away").setAmount(7).build()); items.add(new ItemMaker(Material.BOAT).build()); items.add(new ItemMaker(Material.IRON_BLOCK).build()); break; case EPICA: break; case LEGENDARIA: break; } return items; }
public LobbySelector(WCLobby instance){ gameSelector = iu.createInventory(9, "&cServidores"); ItemStack glass = ItemUtils.coloredBlock(DyeColor.ORANGE, "&cWorld&8Crafteros", ItemUtils.ColoredBlock.FLAT_GLASS); //Glass for (int x = 1; x < 8; x++){ gameSelector = iu.setItem(gameSelector, x + 9, glass); gameSelector = iu.setItem(gameSelector, x + (9 * 4), glass); } gameSelector = iu.setItem(gameSelector, 18, glass); gameSelector = iu.setItem(gameSelector, 27, glass); gameSelector = iu.setItem(gameSelector, 26, glass); gameSelector = iu.setItem(gameSelector, 35, glass); // }
@EventHandler public void on(PlayerDropItemEvent event) { ItemStack item = event.getItemDrop().getItemStack(); if (item == null) { return; } if (!item.hasItemMeta() || !item.getItemMeta().hasDisplayName()) { return; } String name = item.getItemMeta().getDisplayName(); if (name.equals("§4§lBlocked Slot")) { event.setCancelled(true); } }
public ArmorPose(ArmorStand a) { this(a.getHeadPose(), a.getBodyPose(), a.getLeftArmPose(), a.getRightArmPose(), a.getLeftLegPose(), a.getRightLegPose(), new JsonMap<>()); for (EquipmentSlot slot : EquipmentSlot.values()) { // Save gear. ItemStack i = Utils.getItem(a, slot); if (!Utils.isAir(i)) getGear().put(slot.name(), i); } }
@Nullable @Override protected Pattern[] get(Event e) { ItemStack i = item.getSingle(e); if (i == null) { return null; } if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) { return ((BannerMeta) i.getItemMeta()).getPatterns().stream().toArray(Pattern[]::new); } return null; }
public void start(Player player, Rune rune) { startEffect(player, rune); setActiveRune(player, rune); switch(rune.getName()) { case "Freeze": handleFreeze(player, rune); return; case "Fire Storm": handleFireStorm(player, rune); break; case "Slowdown": handleSlowdown(player, rune); break; case "Invisibility": handleInvisibility(player, rune); break; case "Lightning": handleLightning(player, rune); break; case "Detonate": handleDetonate(player, rune); break; default: return; } player.getInventory().setItemInMainHand(new ItemStack(Material.AIR)); player.sendMessage(Lang.HEADERS_TOKENS.toString() + Lang.TOKENS_RUNE_APPLY.toString() .replaceAll("%s", rune.getName())); }
public FireCraftTableRecipe(int time, double temperature, int maxTime, String name, List<String> shape, HashMap<Character, ItemStack> materials, ItemStack[] product) { super(); this.time = time; this.temperature = temperature; this.maxTime = maxTime; this.name = name; this.shape = shape; this.materials = materials; this.product = product; }
static void savePlayer(PlayerWrapper playerWrapper, Path file) throws IOException { List<NbtCompound> slotList = new ArrayList<>(); try (DataOutputStream dataOutput = new DataOutputStream(new GZIPOutputStream(Files.newOutputStream(file)))) { for (Slot slot : SlotManager.instance().getSlots()) { if (slot.getSlotType() == Slot.SlotType.ARMOR) { continue; } List<NbtCompound> itemList = new ArrayList<>(); List<Integer> slotIds = slot.getSlotIds(); Inventory inventory = playerWrapper.getInventory(); for (int i = 0; i < slotIds.size(); i++) { int slotId = slotIds.get(i); ItemStack itemStack = inventory.getItem(slotId); if (!ItemUtils.isEmpty(itemStack) && !slot.isCup(itemStack)) { itemList.add(ItemUtils.itemStackToNBT(itemStack, i + "")); } } if (itemList.size() > 0 || playerWrapper.isBuyedSlot(slot.getName())) { NbtCompound slotNbt = NbtFactory.ofCompound(slot.getName()); slotNbt.put("type", slot.getSlotType().name()); if (playerWrapper.isBuyedSlot(slot.getName())) { slotNbt.put("buyed", "true"); } slotNbt.put(NbtFactory.ofCompound("items", itemList)); slotList.add(slotNbt); } } NbtCompound playerNbt = NbtFactory.ofCompound("Inventory"); playerNbt.put(NbtFactory.ofCompound("slots", slotList)); playerNbt.put("buyed-slots", playerWrapper.getBuyedGenericSlots()); NbtBinarySerializer.DEFAULT.serialize(playerNbt, dataOutput); } }
/** * Create an item to represent this punishment * @return item */ public ItemStack getItem() { return ItemManager.createItem(isValid() ? getType().getIcon() : Material.BARRIER, getType().getDisplay(), "Source: " + ChatColor.WHITE + getSource(), "Date: " + ChatColor.WHITE + new Date(timestamp).toString(), "Click here to " + (isValid() ? "in" : "") + "validate this punishment."); }
public ItemRequest(Location terminal, int slot, ItemStack item, ItemTransportFlow flow) { this.terminal = terminal; this.item = item; this.slot = slot; this.flow = flow; }
public static void loadInventory(Player p) { p.getInventory().clear(); p.getInventory().setContents((ItemStack[])inventoryContents.get(p.getName())); p.getInventory().setArmorContents((ItemStack[])armorContents.get(p.getName())); p.setLevel(((Integer)xplevel.get(p.getName())).intValue()); inventoryContents.remove(p.getName()); armorContents.remove(p.getName()); xplevel.remove(p.getName()); }
public GameVotingRunnable() { this.api = Arcadia.getPlugin(Arcadia.class).getAPI(); api.getGameManager().getMainBossBar().setColor(BarColor.YELLOW); List<Class<? extends BaseGame>> temp = api.getGameRegistry().getRegisteredGames(); List<String> allowedGames = api.getPlugin().mainConfiguration.fetch().getStringList("games-in-voting"); Iterator<Class<? extends BaseGame>> iterator = temp.iterator(); while(iterator.hasNext()) { Class<? extends BaseGame> next = iterator.next(); if(!allowedGames.contains(next.getName())) iterator.remove(); } Collections.shuffle(temp); int slot = 2; for(int i=0; i<5; i++) { if(i < temp.size()) { slots.put(slot, temp.get(i)); slot++; } } Bukkit.getOnlinePlayers().forEach(player -> { for(int i=0; i<9; i++) { Utils.setSpacer(player, i); } int s = 2; for(Class<? extends BaseGame> key : slots.values()) { final VotingData votingData = api.getGameRegistry().getVotingData(key); ItemStack itemStack = new ItemStack(votingData.getMaterialData().getItemType(), 1, votingData.getMaterialData().getData()); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&b&l" + votingData.getGameName())); itemStack.setItemMeta(itemMeta); player.getInventory().setItem(s, itemStack); s++; } }); api.getPlugin().getServer().getPluginManager().registerEvents(this, api.getPlugin()); this.runTaskTimer(Arcadia.getPlugin(Arcadia.class), 0, 20L); }
public void addLore(int ID, int DATA, int STACK, List<String> Lore, CommandSender sender) { try { Integer.parseInt(String.valueOf(tempStr)); ItemStack itemStack = new MaterialData(ID, (byte) DATA).toItemStack(STACK); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setLore(Lore); } catch (NumberFormatException e) { sender.sendMessage("§c[ §4§l! §c] §3§l줄 수§7를 입력해주세요."); return; } }
/** * Give strength on spinash use * @param event Event */ @EventHandler public void onInteract(PlayerInteractEvent event) { if (event.getItem() != null && event.getItem().isSimilar(this.spinash)) { event.getPlayer().addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(this.bonusTime * 20, 1)); event.getPlayer().setItemInHand(new ItemStack(Material.AIR)); event.setCancelled(true); } }
public void onItemDrop(PlayerDropItemEvent e) { if(Variables.backpack.containsKey(e.getPlayer().getUniqueId())) { ItemStack item = e.getItemDrop().getItemStack(); SlimefunItem sfItem = SlimefunItem.getByItem(item); if(sfItem instanceof SlimefunBackpack) e.setCancelled(true); } }
@EventHandler public void onMyPetItemUse(PlayerInteractEvent event) { if (event.getItem() != null) { Player player = event.getPlayer(); if (!InventoryManager.playerIsLoaded(player)) { return; } Inventory inventory = InventoryManager.get(player).getInventory(); if (isMyPetItem(event.getItem()) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)) { Slot petSlot = getMyPetSlot(); ItemStack currentPet = inventory.getItem(petSlot.getSlotId()); boolean hasPet = !petSlot.isCup(currentPet); ItemStack newPet = event.getItem(); if (!hasPet) { currentPet = null; } player.getEquipment().setItemInMainHand(currentPet); inventory.setItem(petSlot.getSlotId(), newPet); swapMyPets(player, hasPet, newPet); } } }
public static Inventory resetSF(ItemStack itemKey){ WorkbenchRecipe sf=rs.getSF(itemKey.getItemMeta().getDisplayName().split(":")[0]); Inventory inv=createDefaultGUI(rs.getWorkbenchItems()[7]+"*"); inv.setItem(0, itemKey); inv.setItem(49, Items.createPItem((short) 14, "��b��l==>��c��l�����b��l<==")); return sf.setInv(inv); }
public PlayerListener(Main plugin) { diamondMiner = new HashMap<String, Boolean>(); speedMiner = new HashMap<String, ItemStack>(); rainbowMiner = new HashMap<String, ItemStack>(); randomGen = new Random(); this.plugin = plugin; }
@SuppressWarnings("unchecked") public ArrayList<CraftArray> getCrafts(){ ArrayList<CraftArray> craftlist = new ArrayList<CraftArray>(); try { File craftfile = new File(plugin.getDataFolder(), "crafts.yml"); craftfile.createNewFile(); FileConfiguration craftconfig = YamlConfiguration.loadConfiguration(craftfile); if(craftconfig.isSet("Crafts")) { for(String craftpath : craftconfig.getConfigurationSection("Crafts").getKeys(false)) { craftpath = "Crafts." + craftpath; ArrayList<ItemStack> config_craft = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".craft"); ArrayList<ItemStack> config_resultitems = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".result.items"); ArrayList<Integer> config_resultprobs = (ArrayList<Integer>) craftconfig.getIntegerList(craftpath + ".result.probs"); HashMap<ItemStack,Integer> config_result = new HashMap<ItemStack, Integer>(); for(ItemStack resultitem : config_resultitems) { config_result.put(resultitem, config_resultprobs.get(config_resultitems.indexOf(resultitem))); } ArrayList<String> config_cmds = (ArrayList<String>) craftconfig.getStringList(craftpath + ".cmds"); boolean config_redstonepower = craftconfig.getBoolean(craftpath + ".redstonepower"); int config_experience = craftconfig.getInt(craftpath + ".experience"); CraftArray specraft = new CraftArray(config_craft, config_result, config_cmds, config_redstonepower, config_experience); craftlist.add(specraft); } return craftlist; } else { return craftlist; } } catch (Exception e) { e.printStackTrace(); return craftlist; } }
private ItemStack encrypted(ItemStack itemStack, String textToEncrypt) { final ItemMeta itemMeta = itemStack.getItemMeta(); final List<String> lore = itemMeta.getLore() != null ? itemMeta.getLore() : new ArrayList<String>(); lore.add(encrypted(textToEncrypt)); itemMeta.setLore(lore); final ItemStack encryptedItemStack = itemStack.clone(); encryptedItemStack.setItemMeta(itemMeta); return encryptedItemStack; }
/** * Force open a book for the given player. * @param player * @param book */ public static void openBook(Player player, ItemStack book) { ItemStack saved = player.getEquipment().getItemInMainHand(); player.getEquipment().setItemInMainHand(book); // Change hand item to book. PacketDataSerializer pds = new PacketDataSerializer(Unpooled.buffer()); pds.a(EnumHand.MAIN_HAND); sendPacket(player, new PacketPlayOutCustomPayload("MC|BOpen", pds)); player.getEquipment().setItemInMainHand(saved); // Restore hand item. }
@EventHandler public void onDrop(ItemSpawnEvent event) { if(event.isCancelled()) return; final Item itemDrop = event.getEntity(); if(itemDrop.getItemStack().getType() == Material.BOWL) { final Runnable task = new Runnable() { public void run() { if(itemDrop.getItemStack().getAmount() != 1) return; Location itemLocation = itemDrop.getLocation(); if(itemLocation.getBlock().getType() == Material.WATER || itemLocation.getBlock().getType() == Material.STATIONARY_WATER) { itemDrop.remove(); ItemStack i_beetroot = new ItemStack(Material.BEETROOT_SOUP, 1); ItemMeta beetrootMeta= i_beetroot.getItemMeta(); beetrootMeta.setDisplayName(ChatColor.RESET + Survival.instance.Words.get("Water Bowl")); i_beetroot.setItemMeta(beetrootMeta); itemDrop.getWorld().dropItem(itemLocation, i_beetroot); } } }; Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, task, 20L); } }
public static ItemStack rename(ItemStack i, String name) { ItemMeta meta = i.getItemMeta(); meta.setDisplayName(name); i.setItemMeta(meta); return i; }
public static ItemStack toPetItem(ItemStack item) { List<String> itemLore = item.getItemMeta().getLore(); for (PetType petType : PETS.values()) { List<String> petItemLore = petType.getSpawnItem().getItemMeta().getLore(); if (itemLore.equals(petItemLore)) { return petType.getSpawnItem(); } } return item; }
public ItemStacks(ItemStack sta){ meta = new DefaultMeta(sta.getItemMeta()); id = sta.getTypeId(); durability = sta.getDurability(); amount = sta.getAmount(); array = new EnchantArray(sta); }
@Command(label = "bind", description = "Binds a spell to a wand in your hand", usage = "/bind <spell> <left|right>") @Arguments(args = { @Argument(label = "spell", type = ArgumentType.STRING, required = true), @Argument(label = "hand", type = ArgumentType.OPTION, required = true, options = { "left", "right" }) }) public static boolean bindSpellCommand(CommandContext ctx) { if (!ctx.isPlayer()) { ctx.getSender().sendMessage(ChatColor.RED + "Only in-game players can bind spells"); return true; } String spell = ctx.getParamater("spell").toString().toLowerCase(); Caster caster = MystiCraft.getCasterManager().getCaster(ctx.getPlayer()); if (MystiCraft.getSpellManager().getSpell(spell) != null && caster.getKnowledge().isSpellKnown(spell)) { ItemStack item = null; Wand wand = null; if (ctx.getParamater("hand").equals("right")) { item = ctx.getPlayer().getInventory().getItemInMainHand(); } else if (ctx.getParamater("hand").equals("left")) { item = ctx.getPlayer().getInventory().getItemInOffHand(); } if ((wand = MystiCraft.getWandManager().getWand(item)) != null) { wand.bind(item, spell); } else { ctx.getPlayer().sendMessage(ChatColor.RED + "The item in your " + ctx.getParamater("hand") + " hand is not a wand"); } } else { ctx.getPlayer().sendMessage(ChatColor.RED + "You do not know " + spell); } return true; }
private List<ArmorStandData> createIceASD() { List<ArmorStandData> asds = new ArrayList<>(); ItemStack block = ITEM_ICE_BLOCK; asds.add(new ArmorStandData(new RelLoc(0.05f + 1.3f, -1.3f, 0.5f - 0.25f), new Vector(1, 0, 1), false, null, ITEM_BLAZE, new Vector(0f, 0f, 0f), new Vector(-10f, 90f, 90f))); asds.add(new ArmorStandData(new RelLoc(0.05f + 0.8f, -1.3f, 0.5f - 0.75f), new Vector(1, 0, 1), false, null, ITEM_BLAZE, new Vector(0f, 0f, 0f), new Vector(-10f, 90f, 90f))); asds.add(new ArmorStandData(new RelLoc(0.05f + 1.2f, -1.3f, 0.5f + 0.4f), new Vector(-1, 0, 1), false, null, ITEM_BLAZE, new Vector(0f, 0f, 0f), new Vector(-10f, 90f, 90f))); asds.add(new ArmorStandData(new RelLoc(0.05f + 0.74f, -1.3f, 0.5f + 0.84f), new Vector(-1, 0, 1), false, null, ITEM_BLAZE, new Vector(0f, 0f, 0f), new Vector(-10f, 90f, 90f))); asds.add(new ArmorStandData(new RelLoc(0.5f, -0.675f, 0.5f), new Vector(1, 0, 0), true, block, null, new Vector(0f, 0f, 0f), new Vector(0f, 0f, 0f))); asds.add(new ArmorStandData(new RelLoc(0.5f, -0.175f, 0.5f), new Vector(1, 0, 0), true, block, null, new Vector(0f, 0f, 0f), new Vector(0f, 0f, 0f))); return asds; }
@EventHandler public void onRuneUse(PlayerInteractEvent event) { if(!(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK))) { return; } if(event.getHand() == null || !event.getHand().equals(EquipmentSlot.HAND)) { return; } ItemStack item = event.getPlayer().getInventory().getItemInMainHand(); if(item == null || item.getItemMeta() == null || !item.getType().equals(Material.ENCHANTED_BOOK)) { return; } Player player = event.getPlayer(); Rune rune = plugin.getRuneManager().getRune(item.getItemMeta().getDisplayName().substring(2)); if(rune == null) { return; } event.setCancelled(true); if(plugin.getRuneManager().hasActiveRune(player)) { player.sendMessage(Lang.HEADERS_TOKENS.toString() + Lang.TOKENS_RUNE_ALREADY_ACTIVE.toString()); return; } if(Cooldowns.getCooldown(player, "rune") > 0) { player.sendMessage(Lang.HEADERS_TOKENS.toString() + Lang.TOKENS_RUNE_COOLDOWN.toString() .replaceAll("%d", Convert.timeToString((int) (Cooldowns.getCooldown(player, "rune") / 1000)))); return; } plugin.getRuneManager().start(player, rune); }