From 3f98e8f10594673a903bd0b4864a281422bb6720 Mon Sep 17 00:00:00 2001 From: hsgamer Date: Sat, 14 Sep 2024 14:00:29 +0700 Subject: [PATCH] throw exception early on default provider --- .../picker/HologramProviderPicker.java | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/picker/src/main/java/io/github/projectunified/unihologram/picker/HologramProviderPicker.java b/picker/src/main/java/io/github/projectunified/unihologram/picker/HologramProviderPicker.java index 667730b5..31899322 100644 --- a/picker/src/main/java/io/github/projectunified/unihologram/picker/HologramProviderPicker.java +++ b/picker/src/main/java/io/github/projectunified/unihologram/picker/HologramProviderPicker.java @@ -1,13 +1,9 @@ package io.github.projectunified.unihologram.picker; -import io.github.projectunified.unihologram.api.Hologram; import io.github.projectunified.unihologram.api.HologramProvider; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import java.util.Optional; import java.util.function.BooleanSupplier; import java.util.function.Function; import java.util.function.Predicate; @@ -33,27 +29,6 @@ public HologramProviderPicker(I input) { this.input = input; } - private HologramProvider exceptionHologramProvider() { - return new HologramProvider() { - private final UnsupportedOperationException exception = new UnsupportedOperationException("This is an exception hologram provider. If you see this, that means your hologram provider picker is not working correctly"); - - @Override - public @NotNull Hologram createHologram(@NotNull String name, @NotNull T location) { - throw exception; - } - - @Override - public Optional> getHologram(@NotNull String name) { - throw exception; - } - - @Override - public Collection> getAllHolograms() { - throw exception; - } - }; - } - /** * Add an entry * @@ -114,13 +89,14 @@ public HologramProvider pick() { } /** - * Get the default provider + * Get the default provider. + * By default, this throws an exception. * * @param input the input * @return the default provider */ protected HologramProvider getDefaultProvider(I input) { - return exceptionHologramProvider(); + throw new IllegalStateException("No default provider is set"); } private static class Entry {