Source:
<code>public void init() { final Cause cause = PhaseTracker.getCauseStackManager().getCurrentCause(); try { SpongeParameterizedCommandRegistrar.INSTANCE.register( Launcher.getInstance().getCommonPlugin(), this.spongeCommand.get().createSpongeCommand(), "sponge" ); } catch (final CommandFailedRegistrationException ex) { throw new RuntimeException("Failed to create root Sponge command!", ex); } try { SpongeParameterizedCommandRegistrar.INSTANCE.register( Launcher.getInstance().getCommonPlugin(), <START> ((SpongePaginationService) Sponge.getServiceProvider().paginationService()).createPaginationCommand(), <END> "pagination", "page" ); } catch (final CommandFailedRegistrationException ex) { throw new RuntimeException("Failed to create pagination command!", ex); } final Set<TypeToken<?>> usedTokens = new HashSet<>(); for (final CommandRegistrar<?> registrar : this.game.getRegistry().getCatalogRegistry().getAllOf(CommandRegistrar.class)) { final TypeToken<?> handledType = registrar.handledType(); if (handledType == null) { SpongeCommon.getLogger().error("Registrar '{}' did not provide a handledType, skipping...", registrar.getClass()); } else if (usedTokens.add(handledType)) { this.game.getEventManager().post(this.createEvent(cause, this.game, registrar)); } else { SpongeCommon.getLogger() .warn("Command type '{}' has already been collected, skipping request from {}", handledType.toString(), registrar.getClass()); } } SpongeParameterizedCommandRegistrar.INSTANCE.register( Launcher.getInstance().getCommonPlugin(), SpongeAdventure.CALLBACK_COMMAND.createCommand(), "callback"); BrigadierCommandRegistrar.INSTANCE.completeVanillaRegistration(); this.hasStarted = true; }</code><technical_language>This run if service replaced, this throw a class cast exception otherwise</technical_language>

Target:
public void init() { final Cause cause = PhaseTracker.getCauseStackManager().getCurrentCause(); try { SpongeParameterizedCommandRegistrar.INSTANCE.register( Launcher.getInstance().getCommonPlugin(), this.spongeCommand.get().createSpongeCommand(), "sponge" ); } catch (final CommandFailedRegistrationException ex) { throw new RuntimeException("Failed to create root Sponge command!", ex); } try { final PaginationService paginationService = Sponge.getServiceProvider().paginationService(); if (paginationService instanceof SpongePaginationService) { SpongeParameterizedCommandRegistrar.INSTANCE.register( Launcher.getInstance().getCommonPlugin(), ((SpongePaginationService) paginationService).createPaginationCommand(), "pagination", "page" ); } } catch (final CommandFailedRegistrationException ex) { throw new RuntimeException("Failed to create pagination command!", ex); } final Set<TypeToken<?>> usedTokens = new HashSet<>(); for (final CommandRegistrar<?> registrar : this.game.getRegistry().getCatalogRegistry().getAllOf(CommandRegistrar.class)) { final TypeToken<?> handledType = registrar.handledType(); if (handledType == null) { SpongeCommon.getLogger().error("Registrar '{}' did not provide a handledType, skipping...", registrar.getClass()); } else if (usedTokens.add(handledType)) { this.game.getEventManager().post(this.createEvent(cause, this.game, registrar)); } else { SpongeCommon.getLogger() .warn("Command type '{}' has already been collected, skipping request from {}", handledType.toString(), registrar.getClass()); } } SpongeParameterizedCommandRegistrar.INSTANCE.register( Launcher.getInstance().getCommonPlugin(), SpongeAdventure.CALLBACK_COMMAND.createCommand(), "callback"); BrigadierCommandRegistrar.INSTANCE.completeVanillaRegistration(); this.hasStarted = true; }