diff --git a/src/main/java/net/citizensnpcs/api/npc/SimpleNPCDataStore.java b/src/main/java/net/citizensnpcs/api/npc/SimpleNPCDataStore.java index 4903bf93..37bd2274 100644 --- a/src/main/java/net/citizensnpcs/api/npc/SimpleNPCDataStore.java +++ b/src/main/java/net/citizensnpcs/api/npc/SimpleNPCDataStore.java @@ -54,8 +54,8 @@ public void loadInto(NPCRegistry registry) { continue; } NPC npc = registry.createNPC(type, - key.keyExists("uuid") ? UUID.fromString(key.getString("uuid")) : UUID.randomUUID(), id, - key.getString("name")); + !key.getString("uuid", "").isEmpty() ? UUID.fromString(key.getString("uuid")) : UUID.randomUUID(), + id, key.getString("name")); npc.load(key); } } diff --git a/src/main/java/net/citizensnpcs/api/util/DatabaseStorage.java b/src/main/java/net/citizensnpcs/api/util/DatabaseStorage.java index 8997cf8f..31ecbeae 100644 --- a/src/main/java/net/citizensnpcs/api/util/DatabaseStorage.java +++ b/src/main/java/net/citizensnpcs/api/util/DatabaseStorage.java @@ -21,43 +21,43 @@ * Implements a traversable tree-view database, which can be accessed with * simple keys, and is dynamic, meaning that any necessary tables or columns * must be created when needed. - * + * * Keys are formatted using a general node-subnode format x.x.x...x, and will be * treated by this object according to a set of rules. * - * + * *

* For example, the user sets a string at the key * npcs.Bob.location.x *

* @@ -120,7 +120,7 @@ private Table createTable(String name, int type, boolean autoIncrement) { PreparedStatement stmt = null; Table created = null; try { - stmt = conn.prepareStatement("CREATE TABLE IF NOT EXISTS `" + name + "`(`" + pk + "` " + directType + stmt = conn.prepareStatement("CREATE TABLE IF NOT EXISTS `" + name + "` (`" + pk + "` " + directType + primaryType + ")"); stmt.execute(); created = new Table().setName(name).setPrimaryKey(pk).setPrimaryKeyType(directType);