Adding Citadel support and finally fixing brew colors for 1.12

This commit is contained in:
ProgrammerDan
2017-07-26 14:36:50 -04:00
parent 851160fbac
commit 5089b24dac
10 changed files with 115 additions and 16 deletions
+23 -13
View File
@@ -1,5 +1,6 @@
package com.dre.brewery;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.BrewerInventory;
@@ -685,25 +686,27 @@ public class Brew {
}
public enum PotionColor {
PINK(1, PotionType.REGEN),
CYAN(2, PotionType.SPEED),
ORANGE(3, PotionType.FIRE_RESISTANCE),
GREEN(4, PotionType.POISON),
BRIGHT_RED(5, PotionType.INSTANT_HEAL),
BLUE(6, PotionType.NIGHT_VISION),
BLACK(8, PotionType.WEAKNESS),
RED(9, PotionType.STRENGTH),
GREY(10, PotionType.SLOWNESS),
WATER(11, P.use1_9 ? PotionType.WATER_BREATHING : null),
DARK_RED(12, PotionType.INSTANT_DAMAGE),
BRIGHT_GREY(14, PotionType.INVISIBILITY);
PINK(1, PotionType.REGEN, Color.FUCHSIA),
CYAN(2, PotionType.SPEED, Color.AQUA),
ORANGE(3, PotionType.FIRE_RESISTANCE, Color.ORANGE),
GREEN(4, PotionType.POISON, Color.GREEN),
BRIGHT_RED(5, PotionType.INSTANT_HEAL, Color.fromRGB(255,0,0)),
BLUE(6, PotionType.NIGHT_VISION, Color.NAVY),
BLACK(8, PotionType.WEAKNESS, Color.BLACK),
RED(9, PotionType.STRENGTH, Color.fromRGB(196,0,0)),
GREY(10, PotionType.SLOWNESS, Color.GRAY),
WATER(11, P.use1_9 ? PotionType.WATER_BREATHING : null, Color.BLUE),
DARK_RED(12, PotionType.INSTANT_DAMAGE, Color.fromRGB(128,0,0)),
BRIGHT_GREY(14, PotionType.INVISIBILITY, Color.SILVER);
private final int colorId;
private final PotionType type;
private final Color color;
PotionColor(int colorId, PotionType type) {
PotionColor(int colorId, PotionType type, Color color) {
this.colorId = colorId;
this.type = type;
this.color = color;
}
// gets the Damage Value, that sets a color on the potion
@@ -718,11 +721,18 @@ public class Brew {
public PotionType getType() {
return type;
}
public Color getColor() {
return color;
}
public void colorBrew(PotionMeta meta, ItemStack potion, boolean destillable) {
if (P.use1_9) {
meta.setBasePotionData(new PotionData(getType()));
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
if (P.use1_12) {
meta.setColor(getColor());
}
} else {
potion.setDurability(getColorId(destillable));
}