本文整理汇总了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);
}
}
}
}
示例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;
}
}
}
示例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
}
}
示例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");
}
}
}
示例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);
}
}
}
示例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();
}
}
示例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 !");
}
}
示例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);
}
}
示例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)));
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例14: onBlockPlace
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if (!event.getPlayer().hasPermission("mclink.build"))
event.setCancelled(true);
}
示例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);
}