当前位置: 首页>>代码示例>>Java>>正文


Java BlockPlaceEvent.getBlock方法代码示例

本文整理汇总了Java中org.bukkit.event.block.BlockPlaceEvent.getBlock方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPlaceEvent.getBlock方法的具体用法?Java BlockPlaceEvent.getBlock怎么用?Java BlockPlaceEvent.getBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.block.BlockPlaceEvent的用法示例。


在下文中一共展示了BlockPlaceEvent.getBlock方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
  public void onBlockPlace(BlockPlaceEvent event) {
if (Walls.getSpectators().contains(event.getPlayer().getName())) {
	event.setCancelled(true);
	return;
}

      if (State.PVP)
          return;
      
      Block b = event.getBlock();
      if (b.getType()==Material.TNT && !State.PVP) {
          Chat.player(event.getPlayer(), "&cYou are not allowed to use TNT before the walls drop!");
          event.setCancelled(true);
      }
      
      
      Team team = Team.getTeam(event.getPlayer());
      if (b.getX() < team.getMin().getX() + 1 || b.getZ() < team.getMin().getZ() + 1) {
          event.setCancelled(true);
      }
      if (b.getX() > team.getMax().getX() - 1 || b.getZ() > team.getMax().getZ() - 1) {
          event.setCancelled(true);
      }
  }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:26,代码来源:Events.java

示例2: onPlaceChest

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlaceChest(BlockPlaceEvent e) {
	if (!cm.isAntiQuickDoubleChest) {
		return;
	}
	Block block = e.getBlock();
	if (block == null) {
		return;
	}
	Material blockType = block.getType();
	if (Material.CHEST == blockType || Material.TRAPPED_CHEST == blockType) {
		if (isShopBlockNearby(block)) {
			e.setCancelled(true);
			e.getPlayer().sendMessage(i18n.tr("antiQuickShopDoubleChest"));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:18,代码来源:AntiQuickShopDoubleChest.java

示例3: BlockPlaceEvent

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void BlockPlaceEvent(BlockPlaceEvent e){
    Player p = e.getPlayer();
    Block b = e.getBlock();

    if (e.getItemInHand().getType() == Material.DROPPER && e.getItemInHand().getEnchantments() != null && e.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) {
        Casino c = new Casino(e.getBlockPlaced().getLocation());
        c.effect();
    }

    for(Entity en : p.getNearbyEntities (4D, 4D, 4D)){
        if (en instanceof Player){
            if(en == p) continue;
            if(b.getType() == Material.FIRE){

                if(Files.user.getBoolean("Users." + en.getName() + ".pvp") == false){
                    p.sendMessage(Utils.colorize(PAData.SURVIVAL.getPrefix() + ChatColor.DARK_RED + " No puedes poner ese bloque cerca de un jugador con el pvp desactivado."));
                    e.setCancelled(true);
                }
            }
        }
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:24,代码来源:PlayerEvents.java

示例4: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent e) {
	if (e.isCancelled()) {
		return;
	}
	if (!e.getBlock().getType().equals(Material.CAULDRON)) {
		return;
	}
	Block b = e.getBlock();
	Location loc = b.getLocation();
	loc.setY(loc.getY() + 1);
	Block upon = loc.getBlock();
	if (upon.getType().equals(Material.AIR)) {
		return;
	}
	e.setCancelled(true);
	e.getPlayer().sendMessage(Messages.getMessages().getNoPlace().replace("&", "§"));
}
 
开发者ID:Soldier233,项目名称:SlimefunBugFixer,代码行数:19,代码来源:Listeners.java

示例5: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
    Player player = event.getPlayer();
    Block b = event.getBlock();
    b.setMetadata("blockBreaker", new FixedMetadataValue(PrisonPicks.getInstance(), player.getUniqueId()));
}
 
开发者ID:ThePhilderbeast,项目名称:prisonPicks,代码行数:8,代码来源:Events.java

示例6: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
/**
 * Tagging placed logs
 *
 * @param event Event
 */
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
    Block block = event.getBlock();

    if (block.getType().equals(Material.LOG) || block.getType().equals(Material.LOG_2))
        block.setMetadata("placed", new FixedMetadataValue(this.plugin, event.getPlayer().getUniqueId()));
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:14,代码来源:FastTreeModule.java

示例7: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockPlace(final BlockPlaceEvent event) {
    final Block block = event.getBlock();
    if(block.getType() == FoundDiamondsListener.SEARCH_TYPE) {
        this.foundLocations.add(block.getLocation().toString());
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:8,代码来源:FoundDiamondsListener.java

示例8: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public final void onBlockPlace(final BlockPlaceEvent event) {
    final Block block = event.getBlock();
    final WorldBorder worldBorder = wbHandler.getBorder(block.getWorld());
    if (worldBorder != null && !worldBorder.isInBounds(block)) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(DENY_BUILD);
    }
}
 
开发者ID:Mystiflow,项目名称:WorldBorder,代码行数:10,代码来源:WorldBorderListener.java

示例9: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlace(BlockPlaceEvent evt) {
    Block source = evt.getBlock();
    Structure s = match(source);
    if (s == null) return;
    
    s.onCreate(evt);
}
 
开发者ID:Recraft,项目名称:Recreator,代码行数:9,代码来源:StructureChangeListener.java

示例10: onPlaceBlock

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlaceBlock(BlockPlaceEvent e) {
	Block block = e.getBlock();

	Material blockMaterial = block.getType();
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();
	WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());

	if (CropControl.getDAO().isTracked(block) == true) {
		// We've got a replacement
		CropControl.getPlugin().debug("Ghost object? Placement is overtop a tracked object at {0}, {1}, {2}", x, y, z);
		handleRemoval(block, chunk);
	}
	if (harvestableCrops.containsKey(blockMaterial)) {
		// we placed a block overtop an existing crop. Will be handled by a break event?
		/*Crop crop = chunk.getCrop(x, y, z);
		if (crop != null) {
			crop.setRemoved();
			CropControl.getPlugin().debug("Missed an event? Replacing a Crop at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		
		// We've placed a crop!
		Crop.create(chunk, x, y, z, blockMaterial.toString(), getBaseCropState(blockMaterial),
				e.getPlayer().getUniqueId(), System.currentTimeMillis(), harvestableCrops.get(blockMaterial));
	} else if (blockMaterial == Material.SAPLING) {
		// we placed a block overtop an existing sapling. TODO: Do I need to remove sapling here, or will there be a break event?
		/*Sapling sapling = chunk.getSapling(x, y, z);
		if (sapling != null) {
			sapling.setRemoved();
			CropControl.getPlugin().debug("Missed an event? Replacing a Sapling at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		// We've placed a sapling!
		Sapling.create(chunk, x, y, z, getSaplingType(block.getData()),
				e.getPlayer().getUniqueId(), System.currentTimeMillis(), false);
	} else if (blockMaterial == Material.CHORUS_FLOWER) {
		/*if (CropControl.getDAO().isTracked(block) == true) {
			CropControl.getPlugin().debug("Ghost object? Placement is overtop a tracked object at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		
		// TODO: Check if connected to an existing chorus tree.

		// First register the "tree"
		Tree chorusPlant = Tree.create(chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				e.getPlayer().getUniqueId(), System.currentTimeMillis());

		// Then the component in the tree.
		TreeComponent.create(chorusPlant, chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				e.getPlayer().getUniqueId(), false);
	} else if (blockMaterial.isSolid()){ // check for cactus.
		for (BlockFace face : CropControlEventHandler.directions) {
			Block adj = block.getRelative(face);
			if (Material.CACTUS.equals(adj.getType())) {
				Location loc = adj.getLocation();
				if (!pendingChecks.contains(loc)) {
					pendingChecks.add(loc);
					handleBreak(adj, BreakType.PLAYER, e.getPlayer().getUniqueId(), null);
				}		
			}
		}
	}
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:67,代码来源:CropControlEventHandler.java

示例11: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
    Block block = event.getBlock();

    blockBridge.notifyBlockUpdate(block.getLocation(), block.getType(), block.getState());
}
 
开发者ID:satoshinm,项目名称:WebSandboxMC,代码行数:7,代码来源:BlockListener.java


注:本文中的org.bukkit.event.block.BlockPlaceEvent.getBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。