mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 08:59:01 +00:00
Convert pre 1.11 Brews (cosmetic)
This commit is contained in:
@@ -14,8 +14,10 @@ import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -985,19 +987,40 @@ public class Brew implements Cloneable {
|
||||
getFromPotionEffect(((PotionMeta) meta), true);
|
||||
}
|
||||
|
||||
public void convertPre19(ItemStack item) {
|
||||
public void convertPre1_9(ItemStack item) {
|
||||
removeLegacy(item);
|
||||
PotionMeta potionMeta = ((PotionMeta) item.getItemMeta());
|
||||
assert potionMeta != null;
|
||||
|
||||
BrewLore lore = new BrewLore(this, potionMeta);
|
||||
lore.removeEffects();
|
||||
|
||||
if (hasRecipe()) {
|
||||
BrewLore lore = new BrewLore(this, potionMeta);
|
||||
lore.removeEffects();
|
||||
currentRecipe.getColor().colorBrew(potionMeta, item, canDistill());
|
||||
lore.removeLegacySpacing();
|
||||
} else {
|
||||
PotionColor.GREY.colorBrew(potionMeta, item, canDistill());
|
||||
new BrewLore(this, potionMeta).removeLegacySpacing();
|
||||
}
|
||||
lore.removeLegacySpacing();
|
||||
save(potionMeta);
|
||||
item.setItemMeta(potionMeta);
|
||||
}
|
||||
|
||||
public void convertPre1_11(ItemStack item) {
|
||||
removeLegacy(item);
|
||||
PotionMeta potionMeta = ((PotionMeta) item.getItemMeta());
|
||||
assert potionMeta != null;
|
||||
|
||||
potionMeta.setBasePotionData(new PotionData(PotionType.UNCRAFTABLE));
|
||||
BrewLore lore = new BrewLore(this, potionMeta);
|
||||
lore.removeEffects();
|
||||
|
||||
if (hasRecipe()) {
|
||||
lore.addOrReplaceEffects(currentRecipe.getEffects(), getQuality());
|
||||
currentRecipe.getColor().colorBrew(potionMeta, item, canDistill());
|
||||
} else {
|
||||
PotionColor.GREY.colorBrew(potionMeta, item, canDistill());
|
||||
}
|
||||
lore.removeLegacySpacing();
|
||||
save(potionMeta);
|
||||
item.setItemMeta(potionMeta);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user