本文整理汇总了Java中in.twizmwaz.cardinal.match.Match.getPlayingContainer方法的典型用法代码示例。如果您正苦于以下问题:Java Match.getPlayingContainer方法的具体用法?Java Match.getPlayingContainer怎么用?Java Match.getPlayingContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类in.twizmwaz.cardinal.match.Match
的用法示例。
在下文中一共展示了Match.getPlayingContainer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInventoryClick
import in.twizmwaz.cardinal.match.Match; //导入方法依赖的package包/类
/**
* Checks if the wool has been picked up when a player clicks on an item in their inventory.
*
* @param event The event.
*/
@EventHandler(ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent event) {
for (Wool wool : getWools(Cardinal.getMatch(event.getWorld()))) {
Player player = event.getActor();
ItemStack item = event.getCurrentItem();
Team team = wool.getTeam();
Match match = Cardinal.getMatch(player);
CompetitorContainer container = match.getPlayingContainer(player);
if (!wool.isComplete()
&& item.getType().equals(Material.WOOL)
&& item.getData().getData() == wool.getColor().getData()
&& team.equals(container)) {
wool.setTouched(true);
boolean showMessage = false;
if (wool.isShow() && !wool.hasPlayerTouched(player)) {
wool.addPlayerTouched(player);
showMessage = true;
Channels.getTeamChannel(match, team).sendPrefixedMessage(
new LocalizedComponentBuilder(
ChatConstant.getConstant("objective.wool.touched"),
Components.getName(player).build(),
wool.getComponent(),
new TeamComponent(wool.getTeam())
).build()
);
//todo: send message to observers
}
}
}
}
示例2: onPlayerPickupItem
import in.twizmwaz.cardinal.match.Match; //导入方法依赖的package包/类
/**
* Checks if the wool has been picked up when a player picks an item up from the ground.
*
* @param event The event.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
for (Wool wool : getWools(Cardinal.getMatch(event.getWorld()))) {
Player player = event.getPlayer();
ItemStack item = event.getItem().getItemStack();
Team team = wool.getTeam();
Match match = Cardinal.getMatch(player);
CompetitorContainer container = match.getPlayingContainer(player);
if (!wool.isComplete()
&& item.getType().equals(Material.WOOL)
&& item.getData().getData() == wool.getColor().getData()
&& team.equals(container)) {
wool.setTouched(true);
if (wool.isShow() && !wool.hasPlayerTouched(player)) {
wool.addPlayerTouched(player);
Channels.getTeamChannel(match, team).sendPrefixedMessage(
new LocalizedComponentBuilder(
ChatConstant.getConstant("objective.wool.touched"),
Components.getName(player).build(),
wool.getComponent(),
new TeamComponent(wool.getTeam())
).build()
);
//todo: send message to observers
}
}
}
}
示例3: onBlockPlace
import in.twizmwaz.cardinal.match.Match; //导入方法依赖的package包/类
/**
* Checks if this wool has been captured when a block is placed.
*
* @param event The event.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
for (Wool wool : getWools(Cardinal.getMatch(event.getWorld()))) {
if (wool.isComplete()) {
continue;
}
Player player = event.getPlayer();
Block block = event.getBlock();
if (wool.getMonument().contains(block.getLocation().toVector()) && block.getType().equals(Material.WOOL)
&& ((org.bukkit.material.Wool) block.getState().getMaterialData()).getColor().equals(wool.getColor())) {
wool.setComplete(true);
if (wool.isShow()) {
//fixme: unchecked cast
Match match = Cardinal.getMatch(event.getWorld());
Team team = (Team) match.getPlayingContainer(player);
Channels.getGlobalChannel(match.getMatchThread()).sendMessage(
new LocalizedComponentBuilder(ChatConstant.getConstant("objective.wool.completed"),
Components.getName(player).build(),
wool.getComponent(),
new TeamComponent(team)).color(ChatColor.GRAY).build());
}
Bukkit.getPluginManager().callEvent(new ObjectiveCompleteEvent(wool, player));
}
}
}
示例4: 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()
)
);
}
}
});
}