Java 类org.bukkit.event.player.PlayerAchievementAwardedEvent 实例源码

项目:MundoSK    文件:AchievementMundo.java   
public static void load() {
    Registration.registerEnum(Achievement.class, "achievement", Achievement.values())
            .document("Achievement", "1.4.10", "An achievement that a player can get. "
                    + "Note that achievements were removed in Minecraft 1.12 and thus this syntax will not work if you are running Bukkit/Spigot 1.12 and above.");
    Registration.registerEffect(EffAwardAch.class, "award achieve[ment] %achievement% to %player%")
            .document("Award Achievement", "1.4.10", "Awards the specified achievement to the specified player. "
                    + "Note that achievements were removed in Minecraft 1.12 and thus this syntax will not work if you are running Bukkit/Spigot 1.12 and above.");
    Registration.registerEffect(EffRemoveAch.class, "remove achieve[ment] %achievement% from %player%")
            .document("Remove Achievement", "1.4.10", "Removes the specified achievement from the specified player. "
                    + "Note that achievements were removed in Minecraft 1.12 and thus this syntax will not work if you are running Bukkit/Spigot 1.12 and above.");
    Registration.registerEvent("Achievement Award", EvtAchAward.class, PlayerAchievementAwardedEvent.class, "achieve[ment] [%-achievement%] award", "award of achieve[ment] [%-achievement%]")
            .document("Achievement Award", "1.4.10", "Called when a player is awarded either the specified achievement or any achievement. "
                    + "Note that achievements were removed in Minecraft 1.12 and thus this syntax will not work if you are running Bukkit/Spigot 1.12 and above.")
            .eventValue(Achievement.class, "1.4.10", "The achievement that was awarded.");
    Registration.registerEventValue(PlayerAchievementAwardedEvent.class, Achievement.class, PlayerAchievementAwardedEvent::getAchievement);
    Registration.registerExpression(ExprParentAch.class,Achievement.class, ExpressionType.PROPERTY,"parent of achieve[ment] %achievement%")
            .document("Parent of Achievement", "1.4.10", "An expression for the parent achievement of the specified achievement. "
                    + "Note that achievements were removed in Minecraft 1.12 and thus this syntax will not work if you are running Bukkit/Spigot 1.12 and above.");
    Registration.registerExpression(ExprAllAch.class,Achievement.class,ExpressionType.PROPERTY,"achieve[ment]s of %player%", "%player%'s achieve[ment]s")
            .document("Achievements of Player", "1.4.10", "An expression for a list of the achievements that the specified player has.");
    Registration.registerExpressionCondition(CondHasAch.class,ExpressionType.PROPERTY,"%player% has achieve[ment] %achievement%")
            .document("Player has Achievement", "1.4.10", "Checks whether the specified player has the specified achievement.");
}
项目:DiscordSRV    文件:PlayerAchievementsListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void PlayerAchievementAwardedEvent(PlayerAchievementAwardedEvent event) {
    // return if achievement messages are disabled
    if (StringUtils.isBlank(LangUtil.Message.PLAYER_ACHIEVEMENT.toString())) return;

    // return if achievement or player objects are fucking knackered because this can apparently happen for some reason
    if (event == null || event.getAchievement() == null || event.getPlayer() == null) return;

    // turn "SHITTY_ACHIEVEMENT_NAME" into "Shitty Achievement Name"
    String achievementName = PrettyUtil.beautify(event.getAchievement());

    String discordMessage = LangUtil.Message.PLAYER_ACHIEVEMENT.toString()
            .replaceAll("%time%|%date%", TimeUtil.timeStamp())
            .replace("%username%", event.getPlayer().getName())
            .replace("%displayname%", event.getPlayer().getDisplayName())
            .replace("%world%", event.getPlayer().getWorld().getName())
            .replace("%achievement%", achievementName);
    if (PluginUtil.pluginHookIsEnabled("placeholderapi")) discordMessage = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(event.getPlayer(), discordMessage);

    DiscordUtil.sendMessage(DiscordSRV.getPlugin().getMainTextChannel(), DiscordUtil.strip(discordMessage));
}
项目:StarQuestCode    文件:SQRankup2.java   
@EventHandler
public void onPlayerAchievement(PlayerAchievementAwardedEvent event){
    Achievement a = event.getAchievement();
    for(String s : bonusTags.keySet()){
        BonusTag t = bonusTags.get(s);
        if(t instanceof AchievementTag){
            AchievementTag tag = (AchievementTag) t;
            Achievement a2 = tag.getAchievement();
            if(a2 == a){
                String id = tag.getIdentifier();
                ArrayList<String> certs = database.getCertsOfPlayer(event.getPlayer().getUniqueId());
                if(!certs.contains(id)){
                    certs.add(id);
                }
                database.updateCertsOfPlayer(event.getPlayer().getUniqueId(), certs);
                event.getPlayer().sendMessage("You have unlocked the tag " + tag.getTagFormatted() + ", do /certs tag to set it.");
                return;
            }
        }
    }
}
项目:MundoSK    文件:EvtAchAward.java   
@Override
public boolean check(Event event) {
    if (event instanceof PlayerAchievementAwardedEvent) {
        if (ach != null) {
            if (((PlayerAchievementAwardedEvent) event).getAchievement() == ach.getSingle()) return true;
            else return false;
        } else return true;
    } else return false;
}
项目:LeagueOfLegends    文件:PlayerAchievementAwardedList.java   
@EventHandler
public void inventoryOpen(PlayerAchievementAwardedEvent event) {
    event.setCancelled(true);
    if (event.getAchievement() == Achievement.OPEN_INVENTORY) {
        if (!(event.getPlayer().getGameMode().equals(GameMode.CREATIVE))) {
            Inventory inv = Bukkit.createInventory(null, 54, "NIGDY NIE DOSTANIESZ SW. EQ!");
            inv.setContents(event.getPlayer().getInventory().getContents());
            event.getPlayer().openInventory(inv);
        }
    }
}
项目:Ultra-Hardcore-1.8    文件:EvGame.java   
@EventHandler
public void achievementAwarded(PlayerAchievementAwardedEvent a) {
    if (eA.mA.i() > 5 && eA.mA.i() < 8 && eA.mE.getIngamePlayers().contains(a.getPlayer().getName())) {
        return;
    }
    a.setCancelled(true);
}
项目:xEssentials-deprecated-bukkit    文件:VanishArchievementEvent.java   
@EventHandler
public void hideAchievement(PlayerAchievementAwardedEvent e) {
    XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
    if(xp.isVanished()) {
        e.setCancelled(true);
    }
}
项目:DiscordSRV    文件:PlayerAchievementsListener.java   
public PlayerAchievementsListener() {
    if (PlayerAchievementAwardedEvent.class.isAnnotationPresent(Deprecated.class)) return;

    Bukkit.getPluginManager().registerEvents(this, DiscordSRV.getPlugin());
}
项目:OneSlotServer    文件:PlayerListener.java   
@EventHandler
public void onPlayerAchievementAwarded(PlayerAchievementAwardedEvent event) {
    if(!event.getPlayer().getUniqueId().equals(plugin.activePlayer.player.getUniqueId())) {
        event.setCancelled(true);
    }
}
项目:xEssentials-deprecated-bukkit    文件:AchievementEvent.java   
@EventHandler
public void onAchievement(PlayerAchievementAwardedEvent e) {
    e.setCancelled(true);
}
项目:AutismChat3    文件:AchievementEvent.java   
@EventHandler(priority = EventPriority.MONITOR)
public void achievementEvent(final PlayerAchievementAwardedEvent e) {

}