-
Notifications
You must be signed in to change notification settings - Fork 0
Velocity Event Decorators
@shamoo/velocity-raw exports 46 generated Velocity event decorators from the pinned generated API 3.4.0-20260121.190037-118. Each decorator:
- is imported from
@shamoo/velocity-raw; - targets one method;
- is invoked with no arguments;
- records its fully qualified Java event name in compiler metadata;
- marks the method as a Velocity event invocation.
import { Component, Context } from '@shamoo/decorators';
import { OnPostLoginEvent } from '@shamoo/velocity-raw';
@Component()
export class Listener {
@OnPostLoginEvent()
public joined(@Context() payload: { readonly type: string }): void {
console.info(payload.type);
}
}Generated event interfaces model the pinned Velocity JVM API, but the current bundled Runtime adapter supplies only copied { type } data to JavaScript, not a live Velocity event object. It registers at order 0. The Java bridge supports native asynchronous continuation through EventTask.resumeWhenComplete; the JavaScript handler may return a Promise, but generated JVM methods are unavailable through the current data-only callback.
OnCommandExecuteEvent, OnPlayerAvailableCommandsEvent, OnPostCommandInvocationEvent
OnConnectionHandshakeEvent, OnDisconnectEvent, OnLoginEvent, OnPluginMessageEvent, OnPostLoginEvent, OnPreLoginEvent, OnPreTransferEvent
OnPermissionsSetupEvent
OnCookieReceiveEvent, OnCookieRequestEvent, OnCookieStoreEvent, OnGameProfileRequestEvent, OnKickedFromServerEvent, OnPlayerChannelRegisterEvent, OnPlayerChannelUnregisterEvent, OnPlayerChatEvent, OnPlayerChooseInitialServerEvent, OnPlayerClientBrandEvent, OnPlayerModInfoEvent, OnPlayerResourcePackStatusEvent, OnPlayerSettingsChangedEvent, OnServerConnectedEvent, OnServerLoginPluginMessageEvent, OnServerPostConnectEvent, OnServerPreConnectEvent, OnServerResourcePackRemoveEvent, OnServerResourcePackSendEvent, OnTabCompleteEvent
OnPlayerConfigurationEvent, OnPlayerEnterConfigurationEvent, OnPlayerEnteredConfigurationEvent, OnPlayerFinishConfigurationEvent, OnPlayerFinishedConfigurationEvent
OnListenerBoundEvent, OnListenerCloseEvent, OnProxyInitializeEvent, OnProxyPingEvent, OnProxyPreShutdownEvent, OnProxyReloadEvent, OnProxyShutdownEvent
OnServerRegisteredEvent, OnServerUnregisteredEvent
OnProxyQueryEvent
Keep Velocity imports reachable only from velocityEntrypoint. A common source file reached by both entrypoints cannot import @shamoo/velocity-raw, because that would leak Velocity declarations into the Paper bundle. Put handlers in src/velocity.ts or another Velocity-only module and export common platform-neutral state from src/plugin.ts.
// src/velocity.ts
export * from './plugin.js';
import { defineVelocityEntrypoint } from '@shamoo/velocity';
import { OnProxyInitializeEvent } from '@shamoo/velocity-raw';
import { Component, Context } from '@shamoo/decorators';
@Component()
export class VelocityEvents {
@OnProxyInitializeEvent()
public initialized(@Context() payload: { readonly type: string }): void {
console.info(payload.type);
}
}
export default defineVelocityEntrypoint({
start() {},
stop() {},
});Use zero-argument entrypoint hooks: although defineVelocityEntrypoint accepts VelocityEntrypointContext, the current bundled adapter does not pass that context.
Source: generated Velocity event exports and package-grouped generated sources.