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


Java Texts.of方法代码示例

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


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

示例1: deserialize

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    try {
        return Texts.json().from(json.getAsString());
    } catch (TextMessageException e) {
        e.printStackTrace();
    }
    return Texts.of();
}
 
开发者ID:thomas15v,项目名称:CrossEvents,代码行数:10,代码来源:TextFormatter.java

示例2: getName

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text getName() {
    return Texts.of(TextColors.BLUE, "G",
            TextColors.RED, "o",
            TextColors.YELLOW, "o",
            TextColors.BLUE, "g",
            TextColors.GREEN, "l",
            TextColors.RED, "e");
}
 
开发者ID:InspireNXE,项目名称:Enquiry-Legacy,代码行数:10,代码来源:GoogleEngine.java

示例3: translateAction

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text translateAction(User user)
{
    if (this.hasAttached())
    {
        return super.translateAction(user);
    }
    String delim = ChatFormat.GREY + " | " + ChatFormat.GOLD;
    return Texts.of(super.translateAction(user), "\n" +
        user.getTranslation(POSITIVE, "    with {input#signtext} written on it", StringUtils.implode(delim,
                                                                                                     this.oldLines)));
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:13,代码来源:PlayerSignBreak.java

示例4: translateAction

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text translateAction(User user)
{
    String delim = ChatFormat.GREY + " | " + ChatFormat.GOLD;
    if (oldLines == null || oldLines.length == 0)
    {
        return user.getTranslation(POSITIVE, "{user} wrote {input#signtext} on a sign", this.player.name,
                                   StringUtils.implode(delim, newLines));
    }
    return Texts.of(user.getTranslation(POSITIVE, "{user} wrote {input#signtext} on a sign", this.player.name,
                               StringUtils.implode(delim, newLines)) , "\n" ,
        user.getTranslation(POSITIVE, "    The old signtext was {input#signtext}", StringUtils.implode(delim,
                                                                                                       oldLines)));
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:15,代码来源:SignChange.java

示例5: translateAction

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text translateAction(User user)
{
    if (this.hasAttached())
    {
        return super.translateAction(user);
    }
    String delim = ChatFormat.GREY + " | " + ChatFormat.GOLD;
    return Texts.of(super.translateAction(user), "\n" ,
        user.getTranslation(POSITIVE, "    with {input#signtext} written on it", StringUtils.implode(delim,
                                                                                                     this.oldLines)));
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:13,代码来源:SignBreak.java

示例6: getDescription

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
default Text getDescription() {
    return Texts.of(getStringDescription());
}
 
开发者ID:kenzierocks,项目名称:Annointment,代码行数:4,代码来源:Command.java

示例7: textToString

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Test public void textToString() {
	Text text = Texts.of("something");
	assertEquals("something", new CommandTestHelper(null).toString(text));
}
 
开发者ID:vorburger,项目名称:SwissKnightMinecraft,代码行数:5,代码来源:CommandTestHelperTest.java

示例8: get

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
public Text get(Messages message, String... strings){
   return Texts.of(String.format(languageConfig.getRoot().getNode(message.name()).getString(), strings));
}
 
开发者ID:thomas15v,项目名称:ChunkLord,代码行数:4,代码来源:LanguageManager.java

示例9: getName

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text getName() {
    return Texts.of(TextColors.YELLOW, "DuckDuck", TextColors.GRAY, "Go");
}
 
开发者ID:InspireNXE,项目名称:Enquiry-Legacy,代码行数:5,代码来源:DuckDuckGoEngine.java

示例10: getName

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text getName() {
    return Texts.of(TextColors.GRAY, "Bing");
}
 
开发者ID:InspireNXE,项目名称:Enquiry-Legacy,代码行数:5,代码来源:BingEngine.java

示例11: parseValue

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Nullable
@Override
protected Object parseValue(CommandSource source, CommandArgs args) throws
        ArgumentParseException {
    if (!(source instanceof Living)) {
        throw new ArgumentParseException(Texts.of("The command source is not located!"),
                                         source.toString(), 0);
    }
    final Living callingEntity = (Living) source;
    Location<World> location = callingEntity.getLocation();
    Collection<Entity> nearby = callingEntity.getWorld().getEntities(
            input -> {
                if (input == null) {
                    return false;
                }
                Vector3d targetCoords = input.getLocation().getPosition();
                Vector3d casterCoords = location.getPosition();
                return targetCoords.distance(casterCoords)
                        > EntitySkillArgument.this.maxDistance;
            });
    Vector3d middle = callingEntity.getProperty(EyeLocationProperty.class).get().getValue();

    double closestDistance = this.maxDistance;
    @Nullable
    E closest = null;

    for (Entity entity : nearby) {
        if (!this.clazz.isInstance(entity)) {
            continue;
        }
        @SuppressWarnings("unchecked")
        E ent = (E) entity;

        Vector3d otherMiddle = entity.getLocation().getPosition();
        if (entity instanceof Living) {
            otherMiddle = entity.getProperty(EyeLocationProperty.class).get().getValue();
        }
        final Vector3d diff = otherMiddle.sub(middle);
        // Algorithm: Make a triangle
        final Vector3d doubleDirection = middle.clone();
        final double b = diff.dot(doubleDirection);
        final double c = middle.distanceSquared(otherMiddle);

        final double a = Math.sqrt(c - b * b);
        if (a < closestDistance) {
            if (this.condition.test(ent)) {
                closestDistance = a;
                closest = ent;
            }
        }
    }

    if (closestDistance < this.maxDistance) {
        return closest;
    }
    return null;
}
 
开发者ID:AfterKraft,项目名称:KraftRPG-API,代码行数:58,代码来源:EntitySkillArgument.java

示例12: TestSkillAbstract

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
public TestSkillAbstract(RpgPlugin plugin) {
    super(plugin, "TestSkill", Texts.of("This is a test skill."));
}
 
开发者ID:AfterKraft,项目名称:KraftRPG-API,代码行数:4,代码来源:TestSkillAbstract.java

示例13: StandardEffect

import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
/**
 * Creates a new {@link StandardEffect} with the desired operations, name and effect types.
 *
 * @param name            The name of this standard effect
 * @param applyOperations The many standard operations when the effect is applied
 * @param types           The various effect types
 */
public StandardEffect(String name,
                      Set<ApplyEffectOperation> applyOperations,
                      Collection<EffectType> types) {
    this(name, applyOperations, types, Texts.of(""), Sets.<EffectProperty<?>>newHashSet());
}
 
开发者ID:AfterKraft,项目名称:KraftRPG-API,代码行数:13,代码来源:StandardEffect.java


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