rename DhApiEventInjector -> ApiEventInjector
This renaming was because the injector isn't designed to be used from the API, only internally; and externally available objects all start with "DhApi"
This commit is contained in:
@@ -5,11 +5,11 @@ import com.seibel.lod.api.interfaces.override.IDhApiOverrideable;
|
||||
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGeneratorOverrideRegister;
|
||||
import com.seibel.lod.api.interfaces.world.IDhApiWorldProxy;
|
||||
import com.seibel.lod.api.methods.override.DhApiWorldGeneratorOverrideRegister;
|
||||
import com.seibel.lod.core.DependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.DependencyInjection.ApiEventInjector;
|
||||
import com.seibel.lod.core.DependencyInjection.OverrideInjector;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.api.interfaces.data.IDhApiTerrainDataRepo;
|
||||
import com.seibel.lod.core.interfaces.dependencyInjection.IDhApiEventInjector;
|
||||
import com.seibel.lod.api.interfaces.events.IDhApiEventInjector;
|
||||
import com.seibel.lod.core.interfaces.dependencyInjection.IOverrideInjector;
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ public class DhApiMain
|
||||
// always available //
|
||||
|
||||
/** Used to bind/unbind Distant Horizons Api events. */
|
||||
public static final IDhApiEventInjector events = DhApiEventInjector.INSTANCE;
|
||||
public static final IDhApiEventInjector events = ApiEventInjector.INSTANCE;
|
||||
|
||||
/** Used to bind/unbind Distant Horizons Api events. */
|
||||
public static final IDhApiWorldGeneratorOverrideRegister worldGenOverrides = DhApiWorldGeneratorOverrideRegister.INSTANCE;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.interfaces.dependencyInjection;
|
||||
package com.seibel.lod.api.interfaces.events;
|
||||
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.seibel.lod.api.methods.events;
|
||||
|
||||
import com.seibel.lod.api.objects.DhApiResult;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.DependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.DependencyInjection.ApiEventInjector;
|
||||
|
||||
/**
|
||||
* Handles adding/removing event handlers.
|
||||
@@ -22,7 +22,7 @@ public class DhApiEventRegister
|
||||
{
|
||||
try
|
||||
{
|
||||
DhApiEventInjector.INSTANCE.bind(eventInterface, eventHandlerImplementation);
|
||||
ApiEventInjector.INSTANCE.bind(eventInterface, eventHandlerImplementation);
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
@@ -38,7 +38,7 @@ public class DhApiEventRegister
|
||||
*/
|
||||
public static DhApiResult<Void> off(Class<? extends IDhApiEvent> eventInterface, Class<IDhApiEvent> eventHandlerClass)
|
||||
{
|
||||
if (DhApiEventInjector.INSTANCE.unbind(eventInterface, eventHandlerClass))
|
||||
if (ApiEventInjector.INSTANCE.unbind(eventInterface, eventHandlerClass))
|
||||
{
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,7 +22,7 @@ package com.seibel.lod.core.DependencyInjection;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.events.ApiEventDefinitionHandler;
|
||||
import com.seibel.lod.core.interfaces.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.interfaces.dependencyInjection.IDhApiEventInjector;
|
||||
import com.seibel.lod.api.interfaces.events.IDhApiEventInjector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -35,16 +35,16 @@ import java.util.HashMap;
|
||||
* @author James Seibel
|
||||
* @version 2022-11-20
|
||||
*/
|
||||
public class DhApiEventInjector extends DependencyInjector<IDhApiEvent> implements IDhApiEventInjector // Note to self: Don't try adding a generic type to IDhApiEvent, the consturctor won't accept it
|
||||
public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements IDhApiEventInjector // Note to self: Don't try adding a generic type to IDhApiEvent, the consturctor won't accept it
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger(DhApiEventInjector.class.getSimpleName());
|
||||
private static final Logger LOGGER = LogManager.getLogger(ApiEventInjector.class.getSimpleName());
|
||||
private static final HashMap<Class<? extends IDhApiEvent>, Object> FIRED_ONE_TIME_EVENT_PARAMETERS_BY_EVENT_INTERFACE = new HashMap<>();
|
||||
|
||||
public static final DhApiEventInjector INSTANCE = new DhApiEventInjector();
|
||||
public static final ApiEventInjector INSTANCE = new ApiEventInjector();
|
||||
|
||||
|
||||
|
||||
private DhApiEventInjector() { super(IDhApiEvent.class, true); }
|
||||
private ApiEventInjector() { super(IDhApiEvent.class, true); }
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package tests;
|
||||
|
||||
import com.seibel.lod.core.DependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.DependencyInjection.ApiEventInjector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import testItems.events.abstractObjects.DhApiOneTimeTestEvent;
|
||||
@@ -24,7 +24,7 @@ public class EventInjectorTest
|
||||
public void testGeneralAndRecurringEvents() // this also tests list dependencies since there can be more than one event handler bound per event
|
||||
{
|
||||
// Injector setup
|
||||
DhApiEventInjector TEST_EVENT_HANDLER = DhApiEventInjector.INSTANCE;
|
||||
ApiEventInjector TEST_EVENT_HANDLER = ApiEventInjector.INSTANCE;
|
||||
TEST_EVENT_HANDLER.clear();
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class EventInjectorTest
|
||||
public void testOneTimeEventFiring()
|
||||
{
|
||||
// Injector setup
|
||||
DhApiEventInjector TEST_EVENT_HANDLER = DhApiEventInjector.INSTANCE;
|
||||
ApiEventInjector TEST_EVENT_HANDLER = ApiEventInjector.INSTANCE;
|
||||
TEST_EVENT_HANDLER.clear();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user