You need to learn to use classes for grouping items together. If you use this class throughout your script you will remove all of your redundant code where you have to check each type. (Edit as EagleScript said Enum Classes will make this way better so here is the same thing written with enums now)
public enum Potion {
IRIT(259, 101),
TOADFLAX(2998, 3002),
AVENTOE(261, 103),
KWUARM(263, 105),
CANDENTINE(265, 107),
LANTADYME(2481, 2483);
public final int HerbPrice;
public final int Margin;
public final int UnfinishedPrice;
public final String Name;
public final int HerbId;
public final int UnfinishedId;
private final String UnfinishedName;
Potion(int herbId, int unfinishedId) {
Name = name().substring(0,1).toUpperCase() + name().substring(1).toLowerCase();
UnfinishedName = Name + " potion (unf)";
HerbId = herbId;
UnfinishedId = unfinishedId;
// TODO: you should make your GE lookup class methods static so you dont need to instiantiate this.
GrandExchange ge = new GrandExchange();
HerbPrice = Math.max(ge.getBuyingPrice(HerbId), ge.getSellingPrice(HerbId));
UnfinishedPrice = Math.min(ge.getBuyingPrice(UnfinishedId), ge.getSellingPrice(UnfinishedId));
Margin = UnfinishedPrice - HerbPrice;
}
}
// here is how you would get the current potion you are using
Potion highestMarginPotion = Arrays.stream(Potion.values()).max(Comparator.comparingInt(p -> p.Margin)).get();
Please make sure you know how to use classes though before using this code.