Skip to content

PrefabPasteEvent

Package: com.hypixel.hytale.server.core.prefab.event Extends: CancellableEcsEvent Implements: ICancellableEcsEvent Cancellable: Yes

ECS event dispatched when a prefab is being pasted into the world. Cancelling this event prevents the paste operation.

FieldTypeAccessorMutableNullable
prefabIdintgetPrefabId()NoNo
pasteStartbooleanisPasteStart()NoNo
  • prefabId — The identifier of the prefab being pasted.
  • pasteStart — Whether this is the start of the paste operation (true) or a continuation.

Dispatch location not identified in decompiled source. This event may be dispatched by game modules not yet mapped.

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());