What I am trying to do: Left click with bow: "Fire arrows" Left click again with bow: "Slow Arrows" Left click: "Fire arrows" ext ext. I've tried many ways to do this but I've been feeling really sick and as a dev I need to get this done quickly by tomorrow :S How would I do this using HashMaps???
No, I want to do: Left click to enter fire mode, whenever their arrows hit someone it burns them. Left click again to enter slow mode whenever their arrows hit someone the target is slowed then it goes back to fire and then back to slow.
Code:java HashMap<Player, String> playerState //on left clickif(playerState.get(player) == "fire"){playerState.put(player, "slow");}else{playerState.put(player, "fire");} //on arrow hit if(the arrow was shot by a player){Player shooter = //get the shooter if(playerState.get(shooter) == "fire"){//set the person who was hit on fire}else if(playerState.get(shooter) == "slow")){//add slowness to the person who was hit} } This is not real java code. fix it yourself
my tip: change the display name of the bow when you click in the air, is rather easy. then when a bow hits, iterate through the shooters inventory and chech what the bow is named.
MrSnare sorry to be a pain but I've still got a migraine, would you be able to explain how to use the code you gave me before. My previous methods were setting the lore > check the lore then set it again, but the issue im having is putting them back to the start.
Do you know how to use HashMaps? If not, go learn how to use it. This code is pretty simple. I even told you what events to put the lines in.
when you create the class do: playerState = new HashMap<Player, String>(); you have to instantiate it.