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


Java Match.hasPlayer方法代碼示例

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


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

示例1: onBucketEmpty

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Filters PlayerBucketEmptyEvent (placing down a block of liquid).
 *
 * <p>Applies to: block, block place and block place against.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
  Match match = Cardinal.getMatch(event.getPlayer());
  if (match == null || !match.hasPlayer(event.getPlayer())) {
    return;
  }
  for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_PLACE, ApplyType.BLOCK_PLACE_AGAINST)) {
    Block evaluating = reg.isType(ApplyType.BLOCK_PLACE_AGAINST)
        ? event.getBlockClicked() : event.getBlockClicked().getRelative(event.getBlockFace());

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

示例2: onBlockUse

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Filters PlayerInteractEvent (right clicking blocks or triggering pressure plates).
 *
 * <p>Applies to: use<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockUse(PlayerInteractEvent event) {
  if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
    Match match = Cardinal.getMatch(event.getPlayer());
    if (match == null || !match.hasPlayer(event.getPlayer())) {
      return;
    }
    for (AppliedRegion reg : get(match, ApplyType.USE)) {
      Block evaluating = event.getClickedBlock();

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

示例3: onBlockDamage

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的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: onBlockBreak

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Checks the destroyable's state when a player breaks a block.
 *
 * @param event The event.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
  Player player = event.getPlayer();
  Match match = Cardinal.getMatch(player);
  List<Destroyable> destroyables = getDestroyables(match);
  if (match == null || !match.hasPlayer(player) || destroyables.size() == 0) {
    return;
  }
  Block block = event.getBlock();
  destroyables.forEach(destroyable -> {
    if (destroyable.isPartOf(block)) {
      destroyable.addBrokenPiecesFor(player, 1);
    }
  });
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:21,代碼來源:DestroyableModule.java

示例5: onBlockPlace

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Filters BlockPlaceEvent.
 *
 * <p>Applies to: block, block place and block place against.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
  Match match = Cardinal.getMatch(event.getPlayer());
  if (match == null || !match.hasPlayer(event.getPlayer())) {
    return;
  }
  for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_PLACE, ApplyType.BLOCK_PLACE_AGAINST)) {
    Block evaluating = reg.isType(ApplyType.BLOCK_PLACE_AGAINST) ? event.getBlockAgainst() : event.getBlock();

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

示例6: onBlockBreak

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Filters BlockBreakEvent.
 *
 * <p>Applies to: block, block break.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent 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())) {
      break;
    }
  }
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:20,代碼來源:AppliedModule.java

示例7: onBucketFill

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Filters PlayerBucketFillEvent (removing a block of liquid).
 *
 * <p>Applies to: block and block break.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent 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.getBlockClicked();

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

示例8: onPlayerDeath

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Removes the player from the list of players who have touched the monument during their previous life.
 *
 * @param event The event.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDeath(PlayerDeathEvent event) {
  Player player = event.getEntity();
  Match match = Cardinal.getMatch(player);
  List<Destroyable> destroyables = getDestroyables(match);
  if (match == null || !match.hasPlayer(player) || destroyables.size() == 0) {
    return;
  }
  destroyables.forEach(core -> core.getTouchedPlayers().remove(player));
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:16,代碼來源:DestroyableModule.java

示例9: onBlockBreak

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Checks if the core has been touched when a player breaks a block.
 *
 * @param event The event.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
  Player player = event.getPlayer();
  Match match = Cardinal.getMatch(player);
  List<Core> cores = getCores(match);
  if (match == null || !match.hasPlayer(player) || cores.size() == 0) {
    return;
  }
  Team team = (Team) match.getPlayingContainer(player);
  Block block = event.getBlock();
  cores.forEach(core -> {
    if (core.getRegion().contains(block.getLocation())) {
      core.setTouched(team);
      if (core.isShow() && !core.getTouchedPlayers().contains(player)) {
        core.getTouchedPlayers().add(player);
        Channels.getTeamChannel(match, team).sendPrefixedMessage(
            new LocalizedComponent(
                ChatConstant.getConstant("objective.core.touched"),
                new TeamComponent(core.getOwner()),
                core.getComponent(),
                Components.getName(player).build()
            )
        );
      }
    }
  });
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:33,代碼來源:CoreModule.java

示例10: onPlayerDeath

import in.twizmwaz.cardinal.match.Match; //導入方法依賴的package包/類
/**
 * Removes the player from the list of players who have touched the core during their previous life.
 *
 * @param event The event.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDeath(PlayerDeathEvent event) {
  Player player = event.getEntity();
  Match match = Cardinal.getMatch(player);
  List<Core> cores = getCores(match);
  if (match == null || !match.hasPlayer(player) || cores.size() == 0) {
    return;
  }
  cores.forEach(core -> core.getTouchedPlayers().remove(player));
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:16,代碼來源:CoreModule.java


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