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


Java CompatibilityHandler类代码示例

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


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

示例1: spawnVillager

import io.github.dre2n.commons.compatibility.CompatibilityHandler; //导入依赖的package包/类
/**
 * @param location
 * the location where the villager will spawn
 * @return
 * the spawned villager
 */
public static Villager spawnVillager(Location location) {
    Villager villager = (Villager) location.getWorld().spawnEntity(location, EntityType.VILLAGER);
    if (Version.andHigher(Version.MC1_11).contains(CompatibilityHandler.getInstance().getVersion())) {
        villager.setProfession(Profession.NITWIT);
    } else {
        villager.setProfession(Profession.FARMER);
    }
    villager.setCustomName(MOB_VILLAGER.getMessage());
    villager.setCustomNameVisible(true);
    return villager;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:18,代码来源:FMob.java

示例2: stopSound

import io.github.dre2n.commons.compatibility.CompatibilityHandler; //导入依赖的package包/类
private void stopSound(Player player, Faction faction) {
    if (player == null || faction == null || faction.getAnthem() == null) {
        return;
    }
    if (Version.andHigher(Version.MC1_10).contains(CompatibilityHandler.getInstance().getVersion())) {
        player.stopSound(faction.getAnthem());
    } else {
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stopsound " + player.getName() + " master " + faction.getAnthem());
    }
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:11,代码来源:PlayerListener.java

示例3: onExecute

import io.github.dre2n.commons.compatibility.CompatibilityHandler; //导入依赖的package包/类
@Override
public void onExecute(String[] args, CommandSender sender) {
    List<UniversalItem> iItemList = CaliburnAPI.getInstance().getItems().getItems(CustomItem.class);

    plugin.loadIConfig();
    plugin.loadMessageConfig();
    plugin.loadICommands();
    plugin.loadAPI();

    MessageUtil.sendPluginTag(sender, plugin);
    MessageUtil.sendCenteredMessage(sender, IMessage.COMMAND_RELOAD_SUCCESS.getMessage());
    MessageUtil.sendCenteredMessage(sender, IMessage.COMMAND_MAIN_LOADED.getMessage(String.valueOf(iItemList.size())));
    MessageUtil.sendCenteredMessage(sender, IMessage.COMMAND_MAIN_COMPATIBILITY.getMessage(String.valueOf(CompatibilityHandler.getInstance().getInternals())));
}
 
开发者ID:DRE2N,项目名称:ItemsXL,代码行数:15,代码来源:ReloadCommand.java

示例4: onExecute

import io.github.dre2n.commons.compatibility.CompatibilityHandler; //导入依赖的package包/类
@Override
public void onExecute(String[] args, CommandSender sender) {
    List<UniversalItem> itemList = CaliburnAPI.getInstance().getItems().getItems(CustomItem.class);

    MessageUtil.sendCenteredMessage(sender, "&4" + I[0] + T[0] + E[0] + M[0] + S[0] + "&f" + X[0] + L[0]);
    MessageUtil.sendCenteredMessage(sender, "&4" + I[1] + T[1] + E[1] + M[1] + S[1] + "&f" + X[1] + L[1]);
    MessageUtil.sendCenteredMessage(sender, "&4" + I[2] + T[2] + E[2] + M[2] + S[2] + "&f" + X[2] + L[2]);
    MessageUtil.sendCenteredMessage(sender, "&4" + I[3] + T[3] + E[3] + M[3] + S[3] + "&f" + X[3] + L[3]);
    MessageUtil.sendCenteredMessage(sender, "&4" + I[4] + T[4] + E[4] + M[4] + S[4] + "&f" + X[4] + L[4]);
    MessageUtil.sendCenteredMessage(sender, "&b&l######## " + IMessage.COMMAND_MAIN_WELCOME.getMessage() + " &7v" + plugin.getDescription().getVersion() + " &b&l########");
    MessageUtil.sendCenteredMessage(sender, IMessage.COMMAND_MAIN_LOADED.getMessage(String.valueOf(itemList.size())));
    MessageUtil.sendCenteredMessage(sender, IMessage.COMMAND_MAIN_COMPATIBILITY.getMessage(CompatibilityHandler.getInstance().getInternals().toString()));
    MessageUtil.sendCenteredMessage(sender, IMessage.COMMAND_MAIN_HELP.getMessage());
    MessageUtil.sendCenteredMessage(sender, "&7\u00a92015-2017 Daniel Saukel; licensed under GPLv3.");
}
 
开发者ID:DRE2N,项目名称:ItemsXL,代码行数:16,代码来源:MainCommand.java

示例5: sendNewWarnings

import io.github.dre2n.commons.compatibility.CompatibilityHandler; //导入依赖的package包/类
/**
 * Sends notifications of new warnings to the player
 */
public void sendNewWarnings() {
    if (player == null || !player.isOnline()) {
        return;
    }
    int i = 0;
    WReason send = null;
    for (WReason reason : data.getReasons()) {
        if (!reason.isSeen()) {
            i++;
            send = reason;
            reason.setSeen(true);
        }
    }
    if (i == 0) {
        return;
    } else if (i == 1) {
        MessageUtil.sendMessage(player, WMessages.NEW_WARNINGS_ONE.getMessage(send.getMod().getName(), send.getCase()));
    } else if (i > 1) {
        MessageUtil.sendMessage(player, WMessages.NEW_WARNINGS_MULTIPLE.getMessage());
    }
    if (CompatibilityHandler.getInstance().isSpigot()) {
        BaseComponent[] msg = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', WMessages.NEW_WARNINGS_CLICK.getMessage()));
        ClickEvent onClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/warnxs list");
        for (BaseComponent component : msg) {
            component.setClickEvent(onClick);
        }
        player.spigot().sendMessage(msg);
    } else {
        MessageUtil.sendMessage(player, WMessages.NEW_WARNINGS_CMD.getMessage());
    }
}
 
开发者ID:DRE2N,项目名称:WarnXS,代码行数:35,代码来源:WPlayer.java

示例6: onExecute

import io.github.dre2n.commons.compatibility.CompatibilityHandler; //导入依赖的package包/类
@Override
public void onExecute(String[] args, CommandSender sender) {
    WPlayer wPlayer = null;
    if (args.length == 2 && WPermissions.hasPermission(sender, WPermissions.LIST_OTHERS)) {
        wPlayer = plugin.getWPlayers().getByName(args[1]);
        if (wPlayer == null) {
            MessageUtil.sendMessage(sender, WMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
            return;
        }
    } else if (sender instanceof Player) {
        wPlayer = plugin.getWPlayers().getByPlayer((Player) sender);
    } else {
        MessageUtil.sendMessage(sender, WMessages.ERROR_NO_SUCH_PLAYER.getMessage("none"));
        return;
    }

    MessageUtil.sendCenteredMessage(sender, WMessages.CMD_LIST_PENALTY_POINTS.getMessage(wPlayer.getName(), String.valueOf(wPlayer.getPenaltyPoints())));
    MessageUtil.sendCenteredMessage(sender, "&e&l= = = = = = = = = =");
    MessageUtil.sendMessage(sender, "&bDATE &e| &bMOD &e| &bPENALTY POINTS");
    for (WReason reason : wPlayer.getData().getReasons()) {
        String date = reason.getDate().toString();
        String pps = String.valueOf(reason.getPenaltyPoints());
        String mod = reason.getMod().getName();
        String wCase = reason.getCase();
        String message = ChatColor.GOLD + date + ChatColor.YELLOW + " | " + ChatColor.GOLD + mod + ChatColor.YELLOW + " | " + ChatColor.GOLD + pps;
        if (CompatibilityHandler.getInstance().isSpigot()) {
            HoverEvent onHover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(" " + ChatColor.DARK_RED + wCase));
            BaseComponent[] text = TextComponent.fromLegacyText(message);
            for (BaseComponent component : text) {
                component.setHoverEvent(onHover);
            }
            ((Player) sender).spigot().sendMessage(text);
        } else {
            MessageUtil.sendMessage(sender, message);
        }
    }
}
 
开发者ID:DRE2N,项目名称:WarnXS,代码行数:38,代码来源:ListCommand.java


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