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


Java Achievement类代码示例

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


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

示例1: load

import org.bukkit.Achievement; //导入依赖的package包/类
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.");
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:24,代码来源:AchievementMundo.java

示例2: onPlayerAchievement

import org.bukkit.Achievement; //导入依赖的package包/类
@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;
			}
		}
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:22,代码来源:SQRankup2.java

示例3: run

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
    StringBuilder output = new StringBuilder();
    Random randomGenerator = new Random();

    String[] words = TotalFreedomMod.CAKE_LYRICS.split(" ");
    for (String word : words)
    {
        String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
        output.append(ChatColor.COLOR_CHAR).append(color_code).append(word).append(" ");
    }

    for (Player player : server.getOnlinePlayers())
    {
        ItemStack heldItem = new ItemStack(Material.CAKE, 1);
        player.getInventory().setItem(player.getInventory().firstEmpty(), heldItem);
        player.awardAchievement(Achievement.MINE_WOOD);
        player.awardAchievement(Achievement.BUILD_WORKBENCH);
        player.awardAchievement(Achievement.BUILD_HOE);
        player.awardAchievement(Achievement.BAKE_CAKE);
    }

    TFM_Util.bcastMsg(output.toString());
    return true;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:27,代码来源:Command_cake.java

示例4: serialize

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
public Map<String, Object> serialize() {
    final Object serializedObject;
    switch (this.type) {
        case SHOW_ACHIEVEMENT:
            serializedObject = ((Achievement)this.object).name();
            break;
        case SHOW_ITEM: // ItemStack is ConfigurationSerializable
        case SHOW_TEXT: // String[] is supported automatically
            serializedObject = this.object;
            break;
        default:
            throw new IllegalArgumentException("Should never be here!");
    }
    return ImmutableMap.<String, Object>of(
            "type", this.type.name(),
            "object", serializedObject
    );
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:20,代码来源:Hover.java

示例5: init

import org.bukkit.Achievement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult arg3) {
	// TODO Auto-generated method stub
	ach = (Expression<Achievement>) expr[0];
	return true;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:8,代码来源:ExprParentAch.java

示例6: init

import org.bukkit.Achievement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult arg3) {
	// TODO Auto-generated method stub
	player = (Expression<Player>) expr[0];
	ach = (Expression<Achievement>) expr[1];
	return true;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:9,代码来源:CondHasAch.java

示例7: init

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expr, int matchedPattern,
		Kleenean paramKleenean, ParseResult paramParseResult) {
	ach = (Expression<Achievement>) expr[0];
	player = (Expression<Player>) expr[1];
	return true;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:8,代码来源:EffAwardAch.java

示例8: init

import org.bukkit.Achievement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] expr, int matchedPattern,
		Kleenean paramKleenean, ParseResult paramParseResult) {
	// TODO Auto-generated method stub
	ach = (Expression<Achievement>) expr[0];
	player = (Expression<Player>) expr[1];
	return true;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:10,代码来源:EffRemoveAch.java

示例9: get

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
@Nullable
protected Achievement[] get(Event event) {
	List<Achievement> list = new ArrayList<>();
	for (int a = 0; a < Achievement.values().length; a++) {
		if (player.getSingle(event).hasAchievement(Achievement.values()[a])) list.add(Achievement.values()[a]);
	}
	return list.toArray(new Achievement[list.size()]);
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:10,代码来源:ExprAllAch.java

示例10: iterator

import org.bukkit.Achievement; //导入依赖的package包/类
public Iterator<Achievement> iterator(Event event) {
	List<Achievement> list = new ArrayList<>();
	for (int a = 0; a < Achievement.values().length; a++) {
		if (player.getSingle(event).hasAchievement(Achievement.values()[a])) list.add(Achievement.values()[a]);
	}
	return list.iterator();
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:8,代码来源:ExprAllAch.java

示例11: beautify

import org.bukkit.Achievement; //导入依赖的package包/类
/**
 * turn "SHITTY_ACHIEVEMENT_NAME" into "Shitty Achievement Name"
 * @param achievement achievement to beautify
 * @return pretty achievement name
 */
@SuppressWarnings("deprecation")
public static String beautify(Achievement achievement) {
    if (achievement == null) return "<✗>";

    return Arrays.stream(achievement.name().toLowerCase().split("_"))
            .map(s -> s.substring(0, 1).toUpperCase() + s.substring(1))
            .collect(Collectors.joining(" "));
}
 
开发者ID:Scarsz,项目名称:DiscordSRV,代码行数:14,代码来源:PrettyUtil.java

示例12: inventoryOpen

import org.bukkit.Achievement; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:xdev-pl,项目名称:LeagueOfLegends,代码行数:12,代码来源:PlayerAchievementAwardedList.java

示例13: getAchievementFromInternalName

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
public Achievement getAchievementFromInternalName(String name) {
	try {
		return Achievement.valueOf(name.toUpperCase().replace("MINECRAFT:", ""));
	} catch (IllegalArgumentException e) {
		return null;
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:9,代码来源:PokkitUnsafe.java

示例14: awardAchievement

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
public void awardAchievement(Achievement achievement) {
    Validate.notNull(achievement, "Achievement cannot be null");
    if (achievement.hasParent() && !hasAchievement(achievement.getParent())) {
        awardAchievement(achievement.getParent());
    }
    getHandle().getStatisticManager().setStatistic(getHandle(), CraftStatistic.getNMSAchievement(achievement), 1);
    getHandle().getStatisticManager().updateStatistics(getHandle());
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:10,代码来源:CraftPlayer.java

示例15: removeAchievement

import org.bukkit.Achievement; //导入依赖的package包/类
@Override
public void removeAchievement(Achievement achievement) {
    Validate.notNull(achievement, "Achievement cannot be null");
    for (Achievement achieve : Achievement.values()) {
        if (achieve.getParent() == achievement && hasAchievement(achieve)) {
            removeAchievement(achieve);
        }
    }
    getHandle().getStatisticManager().setStatistic(getHandle(), CraftStatistic.getNMSAchievement(achievement), 0);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:11,代码来源:CraftPlayer.java


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