Update to 1.9

This commit is contained in:
Daniel Saukel
2016-03-21 20:35:12 +01:00
parent 08a025fff6
commit 7a514d5378
8 changed files with 886 additions and 844 deletions
+23 -8
View File
@@ -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));