本文整理汇总了Java中org.bukkit.Material.WOOL属性的典型用法代码示例。如果您正苦于以下问题:Java Material.WOOL属性的具体用法?Java Material.WOOL怎么用?Java Material.WOOL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.WOOL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Game
public Game() {
Bukkit.getLogger().info("Loading blocks in main thread. Players shouldn't join now. Parsing " + Utils.countBlocks(BLOCK1, BLOCK2) + " objects...");
long time = System.currentTimeMillis();
for(int x = Math.min(BLOCK1.getX(), BLOCK2.getX()); x <= Math.max(BLOCK1.getX(), BLOCK2.getX()); x++) {
for(int y = Math.min(BLOCK1.getY(), BLOCK2.getY()); y <= Math.max(BLOCK1.getY(), BLOCK2.getY()); y++) {
for(int z = Math.min(BLOCK1.getZ(), BLOCK2.getZ()); z <= Math.max(BLOCK1.getZ(), BLOCK2.getZ()); z++) {
Block block = BLOCK1.getWorld().getBlockAt(x, y, z);
if(PAINTABLE_BLOCKS.contains(block.getType())) {
blocks.put(block, new ArenaBlock(x, y, z));
if(block.getType() == Material.WOOL)
block.setData((byte) 0);
}
}
}
}
Bukkit.getLogger().info(blocks.values().size() + " blocks loaded out of " + Utils.countBlocks(BLOCK1, BLOCK2) + " in " + (System.currentTimeMillis() - time) + "ms");
Bukkit.getScheduler().runTaskTimer(Absorption.get(), new RegenerationLoop(), 5 * 20, 5 * 20);
}
示例2: handleWoolCrafting
@EventHandler
public void handleWoolCrafting(PrepareItemCraftEvent event) {
ItemStack result = event.getRecipe().getResult();
InventoryHolder holder = event.getInventory().getHolder();
if (holder instanceof Player) {
MatchPlayer playerHolder = this.match.getPlayer((Player) holder);
if (playerHolder != null && result != null && result.getType() == Material.WOOL) {
for(MonumentWool wool : this.wools) {
if(wool.getDefinition().isObjectiveWool(result)) {
if(!wool.getDefinition().isCraftable()) {
playerHolder.sendMessage(ChatColor.RED + PGMTranslations.t("match.wool.craftDisabled", playerHolder, BukkitUtils.woolMessage(wool.getDyeColor())));
event.getInventory().setResult(null);
}
}
}
}
}
}
示例3: isDestroyableWool
/**
* Test if the given ItemStack is strictly an enemy wool i.e. not also
* a wool that the given team can capture.
*/
private boolean isDestroyableWool(ItemStack stack, Competitor team) {
if(stack == null || stack.getType() != Material.WOOL) {
return false;
}
DyeColor color = ((Wool) stack.getData()).getColor();
boolean enemyOwned = false;
for(Goal goal : team.getMatch().needMatchModule(GoalMatchModule.class).getGoals()) {
if(goal instanceof MonumentWool) {
MonumentWool wool = (MonumentWool) goal;
if(wool.isVisible() && !wool.isPlaced() && wool.getDyeColor() == color) {
if(wool.getOwner() == team) {
return false;
} else {
enemyOwned = true;
}
}
}
}
return enemyOwned;
}
示例4: setMaterial
@SuppressWarnings("deprecation")
private void setMaterial(GameStatus gs, Block attachedBlock) {
String material = SkyWarsReloaded.getCfg().getSignJoinMaterial();
Material sMat;
if (material.equalsIgnoreCase("wool")) {
sMat = Material.WOOL;
} else if (material.equalsIgnoreCase("clay")) {
sMat = Material.STAINED_CLAY;
} else if (material.equalsIgnoreCase("glass")) {
sMat = Material.STAINED_GLASS;
} else {
sMat = null;
}
if (sMat != null) {
if (gs == GameStatus.JOINABLE) {
attachedBlock.setType(sMat);
attachedBlock.setData((byte) 5);
} else if (gs == GameStatus.FULL || gs == GameStatus.INPROGRESS) {
attachedBlock.setType(sMat);
attachedBlock.setData((byte) 14);
} else if (gs == GameStatus.RESTARTING) {
attachedBlock.setType(sMat);
attachedBlock.setData((byte) 11);
}
}
}
示例5: placeBlock
@SuppressWarnings( value = "deprecation" )
private void placeBlock( int seq, int data )
{
int x = seq % 1000;
int z = seq / 1000;
Block block = this.getWorld().getBlockAt( x, this.getHeight(), z );
if( block.getType() != Material.WOOL )
{
block.setType( Material.WOOL );
}
byte woolColor = PlaceColor.getColorById( data ).getWoolColor();
if( block.getData() != woolColor )
{
block.setData( woolColor );
FallingBlock fb = this.getWorld().spawnFallingBlock( new Location( this.getWorld(), x, this.getFallingBlockHeight(), z ), Material.WOOL, woolColor );
fb.setDropItem( false );
fb.setHurtEntities( false );
}
}
示例6: addItem
@SuppressWarnings("unchecked")
protected GUIItem addItem(String itemName, Class<?> type, Object value, Consumer<Object> setter) {
GUIItem gi = addItem(Material.WOOL, ChatColor.YELLOW + itemName);
// Display the current value.
String str = value != null ? value.toString() : "null";
gi.addLore("Value: " + ChatColor.YELLOW + (str.length() > 35 ? str.substring(0, 35) + "..." : str), "");
// Apply the handler specific code.
JsonSerializer.getHandler(type).editItem(gi, value, setter, type);
// If it's using the default icon, set the color based on the data state.
if (gi.getItem().getType() == Material.WOOL) {
boolean green = value != null && (!(value instanceof Boolean) || ((Boolean) value));
gi.setColor(green ? DyeColor.LIME : DyeColor.RED);
}
// Update the gui if the value changes.
gi.anyClick(ce -> {
if (ce.getGUI() == this)
reconstruct();
});
return gi;
}
示例7: onPlayerInteract
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
e.setCancelled(true);
e.getPlayer().updateInventory();
ItemStack item = e.getItem();
if(item == null) return;
Player player = e.getPlayer();
CPlayer cplayer = AgarMC.get().getGame().getCPlayer(player);
if(cplayer == null) return;
if(item.getType() == Material.WRITTEN_BOOK) {
e.setCancelled(false);
return ;
} else if(item.getType() == Material.WOOL) {
TeamSelectorGui.display(player);
} else if(item.getType() == SamaGamesAPI.get().getGameManager().getCoherenceMachine().getLeaveItem().getType()) {
SamaGamesAPI.get().getGameManager().kickPlayer(player, ChatColor.RED + "Vous avez quitté la partie");
}
if(!cplayer.isPlaying()) {
if(item.getType() == Material.NETHER_STAR) {
player.sendMessage(ChatColor.DARK_GREEN + "Vous entrez dans le jeu, bonne chance !");
cplayer.play();
}
} else {
if(item.getType() == Material.MAGMA_CREAM) {
cplayer.split();
} else if(item.getType() == Material.SLIME_BALL) {
cplayer.ejectMass();
} else if(item.getType() == Material.DIODE) {
MenuGui.display(player);
}
}
}
示例8: onPlace
@EventHandler
public void onPlace(BlockPlaceEvent event) {
if (event.getBlockPlaced().getType() == Material.WOOL && event.getBlockPlaced().getState().getData().getData() == color) {
if (!completed) {
if (!podium.contains(event.getBlockPlaced().getLocation())) {
return;
}
if (!owner.containsPlayer(event.getPlayer())) {
return;
}
event.setCancelled(false); //override filter
setCompleted(true);
TeamManagerModule teamManagerModule = TGM.get().getModule(TeamManagerModule.class);
MatchTeam matchTeam = teamManagerModule.getTeam(event.getPlayer());
for (WoolObjectiveService woolObjectiveService : services) {
woolObjectiveService.place(event.getPlayer(), matchTeam, event.getBlock());
}
}
} else {
if (podium.contains(event.getBlockPlaced().getLocation())) {
event.setCancelled(true);
}
}
}
示例9: onWoolCraft
@EventHandler
public void onWoolCraft(CraftItemEvent event) {
if (event.getRecipe().getResult().getType() == Material.WOOL) {
event.setCancelled(true);
event.getWhoClicked().sendMessage(ChatColor.RED + "You are now allowed to craft wool.");
}
}
示例10: onPickup
@EventHandler
public void onPickup(EntityPickupItemEvent event) {
if (event.getEntity() instanceof Player) {
if (event.getItem() != null && event.getItem().getItemStack().getType() == Material.WOOL) {
if (event.getItem().getItemStack().getData().getData() == color) {
handleWoolPickup(((Player) event.getEntity()).getPlayer());
}
}
}
}
示例11: onCollect
@EventHandler
public void onCollect(InventoryClickEvent event) {
if (event.getCurrentItem() != null && event.getCurrentItem().getType() == Material.WOOL) {
if (event.getCurrentItem().getData().getData() == color) {
handleWoolPickup((Player) event.getWhoClicked());
}
}
}
示例12: getTeamSelector
public static ItemStack getTeamSelector()
{
ItemStack stack = new ItemStack(Material.WOOL, 1);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + "Select Team " + ChatColor.GRAY + "(Right click)");
meta.setLore(null);
stack.setItemMeta(meta);
return stack;
}
示例13: isObjectiveWool
private boolean isObjectiveWool(ItemStack stack) {
if(stack.getType() == Material.WOOL) {
for(MonumentWool wool : this.wools) {
if(wool.getDefinition().isObjectiveWool(stack)) return true;
}
}
return false;
}
示例14: onButtonClick
@EventHandler
public void onButtonClick(final InventoryClickEvent event) {
ItemStack stack = event.getCurrentItem();
final MatchPlayer player = this.getMatch().getPlayer(event.getWhoClicked());
if(stack == null || player == null) return;
if(stack.getType() != Material.WOOL && stack.getType() != Material.CARPET) return;
ItemMeta meta = stack.getItemMeta();
if(!meta.hasDisplayName()) return;
String name = meta.getDisplayName();
if(!name.startsWith(BUTTON_PREFIX)) return;
event.setCancelled(true);
final int score = stack.getAmount();
if(!isScoreValid(score)) return;
this.getMatch().getScheduler(MatchScope.LOADED).createTask(() -> {
Integer oldScore = playerRatings.get(player);
if(oldScore == null || oldScore != score) {
player.playSound(Sound.UI_BUTTON_CLICK, 1, 2);
rate(player, score);
}
else {
player.getBukkit().closeInventory();
}
});
}
示例15: 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 ) );
}
}