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.
resendRegistries(Player): Resends the registry data to the specified player.resendRegistries(Player, Consumer<PlayerConfigurationConnection>): Resends the registry data to the specified player with a callback to modify the connection configuration before resending.
Example Usage
Section titled “Example Usage”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();
}
}
}