本文整理汇总了Java中org.bukkit.Material.REDSTONE_BLOCK属性的典型用法代码示例。如果您正苦于以下问题:Java Material.REDSTONE_BLOCK属性的具体用法?Java Material.REDSTONE_BLOCK怎么用?Java Material.REDSTONE_BLOCK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.REDSTONE_BLOCK属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: click
@EventHandler(priority = EventPriority.HIGHEST)
public void click(final InventoryClickEvent event) {
if(event.getCurrentItem() == null) return;
Player player = (Player) event.getWhoClicked();
if(!purchasingMap.containsKey(player)) return;
Material clicked = event.getCurrentItem().getType();
for(Gizmo gizmo : gizmos) {
if(clicked == gizmo.getIcon()) {
player.closeInventory();
if(gizmo.ownsGizmo(player)) {
GizmoUtils.setGizmo(player, gizmo, false);
} else if(purchasingMap.containsKey(player)) {
player.sendMessage(ChatColor.GOLD + LobbyTranslations.get().t("gizmo.currentlyPurchasing", player));
} else if(gizmo.canPurchase(player)) {
GizmoUtils.openShop(player, gizmo);
purchasingMap.put(player, gizmo);
} else {
player.sendMessage(gizmo.getNoPurchaseMessage(player));
}
break;
}
}
if(clicked == Material.DIAMOND) {
GizmoUtils.purchaseGizmo(player, purchasingMap.get(player));
} else if(clicked == Material.REDSTONE_BLOCK) {
GizmoUtils.cancelPurchase(player);
}
event.setCancelled(true);
}
示例2: openShop
public static void openShop(Player player, Gizmo gizmo) {
Inventory inventory = Bukkit.createInventory(player, 54, StringUtils.truncate(ChatColor.GOLD + LobbyTranslations.get().t("gizmos.shopFor", player, gizmo.getColoredName(player)), 32));
inventory.setItem(4, Utils.getGhastTear(player, RaindropsListener.raindrops.get(player)));
inventory.setItem(22, gizmo.getItemStack(player));
ItemStack accept = new ItemStack(Material.DIAMOND);
ItemMeta acceptMeta = accept.getItemMeta();
acceptMeta.setDisplayName(ChatColor.GREEN + LobbyTranslations.get().t("purchase.purchase", player, gizmo.getColoredName(player)));
acceptMeta.setLore(Lists.newArrayList(gizmo.getCostText(player)));
accept.setItemMeta(acceptMeta);
ItemStack exit = new ItemStack(Material.REDSTONE_BLOCK);
ItemMeta exitMeta = exit.getItemMeta();
exitMeta.setDisplayName(ChatColor.RED + LobbyTranslations.get().t("purchase.cancel", player));
exit.setItemMeta(exitMeta);
for(int i = 3; i < 6; i++) {
for(int x = 0; x < 3; x++) {
inventory.setItem(i * 9 + x, accept);
}
for(int y = 6; y < 9; y++) {
inventory.setItem(i * 9 + y, exit);
}
}
player.openInventory(inventory);
}
示例3: initButtons
private void initButtons() {
if ( exitButton == null ) {
this.exitButton = new GUIButton( "§4X", Material.REDSTONE_BLOCK );
exitButton.setPosition( new Vector2i( 8, 0 ) );
}
if ( nextButton == null && useNextButton ) {
this.nextButton = new GUIButton( "§aNext", Material.WOOL, (byte) 5 );
nextButton.setPosition( new Vector2i( 8, getSize().getY() - 1 ) );
}
}
示例4: updateSpectateMenu
public void updateSpectateMenu(final GamePlayer gamePlayer) {
if (!SkyWarsReloaded.getIC().has(gamePlayer.getP()) || gamePlayer.isSpectating() || !SkyWarsReloaded.getIC().getMenu(gamePlayer.getP()).getName().equalsIgnoreCase(menuName)) {
return;
} else {
ArrayList<Game> games = SkyWarsReloaded.getGC().getGames();
for (int iii = 0; iii < games.size(); iii++) {
if (iii >= menuSize) {
break;
}
Game game = games.get(iii);
List<String> loreList = Lists.newLinkedList();
loreList.add(ChatColor.RED + "" + ChatColor.BOLD + game.getMapName().toUpperCase());
loreList.add((new Messaging.MessageFormatter().format("menu.spectate-game-header") + " " + game.getPlayers().size() + "/" + game.getNumberOfSpawns()));
for (GamePlayer gPlayer: game.getPlayers()) {
if (gPlayer.getP() != null) {
loreList.add(ChatColor.WHITE + gPlayer.getP().getName());
}
}
Material gameIcon = Material.REDSTONE_BLOCK;
String gameNumber = String.valueOf(game.getGameNumber());
if (game.getState() == GameState.PREGAME) {
gameIcon = Material.EMERALD_BLOCK;
} else if (game.getState() == GameState.ENDING) {
gameIcon = Material.LAPIS_BLOCK;
}
if (gamePlayer.getP() != null) {
SkyWarsReloaded.getIC().setOption(
gamePlayer.getP(),
iii,
new ItemStack(gameIcon, 1),
gameNumber,
loreList.toArray(new String[loreList.size()]));
}
}
if (gamePlayer.getP() != null) {
SkyWarsReloaded.getIC().update(gamePlayer.getP());
}
final GamePlayer player = gamePlayer;
SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
@Override
public void run() {
updateSpectateMenu(player);
}
}, 40);
}
}
示例5: updateJoinMenu
public void updateJoinMenu(final GamePlayer gamePlayer) {
if (!SkyWarsReloaded.getIC().has(gamePlayer.getP()) || gamePlayer.inGame() || !SkyWarsReloaded.getIC().getMenu(gamePlayer.getP()).getName().equalsIgnoreCase(joinName)) {
return;
} else {
ArrayList<Game> games = SkyWarsReloaded.getGC().getGames();
for (int iii = 0; iii < games.size(); iii++) {
if (iii >= menuSize) {
break;
}
Game game = games.get(iii);
List<String> loreList = Lists.newLinkedList();
if (game.getState() != GameState.PREGAME) {
loreList.add((new Messaging.MessageFormatter().format("signJoinSigns.inprogress").toUpperCase()));
}
loreList.add(ChatColor.RED + "" + ChatColor.BOLD + game.getMapName().toUpperCase());
loreList.add((new Messaging.MessageFormatter().format("menu.spectate-game-header") + " " + game.getPlayers().size() + "/" + game.getNumberOfSpawns()));
for (GamePlayer gPlayer: game.getPlayers()) {
if (gPlayer.getP() != null) {
loreList.add(ChatColor.WHITE + gPlayer.getP().getName());
}
}
double xy = ((double) (game.getPlayers().size() / game.getNumberOfSpawns()));
Material gameIcon = Material.REDSTONE_BLOCK;
String gameNumber = String.valueOf(game.getGameNumber());
if (game.getState() == GameState.PREGAME) {
gameIcon = Material.DIAMOND_HELMET;
if (xy < 0.75) {
gameIcon = Material.GOLD_HELMET;
}
if (xy < 0.50) {
gameIcon = Material.IRON_HELMET;
}
if (xy < 0.25) {
gameIcon = Material.LEATHER_HELMET;
}
}
if (gamePlayer.getP() != null) {
SkyWarsReloaded.getIC().setOption(
gamePlayer.getP(),
iii,
new ItemStack(gameIcon, 1),
gameNumber,
loreList.toArray(new String[loreList.size()]));
}
}
if (gamePlayer.getP() != null && !gamePlayer.inGame()) {
SkyWarsReloaded.getIC().update(gamePlayer.getP());
}
final GamePlayer player = gamePlayer;
SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
@Override
public void run() {
updateJoinMenu(player);
}
}, 40);
}
}
示例6: acceptOrDeny
public static Inventory acceptOrDeny(ItemStack clickedRequest) {
String temp = ChatColor.stripColor(clickedRequest.getItemMeta().getDisplayName());
int clickedId = Integer.parseInt(temp.substring(9, temp.length()));
BanRequest br = new BanRequest(clickedId);
Inventory i = Bukkit.createInventory(null, 54, Messager.color("&eRequest #" + br.id));
i.setItem(22, br.getItem());
ItemStack em = new ItemStack(Material.EMERALD_BLOCK);
ItemMeta emM = em.getItemMeta();
emM.setDisplayName(Messager.color("&aAccept Ban Request."));
emM.setLore(Arrays.asList(Messager.color("&7This can only be undone manually.")));
em.setItemMeta(emM);
ItemStack red = new ItemStack(Material.REDSTONE_BLOCK);
ItemMeta redM = red.getItemMeta();
redM.setDisplayName(Messager.color("&cDeny Ban Request."));
redM.setLore(Arrays.asList(Messager.color("&7This can only be undone manually.")));
red.setItemMeta(redM);
i.setItem(9, em);
i.setItem(10, em);
i.setItem(11, em);
i.setItem(15, red);
i.setItem(16, red);
i.setItem(17, red);
i.setItem(18, em);
i.setItem(19, em);
i.setItem(20, em);
i.setItem(24, red);
i.setItem(25, red);
i.setItem(26, red);
i.setItem(27, em);
i.setItem(28, em);
i.setItem(29, em);
i.setItem(33, red);
i.setItem(34, red);
i.setItem(35, red);
ItemStack back = new ItemStack(Material.ARROW);
ItemMeta im = back.getItemMeta();
im.setDisplayName(Messager.color("&cBack"));
back.setItemMeta(im);
i.setItem(45, back);
return i;
}