PrefabPasteEvent
Package:
com.hypixel.hytale.server.core.prefab.eventExtends:CancellableEcsEventImplements:ICancellableEcsEventCancellable: Yes
ECS event dispatched when a prefab is being pasted into the world. Cancelling this event prevents the paste operation.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Nullable |
|---|---|---|---|---|
prefabId | int | getPrefabId() | No | No |
pasteStart | boolean | isPasteStart() | No | No |
- prefabId — The identifier of the prefab being pasted.
- pasteStart — Whether this is the start of the paste operation (
true) or a continuation.
Fired By
Section titled “Fired By”Dispatch location not identified in decompiled source. This event may be dispatched by game modules not yet mapped.
Listening
Section titled “Listening”ECS events are handled by EntityEventSystem subclasses, not by getEventRegistry().register().
public class MyPrefabPasteHandler extends EntityEventSystem<EntityStore, PrefabPasteEvent> { @Override public Query<EntityStore> getQuery() { return MY_COMPONENT_TYPE; }
@Override public void handle(int index, ArchetypeChunk<EntityStore> chunk, Store<EntityStore> store, CommandBuffer<EntityStore> commandBuffer, PrefabPasteEvent event) { int prefabId = event.getPrefabId(); boolean isStart = event.isPasteStart();
// Example: prevent pasting restricted prefabs if (isRestrictedPrefab(prefabId)) { event.setCancelled(true); } }}
// Register in plugin setup():getEntityStoreRegistry().registerSystem(new MyPrefabPasteHandler());Related Events
Section titled “Related Events”PrefabPlaceEntityEvent— Fired when a prefab places an entity into the world.