Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UUIDPersister, fix NPC evoker saving, make TeleportStuckAction re…
…use old code
- Loading branch information
Showing
5 changed files
with
49 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/net/citizensnpcs/api/persistence/UUIDPersister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.citizensnpcs.api.persistence; | ||
|
||
import java.util.UUID; | ||
|
||
import net.citizensnpcs.api.util.DataKey; | ||
|
||
public class UUIDPersister implements Persister<UUID> { | ||
@Override | ||
public UUID create(DataKey root) { | ||
try { | ||
return UUID.fromString(root.getString("")); | ||
} catch (IllegalArgumentException e) { | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public void save(UUID instance, DataKey root) { | ||
root.setString("", instance.toString()); | ||
} | ||
} |