本文整理汇总了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.";
}
示例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;
}
示例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());
}
});
}
}
}
示例4: onPlaceholderReplace
import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
return playerReplacer.apply(event.getPlayer());
}
示例5: onPlaceholderReplace
import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
return lastReplacer.get();
}
示例6: onPlaceholderReplace
import be.maximvdw.placeholderapi.PlaceholderReplaceEvent; //导入依赖的package包/类
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
return rankReplacer.apply(rank);
}