Java Code Examples for org.bukkit.potion.PotionData#isExtended()

The following examples show how to use org.bukkit.potion.PotionData#isExtended() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PotionHandler.java    From BetonQuest with GNU General Public License v3.0 6 votes vote down vote up
public boolean checkBase(PotionData base) {
    switch (typeE) {
        case WHATEVER:
            return true;
        case REQUIRED:
            if (base.getType() != type) {
                return false;
            }
            if (extendedE == Existence.REQUIRED && base.isExtended() != extended) {
                return false;
            }
            return upgradedE != Existence.REQUIRED || base.isUpgraded() == upgraded;
        default:
            return false;
    }
}
 
Example 2
Source File: CraftPotionUtil.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public static String fromBukkit(PotionData data) {
    String type;
    if (data.isUpgraded()) {
        type = upgradeable.get(data.getType());
    } else if (data.isExtended()) {
        type = extendable.get(data.getType());
    } else {
        type = regular.get(data.getType());
    }
    Preconditions.checkNotNull(type, "Unknown potion type from data " + data);

    return "minecraft:" + type;
}
 
Example 3
Source File: VersionUtils_1_13.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JsonObject getBasePotionEffect(PotionMeta potionMeta) {
    PotionData potionData = potionMeta.getBasePotionData();
    JsonObject baseEffect = new JsonObject();
    baseEffect.addProperty("type", potionData.getType().name());

    if (potionData.isUpgraded()) {
        baseEffect.addProperty("upgraded", true);
    }
    if (potionData.isExtended()) {
        baseEffect.addProperty("extended", true);
    }
    return baseEffect;
}
 
Example 4
Source File: VersionUtils_1_12.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JsonObject getBasePotionEffect(PotionMeta potionMeta) {
    PotionData potionData = potionMeta.getBasePotionData();
    JsonObject baseEffect = new JsonObject();
    baseEffect.addProperty("type", potionData.getType().name());

    if (potionData.isUpgraded()) {
        baseEffect.addProperty("upgraded", true);
    }
    if (potionData.isExtended()) {
        baseEffect.addProperty("extended", true);
    }
    return baseEffect;
}