Add /paper dumplisteners command (#8507)
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com>
This commit is contained in:
parent
da230d521c
commit
8aff07afb0
2 changed files with 190 additions and 0 deletions
37
patches/api/0409-Add-paper-dumplisteners-command.patch
Normal file
37
patches/api/0409-Add-paper-dumplisteners-command.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Warrior <50800980+Warriorrrr@users.noreply.github.com>
|
||||
Date: Sat, 19 Nov 2022 19:46:44 +0100
|
||||
Subject: [PATCH] Add /paper dumplisteners command
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/HandlerList.java b/src/main/java/org/bukkit/event/HandlerList.java
|
||||
index ed78cca71f83b296d082d0af147ca8d622c7606a..2292bd460ce2be113beb4ba6b4eb19350060f01c 100644
|
||||
--- a/src/main/java/org/bukkit/event/HandlerList.java
|
||||
+++ b/src/main/java/org/bukkit/event/HandlerList.java
|
||||
@@ -33,6 +33,13 @@ public class HandlerList {
|
||||
*/
|
||||
private static ArrayList<HandlerList> allLists = new ArrayList<HandlerList>();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Event types which have instantiated a {@link HandlerList}.
|
||||
+ */
|
||||
+ private static final java.util.Set<String> EVENT_TYPES = java.util.concurrent.ConcurrentHashMap.newKeySet();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Bake all handler lists. Best used just after all normal event
|
||||
* registration is complete, ie just after all plugins are loaded if
|
||||
@@ -94,6 +101,12 @@ public class HandlerList {
|
||||
* The HandlerList is then added to meta-list for use in bakeAll()
|
||||
*/
|
||||
public HandlerList() {
|
||||
+ // Paper start
|
||||
+ java.lang.StackWalker.getInstance(java.util.EnumSet.of(java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE), 4)
|
||||
+ .walk(s -> s.filter(f -> Event.class.isAssignableFrom(f.getDeclaringClass())).findFirst())
|
||||
+ .map(f -> f.getDeclaringClass().getName())
|
||||
+ .ifPresent(EVENT_TYPES::add);
|
||||
+ // Paper end
|
||||
handlerslots = new EnumMap<EventPriority, ArrayList<RegisteredListener>>(EventPriority.class);
|
||||
for (EventPriority o : EventPriority.values()) {
|
||||
handlerslots.put(o, new ArrayList<RegisteredListener>());
|
Loading…
Add table
Add a link
Reference in a new issue