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


Java BlockPlaceEvent.setCancelled方法代码示例

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


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

示例1: onPlayerBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
/**
 * Prevents placing of blocks
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW)
public void onPlayerBlockPlace(final BlockPlaceEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());
    if (!Settings.netherIslands) {
        if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
                || e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
            if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
                return;
            }
            if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
                e.setCancelled(true);
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:22,代码来源:NetherEvents.java

示例2: onBlockRegister

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockRegister(BlockPlaceEvent e) {
	if (BlockStorage.hasBlockInfo(e.getBlock())) {
		e.setCancelled(true);
		return;
	}
	ItemStack item = e.getItemInHand();
	if (item != null && item.getType() == Material.INK_SACK) return;
	SlimefunItem sfItem = SlimefunItem.getByItem(item);
	if (sfItem != null && !(sfItem instanceof NotPlaceable)){
		BlockStorage.addBlockInfo(e.getBlock(), "id", sfItem.getID(), true);
		if (SlimefunItem.blockhandler.containsKey(sfItem.getID())) {
			SlimefunItem.blockhandler.get(sfItem.getID()).onPlace(e.getPlayer(), e.getBlock(), sfItem);
		}
	}
	else {
		for (ItemHandler handler: SlimefunItem.getHandlers("BlockPlaceHandler")) {
			if (((BlockPlaceHandler) handler).onBlockPlace(e, item)) break;
		}
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:22,代码来源:ToolListener.java

示例3: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent e)
{
    User user = MWAPI.getUserHandler().findById(e.getPlayer().getUniqueId());

    if (user.getGame() != null)
    {
        if (user.getGame().getSpectators().contains(user) || user.getGame().getState().equals(GameState.LOBBY))
        {
            e.setCancelled(true);
            return;
        }

        // TODO handle other stuff like the castles and walls
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:17,代码来源:BlockPlaceListener.java

示例4: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlace(BlockPlaceEvent e) {
	if (haulted) {
		if (!e.getPlayer().isOp()) {
			e.getPlayer().sendMessage(TAG + ChatColor.RED + "Server Haulted!");
			e.setCancelled(true);
			return;
		}
	}
	if (!e.getPlayer().hasPermission("behave.build.place")) {
		e.setCancelled(true);
		if(getConfig().getBoolean("msgbb")){
			e.getPlayer().sendMessage(ChatColor.BLUE + "[Behave] " + ChatColor.RED + "you dont have permision");
		}
	}
}
 
开发者ID:OverloadedCore,项目名称:behave,代码行数:17,代码来源:MainPart.java

示例5: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@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);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:30,代码来源:WoolObjective.java

示例6: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent event)
{
  Player player = event.getPlayer();
  Material block = event.getBlock().getType();
  if ((modMode.contains(player.getName())) &&
    (block == Material.CARPET)) {
    event.setCancelled(true);
    player.updateInventory();
  }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:12,代码来源:ModeratorMode.java

示例7: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
/**
 * Prevent portal trap
 *
 * @param event Event
 */
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
    if(!this.game.isGameStarted() || !this.game.hasPlayer(event.getPlayer()))
    {
        event.setCancelled(true);
        return;
    }

    boolean flag = false;

    if(event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().add(1.0D, 0.0D, 0.0D)).getType() == Material.PORTAL)
        flag = true;

    if(event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().subtract(1.0D, 0.0D, 0.0D)).getType() == Material.PORTAL)
        flag = true;

    if(event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().add(0.0D, 0.0D, 1.0D)).getType() == Material.PORTAL)
        flag = true;

    if(event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation().subtract(0.0D, 0.0D, 1.0D)).getType() == Material.PORTAL)
        flag = true;

    if(flag)
    {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "Vous ne pouvez pas placer de bloc ici !");
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:35,代码来源:SecurityListener.java

示例8: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
/**
 * Disable placing torchs
 * @param event The event
 */
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
    if (event.getBlockPlaced().getType() == Material.TORCH || event.getBlockPlaced().getType() == Material.REDSTONE_TORCH_ON || event.getBlockPlaced().getType() == Material.REDSTONE_TORCH_OFF)
    {
        event.getPlayer().sendMessage(ChatColor.RED + "Les torches sont désactivées dans cette partie.");
        event.setCancelled(true);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:14,代码来源:LightsOutModule.java

示例9: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockPlaceEvent event) {
	Gamer g = Gamer.get(event.getPlayer());
	Block b = event.getBlockPlaced();
	
	if (event.getBlockPlaced().getType() != Material.STONE_PLATE)
		return;
	
	event.setCancelled(false);

	Mine mine = new Mine(g, b);
	b.setMetadata("Mine", new FixedMetadataValue(Nexus.getPlugin(), Mine.getList().indexOf(mine)));
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:14,代码来源:KitEvents.java

示例10: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent e) {
	Block b = e.getBlockPlaced().getRelative(0, -1, 0);
	SlimefunItem item = BlockStorage.check(b);
	if(item == null) return;
	if(item.getID().equalsIgnoreCase("ANCIENT_PEDESTAL")) {
		Messages.local.sendTranslation(e.getPlayer(), "messages.cannot-place", true);
		e.setCancelled(true);
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:11,代码来源:AncientAltarListener.java

示例11: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent event) {
	Game game = Chambers.getInstance().getGameManager().getGame();
	if (!game.hasStarted()) {
		if (!event.getPlayer().isOp()) {
			event.setCancelled(true);
		}
	}
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:10,代码来源:GameProtectionListener.java

示例12: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event) {
    Key key = plugin.getKeyManager().getKey(event.getItemInHand());
    if (key != null) {
        event.setCancelled(true);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:8,代码来源:KeyListener.java

示例13: 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

示例14: onBlockPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
	if (!event.getPlayer().hasPermission("mclink.build"))
		event.setCancelled(true);
}
 
开发者ID:GigaGamma,项目名称:McLink,代码行数:6,代码来源:BlockProtect.java

示例15: onPlace

import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());

    if (!u.isOnRank(PACmd.Grupo.Builder)) e.setCancelled(true);
}
 
开发者ID:cadox8,项目名称:PA,代码行数:7,代码来源:PlayerEvents.java


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