Skip to content

Resynchronizing Registries

The RegistryReconfigurer is a utility for reconfiguring the connection of a player to re-synchronize registries and show updated biome data to the player without them needing to relog.

ExampleListener.java Java
import me.outspending.biomesapi.connection.RegistryReconfigurer;
import me.outspending.biomesapi.exceptions.HorriblePlayerLoginEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;

public class ExampleListener implements Listener {

  private static final RegistryReconfigurer REGISTRY_RECONFIGURER = RegistryReconfigurer.newReconfigurer();

  @EventHandler
  public void onBlockBreak(BlockBreakEvent event) {
      Player player = event.getPlayer();
      try {
          REGISTRY_RECONFIGURER.resendRegistries(player);
      } catch (HorriblePlayerLoginEvent e) {
          // Thrown if a plugin is listening to PlayerLoginEvent.
          e.printStackTrace();
      }
  }
}