Beispiel #1
0
 public void updateBan(BanTable ban, Date now) {
   if (!ban.expires()) return;
   if (now.compareTo(ban.getExpiry()) >= 0) {
     plugin
         .getLogger()
         .info(
             Msg.format(
                 "%s [%04d] on %s has expired.",
                 ban.getType().getNiceName(), ban.getId(), ban.getPlayer().getName()));
     ban.setType(ban.getType().lift());
     getDatabase().save(ban);
   }
 }
Beispiel #2
0
 public PlayerTable getPlayer(OfflinePlayer player) {
   PlayerTable result =
       getDatabase().find(PlayerTable.class).where().eq("uuid", player.getUniqueId()).findUnique();
   if (result == null) {
     result = new PlayerTable(player, new Date());
     getDatabase().save(result);
   } else if (!result.getName().equals(player.getName())) {
     if (player.getName() == null) {
       plugin.getLogger().warning("Unknown for player with UUID " + player.getUniqueId());
       return null;
     }
     result.setName(player.getName());
     getDatabase().save(result);
   }
   return result;
 }