@SuppressWarnings("unchecked")
 protected LockedBlock(ResultSet r, String typeId)
     throws SQLException, ClassNotFoundException, IOException {
   this.lockId = r.getLong("ID");
   this.l =
       new Location(
           Bukkit.getWorld(r.getString("World")), r.getLong("X"), r.getLong("Y"), r.getLong("Z"));
   this.ownerId = r.getLong("Owner");
   this.guests = (ArrayList<Long>) Serializer.deserialize(r.getString("Guests"));
   this.level = LockLevel.getLevel(r.getInt("AccessLevel"));
   this.typeId = typeId;
 }
 /** Saves the lock into the SQL database as a new row */
 public void saveNew() throws SQLException, IOException {
   GoldenApple.getInstance()
       .database
       .execute(
           "INSERT INTO Locks (ID, X, Y, Z, World, Type, AccessLevel, Owner, Guests) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
           lockId,
           l.getBlockX(),
           l.getBlockY(),
           l.getBlockZ(),
           l.getWorld().getName(),
           typeId,
           level.levelId,
           ownerId,
           Serializer.serialize(guests));
 }
 /** Saves the lock into the SQL database */
 public void save() {
   try {
     GoldenApple.getInstance()
         .database
         .execute(
             "UPDATE Locks SET AccessLevel=?, Owner=?, Guests=? WHERE ID=?",
             level.levelId,
             ownerId,
             Serializer.serialize(guests),
             lockId);
   } catch (SQLException | IOException e) {
     GoldenApple.log(Level.SEVERE, "Failed to save changes to lock " + lockId + ":");
     GoldenApple.log(Level.SEVERE, e);
   }
 }