Need help with PotionEffect Builder


I have a wierd issue with the PotionEffect builder method:
I have seen a recent post on the forum about applying Potion effects to the player. First, there were no error detected by Eclipse about that code:

public void addEffect(Player target){
            List<PotionEffect> myList = new ArrayList<PotionEffect>();


Since I moved to Java8 in order to make some other methodes work, that .builder() method is underlined. And here is the message it gives:

This static method of interface PotionEffect can only be accessed as PotionEffect.builder

So, what did I do wrong?

1 Like

You need to make sure you’re targeting Java 8.

ok… I thought it had been cinfigured automaticaly by Eclipse when I created the project…
That’s good to now then ^^
It works. Thanks for the help.