Java Code Examples for org.bukkit.Material#MAP
The following examples show how to use
org.bukkit.Material#MAP .
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: RFC6238.java From MCAuthenticator with GNU General Public License v3.0 | 6 votes |
private void sendAndRenderMap(User u, Player p, String newKey) { ImageMapRenderer mapRenderer; try { mapRenderer = new ImageMapRenderer(p.getName(), newKey, serverIp); } catch (WriterException e) { mcAuthenticator.getC().sendDirect(p, "&cThere was an error rendering your 2FA QR code!"); mcAuthenticator.handleException(e); return; } if (!u.isInventoryStored()) u.storeInventory(p); MapView map = Bukkit.createMap(p.getWorld()); map.getRenderers().forEach(map::removeRenderer); map.addRenderer(mapRenderer); ItemStack mapItem = new ItemStack(Material.MAP, 1, map.getId()); p.getInventory().setHeldItemSlot(0); p.getInventory().setItemInMainHand(mapItem); p.sendMap(map); }
Example 2
Source File: Schematic.java From askyblock with GNU General Public License v2.0 | 6 votes |
public Schematic(ASkyBlock plugin) { this.plugin = plugin; // Initialize name = ""; heading = ""; description = "Default Island"; perm = ""; icon = Material.MAP; rating = 50; useDefaultChest = true; biome = Settings.defaultBiome; usePhysics = Settings.usePhysics; file = null; islandCompanion = new ArrayList<EntityType>(); islandCompanion.add(Settings.islandCompanion); companionNames = Settings.companionNames; defaultChestItems = Settings.chestItems; visible = true; order = 0; bedrock = null; chest = null; welcomeSign = null; topGrass = null; playerSpawn = null; //playerSpawnBlock = null; partnerName = ""; }
Example 3
Source File: CreativeInventoryMapUpdateEvent.java From MapManager with MIT License | 5 votes |
/** * @return the {@link MapWrapper} of the item */ public MapWrapper getMapWrapper() { if (this.mapWrapper != null) { return this.mapWrapper; } if (getItemStack() == null) { return null; } if (getItemStack().getType() != Material.MAP) { return null; } MapManager mapManager = ((MapManagerPlugin) Bukkit.getPluginManager().getPlugin("MapManager")).getMapManager(); return this.mapWrapper = mapManager.getWrapperForId(getPlayer(), getItemStack().getDurability()); }
Example 4
Source File: GraphListener.java From LagMonitor with MIT License | 5 votes |
private boolean isOurGraphLegacy(ItemStack mapItem) { if (mapItem.getType() != Material.MAP) return false; short mapId = mapItem.getDurability(); MapView mapView = Bukkit.getMap(mapId); return mapView != null && isOurRenderer(mapView); }
Example 5
Source File: BukkitImageViewer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
private int getMapSlot(Player player) { PlayerInventory inventory = player.getInventory(); for (int i = 0; i < 9; i++) { ItemStack item = inventory.getItem(i); if (item != null && item.getType() == Material.MAP) { return i; } } return -1; }
Example 6
Source File: GraphListener.java From LagMonitor with MIT License | 5 votes |
private boolean isOurGraphLegacy(ItemStack mapItem) { if (mapItem.getType() != Material.MAP) return false; short mapId = mapItem.getDurability(); MapView mapView = Bukkit.getMap(mapId); return mapView != null && isOurRenderer(mapView); }
Example 7
Source File: CraftItemStack.java From Carbon with GNU Lesser General Public License v3.0 | 5 votes |
public static ItemMeta getItemMeta(net.minecraft.server.v1_7_R4.ItemStack item) { if (!hasItemMeta(item)) { return CraftItemFactory.instance().getItemMeta(getType(item)); } Material mat = getType(item); if (mat == Material.WRITTEN_BOOK || mat == Material.BOOK_AND_QUILL) { return new CraftMetaBook(item.tag); } if (mat == Material.SKULL_ITEM) { return new CraftMetaSkull(item.tag); } if (mat == Material.LEATHER_HELMET || mat == Material.LEATHER_CHESTPLATE || mat == Material.LEATHER_LEGGINGS || mat == Material.LEATHER_BOOTS) { return new CraftMetaLeatherArmor(item.tag); } if (mat == Material.POTION) { return new CraftMetaPotion(item.tag); } if (mat == Material.MAP) { return new CraftMetaMap(item.tag); } if (mat == Material.FIREWORK) { return new CraftMetaFirework(item.tag); } if (mat == Material.FIREWORK_CHARGE) { return new CraftMetaCharge(item.tag); } if (mat == Material.ENCHANTED_BOOK) { return new CraftMetaEnchantedBook(item.tag); } if (mat.toString().equals("BANNER")) { return new BannerMeta(item.getData(), item.tag); } return new CraftMetaItem(item.tag); }
Example 8
Source File: CraftItemFactory.java From Carbon with GNU Lesser General Public License v3.0 | 5 votes |
private ItemMeta getItemMeta(Material material, CraftMetaItem meta) { if (material == Material.AIR) { return null; } if (material == Material.WRITTEN_BOOK || material == Material.BOOK_AND_QUILL) { return (meta instanceof CraftMetaBook) ? meta : new CraftMetaBook(meta); } if (material == Material.SKULL_ITEM) { return (meta instanceof CraftMetaSkull) ? meta : new CraftMetaSkull(meta); } if (material == Material.LEATHER_HELMET || material == Material.LEATHER_CHESTPLATE || material == Material.LEATHER_LEGGINGS || material == Material.LEATHER_BOOTS) { return (meta instanceof CraftMetaLeatherArmor) ? meta : new CraftMetaLeatherArmor(meta); } if (material == Material.POTION) { return (meta instanceof CraftMetaPotion) ? meta : new CraftMetaPotion(meta); } if (material == Material.MAP) { return (meta instanceof CraftMetaMap) ? meta : new CraftMetaMap(meta); } if (material == Material.FIREWORK) { return (meta instanceof CraftMetaFirework) ? meta : new CraftMetaFirework(meta); } if (material == Material.FIREWORK_CHARGE) { return (meta instanceof CraftMetaCharge) ? meta : new CraftMetaCharge(meta); } if (material == Material.ENCHANTED_BOOK) { return (meta instanceof CraftMetaEnchantedBook) ? meta : new CraftMetaEnchantedBook(meta); } if (material.toString().equals("BANNER")) { if (meta != null && BannerMeta.class.isAssignableFrom(meta.getClass())) { return meta; } else { return new BannerMeta(meta); } } return new CraftMetaItem(meta); }