All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.cwcode.tkach.config.paper.jackson.modules.OfflinePlayerDeserializer Maven / Gradle / Ivy

There is a newer version: 2.1.6
Show newest version
package ru.cwcode.tkach.config.paper.jackson.modules;

import ru.cwcode.tkach.config.relocate.com.fasterxml.jackson.core.JsonParser;
import ru.cwcode.tkach.config.relocate.com.fasterxml.jackson.databind.DeserializationContext;
import ru.cwcode.tkach.config.relocate.com.fasterxml.jackson.databind.JsonDeserializer;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;

import java.io.IOException;
import java.util.UUID;

public class OfflinePlayerDeserializer extends JsonDeserializer {
  @Override
  public OfflinePlayer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
    return Bukkit.getOfflinePlayer(UUID.fromString(p.getValueAsString()));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy