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


Java Type.BLOCK属性代码示例

本文整理汇总了Java中org.bukkit.Statistic.Type.BLOCK属性的典型用法代码示例。如果您正苦于以下问题:Java Type.BLOCK属性的具体用法?Java Type.BLOCK怎么用?Java Type.BLOCK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.Statistic.Type的用法示例。


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

示例1: statisticTooltip

/**
 * Set the behavior of the component to display information about a parameterless statistic when the client hovers over the text.
 *
 * @param statistic The statistic to display.
 * @param material The sole material parameter to the statistic.
 * @return This message component instance.
 * @exception IllegalArgumentException If the statistic requires a parameter which was not supplied, or was supplied a parameter that was not required.
 */
public MessageComponent statisticTooltip(Statistic statistic, Material material) throws IllegalArgumentException
{
	Type type = statistic.getType();
	if (type == Type.UNTYPED) throw new IllegalArgumentException("That statistic needs no additional parameter!");
	if ((type == Type.BLOCK && material.isBlock()) || type == Type.ENTITY) throw new IllegalArgumentException("Wrong parameter type for that statistic - needs " + type + "!");
	try
	{
		return onHover(MessageHoverEvent.HoverEventAction.SHOW_ACHIEVEMENT, (String) FIELD_STATISTIC_NAME.get(GET_MATERIAL_STATISTIC.invoke(null, statistic, material)));
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
	return this;
}
 
开发者ID:GeorgH93,项目名称:Bukkit_Bungee_PluginLib,代码行数:23,代码来源:MessageComponent.java

示例2: statisticTooltip

/**
 * Set the behavior of the current editing component to display information about a statistic parametered with a material when the client hovers over the text.
 * <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
 * @param which The statistic to display.
 * @param item The sole material parameter to the statistic.
 * @return This builder instance.
 * @exception IllegalArgumentException If the statistic requires a parameter which was not supplied, or was supplied a parameter that was not required.
 */
public FancyMessage statisticTooltip(final Statistic which, Material item) {
	Type type = which.getType();
	if (type == Type.UNTYPED) {
		throw new IllegalArgumentException("That statistic needs no additional parameter!");
	}
	if ((type == Type.BLOCK && item.isBlock()) || type == Type.ENTITY) {
		throw new IllegalArgumentException("Wrong parameter type for that statistic - needs " + type + "!");
	}
	try {
		Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getMaterialStatistic", Statistic.class, Material.class).invoke(null, which, item);
		return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
	} catch (Exception e) {
		e.printStackTrace();
		return this;
	}
}
 
开发者ID:skavrx,项目名称:PartyLobby,代码行数:24,代码来源:FancyMessage.java

示例3: statisticTooltip

public FancyMessage statisticTooltip(final Statistic which, Material item) {
    Type type = which.getType();
    if (type == Type.UNTYPED) {
        throw new IllegalArgumentException("That statistic needs no additional parameter!");
    }
    if ((type == Type.BLOCK && item.isBlock()) || type == Type.ENTITY) {
        throw new IllegalArgumentException("Wrong parameter type for that statistic - needs " + type + "!");
    }

    Object achievement = new SafeMethod(ReflectionUtil.getCBCClass("CraftStatistic"), "getMaterialStatistic", Statistic.class, Material.class).invoke(null, which, item);
    return achievementTooltip(new SafeField<String>(achievement.getClass(), "name").get(achievement));
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:12,代码来源:FancyMessage.java


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