• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectiveTouchEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent的典型用法代码示例。如果您正苦于以下问题:Java ObjectiveTouchEvent类的具体用法?Java ObjectiveTouchEvent怎么用?Java ObjectiveTouchEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectiveTouchEvent类属于in.twizmwaz.cardinal.event.objective包,在下文中一共展示了ObjectiveTouchEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onBlockPlace

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
    if (!isComplete()) {
        if (monument.contains(event.getBlock()) && partOfObjective(event.getBlockPlaced())) {
            if (Teams.getTeamByPlayer(event.getPlayer()).orNull() != team) {
                ChatUtil.sendWarningMessage(event.getPlayer(), new LocalizedChatMessage(ChatConstant.ERROR_ENEMY_OBJECTIVE));
                event.setCancelled(true);
            } else if (!isRepairable()) {
                ChatUtil.sendWarningMessage(event.getPlayer(), new LocalizedChatMessage(ChatConstant.ERROR_REPAIR_OBJECTIVE));
                event.setCancelled(true);
            } else {
                complete--;
                ObjectiveTouchEvent touchEvent = new ObjectiveTouchEvent(this, null, false);
                Bukkit.getServer().getPluginManager().callEvent(touchEvent);
            }
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:19,代码来源:DestroyableObjective.java


示例2: addBrokenPiecesFor

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
/**
 * Breaks a number of pieces for a certain player. This will automatically show touch messages, and complete the
 * monument if it reaches completion percentage.
 * @param player The player that touched.
 * @param contribution The amount of pieces this player broke.
 */
public void addBrokenPiecesFor(Player player, int contribution) {
  CompetitorContainer container = match.getPlayingContainer(player);
  if (!isCompleted() && container instanceof Team) {
    Team team = (Team) container;
    setTouched(team);
    if (show && !touchedPlayers.contains(player)) {
      touchedPlayers.add(player);
      Channels.getTeamChannel(match, team).sendPrefixedMessage(
          new LocalizedComponent(ChatConstant.getConstant("objective.destroyable.touched"),
              new TeamComponent(owner),
              new UnlocalizedComponent(name),
              new NameComponent(player)
          )
      );
    }

    UUID uuid = player.getUniqueId();
    playerContributions.putIfAbsent(uuid, 0);
    playerContributions.put(uuid, playerContributions.get(uuid) + contribution);
    broken += contribution;
    if ((double) broken / total >= completion) {
      completed = true;

      Channels.getGlobalChannel(match.getMatchThread()).sendMessage(
          new LocalizedComponentBuilder(
              ChatConstant.getConstant("objective.destroyable.completed"),
              new TeamComponent(owner),
              new UnlocalizedComponent(name),
              getContributionList()
          ).build()
      );

      Bukkit.getPluginManager().callEvent(new ObjectiveCompleteEvent(this, player));
    } else {
      Bukkit.getPluginManager().callEvent(new ObjectiveTouchEvent(this, player));
    }
    entryHolder.updateEntries();
  }
}
 
开发者ID:CardinalDevelopment,项目名称:Cardinal,代码行数:46,代码来源:Destroyable.java


示例3: onWoolTouch

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onWoolTouch(ObjectiveTouchEvent event) {
    if (event.getObjective().equals(this) && event.displayTouchMessage() && !this.receivedSnowflakes.contains(event.getPlayer().getUniqueId())) {
        Bukkit.getServer().getPluginManager().callEvent(new SnowflakeChangeEvent(event.getPlayer(), Snowflakes.ChangeReason.WOOL_TOUCH, 8, MiscUtils.convertDyeColorToChatColor(color) + name.toUpperCase().replaceAll("_", " ") + ChatColor.GRAY));
        receivedSnowflakes.add(event.getPlayer().getUniqueId());
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:8,代码来源:WoolObjective.java


示例4: onObjectiveTouch

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onObjectiveTouch(ObjectiveTouchEvent event) {
    if (event.getObjective().showOnScoreboard() && event.displayTouchMessage()) {
        if (event.getObjective() instanceof WoolObjective) {
            log(new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_PICKED_FOR, event.getPlayer().getName(), event.getObjective().getName().toUpperCase().replaceAll("_", " "), TeamUtils.getTeamByPlayer(event.getPlayer()).getName()).getMessage(Locale.getDefault().toString()));
        } else if (event.getObjective() instanceof CoreObjective) {
            log(new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_TOUCHED_FOR, event.getPlayer().getName(), event.getObjective().getName(), TeamUtils.getTeamByPlayer(event.getPlayer()).getName()).getMessage(Locale.getDefault().toString()));
        } else if (event.getObjective() instanceof DestroyableObjective) {
            log(new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_DAMAGED_FOR, event.getPlayer().getName(), event.getObjective().getName(), TeamUtils.getTeamByPlayer(event.getPlayer()).getName()).getMessage(Locale.getDefault().toString()));
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:13,代码来源:MatchTranscript.java


示例5: onWoolPickup

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onWoolPickup(InventoryClickEvent event) {
    Player player = (Player) event.getWhoClicked();
    if (!this.complete && GameHandler.getGameHandler().getMatch().isRunning()) {
        try {
            if (event.getCurrentItem().getType().equals(Material.WOOL) && ((Wool) event.getCurrentItem().getData()).getColor().equals(color)) {
                if (Teams.getTeamByPlayer(player).orNull() == team) {
                    boolean touchMessage = false;
                    if (!this.playersTouched.contains(player.getUniqueId())) {
                        this.playersTouched.add(player.getUniqueId());
                        if (this.show && !this.complete) {
                            Teams.getTeamChannel(Optional.of(team)).sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.WHITE + "{0}", new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_PICKED_FOR, team.getColor() + player.getName() + ChatColor.WHITE, MiscUtil.convertDyeColorToChatColor(color) + name.toUpperCase().replaceAll("_", " ") + ChatColor.WHITE, team.getCompleteName() + ChatColor.WHITE)));
                            for (Player player1 : Bukkit.getOnlinePlayers()) {
                                if (Teams.getTeamByPlayer(player1).isPresent() && Teams.getTeamByPlayer(player1).get().isObserver()) {
                                    player1.sendMessage(new UnlocalizedChatMessage(ChatColor.GRAY + "{0}", new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_PICKED_FOR, team.getColor() + player.getName() + ChatColor.GRAY, MiscUtil.convertDyeColorToChatColor(color) + name.toUpperCase().replaceAll("_", " ") + ChatColor.GRAY, team.getCompleteName() + ChatColor.GRAY)).getMessage(player1.getLocale()));
                                }
                            }
                            touchMessage = true;
                        }
                    }
                    if (!touched) touched = true;
                    ObjectiveTouchEvent touchEvent = new ObjectiveTouchEvent(this, player, touchMessage);
                    Bukkit.getServer().getPluginManager().callEvent(touchEvent);
                }
            }
        } catch (NullPointerException e) {
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:30,代码来源:WoolObjective.java


示例6: onWoolPickup

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onWoolPickup(InventoryClickEvent event) {
    Player player = (Player) event.getWhoClicked();
    if (!this.complete && GameHandler.getGameHandler().getMatch().isRunning()) {
        try {
            if (event.getCurrentItem().getType() == Material.WOOL && event.getCurrentItem().getData().getData() == color.getData()) {
                if (TeamUtils.getTeamByPlayer(player) == team) {
                    boolean touchMessage = false;
                    if (!this.playersTouched.contains(player.getUniqueId())) {
                        this.playersTouched.add(player.getUniqueId());
                        if (this.show && !this.complete) {
                            TeamUtils.getTeamChannel(team).sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.GRAY + "{0}", new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_PICKED, team.getColor() + player.getName() + ChatColor.GRAY, MiscUtils.convertDyeColorToChatColor(color) + name.toUpperCase().replaceAll("_", " ") + ChatColor.GRAY)));
                            for (Player player1 : Bukkit.getOnlinePlayers()) {
                                if (TeamUtils.getTeamByPlayer(player1) != null && TeamUtils.getTeamByPlayer(player1).isObserver()) {
                                    String message = new UnlocalizedChatMessage(ChatColor.GRAY + "{0}", new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_PICKED_FOR, team.getColor() + player.getName() + ChatColor.GRAY, MiscUtils.convertDyeColorToChatColor(color) + name.toUpperCase().replaceAll("_", " ") + ChatColor.GRAY, team.getCompleteName() + ChatColor.GRAY)).getMessage(player1.getLocale());
                                    if (!team.getOriginalName().equalsIgnoreCase(team.getName())) {
                                        message = message.replace(new LocalizedChatMessage(ChatConstant.MISC_THE).getMessage(player.getLocale()) + " ", "");
                                    }
                                    player1.sendMessage(message);
                                }
                            }
                            touchMessage = true;
                        }
                    }
                    boolean oldState = this.touched;
                    this.touched = true;
                    if (!oldState) {
                        if (location != null) {
                            proximity = location.distance(place.getVector());
                        } else {
                            proximity = player.getLocation().toVector().distance(place.getVector());
                        }
                    }
                    ObjectiveTouchEvent touchEvent = new ObjectiveTouchEvent(this, player, !oldState, touchMessage);
                    Bukkit.getServer().getPluginManager().callEvent(touchEvent);
                }
            }
        } catch (NullPointerException e) {
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:42,代码来源:WoolObjective.java


示例7: onBlockBreak

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent event) {
    if (!event.isCancelled()) {
        if (getBlocks().contains(event.getBlock())) {
            if (TeamUtils.getTeamByPlayer(event.getPlayer()) != team) {
                boolean touchMessage = false;
                if (!playersTouched.contains(event.getPlayer().getUniqueId())) {
                    playersTouched.add(event.getPlayer().getUniqueId());
                    TeamModule teamModule = TeamUtils.getTeamByPlayer(event.getPlayer());
                    TeamChannel channel = TeamUtils.getTeamChannel(teamModule);
                    if (this.show && !this.complete) {
                        channel.sendLocalizedMessage(new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_TOUCHED, teamModule.getColor() + event.getPlayer().getName() + ChatColor.GRAY, ChatColor.RED + name + ChatColor.GRAY));
                        for (Player player : Bukkit.getOnlinePlayers()) {
                            if (TeamUtils.getTeamByPlayer(player) != null && TeamUtils.getTeamByPlayer(player).isObserver()) {
                                String message = new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_DAMAGED_FOR, teamModule.getColor() + event.getPlayer().getName() + ChatColor.GRAY, ChatColor.AQUA + name + ChatColor.GRAY, teamModule.getCompleteName() + ChatColor.GRAY).getMessage(player.getLocale());
                                if (!teamModule.getOriginalName().equalsIgnoreCase(teamModule.getName())) {
                                    message = message.replace(new LocalizedChatMessage(ChatConstant.MISC_THE).getMessage(player.getLocale()) + " ", "");
                                }
                                player.sendMessage(message);
                            }
                        }
                        touchMessage = true;
                    }
                }
                if (!playersCompleted.contains(event.getPlayer().getUniqueId())) playersCompleted.add(event.getPlayer().getUniqueId());
                boolean oldState = this.touched;
                this.touched = true;
                ObjectiveTouchEvent touchEvent = new ObjectiveTouchEvent(this, event.getPlayer(), !oldState, touchMessage);
                Bukkit.getServer().getPluginManager().callEvent(touchEvent);
                event.setCancelled(false);
            } else {
                event.setCancelled(true);
                if (this.show) ChatUtils.sendWarningMessage(event.getPlayer(), new LocalizedChatMessage(ChatConstant.ERROR_OWN_CORE));
                return;
            }
        }
        if (core.contains(event.getBlock())) {
            if (TeamUtils.getTeamByPlayer(event.getPlayer()) == team) {
                event.setCancelled(true);
                if (this.show) ChatUtils.sendWarningMessage(event.getPlayer(), new LocalizedChatMessage(ChatConstant.ERROR_OWN_CORE));
            }
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:45,代码来源:CoreObjective.java


示例8: onWoolTouch

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onWoolTouch(ObjectiveTouchEvent event) {
    if (event.getObjective().equals(this) && event.displayTouchMessage()) {
        Bukkit.getServer().getPluginManager().callEvent(new SnowflakeChangeEvent(event.getPlayer(), Snowflakes.ChangeReason.WOOL_TOUCH, 8, MiscUtil.convertDyeColorToChatColor(color) + name.toUpperCase().replaceAll("_", " ") + ChatColor.GRAY));
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:7,代码来源:WoolObjective.java


示例9: onTouchEvent

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onTouchEvent(ObjectiveTouchEvent event) {
    if (event.getObjective().equals(objective)) this.active = info.needsTouch;
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:5,代码来源:GameObjectiveProximityHandler.java


示例10: onObjectiveTouch

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler
public void onObjectiveTouch(ObjectiveTouchEvent event) {
    updateObjectivePrefix(event.getObjective());
    updateTeamOrder();
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:6,代码来源:ScoreboardModule.java


示例11: onBlockBreak

import in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent event) {
    if (!event.isCancelled()) {
        if (getBlocks().contains(event.getBlock())) {
            if (Teams.getTeamByPlayer(event.getPlayer()).orNull() != team) {
                boolean touchMessage = false;
                if (!playersTouched.contains(event.getPlayer().getUniqueId())) {
                    playersTouched.add(event.getPlayer().getUniqueId());
                    Optional<TeamModule> teamModule = Teams.getTeamByPlayer(event.getPlayer());
                    if (teamModule.isPresent()) {
                        ChatChannel channel = Teams.getTeamChannel(teamModule);
                        if (this.show && !this.complete) {
                            channel.sendLocalizedMessage(new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_TOUCHED_FOR, teamModule.get().getColor() + event.getPlayer().getName() + ChatColor.WHITE, name, teamModule.get().getCompleteName() + ChatColor.WHITE));
                            for (Player player : Bukkit.getOnlinePlayers()) {
                                if (Teams.getTeamByPlayer(player).isPresent() && Teams.getTeamByPlayer(player).get().isObserver()) {
                                    player.sendMessage(new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_TOUCHED_FOR, teamModule.get().getColor() + event.getPlayer().getName() + ChatColor.GRAY, ChatColor.RED + name + ChatColor.GRAY, teamModule.get().getCompleteName() + ChatColor.GRAY).getMessage(player.getLocale()));
                                }
                            }
                            touchMessage = true;
                        }
                    }
                }
                if (!playersCompleted.contains(event.getPlayer().getUniqueId()))
                    playersCompleted.add(event.getPlayer().getUniqueId());
                this.touched = true;
                ObjectiveTouchEvent touchEvent = new ObjectiveTouchEvent(this, event.getPlayer(), touchMessage);
                Bukkit.getServer().getPluginManager().callEvent(touchEvent);
                event.setCancelled(false);
            } else {
                event.setCancelled(true);
                if (this.show)
                    ChatUtil.sendWarningMessage(event.getPlayer(), new LocalizedChatMessage(ChatConstant.ERROR_OWN_CORE));
                return;
            }
        }
        if (core.contains(event.getBlock())) {
            if (Teams.getTeamByPlayer(event.getPlayer()).orNull() == team) {
                event.setCancelled(true);
                if (this.show)
                    ChatUtil.sendWarningMessage(event.getPlayer(), new LocalizedChatMessage(ChatConstant.ERROR_OWN_CORE));
            }
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:45,代码来源:CoreObjective.java



注:本文中的in.twizmwaz.cardinal.event.objective.ObjectiveTouchEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sorter类代码示例发布时间:2022-05-16
下一篇:
Java MessagingService类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap