當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockDamageEvent.isCancelled方法代碼示例

本文整理匯總了Java中org.bukkit.event.block.BlockDamageEvent.isCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockDamageEvent.isCancelled方法的具體用法?Java BlockDamageEvent.isCancelled怎麽用?Java BlockDamageEvent.isCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.block.BlockDamageEvent的用法示例。


在下文中一共展示了BlockDamageEvent.isCancelled方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockDamage

import org.bukkit.event.block.BlockDamageEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockDamage(BlockDamageEvent event) {
    if (event.isCancelled() || !OrebfuscatorConfig.UpdateOnDamage) {
        return;
    }

    if (!BlockUpdate.needsUpdate(event.getBlock())) {
        return;
    }

    if (!BlockHitManager.hitBlock(event.getPlayer(), event.getBlock())) {
        return;
    }

    BlockUpdate.Update(event.getBlock());
}
 
開發者ID:SamaGames,項目名稱:AntiCheat,代碼行數:17,代碼來源:OrebfuscatorBlockListener.java

示例2: checkBlockDamage

import org.bukkit.event.block.BlockDamageEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void checkBlockDamage(final BlockDamageEvent event) {
    MatchPlayer player = this.match.getParticipant(event.getPlayer());
    if(player == null) return;

    PlayerBlockEventQuery query = new PlayerBlockEventQuery(player, event, event.getBlock().getState());

    for(EventRule rule : this.ruleContext.get(EventRuleScope.BLOCK_BREAK)) {
        if(rule.earlyWarning() && rule.region().contains(event.getBlock())) {
            if(processQuery(rule, query)) {
                if(event.isCancelled() && rule.message() != null) {
                    player.sendWarning(rule.message(), true);
                }
                if(this.useRegionPriority) {
                    break;
                }
            }
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:21,代碼來源:EventRuleMatchModule.java

示例3: onBlockDamage

import org.bukkit.event.block.BlockDamageEvent; //導入方法依賴的package包/類
/**
 * Filters BlockDamageEvent, Used for early warnings.
 *
 * <p>Applies to: block and block break<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockDamage(BlockDamageEvent event) {
  Match match = Cardinal.getMatch(event.getPlayer());
  if (match == null || !match.hasPlayer(event.getPlayer())) {
    return;
  }
  for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_BREAK)) {
    Block evaluating = event.getBlock();

    if (apply(reg, evaluating.getLocation(), event.getPlayer(), event, event, evaluating, event.getPlayer())) {
      if (event.isCancelled()) {
        event.setCancelled(false);
      }
      break;
    }
  }
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:23,代碼來源:AppliedModule.java

示例4: onBlockDamage

import org.bukkit.event.block.BlockDamageEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDamage(BlockDamageEvent event) {
  Sign sign;
  if (!event.isCancelled()
      && event.getBlock() != null
      && (event.getBlock().getType() == Material.WALL_SIGN || event
          .getBlock().getType() == Material.SIGN_POST)) {
    sign = (Sign) event.getBlock().getState();

    if (sign.getLine(0).equals(
        "" + ChatColor.GRAY + ChatColor.BOLD + "[" + ChatColor.YELLOW + "ATM"
            + ChatColor.GRAY + "]")
        && !tgym.Vault.HasPermissions(event.getPlayer(), "tgym.atm.create"))
      event.setCancelled(true);
  }
}
 
開發者ID:Vild,項目名稱:TimeGivesYouMoney,代碼行數:17,代碼來源:BlockListener.java


注:本文中的org.bukkit.event.block.BlockDamageEvent.isCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。