Problem with Switch statement

Status
This thread has been locked.

Backflip

Extremely Well-Known Member
Banned
Feedback score
5
Posts
248
Reactions
88
Resources
0
So Im triying to make a Switch statement that gets a Wool with the color, not only the white one, but I dont know how.

I tried this but its not working:
Code:
if(e.getInventory().getTitle().equalsIgnoreCase("GUI")) {
            switch (e.getCurrentItem().getType()) {
                case new ItemStack(Material.WOOL, 1, (byte) 5):
                    p.sendMessage("HELLO");

But its not working, it only works with case WOOL: but that is thw white one.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/resource-scam-report.325273/)
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

aw

Deactivated
Feedback score
10
Posts
119
Reactions
42
Resources
0
this is very wrong... please learn basic java.
 

Backflip

Extremely Well-Known Member
Banned
Feedback score
5
Posts
248
Reactions
88
Resources
0
Banned forever. Reason: Scamming (https://builtbybit.com/threads/resource-scam-report.325273/)

aw

Deactivated
Feedback score
10
Posts
119
Reactions
42
Resources
0
You're switching an enum and trying to create a new Itemstack as the case.....................
 

Backflip

Extremely Well-Known Member
Banned
Feedback score
5
Posts
248
Reactions
88
Resources
0
You're switching an enum and trying to create a new Itemstack as the case.....................
Lol, I was triying some ways of doing, that, I know thats not possible, how I ca do It then?
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/resource-scam-report.325273/)

Quokka

Manager & Developer
Premium
Feedback score
3
Posts
213
Reactions
94
Resources
0
Lol, I was triying some ways of doing, that, I know thats not possible, how I ca do It then?

Seems like people on MCM would rather put people down for their mistakes, than to help them lmfao. A joke.

Anyways, you'd really check the ItemStack type first, and then do your checks:

Code:
ItemStack itemStack = #getCurrentItem();
switch (#getType()){
    // use #getDurability() to get the different type of wool.
}

f27d889aa91445959aa49e4cf70960ed.png
 
Last edited:

Backflip

Extremely Well-Known Member
Banned
Feedback score
5
Posts
248
Reactions
88
Resources
0
Seems like people on MCM would rather put people down for their mistakes, than to help them lmfao. A joke.

Anyways, you'd really check the ItemStack type first, and then do your checks:

Code:
ItemStack itemStack = #getCurrentItem();
switch (#getType()){
    // use #getDurability() to get the different type of wool.
}

f27d889aa91445959aa49e4cf70960ed.png
Oh thank you! Finally someone helps me.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/resource-scam-report.325273/)
Status
This thread has been locked.
Top