#Assigning information to players
1 messages · Page 1 of 1 (latest)
ok
public class HardModeEvents implements Listener {
boolean already_Informed = false;
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (player.getLocation().getBlock().getBiome() == Biome.ICE_SPIKES) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1, 2));
if (already_Informed == false) {
player.sendMessage(ChatColor.BLUE + "It's getting cold here");
already_Informed = true;
}
} else {
already_Informed = false;
}
}
}
I'm just wondering how I would assign the boolean per player and not global
This may be basic java knowledge that I'm lacking
you know what time it is?
HASHMAP TIME
nvm, you can just make a set
make a set of informed players (add the player to that set eevrytime u inform them)
now use set.contains(player) to check if they have been informed
//sets are faster when it comes to checking if they contain x element so use sets over lists
I'll try it