Java Code Examples for org.bukkit.Material#STICK
The following examples show how to use
org.bukkit.Material#STICK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoDrier.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
private ItemStack getOutput(ItemStack item) { for (int i = 0; i < recipeList.size(); i += 2) { if (SlimefunUtils.isItemSimilar(item, recipeList.get(i), true)) { return recipeList.get(i + 1); } } if (Tag.SAPLINGS.isTagged(item.getType())) { return new ItemStack(Material.STICK, 2); } else if (Tag.LEAVES.isTagged(item.getType())) { return new ItemStack(Material.STICK, 1); } else if (item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION) { return new ItemStack(Material.GLASS_BOTTLE); } return null; }
Example 2
Source File: TNTCannon.java From Civs with GNU General Public License v3.0 | 5 votes |
@Override public boolean createRegionHandler(Block block, Player player, RegionType regionType) { Location location = block.getLocation(); ItemStack controllerWand = new ItemStack(Material.STICK, 1); ItemMeta im = controllerWand.getItemMeta(); im.setDisplayName("Cannon Controller " + Region.locationToString(location)); controllerWand.setItemMeta(im); location.getWorld().dropItemNaturally(block.getRelative(BlockFace.UP, 2).getLocation(), controllerWand); return true; }
Example 3
Source File: TropicalGeneratorTool.java From NBTEditor with GNU General Public License v3.0 | 5 votes |
public TropicalGeneratorTool() { super("tropical-generator", ChatColor.AQUA + "Tropical Fish Generator", Material.STICK); setLore(ChatColor.YELLOW + "Left-click to spawn tropical fish at the cursor position.", ChatColor.YELLOW + "Right-click to spawn tropical fish here."); setDefaultConfig("count", _count); setDefaultConfig("drop-items", _dropItems); }
Example 4
Source File: BlockClickEvent.java From WildernessTp with MIT License | 4 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockClick(PlayerInteractEvent e) { String[] tmp = Bukkit.getVersion().split("MC: "); String version = tmp[tmp.length - 1].substring(0, 3); if (e.getItem() == null) return; if (!e.getItem().hasItemMeta()) return; if (e.getAction().equals(Action.LEFT_CLICK_BLOCK) && e.getItem().getItemMeta().hasLore()) { if (e.getItem().getItemMeta().getLore().equals(Collections.singletonList("Right/left click on blocks to make a region")) && !checkFirstMap(e.getPlayer().getUniqueId(), e.getClickedBlock().getLocation().toVector())) { e.setCancelled(true); wild.firstCorner.put(e.getPlayer().getUniqueId(), e.getClickedBlock().getLocation().toVector()); e.getPlayer().sendMessage(ChatColor.GREEN + "First corner set"); } } else if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { ItemStack stack = new ItemStack(Material.STICK); if (version.equals("1.9") || version.equals("1.1")) { if (e.getPlayer().getInventory().getItemInMainHand() != null) stack = e.getPlayer().getInventory().getItemInMainHand(); else return; } else { //noinspection deprecation if (e.getPlayer().getItemInHand() != null) //noinspection deprecation stack = e.getPlayer().getItemInHand(); else return; } if (!stack.hasItemMeta()) return; if (!stack.getItemMeta().hasLore()) return; if (!stack.getItemMeta().getLore().equals(Collections.singletonList("Right/left click on blocks to make a region"))) return; if (checkSecondMap(e.getPlayer().getUniqueId(), e.getClickedBlock().getLocation().toVector())) return; e.setCancelled(true); wild.secondCorner.put(e.getPlayer().getUniqueId(), e.getClickedBlock().getLocation().toVector()); e.getPlayer().sendMessage(ChatColor.GREEN + "Second corner set"); } }
Example 5
Source File: GUIManager.java From Statz with GNU General Public License v3.0 | 4 votes |
/** * Show a GUI for a specific statistic. * * @param inventoryViewer Player that the GUI should be shown to. * @param targetUUID UUID of the player we should show the statistics for. If null, the uuid of the * player parameter will be used. * @param statistic Statistic that should be shown. */ public void showSpecificStatisticInventory(Player inventoryViewer, UUID targetUUID, String targetPlayerName, PlayerStat statistic) { PaginatedGUI menu = new PaginatedGUI(this.inventoryTitle + targetPlayerName); PlayerInfo data = plugin.getDataManager().getPlayerInfo(targetUUID, statistic); if (data == null) { data = plugin.getDataManager().loadPlayerData(targetUUID); } List<Query> results = data.getRows(); int count = 0; List<PlayerStat> statistics = data.getStatistics(); // Sort so we always have the same order. statistics.sort(Comparator.comparing(Enum::toString)); for (Query query : results) { // Skip Players statistic if (query == null) { continue; } // Get icon of this stat type Material iconMaterial = this.getIconMaterialForSpecificStatistic(query, statistic); // Set default icon if none was defined. if (iconMaterial == null) iconMaterial = Material.STICK; // Find display name of this item. String displayName = plugin.getStatisticDescriptionConfig().getHumanFriendlyTitle(statistic); // Create a list of messages shown when hovering over the item List<String> messages = new ArrayList<>(); String highDetailDescription = ChatColor.stripColor(DescriptionMatcher.getHighDetailDescription(query, statistic)); if (highDetailDescription != null) { messages.addAll(fitTextToScreen(highDetailDescription)); } if (statistic != PlayerStat.JOINS && statistic != PlayerStat.VOTES) { messages.add(""); messages.add(ChatColor.RED + "Click me to go back!"); } // Create an itemstack to show in the inventory GUIButton button = new GUIButton( ItemBuilder.start(iconMaterial).name(displayName).lore(messages).build() ); // Add a listener to each button. button.setListener(event -> { // When a button has been pressed, don't give them the item. event.setCancelled(true); // Send them back to the general overview. this.showStatisticsOverviewInventory(inventoryViewer, targetUUID, targetPlayerName); }); int position = 1 + 2 * (count % 4) + 9 * (count / 4); menu.setButton(position, button); count++; } this.showInventory(inventoryViewer, menu.getInventory()); }
Example 6
Source File: EntityInspectorTool.java From NBTEditor with GNU General Public License v3.0 | 4 votes |
public EntityInspectorTool() { super("entity-inspector", ChatColor.AQUA + "Entity Inspector", Material.STICK); setLore(ChatColor.YELLOW + "Right-click an entity to get their information."); }