PetSQL.pool.execute(()->{PreparedStatementremove=null;PreparedStatementadd=null;try{remove=getConnection().prepareStatement("DELETE FROM pets WHERE uuid=?");remove.setString(1,player.getUniqueId().toString());remove.executeUpdate();for(Petpet:pets){add=getConnection().prepareStatement("INSERT INTO pets(uuid,pet) VALUES (?,?)");add.setString(1,player.getUniqueId().toString());add.setString(2,MyPet.petToJSON(pet));add.executeUpdate();}}catch(SQLExceptione){System.err.println("Could not set pets for "+player.getName());}finally{PetSQL.closeResources(null,remove);PetSQL.closeResources(null,add);}});
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.