当前位置: 首页>>代码示例>>Java>>正文


Java Advancement类代码示例

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


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

示例1: awardAdvancements

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
/**
 * Awards advancements created by Advanced Achievements. This method can be seen as a synchronisation to give
 * advancements which were generated after the corresponding achievement was received for a given player.
 * 
 * @param player
 */
private void awardAdvancements(Player player) {
	Advancement advancement = Bukkit.getServer()
			.getAdvancement(new NamespacedKey(plugin, AdvancementManager.ADVANCED_ACHIEVEMENTS_PARENT));
	// If no parent, user has not used /aach generate, do not do anything.
	if (advancement != null) {
		AdvancementProgress advancementProgress = player.getAdvancementProgress(advancement);
		if (!advancementProgress.isDone()) {
			advancementProgress.awardCriteria(AchievementAdvancement.CRITERIA_NAME);
		}
		for (String achName : plugin.getDatabaseManager().getPlayerAchievementNamesList(player.getUniqueId())) {
			advancement = Bukkit.getServer()
					.getAdvancement(new NamespacedKey(plugin, AdvancementManager.getKey(achName)));
			// Matching advancement might not exist if user has not called /aach generate.
			if (advancement != null) {
				advancementProgress = player.getAdvancementProgress(advancement);
				if (!advancementProgress.isDone()) {
					advancementProgress.awardCriteria(AchievementAdvancement.CRITERIA_NAME);
				}
			}
		}
	}
}
 
开发者ID:PyvesB,项目名称:AdvancedAchievements,代码行数:29,代码来源:AchieveConnectionListener.java

示例2: grant

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
public AdvancementAPI grant(Player... players) {
    Advancement advancement = getAdvancement();
    for (Player player : players) {
        if (!player.getAdvancementProgress(advancement).isDone()) {
            Collection<String> remainingCriteria = player.getAdvancementProgress(advancement).getRemainingCriteria();
            Bukkit.getLogger().info(remainingCriteria.toString());
            for (String remainingCriterion : remainingCriteria)
                player.getAdvancementProgress(getAdvancement())
                        .awardCriteria(remainingCriterion);
        }
    }
    return this;
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:14,代码来源:AdvancementAPI.java

示例3: revoke

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
public AdvancementAPI revoke(Player... players) {
    Advancement advancement = getAdvancement();
    for (Player player : players) {
        if (player.getAdvancementProgress(advancement).isDone()) {
            Collection<String> awardedCriteria = player.getAdvancementProgress(advancement).getAwardedCriteria();
            Bukkit.getLogger().info(awardedCriteria.toString());
            for (String awardedCriterion : awardedCriteria)
                player.getAdvancementProgress(getAdvancement())
                        .revokeCriteria(awardedCriterion);
        }
    }
    return this;
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:14,代码来源:AdvancementAPI.java

示例4: onPlayerAdvancedAchievementReception

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerAdvancedAchievementReception(PlayerAdvancedAchievementEvent event) {
	Player player = event.getPlayer();
	String uuid = player.getUniqueId().toString();
	// Check before updating caches; achievement could have already been received if MultiCommand is set to true in
	// the configuration.
	if (!plugin.getCacheManager().hasPlayerAchievement(player.getUniqueId(), event.getName())) {
		plugin.getCacheManager().getReceivedAchievementsCache().put(uuid, event.getName());
		plugin.getCacheManager().getNotReceivedAchievementsCache().remove(uuid, event.getName());
		plugin.getCacheManager().getTotalPlayerAchievementsCache().put(uuid,
				plugin.getCacheManager().getPlayerTotalAchievements(player.getUniqueId()) + 1);

		if (plugin.getServerVersion() >= 12) {
			Advancement advancement = Bukkit.getServer()
					.getAdvancement(new NamespacedKey(plugin, AdvancementManager.getKey(event.getName())));
			// Matching advancement might not exist if user has not called /aach generate.
			if (advancement != null) {
				player.getAdvancementProgress(advancement).awardCriteria(AchievementAdvancement.CRITERIA_NAME);
			}
		}
	}
	plugin.getDatabaseManager().registerAchievement(player.getUniqueId(), event.getName(), event.getMessage());

	List<String> rewardTexts = giveRewardsAndPrepareTexts(player, event.getCommandRewards(),
			event.getCommandMessage(), event.getItemReward(), event.getMoneyReward(), event.getExperienceReward(),
			event.getMaxHealthReward(), event.getMaxOxygenReward());
	displayAchievement(player, event.getName(), event.getDisplayName(), event.getMessage(), rewardTexts);

	if (plugin.getCacheManager().getPlayerTotalAchievements(player.getUniqueId()) == plugin
			.getAchievementsAndDisplayNames().size()) {
		handleAllAchievementsReceived(player);
	}
}
 
开发者ID:PyvesB,项目名称:AdvancedAchievements,代码行数:34,代码来源:PlayerAdvancedAchievementListener.java

示例5: cleanupOldAchievementAdvancements

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
/**
 * Removes all advancements previously generated by the plugin.
 */
private void cleanupOldAchievementAdvancements() {
	int achievementsCleaned = 0;
	Iterator<Advancement> advancements = Bukkit.getServer().advancementIterator();
	while (advancements.hasNext()) {
		NamespacedKey namespacedKey = advancements.next().getKey();
		if ("advancedachievements".equals(namespacedKey.getNamespace())
				&& !ADVANCED_ACHIEVEMENTS_PARENT.equals(namespacedKey.getKey())) {
			++achievementsCleaned;
			unsafeValues.removeAdvancement(namespacedKey);
		}
	}
	Bukkit.getServer().reloadData();
	plugin.getLogger().info("Cleaned " + achievementsCleaned + " old advancements.");
}
 
开发者ID:PyvesB,项目名称:AdvancedAchievements,代码行数:18,代码来源:AdvancementManager.java

示例6: getAdvancement

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
public Advancement getAdvancement() {
    return Bukkit.getAdvancement(id);
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:4,代码来源:AdvancementAPI.java

示例7: getAdvancementProgress

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement) {
    return implementation.getAdvancementProgress(advancement);
}
 
开发者ID:shawlaf,项目名称:Banmanager,代码行数:5,代码来源:CraftBanmanagerUser.java

示例8: getAdvancementProgress

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement)
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:7,代码来源:PlayerMock.java

示例9: getAdvancement

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Advancement getAdvancement(NamespacedKey key)
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:7,代码来源:ServerMock.java

示例10: advancementIterator

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Iterator<Advancement> advancementIterator()
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:7,代码来源:ServerMock.java

示例11: getAdvancements

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
/**
 * Return the number of advancements the player has completed.
 * @param player
 * @return count
 */
private static int getAdvancements(Player player) {
    List<Advancement> advancements = new ArrayList<>();
    Bukkit.advancementIterator().forEachRemaining(advancements::add);
    return (int) advancements.stream().map(player::getAdvancementProgress).filter(AdvancementProgress::isDone).count();
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:11,代码来源:CommandRankup.java

示例12: getAdvancementProgress

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress( Advancement advancement ) {
    return null;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:FlexPlayer.java

示例13: getAdvancement

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Advancement getAdvancement( NamespacedKey namespacedKey ) {
    throw new UnsupportedOperationException();
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:FlexServerImpl.java

示例14: advancementIterator

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Iterator<Advancement> advancementIterator() {
    return Collections.<Advancement>emptyList().iterator();
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:FlexServerImpl.java

示例15: getAdvancementProgress

import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement) {
    return player.getAdvancementProgress(advancement);
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:5,代码来源:DiscordPlayerCommandSender.java


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