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. *
* A combination of the first two rules gives us the initial starting point to * traverse the key. We have a table and a valid starting point to begin at. *
- * + * *
* For example, the user sets a string at the key
* npcs.Bob.location.x
*
npcs
is created.
- *
+ *
* Bob
does
* not match any other validation patterns, it is treated as a varchar, so a
* primary key npcs_id varchar(255)
is created.
- *
+ *
* location
is created and a foreign key
* fk_location
is inserted into npcs
which references
* location_id
(integer). A row is created in location and the
* fk_location field is updated with the generated id.
- *
+ *
* x varchar(255)
is created for
* location
and the value inserted.
*