@SubscribeEvent @SideOnly(Side.CLIENT) public void onAchievement(AchievementEvent e) { if (!Config.achievementMessages || !(e.getEntityLiving() instanceof EntityPlayer) || e.getEntityLiving().getUniqueID() != Minecraft.getMinecraft().thePlayer.getUniqueID()) return; // Getting discord and minecraft user EntityPlayer player = (EntityPlayer) e.getEntityLiving(); User me = DiscordCE.client.getUserById(DiscordCE.client.getSelfInfo().getId()); // Getting unlocked ac String aString = me.getAsMention() + " has just earned the achievement \"" + e.getAchievement().getStatName().getUnformattedComponentText() + ".\""; // Sending death message DiscordCE.client.getTextChannelById(Preferences.i.usingChannel).sendMessageAsync(aString, null); }
@SubscribeEvent public void onAchievement(AchievementEvent event) { if (((EntityPlayerMP) event.getEntityPlayer()).getStatFile().hasAchievementUnlocked(event.getAchievement())) { // getStatFile // This is necessary because the Achievement event fires even if an achievement is already unlocked. return; } if (!((EntityPlayerMP) event.getEntityPlayer()).getStatFile().canUnlockAchievement(event.getAchievement())) { // getStatFile // This is necessary because the Achievement event fires even if an achievement can not be unlocked yet. return; } if (Slack.instance.senderConnected) { Slack.instance.getSlackSender().sendToSlack(SlackCommandSender.getInstance(), event.getEntityPlayer().getGameProfile().getName() + " has earned the achievement [" + event.getAchievement().getStatName().getUnformattedText() + "]"); } }
@SubscribeEvent public void onAchievementGet(AchievementEvent event) { Achievement achievement = event.getAchievement(); EntityPlayer player = event.getEntityPlayer(); if (!(achievement instanceof AetherAchievement)) { return; } int achievementType = achievement == AchievementsAether.defeat_bronze ? 1 : achievement == AchievementsAether.defeat_silver ? 2 : 0; if (!player.worldObj.isRemote && ((EntityPlayerMP)player).getStatFile().canUnlockAchievement(achievement) && !player.hasAchievement(achievement)) { if (event.getAchievement() == AchievementsAether.enter_aether) { if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.lore_book))) { player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(ItemsAether.lore_book))); } if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.golden_parachute))) { player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(ItemsAether.golden_parachute))); } } AetherNetworkingManager.sendTo(new PacketAchievement(achievementType), (EntityPlayerMP) player); } }
/** When stuff happens */ @SubscribeEvent public void onGetAchievement(AchievementEvent e) { if(!e.getEntity().getEntityWorld().isRemote && e.getAchievement() == LCAchievements.infuseSkyfather) { e.getEntityPlayer().addChatMessage(new TextComponentString(LCText.getAngerGodsChatLore())); } }
@SubscribeEvent public void onAchievement(AchievementEvent event) { StatisticsFile file = ((EntityPlayerMP) event.entityPlayer).func_147099_x(); if (!event.entity.worldObj.isRemote && file.canUnlockAchievement(event.achievement) && !file.hasAchievementUnlocked(event.achievement) && ConfigHandler.betterAchievements) { event.entityPlayer.getEntityData().setInteger("fireworksLeft", 9); event.entityPlayer.getEntityData().setBoolean("fireworkDelay", false); } }
@SubscribeEvent public void onAchievement(final AchievementEvent event) { if (ignoreAchievement || event.entityPlayer.worldObj.isRemote || ((EntityPlayerMP)event.entityPlayer).func_147099_x().hasAchievementUnlocked(event.achievement)) { return; } AchievementPage page = null; for (AchievementPage p : AchievementPage.getAchievementPages()) { if (p.getAchievements().contains(event.achievement)) { page = p; } } final AchievementPage pf = page; EnderCore.proxy.getScheduler().schedule(50, new Runnable() { @Override public void run() { ignoreAchievement = true; triggerAchievement(AchievementSource.ACHIEVEMENT_PAGE, event.entityPlayer, pf, event.entityPlayer, event.achievement); ignoreAchievement = false; } }); }
@SubscribeEvent public void onAchievement(AchievementEvent a){ if(Config.Achievements){ StatisticsFile player = ((EntityPlayerMP) a.entityPlayer).func_147099_x(); if(a.achievement.isAchievement() && player.canUnlockAchievement(a.achievement) && !player.hasAchievementUnlocked(a.achievement)){ TkIrc.toIrc.sendMessage(Config.cName,dePing(IRCBot.colorNick(a.entityPlayer.getCommandSenderName()))+" has just earned the achievement \""+a.achievement.func_150951_e().getUnformattedText()+"\""); } } }
@SubscribeEvent public void onAchievementGet(AchievementEvent event) { ProgressionAPI.registry.fireTrigger(event.getEntityPlayer(), getProvider().getUnlocalisedName(), event.getAchievement()); }