Java Code Examples for org.bukkit.potion.PotionType#INVISIBILITY

The following examples show how to use org.bukkit.potion.PotionType#INVISIBILITY . 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: ItemBuilder.java    From Crazy-Crates with MIT License 5 votes vote down vote up
private PotionType getPotionType(PotionEffectType type) {
    if (type != null) {
        if (type.equals(PotionEffectType.FIRE_RESISTANCE)) {
            return PotionType.FIRE_RESISTANCE;
        } else if (type.equals(PotionEffectType.HARM)) {
            return PotionType.INSTANT_DAMAGE;
        } else if (type.equals(PotionEffectType.HEAL)) {
            return PotionType.INSTANT_HEAL;
        } else if (type.equals(PotionEffectType.INVISIBILITY)) {
            return PotionType.INVISIBILITY;
        } else if (type.equals(PotionEffectType.JUMP)) {
            return PotionType.JUMP;
        } else if (type.equals(PotionEffectType.getByName("LUCK"))) {
            return PotionType.valueOf("LUCK");
        } else if (type.equals(PotionEffectType.NIGHT_VISION)) {
            return PotionType.NIGHT_VISION;
        } else if (type.equals(PotionEffectType.POISON)) {
            return PotionType.POISON;
        } else if (type.equals(PotionEffectType.REGENERATION)) {
            return PotionType.REGEN;
        } else if (type.equals(PotionEffectType.SLOW)) {
            return PotionType.SLOWNESS;
        } else if (type.equals(PotionEffectType.SPEED)) {
            return PotionType.SPEED;
        } else if (type.equals(PotionEffectType.INCREASE_DAMAGE)) {
            return PotionType.STRENGTH;
        } else if (type.equals(PotionEffectType.WATER_BREATHING)) {
            return PotionType.WATER_BREATHING;
        } else if (type.equals(PotionEffectType.WEAKNESS)) {
            return PotionType.WEAKNESS;
        }
    }
    return null;
}
 
Example 2
Source File: PotionEffectUtils.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Checks if given string represents a known potion type and returns that type.
 * Unused currently, will be used soon (TM).
 * @param name Name of potion type
 * @return
 */
@Nullable
public static PotionType checkPotionType(String name) {
	switch (name) {
		case "uncraftable":
		case "empty":
			return PotionType.UNCRAFTABLE;
		case "mundane":
			return PotionType.MUNDANE;
		case "thick":
			return PotionType.THICK;
		case "night vision":
		case "darkvision":
			return PotionType.NIGHT_VISION;
		case "invisibility":
			return PotionType.INVISIBILITY;
		case "leaping":
		case "jump boost":
			return PotionType.JUMP;
		case "fire resistance":
		case "fire immunity":
			return PotionType.FIRE_RESISTANCE;
		case "swiftness":
		case "speed":
			return PotionType.SPEED;
		case "slowness":
			return PotionType.SLOWNESS;
		case "water breathing":
			return PotionType.WATER_BREATHING;
		case "instant health":
		case "healing":
		case "health":
			return PotionType.INSTANT_HEAL;
		case "instant damage":
		case "harming":
		case "damage":
			return PotionType.INSTANT_DAMAGE;
		case "poison":
			return PotionType.POISON;
		case "regeneration":
		case "regen":
			return PotionType.REGEN;
		case "strength":
			return PotionType.STRENGTH;
		case "weakness":
			return PotionType.WEAKNESS;
		case "luck":
			return PotionType.LUCK;
	}
	
	return null;
}
 
Example 3
Source File: NMSHandler.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> cont = (Map<String,Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String,Tag> contents = (Map<String,Tag>)((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag)contents.get("Potion"));
            if (stringTag != null) {
                String tag = stringTag.getValue().replace("minecraft:", "");
                PotionType type = null;
                boolean strong = tag.contains("strong");
                boolean _long = tag.contains("long");
                //Bukkit.getLogger().info("tag = " + tag);
                if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
                    type = PotionType.FIRE_RESISTANCE;
                }else if(tag.equals("harming") || tag.equals("strong_harming")){
                    type = PotionType.INSTANT_DAMAGE;
                }else if(tag.equals("healing") || tag.equals("strong_healing")){
                    type = PotionType.INSTANT_HEAL;
                }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
                    type = PotionType.INVISIBILITY;
                }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
                    type = PotionType.JUMP;
                }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
                    type = PotionType.NIGHT_VISION;
                }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
                    type = PotionType.POISON;
                }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
                    type = PotionType.REGEN;
                }else if(tag.equals("slowness") || tag.equals("long_slowness")){
                    type = PotionType.SLOWNESS;
                }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
                    type = PotionType.SPEED;
                }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
                    type = PotionType.STRENGTH;
                }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
                    type = PotionType.WATER_BREATHING;
                }else if(tag.equals("water")){
                    type = PotionType.WATER;
                }else if(tag.equals("weakness") || tag.equals("long_weakness")){
                    type = PotionType.WEAKNESS;
                }else{
                    return chestItem;
                }
                Potion potion = new Potion(type);
                potion.setHasExtendedDuration(_long);
                potion.setLevel(strong ? 2 : 1);
                chestItem = potion.toItemStack(chestItem.getAmount());
            }
        }
    }

    return chestItem;
}
 
Example 4
Source File: NMSHandler.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> cont = (Map<String,Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String,Tag> contents = (Map<String,Tag>)((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag)contents.get("Potion"));
            if (stringTag != null) {
                String tag = stringTag.getValue().replace("minecraft:", "");
                PotionType type = null;
                boolean strong = tag.contains("strong");
                boolean _long = tag.contains("long");
                //Bukkit.getLogger().info("tag = " + tag);
                if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
                    type = PotionType.FIRE_RESISTANCE;
                }else if(tag.equals("harming") || tag.equals("strong_harming")){
                    type = PotionType.INSTANT_DAMAGE;
                }else if(tag.equals("healing") || tag.equals("strong_healing")){
                    type = PotionType.INSTANT_HEAL;
                }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
                    type = PotionType.INVISIBILITY;
                }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
                    type = PotionType.JUMP;
                }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
                    type = PotionType.NIGHT_VISION;
                }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
                    type = PotionType.POISON;
                }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
                    type = PotionType.REGEN;
                }else if(tag.equals("slowness") || tag.equals("long_slowness")){
                    type = PotionType.SLOWNESS;
                }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
                    type = PotionType.SPEED;
                }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
                    type = PotionType.STRENGTH;
                }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
                    type = PotionType.WATER_BREATHING;
                }else if(tag.equals("water")){
                    type = PotionType.WATER;
                }else if(tag.equals("weakness") || tag.equals("long_weakness")){
                    type = PotionType.WEAKNESS;
                }else{
                    return chestItem;
                }
                Potion potion = new Potion(type);
                potion.setHasExtendedDuration(_long);
                potion.setLevel(strong ? 2 : 1);
                chestItem = potion.toItemStack(chestItem.getAmount());
            }
        }
    }

    return chestItem;
}
 
Example 5
Source File: NMSHandler.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> cont = (Map<String,Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String,Tag> contents = (Map<String,Tag>)((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag)contents.get("Potion"));
            if (stringTag != null) {
                String tag = stringTag.getValue().replace("minecraft:", "");
                PotionType type = null;
                boolean strong = tag.contains("strong");
                boolean _long = tag.contains("long");
                //Bukkit.getLogger().info("tag = " + tag);
                if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
                    type = PotionType.FIRE_RESISTANCE;
                }else if(tag.equals("harming") || tag.equals("strong_harming")){
                    type = PotionType.INSTANT_DAMAGE;
                }else if(tag.equals("healing") || tag.equals("strong_healing")){
                    type = PotionType.INSTANT_HEAL;
                }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
                    type = PotionType.INVISIBILITY;
                }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
                    type = PotionType.JUMP;
                }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
                    type = PotionType.NIGHT_VISION;
                }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
                    type = PotionType.POISON;
                }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
                    type = PotionType.REGEN;
                }else if(tag.equals("slowness") || tag.equals("long_slowness")){
                    type = PotionType.SLOWNESS;
                }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
                    type = PotionType.SPEED;
                }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
                    type = PotionType.STRENGTH;
                }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
                    type = PotionType.WATER_BREATHING;
                }else if(tag.equals("water")){
                    type = PotionType.WATER;
                }else if(tag.equals("weakness") || tag.equals("long_weakness")){
                    type = PotionType.WEAKNESS;
                }else{
                    return chestItem;
                }
                Potion potion = new Potion(type);
                potion.setHasExtendedDuration(_long);
                potion.setLevel(strong ? 2 : 1);
                chestItem = potion.toItemStack(chestItem.getAmount());
            }
        }
    }

    return chestItem;
}
 
Example 6
Source File: NMSHandler.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> cont = (Map<String,Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String,Tag> contents = (Map<String,Tag>)((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag)contents.get("Potion"));
            if (stringTag != null) {
                String tag = stringTag.getValue().replace("minecraft:", "");
                PotionType type = null;
                boolean strong = tag.contains("strong");
                boolean _long = tag.contains("long");
                //Bukkit.getLogger().info("tag = " + tag);
                if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
                    type = PotionType.FIRE_RESISTANCE;
                }else if(tag.equals("harming") || tag.equals("strong_harming")){
                    type = PotionType.INSTANT_DAMAGE;
                }else if(tag.equals("healing") || tag.equals("strong_healing")){
                    type = PotionType.INSTANT_HEAL;
                }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
                    type = PotionType.INVISIBILITY;
                }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
                    type = PotionType.JUMP;
                }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
                    type = PotionType.NIGHT_VISION;
                }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
                    type = PotionType.POISON;
                }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
                    type = PotionType.REGEN;
                }else if(tag.equals("slowness") || tag.equals("long_slowness")){
                    type = PotionType.SLOWNESS;
                }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
                    type = PotionType.SPEED;
                }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
                    type = PotionType.STRENGTH;
                }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
                    type = PotionType.WATER_BREATHING;
                }else if(tag.equals("water")){
                    type = PotionType.WATER;
                }else if(tag.equals("weakness") || tag.equals("long_weakness")){
                    type = PotionType.WEAKNESS;
                }else{
                    return chestItem;
                }
                Potion potion = new Potion(type);
                potion.setHasExtendedDuration(_long);
                potion.setLevel(strong ? 2 : 1);
                chestItem = potion.toItemStack(chestItem.getAmount());
            }
        }
    }

    return chestItem;
}
 
Example 7
Source File: NMSHandler.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> contents = (Map<String,Tag>) ((CompoundTag) itemTags).getValue().get("tag").getValue();
    StringTag stringTag = ((StringTag)contents.get("Potion"));
    if (stringTag != null) {
        String tag = stringTag.getValue().replace("minecraft:", "");
        PotionType type = null;
        boolean strong = tag.contains("strong");
        boolean _long = tag.contains("long");
        //Bukkit.getLogger().info("tag = " + tag);
        if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
            type = PotionType.FIRE_RESISTANCE;
        }else if(tag.equals("harming") || tag.equals("strong_harming")){
            type = PotionType.INSTANT_DAMAGE;
        }else if(tag.equals("healing") || tag.equals("strong_healing")){
            type = PotionType.INSTANT_HEAL;
        }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
            type = PotionType.INVISIBILITY;
        }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
            type = PotionType.JUMP;
        }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
            type = PotionType.NIGHT_VISION;
        }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
            type = PotionType.POISON;
        }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
            type = PotionType.REGEN;
        }else if(tag.equals("slowness") || tag.equals("long_slowness")){
            type = PotionType.SLOWNESS;
        }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
            type = PotionType.SPEED;
        }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
            type = PotionType.STRENGTH;
        }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
            type = PotionType.WATER_BREATHING;
        }else if(tag.equals("water")){
            type = PotionType.WATER;
        }else if(tag.equals("weakness") || tag.equals("long_weakness")){
            type = PotionType.WEAKNESS;
        }else{
            return chestItem;
        }
        Potion potion = new Potion(type);
        potion.setHasExtendedDuration(_long);
        potion.setLevel(strong ? 2 : 1);
        chestItem = potion.toItemStack(chestItem.getAmount());
    }

    return chestItem;
}
 
Example 8
Source File: NMSHandler.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> cont = (Map<String,Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String,Tag> contents = (Map<String,Tag>)((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag)contents.get("Potion"));
            if (stringTag != null) {
                String tag = stringTag.getValue().replace("minecraft:", "");
                PotionType type = null;
                boolean strong = tag.contains("strong");
                boolean _long = tag.contains("long");
                //Bukkit.getLogger().info("tag = " + tag);
                if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
                    type = PotionType.FIRE_RESISTANCE;
                }else if(tag.equals("harming") || tag.equals("strong_harming")){
                    type = PotionType.INSTANT_DAMAGE;
                }else if(tag.equals("healing") || tag.equals("strong_healing")){
                    type = PotionType.INSTANT_HEAL;
                }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
                    type = PotionType.INVISIBILITY;
                }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
                    type = PotionType.JUMP;
                }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
                    type = PotionType.NIGHT_VISION;
                }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
                    type = PotionType.POISON;
                }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
                    type = PotionType.REGEN;
                }else if(tag.equals("slowness") || tag.equals("long_slowness")){
                    type = PotionType.SLOWNESS;
                }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
                    type = PotionType.SPEED;
                }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
                    type = PotionType.STRENGTH;
                }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
                    type = PotionType.WATER_BREATHING;
                }else if(tag.equals("water")){
                    type = PotionType.WATER;
                }else if(tag.equals("weakness") || tag.equals("long_weakness")){
                    type = PotionType.WEAKNESS;
                }else{
                    return chestItem;
                }
                Potion potion = new Potion(type);
                potion.setHasExtendedDuration(_long);
                potion.setLevel(strong ? 2 : 1);
                chestItem = potion.toItemStack(chestItem.getAmount());
            }
        }
    }

    return chestItem;
}