mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-12 12:16:41 +01:00
85f704e537
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
81 lines
3.3 KiB
Diff
81 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
|
Date: Wed, 11 Sep 2024 20:24:30 +0200
|
|
Subject: [PATCH] fix memory keys use of generics
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
|
index d55c33ca14257be5005520e18e465da87a58dbaf..5c9ca6738e48c70538c8b5a3d454c7318fc419ef 100644
|
|
--- a/src/main/java/org/bukkit/Registry.java
|
|
+++ b/src/main/java/org/bukkit/Registry.java
|
|
@@ -305,24 +305,24 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
|
*
|
|
* @see MemoryKey
|
|
*/
|
|
- Registry<MemoryKey> MEMORY_MODULE_TYPE = new Registry<MemoryKey>() {
|
|
+ Registry<MemoryKey<?>> MEMORY_MODULE_TYPE = new Registry<>() {
|
|
|
|
@NotNull
|
|
@Override
|
|
- public Iterator iterator() {
|
|
+ public Iterator<MemoryKey<?>> iterator() {
|
|
return MemoryKey.values().iterator();
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
- public MemoryKey get(@NotNull NamespacedKey key) {
|
|
+ public MemoryKey<?> get(@NotNull NamespacedKey key) {
|
|
return MemoryKey.getByKey(key);
|
|
}
|
|
|
|
@NotNull
|
|
@Override
|
|
- public MemoryKey getOrThrow(@NotNull NamespacedKey key) {
|
|
- MemoryKey memoryKey = get(key);
|
|
+ public MemoryKey<?> getOrThrow(@NotNull NamespacedKey key) {
|
|
+ MemoryKey<?> memoryKey = get(key);
|
|
|
|
Preconditions.checkArgument(memoryKey != null, "No MemoryKey registry entry found for key %s.", key);
|
|
|
|
@@ -331,7 +331,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
|
|
|
@NotNull
|
|
@Override
|
|
- public Stream<MemoryKey> stream() {
|
|
+ public Stream<MemoryKey<?>> stream() {
|
|
return StreamSupport.stream(spliterator(), false);
|
|
}
|
|
};
|
|
diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
|
index d615c006c9153fb65024241604b744fbfc383efc..b757aed1bde330d8720a900f8e0877f77ef14c4a 100644
|
|
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
|
+++ b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
|
@@ -44,7 +44,7 @@ public final class MemoryKey<T> implements Keyed {
|
|
return tClass;
|
|
}
|
|
|
|
- private static final Map<NamespacedKey, MemoryKey> MEMORY_KEYS = new HashMap<>();
|
|
+ private static final Map<NamespacedKey, MemoryKey<?>> MEMORY_KEYS = new HashMap<>();
|
|
//
|
|
public static final MemoryKey<Location> HOME = new MemoryKey<>(NamespacedKey.minecraft("home"), Location.class);
|
|
public static final MemoryKey<Location> POTENTIAL_JOB_SITE = new MemoryKey<>(NamespacedKey.minecraft("potential_job_site"), Location.class);
|
|
@@ -86,7 +86,7 @@ public final class MemoryKey<T> implements Keyed {
|
|
* available under that key
|
|
*/
|
|
@Nullable
|
|
- public static MemoryKey getByKey(@NotNull NamespacedKey namespacedKey) {
|
|
+ public static MemoryKey<?> getByKey(@NotNull NamespacedKey namespacedKey) {
|
|
return MEMORY_KEYS.get(namespacedKey);
|
|
}
|
|
|
|
@@ -96,7 +96,7 @@ public final class MemoryKey<T> implements Keyed {
|
|
* @return the memoryKeys
|
|
*/
|
|
@NotNull
|
|
- public static Set<MemoryKey> values() {
|
|
+ public static Set<MemoryKey<?>> values() {
|
|
return new HashSet<>(MEMORY_KEYS.values());
|
|
}
|
|
}
|