當前位置: 首頁>>代碼示例>>Java>>正文


Java Attribute.getIntValue方法代碼示例

本文整理匯總了Java中org.jdom2.Attribute.getIntValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Attribute.getIntValue方法的具體用法?Java Attribute.getIntValue怎麽用?Java Attribute.getIntValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdom2.Attribute的用法示例。


在下文中一共展示了Attribute.getIntValue方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseEnchantmentStorage

import org.jdom2.Attribute; //導入方法依賴的package包/類
public static EnchantmentStorageMeta parseEnchantmentStorage(Element xml, EnchantmentStorageMeta source) {
    Element book = xml.getChild("enchanted-book");
    if (book != null) {
        for (Element enchantment : book.getChildren("enchantment")) {
            Enchantment type = Enchantment.getByName(XMLParser.parseEnumValue(enchantment.getTextNormalize()));
            int level = 1;

            try {
                Attribute levelAttribute = enchantment.getAttribute("level");
                if (levelAttribute != null) {
                    level = levelAttribute.getIntValue();
                }
            } catch (DataConversionException ignored) {
            }

            source.addStoredEnchant(type, level, false);
        }
    }

    return source;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:22,代碼來源:XMLItemMeta.java

示例2: parseEnchantments

import org.jdom2.Attribute; //導入方法依賴的package包/類
private static Map<Enchantment, Integer> parseEnchantments(Element xml) {
    Map<Enchantment, Integer> enchantments = new HashMap<>();

    Element element = xml.getChild("enchantments");
    if (element != null) {
        for (Element enchantment : element.getChildren("enchantment")) {
            Enchantment type = Enchantment.getByName(XMLParser.parseEnumValue(enchantment.getTextNormalize()));
            int level = 1;

            try {
                Attribute levelAttribute = enchantment.getAttribute("level");
                if (levelAttribute != null) {
                    level = levelAttribute.getIntValue();
                }
            } catch (DataConversionException ignored) {
            }

            enchantments.put(type, level);
        }
    }

    return enchantments;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:24,代碼來源:XMLItemStack.java

示例3: parseMaxPlayers

import org.jdom2.Attribute; //導入方法依賴的package包/類
public static int parseMaxPlayers(Element xml) {
    Attribute attribute = xml.getAttribute("overfill");
    if (attribute != null) {
        try {
            return attribute.getIntValue();
        } catch (DataConversionException ignored) {
        }
    }

    return 0;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:XMLTeam.java

示例4: parseMinPlayers

import org.jdom2.Attribute; //導入方法依賴的package包/類
public static int parseMinPlayers(Element xml) {
    Attribute attribute = xml.getAttribute("min-players");
    if (attribute != null) {
        try {
            return attribute.getIntValue();
        } catch (DataConversionException ignored) {
        }
    }

    return 0;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:XMLTeam.java

示例5: parseSlots

import org.jdom2.Attribute; //導入方法依賴的package包/類
public static int parseSlots(Element xml) {
    Attribute attribute = xml.getAttribute("slots");
    if (attribute != null) {
        try {
            return attribute.getIntValue();
        } catch (DataConversionException ignored) {
        }
    }

    return 0;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:XMLTeam.java

示例6: parseAmount

import org.jdom2.Attribute; //導入方法依賴的package包/類
private static int parseAmount(Element xml) {
    Attribute attribute = xml.getAttribute("amount");
    if (attribute != null) {
        try {
            return attribute.getIntValue();
        } catch (DataConversionException ignored) {
        }
    }

    return 1;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:XMLItemStack.java

示例7: parseSlot

import org.jdom2.Attribute; //導入方法依賴的package包/類
private int parseSlot(Element xml) {
    Attribute attribute = xml.getAttribute("slot");
    if (attribute != null) {
        try {
            return attribute.getIntValue();
        } catch (DataConversionException ignored) {
        }
    }

    return SLOT_NULL;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:ItemStackContent.java

示例8: parseAmplifier

import org.jdom2.Attribute; //導入方法依賴的package包/類
private static int parseAmplifier(Element xml) {
    Attribute attribute = xml.getAttribute("amplifier");
    if (attribute != null) {
        try {
            return attribute.getIntValue();
        } catch (DataConversionException ignored) {
        }
    }

    return 1;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:XMLPotionEffect.java


注:本文中的org.jdom2.Attribute.getIntValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。