本文整理汇总了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);
}
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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.");
}
示例6: getAdvancement
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
public Advancement getAdvancement() {
return Bukkit.getAdvancement(id);
}
示例7: getAdvancementProgress
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement) {
return implementation.getAdvancementProgress(advancement);
}
示例8: getAdvancementProgress
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例9: getAdvancement
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Advancement getAdvancement(NamespacedKey key)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例10: advancementIterator
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Iterator<Advancement> advancementIterator()
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例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();
}
示例12: getAdvancementProgress
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress( Advancement advancement ) {
return null;
}
示例13: getAdvancement
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Advancement getAdvancement( NamespacedKey namespacedKey ) {
throw new UnsupportedOperationException();
}
示例14: advancementIterator
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public Iterator<Advancement> advancementIterator() {
return Collections.<Advancement>emptyList().iterator();
}
示例15: getAdvancementProgress
import org.bukkit.advancement.Advancement; //导入依赖的package包/类
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement) {
return player.getAdvancementProgress(advancement);
}