From 004281cdacd01620a5d334ad6f6be0e4da212ea2 Mon Sep 17 00:00:00 2001 From: asie Date: Thu, 7 Feb 2019 13:11:10 +0100 Subject: [PATCH] joiner -> invokerFactory --- .../net/fabricmc/fabric/api/event/EventFactory.java | 8 ++++---- .../fabricmc/fabric/impl/event/ArrayBackedEvent.java | 10 +++++----- .../fabricmc/fabric/impl/event/EventFactoryImpl.java | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java b/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java index 07eb54217..4d9a27770 100644 --- a/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java +++ b/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java @@ -35,12 +35,12 @@ public final class EventFactory { EventFactoryImpl.invalidate(); } - public static Event createArrayBacked(Class type, Function joiner) { - return EventFactoryImpl.createArrayBacked(type, joiner); + public static Event createArrayBacked(Class type, Function invokerFactory) { + return EventFactoryImpl.createArrayBacked(type, invokerFactory); } - public static Event createArrayBacked(Class type, T emptyInvoker, Function joiner) { - return EventFactoryImpl.createArrayBacked(type, emptyInvoker, joiner); + public static Event createArrayBacked(Class type, T emptyInvoker, Function invokerFactory) { + return EventFactoryImpl.createArrayBacked(type, emptyInvoker, invokerFactory); } public static String getHandlerName(Object event) { diff --git a/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java b/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java index 25b312ae8..8f383bf01 100644 --- a/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java +++ b/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java @@ -24,14 +24,14 @@ import java.util.function.Function; class ArrayBackedEvent extends Event { private final Class type; - private final Function joiner; + private final Function invokerFactory; private final T dummyInvoker; private T[] handlers; - ArrayBackedEvent(Class type, T dummyInvoker, Function joiner) { + ArrayBackedEvent(Class type, T dummyInvoker, Function invokerFactory) { this.type = type; this.dummyInvoker = dummyInvoker; - this.joiner = joiner; + this.invokerFactory = invokerFactory; update(); } @@ -41,12 +41,12 @@ class ArrayBackedEvent extends Event { invoker = dummyInvoker; } else { //noinspection unchecked - invoker = joiner.apply((T[]) Array.newInstance(type, 0)); + invoker = invokerFactory.apply((T[]) Array.newInstance(type, 0)); } } else if (handlers.length == 1) { invoker = handlers[0]; } else { - invoker = joiner.apply(handlers); + invoker = invokerFactory.apply(handlers); } } diff --git a/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java b/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java index 5477ca069..292f07e70 100644 --- a/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java +++ b/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java @@ -37,12 +37,12 @@ public final class EventFactoryImpl { ARRAY_BACKED_EVENTS.forEach(ArrayBackedEvent::update); } - public static Event createArrayBacked(Class type, Function joiner) { - return createArrayBacked(type, null /* buildEmptyInvoker(type, joiner) */, joiner); + public static Event createArrayBacked(Class type, Function invokerFactory) { + return createArrayBacked(type, null /* buildEmptyInvoker(type, invokerFactory) */, invokerFactory); } - public static Event createArrayBacked(Class type, T emptyInvoker, Function joiner) { - ArrayBackedEvent event = new ArrayBackedEvent<>(type, emptyInvoker, joiner); + public static Event createArrayBacked(Class type, T emptyInvoker, Function invokerFactory) { + ArrayBackedEvent event = new ArrayBackedEvent<>(type, emptyInvoker, invokerFactory); ARRAY_BACKED_EVENTS.add(event); return event; }