Skip to content

Commit

Permalink
feat(loader): Add temp loader for temp handlers.
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Dec 19, 2023
1 parent 57e9c88 commit f666f77
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
package com.artformgames.core.user.manager;

import com.artformgames.core.user.User;
import com.artformgames.core.user.handler.AbstractUserHandler;
import com.artformgames.core.user.handler.TempHandlerLoader;
import com.artformgames.core.user.handler.UserHandler;
import com.artformgames.core.user.handler.UserHandlerLoader;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;

import java.util.function.Function;

public interface UserHandlerManager {

boolean containsHandler(@NotNull Class<? extends UserHandler> handlerClazz);

<H extends AbstractUserHandler> void registerHandler(@NotNull UserHandlerLoader<H> loader);

default <H extends AbstractUserHandler> void registerHandler(@NotNull Plugin plugin, @NotNull Class<H> handlerClass,
@NotNull Function<User, H> loader) {
registerHandler(TempHandlerLoader.of(plugin, handlerClass, loader));
}

void unregisterHandler(@NotNull Class<? extends UserHandler> handlerClazz);

}

0 comments on commit f666f77

Please sign in to comment.