Why doesnt this update?

Discussion in 'Spigot Plugin Development' started by Kyllian, Apr 15, 2017.

  1. Hey.

    When I enter something in my hashmap it works fine. But my runnable dont seem to update it?

    This gets succesfully called:
    data.timeLeft.put(uuid, main.getConfig().getInt("Delay"));

    But my runnable:

    Code (Text):
    public void runnableRunner() {
            new BukkitRunnable() {
                public void run() {
                    if (data.timeLeft.isEmpty()) {
                    if (!data.timeLeft.isEmpty()) {
                        for (String uuid : data.timeLeft.keySet()) {

                            int timeLeftOld = data.timeLeft.get(uuid);
                            data.timeLeft.put(uuid, timeLeftOld - 1);

                            if (data.timeLeft.get(uuid) == 0) {
                                // close things
                                // execute commands
            }.runTaskTimer(this, 0, 20);
    Keeps saying empty. What is wrong?
  2. Basic debugging steps. First of all check for null values. Print the values you put inside of the map to the console. Second thing, look at the scopes of your variables. If this is another method, make sure you pass it correctly or assign it to a field.