Solved Material enum doesnt work

joshy

New member
Jun 8, 2024
2
0
1
Hey there,

after a long time, i started developing plugins again today. Embarrassingly i already got defeated by the second class im trying to write:

If i try to import org.bukkit.Material; it doesnt work, bc it doesnt find the Class / Enum...
1717874565468.png
other classes of bukkit, like org.bukkit.inventory.ItemStack; work perfectly fine.
1717874691678.png

I tried finding other issues like this on Stackoverflow, this website and google generally, but didnt find anything.

My information:
IDE: IntelliJ IDEA
Java: 17
Build System: Maven
Paper: 1.20.6-137

Can anyone help me with this problem? Im freaking out...

If you need stuff like my pom.xml or smth, let me know!

Thanks :)
Joshy
 

joshy

New member
Jun 8, 2024
2
0
1
You probably have to update IntelliJ and also use Java 21
Worked perfectly, thank you!

I originally used Java 17, because Gradle complained, that it is not compatible and i didnt get it to work.
Any idea, why thats the case? (I used the latest gradle version...)

In the paper docs Java version 21 and gradle are recommended...

Do you think this was because of the outdated intellij version?
 

Machine Maker

Paper Developer
Staff member
Dec 17, 2021
148
6
22
18
California
You seem to be missing some fundamentals in the java programming language, as well as understanding of syntax highlighting. The first image is invalid java, the second image is missing a semicolon, the 3rd image just shows that the Material import isn't being used.
 

VeniceTheMenance

New member
Aug 27, 2024
2
0
1
You seem to be missing some fundamentals in the java programming language, as well as understanding of syntax highlighting. The first image is invalid java, the second image is missing a semicolon, the 3rd image just shows that the Material import isn't being used.
yeah when i try to add a semicolon it just grays out and doesn’t use
 

stefvanschie

Moderator
Staff member
Dec 17, 2021
122
7
21
18
That is because the code in which you try to use Material is invalid. You can't take materials from RecipeChoice. Simply use Material.DIAMOND.