Villager v = (Villager) loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
v.setCustomName("James");
v.setCustomNameVisible(true); 

Die Zeilen sehen richtig aus, also muss es was mit der Location zu tun haben.
Guck nochmal genau nach, Groß und Kleinschreibung bei der config ist auch wichtig.

PS: schreibe das v vom Villager aus also:

Villager villager = (Villager) loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
villager.setCustomName("James");
villager.setCustomNameVisible(true);    

Das hilft dir bei dir Übersicht beim Programmieren.

...zur Antwort