nicatronTg

Untitled

Apr 28th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1.     public void releaseFromJail(Player ply) {
  2.         final String playerName = ply.getName();
  3.         plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
  4.             public void run() {
  5.                 String key = "mc:player:" + playerName + ":jailendtime";
  6.                 if (!plugin.redisDatabase.getRedis().exists(key)) {
  7.                     return;
  8.                 }
  9.                
  10.                 long jailEndTime = Long.parseLong(plugin.redisDatabase.getRedis().get(key));
  11.                
  12.                 if (jailEndTime <= System.currentTimeMillis()/1000) {
  13.                     plugin.redisDatabase.getRedis().del("mc:player:" + playerName + ":jailendtime");
  14.                    
  15.                     plugin.getServer().getScheduler().runTask(plugin, new Runnable() {
  16.                         public void run() {
  17.                             Player ply = plugin.getServer().getPlayer(playerName);
  18.                             ply.teleport(new Location(plugin.getServer().getWorld("panem"), 75450, 67, 55525));
  19.                             ply.sendMessage(ChatColor.GREEN + "You have been released from jail automatically.");
  20.                         }
  21.                     });
  22.                 }
  23.             }
  24.         });
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment