Formatting
This commit is contained in:
parent
07053c9b5f
commit
0ba5074c30
1 changed files with 5 additions and 4 deletions
|
@ -21,7 +21,7 @@ import static me.night.nullvalkyrie.npc.NPCManager.*;
|
|||
public class NPCDataManager {
|
||||
public static void setNPC(String name, int x, int y, int z, int pitch, int yaw, String world, String texture, String signature) {
|
||||
Document document = DatabaseManager.npcs.find(new Document("Name", name)).first();
|
||||
if(document != null) {
|
||||
if (document != null) {
|
||||
System.out.println("A NPC with this name already exist");
|
||||
} else {
|
||||
Document newDocument = new Document();
|
||||
|
@ -37,9 +37,10 @@ public class NPCDataManager {
|
|||
DatabaseManager.npcs.insertOne(newDocument);
|
||||
}
|
||||
}
|
||||
|
||||
public static void reloadNPC() {
|
||||
try (MongoCursor<Document> cursor = DatabaseManager.npcs.find().cursor()){
|
||||
while(cursor.hasNext()) {
|
||||
try (MongoCursor<Document> cursor = DatabaseManager.npcs.find().cursor()) {
|
||||
while (cursor.hasNext()) {
|
||||
Document document = cursor.next();
|
||||
String name = (String) document.get("Name");
|
||||
int x = (int) document.get("x");
|
||||
|
@ -50,7 +51,7 @@ public class NPCDataManager {
|
|||
String world = (String) document.get("world");
|
||||
String texture = (String) document.get("texture");
|
||||
String signature = (String) document.get("signature");
|
||||
Location location = new Location(Bukkit.getWorld(world), x ,y ,z);
|
||||
Location location = new Location(Bukkit.getWorld(world), x, y, z);
|
||||
location.setPitch((float) pitch);
|
||||
location.setYaw((float) yaw);
|
||||
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), Util.color(name));
|
||||
|
|
Loading…
Reference in a new issue