Repository: PaperMC/Paper
File: paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftVault.java (Java)

Code before:

    @Override
    public void setDisplayLootTable(final @Nullable LootTable lootTable) {
        final VaultConfig config = this.getSnapshot().getConfig();

        this.getSnapshot().setConfig(new VaultConfig(config.lootTable(), config.activationRange(), config.deactivationRange(), config.keyItem(), Optional.ofNullable(CraftLootTable.bukkitToMinecraft(lootTable))));
    }

    @Override
    public long getNextStateUpdateTime() {
        return this.getSnapshot().serverData.stateUpdatingResumesAt();
    }

    @Override
    public void setNextStateUpdateTime(final long nextStateUpdateTime) {
        this.getSnapshot().serverData.pauseStateUpdatingUntil(nextStateUpdateTime);
    }

    @Override
    public @Unmodifiable Set<UUID> getRewardedPlayers() {
        return ImmutableSet.copyOf(this.getSnapshot().serverData.getRewardedPlayers());
    }

    @Override
    public boolean addRewardedPlayer(final UUID playerUUID) {
        return this.getSnapshot().serverData.addToRewardedPlayers(playerUUID);
    }

    @Override
    public boolean removeRewardedPlayer(final UUID playerUUID) {
        return this.getSnapshot().serverData.removeFromRewardedPlayers(playerUUID);
    }
}


Review comment (suggestion):
Missing non-null check here and in the remove method.

Code after:
    }

    @Override
    public void setDisplayedLootTable(final @Nullable LootTable lootTable) {
        final VaultConfig config = this.getSnapshot().getConfig();

        this.getSnapshot().setConfig(new VaultConfig(config.lootTable(), config.activationRange(), config.deactivationRange(), config.keyItem(), Optional.ofNullable(CraftLootTable.bukkitToMinecraft(lootTable))));
    }

    @Override
    public long getNextStateUpdateTime() {
        return this.getSnapshot().serverData.stateUpdatingResumesAt();
    }

    @Override
    public void setNextStateUpdateTime(final long nextStateUpdateTime) {
        this.getSnapshot().serverData.pauseStateUpdatingUntil(nextStateUpdateTime);
    }

    @Override
    public @Unmodifiable Collection<UUID> getRewardedPlayers() {
        return ImmutableSet.copyOf(this.getSnapshot().serverData.getRewardedPlayers());
    }

    @Override
    public boolean addRewardedPlayer(final UUID playerUUID) {
        Preconditions.checkArgument(playerUUID != null, "playerUUID must not be null");
        return this.getSnapshot().serverData.addToRewardedPlayers(playerUUID);
    }

    @Override
    public boolean removeRewardedPlayer(final UUID playerUUID) {
        Preconditions.checkArgument(playerUUID != null, "playerUUID must not be null");
        return this.getSnapshot().serverData.removeFromRewardedPlayers(playerUUID);
    }

    @Override
    public boolean hasRewardedPlayer(final UUID playerUUID) {
        return this.getSnapshot().serverData.getRewardedPlayers().contains(playerUUID);
    }

    @Override
    public @Unmodifiable Set<UUID> getConnectedPlayers() {
        return ImmutableSet.copyOf(this.getSnapshot().getSharedData().getConnectedPlayers());
    }

    @Override
    public boolean hasConnectedPlayer(final UUID playerUUID) {
        return this.getSnapshot().getSharedData().getConnectedPlayers().contains(playerUUID);
    }