uhhh go brrr?
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package core.plugin.CorePluginTypes;
|
||||
|
||||
import core.plugin.Plugin;
|
||||
|
||||
public abstract class ManagerPlugin implements Plugin<Object> {
|
||||
public abstract void tick();
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package core.plugin.CorePluginTypes;
|
||||
|
||||
import core.game.system.SystemLogger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Managers {
|
||||
|
||||
private static List<ManagerPlugin> plugins = new ArrayList<>();
|
||||
public static void register(ManagerPlugin plugin){
|
||||
if(plugin != null){
|
||||
plugins.add(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
public static void tick(){
|
||||
for(ManagerPlugin p : plugins){
|
||||
p.tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package core.plugin.CorePluginTypes;
|
||||
|
||||
import core.plugin.Plugin;
|
||||
|
||||
public abstract class StartupPlugin implements Plugin<Object> {
|
||||
public abstract void run();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package core.plugin;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Represents a initializable piece of content.
|
||||
*
|
||||
* @author Jonathan
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = ElementType.TYPE)
|
||||
public @interface Initializable {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package core.plugin;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
/**
|
||||
* Represents a plugin.
|
||||
* @author Emperor
|
||||
* @param <T> The argument type.
|
||||
*/
|
||||
public interface Plugin<T> {
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param arg The argument.
|
||||
* @return The plugin instance created.
|
||||
*/
|
||||
public Plugin<T> newInstance(T arg) throws Throwable;
|
||||
|
||||
/**
|
||||
* Fires a plugin event.
|
||||
* @param identifier The identifier.
|
||||
* @param args The arguments.
|
||||
* @return Specified by the plugin implementation.
|
||||
*/
|
||||
Object fireEvent(String identifier, Object... args);
|
||||
|
||||
public default void handleSelectionCallback(int skill, Player player){};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package core.plugin;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Represents a plugin manifest.
|
||||
* @author Emperor
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface PluginManifest {
|
||||
|
||||
/**
|
||||
* Gets the plugin type.
|
||||
* @return The plugin type.
|
||||
*/
|
||||
public PluginType type() default PluginType.ACTION;
|
||||
public String name() default "";
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package core.plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin types.
|
||||
* @author Emperor
|
||||
*/
|
||||
public enum PluginType {
|
||||
|
||||
/**
|
||||
* Action plugin type.
|
||||
*/
|
||||
ACTION,
|
||||
|
||||
/**
|
||||
* Dialogue plugin type.
|
||||
*/
|
||||
DIALOGUE,
|
||||
|
||||
/**
|
||||
* Activity plugin type.
|
||||
*/
|
||||
ACTIVITY,
|
||||
|
||||
/**
|
||||
* Player login plugin type.
|
||||
*/
|
||||
LOGIN,
|
||||
|
||||
/**
|
||||
* Player logout plugin type.
|
||||
*/
|
||||
LOGOUT,
|
||||
|
||||
/**
|
||||
* Quest plugin type.
|
||||
*/
|
||||
QUEST;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user