mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 13:24:17 -07:00
Registry Modification API (#10893)
* Registry Modification API * some fixes * even more fixes
This commit is contained in:
@@ -770,6 +770,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import io.papermc.paper.plugin.storage.BootstrapProviderStorage;
|
||||
+import io.papermc.paper.plugin.storage.ProviderStorage;
|
||||
+import io.papermc.paper.plugin.storage.ServerPluginProviderStorage;
|
||||
+import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
@@ -782,9 +784,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ public static final LaunchEntryPointHandler INSTANCE = new LaunchEntryPointHandler();
|
||||
+ private final Map<Entrypoint<?>, ProviderStorage<?>> storage = new HashMap<>();
|
||||
+ private final Object2BooleanMap<Entrypoint<?>> enteredMap = new Object2BooleanOpenHashMap<>();
|
||||
+
|
||||
+ LaunchEntryPointHandler() {
|
||||
+ this.populateProviderStorage();
|
||||
+ this.enteredMap.defaultReturnValue(false);
|
||||
+ }
|
||||
+
|
||||
+ // Utility
|
||||
@@ -800,6 +804,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ storage.enter();
|
||||
+ this.enteredMap.put(entrypoint, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -823,6 +828,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return storage;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasEntered(Entrypoint<?> entrypoint) {
|
||||
+ return this.enteredMap.getBoolean(entrypoint);
|
||||
+ }
|
||||
+
|
||||
+ // Reload only
|
||||
+ public void populateProviderStorage() {
|
||||
+ this.storage.put(Entrypoint.BOOTSTRAPPER, new BootstrapProviderStorage());
|
||||
|
Reference in New Issue
Block a user