▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Плагины/EmakiCoreLib | Script-Powered Modular Plugin Framework
EmakiCoreLib | Script-Powered Modular Plugin Framework

EmakiCoreLib | Script-Powered Modular Plugin Framework

The unified core library for the Emaki plugin suite — action engine, JavaScript scripting, and cross-plugin infrastructure.

Оцените первым
243
0

EmakiCoreLib is the shared foundation for all Emaki series plugins. It does not provide gameplay features directly — instead, it offers unified service registration, an action execution engine, GUI framework, economy bridging, and item source resolution for all upper-layer plugins. If you use any Emaki plugin, this is a required dependency.

Core Features

Action Engine — 28 Built-in Action Types

The action engine is the driving force behind the entire Emaki ecosystem. All upper-layer plugins (skills, forging, strengthening, cooking, etc.) execute their effects through this engine. Actions are described as single-line text in the format actionId param1=value1 param2=value2, with support for @delay=10t delay prefixes and @template=name template references.

Complete Action Type List

CategoryAction IDDescription
MessagessendmessageSend a chat message to the player (MiniMessage supported)
MessagessendtitleSend title and subtitle to the player
MessagessendactionbarSend an action bar message
MessagesbroadcastmessageBroadcast a message to all players
Sound & ParticlesplaysoundPlay a sound effect (volume, pitch configurable)
Sound & ParticlesspawnparticleSpawn particles at a location
EconomygivemoneyGive money to the player
EconomytakemoneyTake money from the player
EconomysetmoneySet the player's balance
ItemscreateitemCreate an item and place it in the player's inventory
ItemssenditemSend the current context item to the player
ItemsclearitemRemove specified items from the player's inventory
ItemsdropitemDrop an item at a specified location
BlocksplaceblockPlace a block (supports CraftEngine/ItemsAdder/Nexo)
Player StatehealRestore player health
Player StatedamageDeal damage to the player
Player StatesethealthSet player health directly
Player StategiveexpGive experience points
Player StatetakeexpTake experience points
Player StatesetexpSet experience points
Player StategivepotioneffectApply a potion effect
Player StateremovepotioneffectRemove a specific potion effect
Player StateclearpotioneffectsClear all potion effects
Player StateteleportTeleport the player to coordinates
CommandsruncommandasplayerExecute a command as the player
CommandsruncommandasopExecute a command with OP privileges
CommandsruncommandasconsoleeExecute a command as console
TemplatesusetemplateReference and execute a predefined action template
IntegrationcastmythicskillTrigger a MythicMobs skill
ScriptingrunjsExecute a JavaScript script (aliases: runscript, javascript)

Action templates let you define reusable action sequences in config.yml under action.templates, then reference them anywhere via @template=templateName.

JavaScript Script Engine

A secure scripting environment powered by GraalJS. When built-in actions aren't enough, write JavaScript to implement custom logic.

Security Sandbox

Scripts run in a strictly isolated sandbox:

  • No file system access (allow_io: false)
  • No thread creation (allow_threads: false)
  • No native code access (allow_native_access: false)
  • No environment variable access (allow_environment_access: false)
  • No host class lookup (allow_host_class_lookup: false)
  • Path security filtering: rejects paths containing .., :, or \
  • Recursive script calls blocked (runjs/runscript/javascript denied from within scripts)
  • Max action dispatch depth limit (default: 3)

Timeout Protection

  • Default timeout: 1000ms
  • Max configurable timeout: 5000ms
  • Scripts forcibly terminated on timeout to prevent server freezes

Script Caching

  • Compiled scripts are cached for improved performance
  • Optional recompilation on reload (recompile_on_reload: true)

Directory Structure

Scripts are stored under plugins/EmakiCoreLib/scripts/ with auto-created subdirectories:

scripts/
├── global/        # General-purpose scripts
├── forge/         # Forging-related scripts
├── strengthen/    # Strengthening-related scripts
├── cooking/       # Cooking-related scripts
├── gem/           # Gem-related scripts
├── skills/        # Skill-related scripts
├── item/          # Item-related scripts
├── attribute/     # Attribute-related scripts
├── templates/     # Template scripts
└── examples/      # Example scripts

The emaki Global Object API

Scripts access the server environment through the emaki global object:

APIDescription
emaki.player.exists()Whether a player exists in the current context
emaki.player.name()Player name
emaki.player.uuid()Player UUID
emaki.player.world()Player's current world name
emaki.player.hasPermission(perm)Check a permission
emaki.player.sendMessage(msg)Send a message to the player
emaki.context.phase()Current execution phase
emaki.context.plugin()Source plugin name
emaki.context.placeholder(key)Get a placeholder value
emaki.context.placeholders()Get all placeholders
emaki.context.attribute(key)Get a context attribute
emaki.context.attributes()Get all context attributes
emaki.context.arg(key)Get an action argument
emaki.context.args()Get all action arguments
emaki.itemCurrent context item operations
emaki.action.run(actionId, args)Execute a specific action
emaki.action.runLine(line)Execute an action line string
emaki.logger.info(msg)Output an INFO log message
emaki.randomRandom number utilities
emaki.state.set(key, value)Write to shared state
emaki.state.get(key)Read from shared state
emaki.textText processing utilities
emaki.runSync(task)Execute a task on the main server thread
emaki.runSyncAndWait(task)Execute on main thread and await completion

Script Example

function main(ctx) {
  emaki.logger.info("Hello from Emaki JavaScript.");
  if (emaki.player.exists()) {
    emaki.player.sendMessage("[EmakiJS] Hello, " + emaki.player.name() + "!");
  }
  emaki.state.set("hello_script_executed", true);
  return { success: true, message: "hello.js executed" };
}

Item Source Resolution

A unified item retrieval interface supporting 7 sources. Use source:itemId format in any configuration that requires an item reference.

SourceAliasesDescription
Vanillavanilla, minecraft, vStandard Minecraft items
CraftEnginecraftengine, ceCraftEngine custom items
ItemsAdderitemsadder, iaItemsAdder custom items
NeigeItemsneigeitems, niNeigeItems custom items
MMOItemsmmoitems, miMMOItems custom items
EmakiItememakiitem, eiEmaki series custom items
Nexonexo, noNexo custom items

Regardless of which item source is referenced in plugin configurations, CoreLib resolves and retrieves them correctly.

Economy Bridging

Three provider selection modes:

ModeDescription
autoAutomatically selects ExcellentEconomy when a currency ID is specified, otherwise falls back to Vault
vaultForces Vault (compatible with most economy plugins)
excellenteconomyForces ExcellentEconomy (requires currency ID, supports multi-currency)

Economy actions (givemoney/takemoney/setmoney) all support provider and currency parameters for flexible adaptation to different server economies.

Condition System

A flexible condition evaluation framework supporting 5 combination modes:

TypeDescription
all_ofAll conditions must pass (default)
any_ofAny single condition passing is sufficient
none_ofAll conditions must fail
at_leastAt least N conditions must pass (requires required_count)
exactlyExactly N conditions must pass (requires required_count)

Conditions support nested grouping and are used for action triggers, equipment restrictions, skill casting, and more.

GUI Framework

A template-driven chest interface builder. Define layouts, item slots, and click actions via YAML templates — upper-layer plugins can create interactive GUIs without writing Java code. Supports item source resolution, placeholder substitution, and action binding.

Item Operation Ledger

A reversible item name/lore modification tracking system. When multiple plugins (forging, strengthening, gems, etc.) modify the same item's display, the ledger records each change and supports precise rollback of individual operations without affecting others.

Config Sync

Cross-plugin hot-reload infrastructure with three file synchronization strategies:

StrategyDescription
versionedFilesAutomatically merges new config entries on plugin update while preserving user modifications
staticFilesOnly extracted when the file doesn't exist; never overwritten afterward
defaultDataFilesSample data extracted only on first install; subsequent updates won't overwrite

Async Infrastructure

  • Async File Service — Non-blocking config I/O to avoid main thread stalls
  • PDC Data Service — PersistentDataContainer read/write utilities
  • Action Dispatcher — Supports delayed execution, async execution, and Future callbacks

Requirements

ItemRequirement
ServerSpigot 1.21+
Java21+
Hard DependenciesNone
Soft DependenciesVault, ExcellentEconomy, PlaceholderAPI, CraftEngine, ItemsAdder, NeigeItems, MMOItems, Nexo

Commands

CommandDescription
/emaki reloadReload core configuration

Permissions

PermissionDescription
emaki.adminAdministrator permission

View Full Wiki Documentation | Join Discord Community | QQ Group

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

1.21.x

Платформы

Поддерживаемые окружения

Сервер

Ссылки

Создатели

Детали

Лицензия:
Опубликован:2 месяца назад
Обновлён:1 неделю назад
Главная