diff --git a/api/src/main/java/net/kyori/adventure/pointer/PointersImpl.java b/api/src/main/java/net/kyori/adventure/pointer/PointersImpl.java index 99fdd36ed..572328bd2 100644 --- a/api/src/main/java/net/kyori/adventure/pointer/PointersImpl.java +++ b/api/src/main/java/net/kyori/adventure/pointer/PointersImpl.java @@ -75,7 +75,7 @@ public boolean supports(final @NotNull Pointer pointer) { @Override public @NotNull Pointers.Builder toBuilder() { - return new BuilderImpl(this); + return new BuilderImpl(new HashMap<>(this.pointers)); } static final class BuilderImpl implements Builder { @@ -85,8 +85,8 @@ static final class BuilderImpl implements Builder { this.pointers = new HashMap<>(); } - BuilderImpl(final @NotNull PointersImpl pointers) { - this.pointers = new HashMap<>(pointers.pointers); + BuilderImpl(final @NotNull Map, Supplier> pointers) { + this.pointers = pointers; } @Override diff --git a/api/src/main/java/net/kyori/adventure/pointer/PointersSupplierImpl.java b/api/src/main/java/net/kyori/adventure/pointer/PointersSupplierImpl.java index 3b8cba1ed..bdbe972af 100644 --- a/api/src/main/java/net/kyori/adventure/pointer/PointersSupplierImpl.java +++ b/api/src/main/java/net/kyori/adventure/pointer/PointersSupplierImpl.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Optional; import java.util.function.Function; +import java.util.function.Supplier; import org.jetbrains.annotations.NotNull; final class PointersSupplierImpl implements PointersSupplier { @@ -73,7 +74,13 @@ public boolean supports(final @NotNull Pointer pointer) { @Override public @NotNull Pointers.Builder toBuilder() { - throw new UnsupportedOperationException(); + final Map, Supplier> pointers = new HashMap<>(); + + for (final Map.Entry, Function> entry : this.supplier.resolvers.entrySet()) { + pointers.put(entry.getKey(), () -> entry.getValue().apply(this.instance)); + } + + return new PointersImpl.BuilderImpl(pointers); } }