hashmap help?

Discussion in 'Plugin Development' started by thewalkingplay, Jun 8, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    hi, i'm making a minigame server and i need to make a invincible countdown, but, in different times (when the player joins the arena the player will be invincible for 3 seconds) i know how to create a runnable, i nned a way to decrase all the hashmap integers by 1 at the same time and if the player is with the value 0 the player is removed from the hashmap.

    hashmap class:
    package me.thewalkingplay.cookiesplap.arena;
    import java.util.HashMap;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    public class ArenaPlayersManager {
        static HashMap<String, String> playersInArena = new HashMap<String, String>();
        static HashMap<String, Integer> protectedPlayers = new HashMap<String, Integer>();
        public static void addPlayerOnArena(String player, String arena) {
            playersInArena.put(player, arena);
            Player p = Bukkit.getPlayer(player);
            p.sendMessage(ChatColor.GREEN + "Voce entrou na arena: " + ChatColor.AQUA + arena);
        public static void removePlayerFromArema(String player) {       
        public static String getPlayerArena(String player) {
            return playersInArena.get(player);
        public static boolean playerIsInArena(String player) {
            if (playersInArena.containsKey(player)) {
                return true;
            } else {
                return false;
        public static void decraseAllProtectedTime() {
    sorry for my english, i'm brazilian
  2. Offline


    Too much static.
  3. Offline


Thread Status:
Not open for further replies.

Share This Page