当前位置: 首页>>代码示例>>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;未经允许,请勿转载。