Numerical schemes for general Klein–Gordon equations with Dirichlet and nonlocal boundary conditions