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


Java PlaceholderReplaceEvent类代码示例

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


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

示例1: onPlaceholderReplace

import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    Player player = event.getPlayer();

    if (player == null) {
        return "Player is required.";
    }

    UserData user = instance.getDataManager().getUser(player.getUniqueId(), false);

    if (user == null) {
        return "User data not found.";
    }

    switch (event.getPlaceholder()) {
        case "duels_wins":
            return String.valueOf(user.get(UserData.StatsType.WINS));
        case "duels_losses":
            return String.valueOf(user.get(UserData.StatsType.LOSSES));
        case "duels_request_enabled":
            return user.canRequest() ? "enabled" : "disabled";
    }

    return "Invalid placeholder.";
}
 
开发者ID:RealizedMC,项目名称:Duels,代码行数:26,代码来源:MVdWPlaceholderHook.java

示例2: registerPlaceholder

import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public boolean registerPlaceholder(uSkyBlock plugin, final PlaceholderReplacer replacer) {
    if (isAvailable()) {
        be.maximvdw.placeholderapi.PlaceholderReplacer proxy = new be.maximvdw.placeholderapi.PlaceholderReplacer() {
            @Override
            public String onPlaceholderReplace(PlaceholderReplaceEvent e) {
                log.info("Placeholder: " + e.getPlaceholder());
                if (replacer.getPlaceholders().contains(e.getPlaceholder())) {
                    return replacer.replace(e.getOfflinePlayer(), e.getPlayer(), e.getPlaceholder());
                }
                return null;
            }
        };
        for (String placeholder : replacer.getPlaceholders()) {
            be.maximvdw.placeholderapi.PlaceholderAPI.registerPlaceholder(plugin, placeholder, proxy);
        }
        return true;
    }
    return false;
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:21,代码来源:MVdWPlaceholderAPI.java

示例3: registerPlaceHolder

import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
public static void registerPlaceHolder(Loader loader, String name, final FeatherBoardReplaceEvent event) {
    if (loader instanceof BukkitLoader) {
        if (Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI")) {
            PlaceholderAPI.registerPlaceholder((Plugin) loader, name, new PlaceholderReplacer() {
                @Override
                public String onPlaceholderReplace(PlaceholderReplaceEvent placeholderReplaceEvent) {
                    return event.getValue(placeholderReplaceEvent.getOfflinePlayer().getName(), placeholderReplaceEvent.isOnline());
                }
            });
        }
    }
}
 
开发者ID:greatman,项目名称:GreatmancodeTools,代码行数:13,代码来源:FeatherBoard.java

示例4: onPlaceholderReplace

import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    return playerReplacer.apply(event.getPlayer());
}
 
开发者ID:novucs,项目名称:factions-top,代码行数:5,代码来源:PlayerReplacer.java

示例5: onPlaceholderReplace

import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    return lastReplacer.get();
}
 
开发者ID:novucs,项目名称:factions-top,代码行数:5,代码来源:LastReplacer.java

示例6: onPlaceholderReplace

import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    return rankReplacer.apply(rank);
}
 
开发者ID:novucs,项目名称:factions-top,代码行数:5,代码来源:RankReplacer.java


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