#Assigning information to players

1 messages · Page 1 of 1 (latest)

whole jungle
#

Let me just type this out

lucid bluff
#

ok

whole jungle
#
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

lucid bluff
#

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

whole jungle
#

I'll try it