package tk.ultimatedev.jailplusplus.task;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import tk.ultimatedev.jailplusplus.models.Cell;
import tk.ultimatedev.jailplusplus.models.Prisoner;
import tk.ultimatedev.jailplusplus.util.Messenger;

import java.util.List;

public class UnjailTask implements Runnable {
    @Override
    public void run() {
        List<Prisoner> prisoners = Prisoner.getAllPrisoners();

        for (Prisoner prisoner : prisoners) {
            if (Bukkit.getPlayer(prisoner.getPlayer()) != null) {
                if (prisoner.getExpiryTime().getTime() < System.currentTimeMillis()) {
                    Prisoner.removePrisoner(prisoner.getId());

                    if (prisoner.getX() == -1 && prisoner.getY() == -1 && prisoner.getZ() == -1) {
                        Bukkit.getPlayer(prisoner.getPlayer()).teleport(Cell.getCell(prisoner.getCell()).getJail().getCuboid().getWorld().getSpawnLocation());
                    } else {
                        Bukkit.getPlayer(prisoner.getPlayer()).teleport(new Location(Bukkit.getWorld(prisoner.getWorld()), (double) prisoner.getX(), (double) prisoner.getY(), (double) prisoner.getZ()));
                    }

                    Messenger.sendMessage(Bukkit.getPlayer(prisoner.getPlayer()), "You have served your sentence, and you are now unjailed!");
                }
            }
        }

    }
}

@@ -40,238 +40,8 @@
 k;%0A%0A
-import org.bukkit.Bukkit;%0Aimport org.bukkit.Location;%0Aimport tk.ultimatedev.jailplusplus.models.Cell;%0Aimport tk.ultimatedev.jailplusplus.models.Prisoner;%0Aimport tk.ultimatedev.jailplusplus.util.Messenger;%0A%0Aimport java.util.List;%0A%0A
 publ
@@ -116,24 +116,70 @@
 oid run() %7B%0A
+        // TODO: Update this task%0A%0A        /*%0A
         List
@@ -1186,22 +1186,33 @@
  %7D%0A        %7D
+%0A        */
 %0A%0A    %7D%0A%7D%0A

fix compile error