mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 07:49:03 +00:00
Update to 1.9
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
package com.dre.brewery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class BIngredients {
|
||||
public static Set<Material> possibleIngredients = new HashSet<Material>();
|
||||
@@ -84,7 +83,11 @@ public class BIngredients {
|
||||
Brew.addOrReplaceEffects(potionMeta, brew.getEffects(), brew.getQuality());
|
||||
|
||||
cookedName = cookRecipe.getName(quality);
|
||||
potion.setDurability(Brew.PotionColor.valueOf(cookRecipe.getColor()).getColorId(false));
|
||||
if (P.use1_9) {
|
||||
potionMeta.setMainEffect(Brew.PotionColor.valueOf(cookRecipe.getColor()).getEffect());
|
||||
} else {
|
||||
potion.setDurability(Brew.PotionColor.valueOf(cookRecipe.getColor()).getColorId(false));
|
||||
}
|
||||
|
||||
} else {
|
||||
// new base potion
|
||||
@@ -92,14 +95,22 @@ public class BIngredients {
|
||||
|
||||
if (state <= 1) {
|
||||
cookedName = P.p.languageReader.get("Brew_ThickBrew");
|
||||
potion.setDurability(Brew.PotionColor.BLUE.getColorId(false));
|
||||
if (P.use1_9) {
|
||||
potionMeta.setMainEffect(Brew.PotionColor.BLUE.getEffect());
|
||||
} else {
|
||||
potion.setDurability(Brew.PotionColor.BLUE.getColorId(false));
|
||||
}
|
||||
} else {
|
||||
for (Material ingredient : materials.keySet()) {
|
||||
if (cookedNames.containsKey(ingredient)) {
|
||||
// if more than half of the ingredients is of one kind
|
||||
if (materials.get(ingredient) > (getIngredientsCount() / 2)) {
|
||||
cookedName = cookedNames.get(ingredient);
|
||||
potion.setDurability(Brew.PotionColor.CYAN.getColorId(true));
|
||||
if (P.use1_9) {
|
||||
potionMeta.setMainEffect(Brew.PotionColor.CYAN.getEffect());
|
||||
} else {
|
||||
potion.setDurability(Brew.PotionColor.CYAN.getColorId(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,7 +119,11 @@ public class BIngredients {
|
||||
if (cookedName == null) {
|
||||
// if no name could be found
|
||||
cookedName = P.p.languageReader.get("Brew_Undefined");
|
||||
potion.setDurability(Brew.PotionColor.CYAN.getColorId(true));
|
||||
if (P.use1_9) {
|
||||
potionMeta.setMainEffect(Brew.PotionColor.CYAN.getEffect());
|
||||
} else {
|
||||
potion.setDurability(Brew.PotionColor.CYAN.getColorId(true));
|
||||
}
|
||||
}
|
||||
|
||||
potionMeta.setDisplayName(P.p.color("&f" + cookedName));
|
||||
|
||||
Reference in New Issue
Block a user