org.bukkit.block.Block.setMetadata()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(239)

本文整理了Java中org.bukkit.block.Block.setMetadata()方法的一些代码示例,展示了Block.setMetadata()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.setMetadata()方法的具体详情如下:
包路径:org.bukkit.block.Block
类名称:Block
方法名:setMetadata

Block.setMetadata介绍

暂无

代码示例

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
  base.setMetadata(metadataKey, newMetadataValue);
}

代码示例来源:origin: NyaaCat/RPGItems-reloaded

changedBlockData.put(b.getLocation(), b.getBlockData());
BlockFace o = faces.get(random.nextInt(faces.size()));
b.setMetadata("RPGItems.Torch", new FixedMetadataValue(RPGItems.plugin, null));
b.setType(o == BlockFace.DOWN ? Material.TORCH : Material.WALL_TORCH, false);
if (o != BlockFace.DOWN) {

代码示例来源:origin: mcMMO-Dev/mcMMO

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent event) {
  /* WORLD BLACKLIST CHECK */
  if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
    return;
  Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
  if (furnaceBlock == null) {
    return;
  }
  HumanEntity player = event.getPlayer();
  if (!UserManager.hasPlayerDataKey(player)) {
    return;
  }
  if(!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0)
    furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
}

代码示例来源:origin: AddstarMC/Minigames

@SuppressWarnings("deprecation")
public static ScoreboardDisplay load(Minigame minigame, ConfigurationSection section) {
  int width = section.getInt("width");
  int height = section.getInt("height");
  Location location = MinigameUtils.loadShortLocation(section.getConfigurationSection("location"));
  BlockFace facing = BlockFace.valueOf(section.getString("dir"));
  
  // from invalid world
  if (location == null) {
    return null;
  }
  
  ScoreboardDisplay display = new ScoreboardDisplay(minigame, width, height, location, facing);
  display.setOrder(ScoreboardOrder.valueOf(section.getString("order")));
  MinigameStat stat = MinigameStats.getStat(section.getString("stat", "wins"));
  StatValueField field = StatValueField.valueOf(section.getString("field", "Total"));
  display.setStat(stat, field);
  Block block = location.getBlock();
  block.setMetadata("MGScoreboardSign", new FixedMetadataValue(Minigames.getPlugin(), true));
  block.setMetadata("Minigame", new FixedMetadataValue(Minigames.getPlugin(), minigame));
  
  return display;
}

代码示例来源:origin: AddstarMC/Minigames

event.setLine(2, minigame.getName(false));
event.getBlock().setMetadata("Minigame", new FixedMetadataValue(plugin, minigame));
return true;

代码示例来源:origin: nsporillo/GlobalWarming

/**
 * Only allow sea-level blocks to flow if they are below the custom sea-level
 * - Track any new blocks originating from sea-level blocks
 */
@EventHandler
public void onBlockFromToEvent(BlockFromToEvent event) {
  if (event.getBlock().hasMetadata(SEALEVEL_BLOCK)) {
    boolean isWaterFixed = isOverride;
    if (!isWaterFixed) {
      final World world = event.getBlock().getWorld();
      final WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID());
      final int baseSeaLevel = world.getSeaLevel() - 1;
      final int deltaSeaLevel = (int) seaMap.getValue(climateEngine.getTemperature());
      final int customSeaLevel = baseSeaLevel + deltaSeaLevel;
      isWaterFixed = event.getBlock().getY() > customSeaLevel;
    }
    if (isWaterFixed) {
      event.setCancelled(true);
    } else {
      event.getToBlock().setMetadata(SEALEVEL_BLOCK, BLOCK_TAG);
    }
  }
}

代码示例来源:origin: nsporillo/GlobalWarming

block.setMetadata(SEALEVEL_BLOCK, BLOCK_TAG);

代码示例来源:origin: mcMMO-Dev/mcMMO

furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());

代码示例来源:origin: marcelo-mason/PreciousStones

field.getBlock().setMetadata("Pstone", new FixedMetadataValue(plugin, true));

代码示例来源:origin: marcelo-mason/PreciousStones

field.getBlock().setMetadata("Pstone", new FixedMetadataValue(plugin, true));

相关文章