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

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

package ru.cwcode.tkach.config.paper.jackson.modules;

import ru.cwcode.tkach.config.relocate.com.fasterxml.jackson.core.JsonGenerator;
import ru.cwcode.tkach.config.relocate.com.fasterxml.jackson.databind.JsonSerializer;
import ru.cwcode.tkach.config.relocate.com.fasterxml.jackson.databind.SerializerProvider;
import org.bukkit.Location;

import java.io.IOException;

public class LocationSerializer extends JsonSerializer {
  @Override
  public void serialize(Location value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
    String builder =
       value.getWorld().getName() + ", " +
          value.getX() + " " +
          value.getY() + " " +
          value.getZ() + " " +
          value.getPitch() + " " +
          value.getYaw();
    
    gen.writeString(builder);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy