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


Java Statistic类代码示例

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


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

示例1: replace

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
@Override
public Text replace(Text text, @Nullable Object player) {
    if (player instanceof Player) {
        Player p = (Player) player;
        for (String var : TextUtil.getVariables(text)) {
            if (var.startsWith("%stat:")) {
                try {
                    String stat = var.replace("%", "").split(":")[1];
                    Long value = p.get(Keys.STATISTICS).get().get(Sponge.getRegistry().getType(Statistic.class, stat).get());
                    if (value == null) value = 0L;
                    text = TextUtil.replace(text, var, Messages.toText(value + ""));
                } catch (Exception ex) {
                    text = TextUtil.replace(text, var, Text.of());
                }
            }
        }
    }
    return text;
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:20,代码来源:StatVariable.java

示例2: getStatisticValues

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
public Map<Statistic, Long> getStatisticValues() {
    final Map<Statistic, Long> map = new HashMap<>();
    for (Map.Entry<String, StatisticEntry> entry : this.statisticEntries.entrySet()) {
        final LanternStatistic statistic = entry.getValue().getStatistic();
        if (statistic != null) {
            map.put(statistic, entry.getValue().get());
        }
    }
    return map;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:StatisticMap.java

示例3: StatisticView

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
public StatisticView(Statistic value) {
    super(value);

    this.stat = value.getId();
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:6,代码来源:StatisticView.java

示例4: register

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
@Override
protected void register(Statistic catalogType) {
    super.register(catalogType);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:StatisticRegistryModule.java

示例5: internalRegister

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
void internalRegister(Statistic catalogType, boolean disallowInbuiltPluginIds) {
    super.register(catalogType, disallowInbuiltPluginIds);
    this.byInternalId.put(((LanternStatistic) catalogType).getInternalId(), catalogType);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:StatisticRegistryModule.java

示例6: getByInternalId

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
public Optional<Statistic> getByInternalId(String internalId) {
    return Optional.ofNullable(this.byInternalId.get(checkNotNull(internalId, "internalId")));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:StatisticRegistryModule.java

示例7: get

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
public StatisticEntry get(Statistic statistic) {
    return this.statisticEntries.computeIfAbsent(((LanternStatistic) statistic).getInternalId(),
            id -> new StatisticEntry((LanternStatistic) statistic));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:StatisticMap.java

示例8: build

import org.spongepowered.api.statistic.Statistic; //导入依赖的package包/类
@Override
protected Statistic build(String pluginId, String id, String name, Translation translation, StatisticType type, NumberFormat format,
        String internalId, @Nullable Criterion criterion) {
    return new LanternStatistic(pluginId, id, name, translation, internalId, format, criterion, type);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternStatisticBuilder.java


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