File tree Expand file tree Collapse file tree
core/src/main/java/com/wolfyscript/utilities/bukkit/persistent/player Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,15 +119,18 @@ public <T extends CustomPlayerData> Optional<T> getData(Class<T> dataType) {
119119 var objectMapper = core .getWolfyUtils ().getJacksonMapperUtil ().getGlobalMapper ();
120120 org .bukkit .NamespacedKey key = dataID .bukkit ();
121121 if (dataContainer .has (key , PersistentDataType .STRING )) {
122- try {
123- return objectMapper .reader (new InjectableValues .Std ()
124- .addValue (WolfyCoreBukkit .class , core )
125- .addValue (UUID .class , playerUUID )
126- )
127- .forType (CustomPlayerData .class )
128- .readValue (dataContainer .get (key , PersistentDataType .STRING ));
129- } catch (JsonProcessingException e ) {
130- e .printStackTrace ();
122+ String jsonData = dataContainer .get (key , PersistentDataType .STRING );
123+ if (jsonData != null ) {
124+ try {
125+ return objectMapper .reader (new InjectableValues .Std ()
126+ .addValue (WolfyCoreBukkit .class , core )
127+ .addValue (UUID .class , playerUUID )
128+ )
129+ .forType (CustomPlayerData .class )
130+ .readValue (jsonData );
131+ } catch (JsonProcessingException e ) {
132+ e .printStackTrace ();
133+ }
131134 }
132135 }
133136 return null ;
You can’t perform that action at this time.
0 commit comments