TipsFactory.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:tips 作者:
private void parse(ConfigurationSection config) {
    for (Map.Entry<String, Object> entry : config.getValues(false).entrySet()) {

        MemorySection section = (MemorySection) entry.getValue();

        String message = ChatColor.translateAlternateColorCodes('`', entry.getKey());

        String exemptPermission = section.getString("exempt-permission");
        String receivePermission = section.getString("receive-permission");

        if (exemptPermission != null && receivePermission != null && exemptPermission.equals(receivePermission)) {
            throw new IllegalArgumentException("exempt permission and receive permission are at the same value");
        }

        String formatterName = section.getString("formatter");
        TipFormatter formatter = this.plugin.getTipsManager().getFormatter(formatterName);

        if (formatter == null) {
            throw new IllegalArgumentException("that formatter does not exist");
        }

        this.tips.add(new Tip(receivePermission, exemptPermission, message, formatter));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号