2022-11-23 23:59:01 -06:00
|
|
|
package noppes.npcs.controllers.data;
|
2021-09-30 00:56:49 -05:00
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.eventhandler.Event;
|
2026-01-13 23:45:14 +02:00
|
|
|
import noppes.npcs.constants.EnumScriptType;
|
2021-09-30 00:56:49 -05:00
|
|
|
|
2023-01-12 21:33:06 -05:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
2021-09-30 00:56:49 -05:00
|
|
|
public interface IScriptHandler {
|
2026-01-13 23:45:14 +02:00
|
|
|
void callScript(EnumScriptType type, Event event);
|
|
|
|
|
|
2023-07-13 13:56:32 -05:00
|
|
|
void callScript(String hookName, Event event);
|
2021-09-30 00:56:49 -05:00
|
|
|
|
|
|
|
|
boolean isClient();
|
|
|
|
|
|
|
|
|
|
boolean getEnabled();
|
|
|
|
|
|
2023-07-13 13:56:32 -05:00
|
|
|
void setEnabled(boolean enabled);
|
2021-09-30 00:56:49 -05:00
|
|
|
|
|
|
|
|
String getLanguage();
|
|
|
|
|
|
2023-07-13 13:56:32 -05:00
|
|
|
void setLanguage(String language);
|
2021-09-30 00:56:49 -05:00
|
|
|
|
2026-01-13 17:34:14 +02:00
|
|
|
void setScripts(List<IScriptUnit> list);
|
2023-02-19 16:22:28 -06:00
|
|
|
|
2026-01-13 17:34:14 +02:00
|
|
|
List<IScriptUnit> getScripts();
|
2021-09-30 00:56:49 -05:00
|
|
|
|
|
|
|
|
String noticeString();
|
|
|
|
|
|
|
|
|
|
Map<Long, String> getConsoleText();
|
|
|
|
|
|
|
|
|
|
void clearConsole();
|
2026-01-13 18:14:38 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new Janino (Java) script unit for this handler.
|
|
|
|
|
* Handlers that don't support Janino scripts should return null.
|
|
|
|
|
*
|
|
|
|
|
* @return A new JaninoScript instance, or null if not supported
|
|
|
|
|
*/
|
|
|
|
|
default IScriptUnit createJaninoScriptUnit() {
|
|
|
|
|
return null; // Default: Janino not supported
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if this handler supports Janino (Java) scripts.
|
|
|
|
|
*
|
|
|
|
|
* @return true if createJaninoScriptUnit() can create valid Janino scripts
|
|
|
|
|
*/
|
|
|
|
|
default boolean supportsJanino() {
|
|
|
|
|
return createJaninoScriptUnit() != null;
|
|
|
|
|
}
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|