Server

Learn more about the available Server Decorators

Basic Event Decorator

Every basic event decorator has an optional parameter for the eventname to be listened If the parameter is not provided, the name of the decorated method will be used as the eventname.

// Please notice, the first parameter inside the method is everytime
// the player they send the event to server

@OnClient('customEventname')
public doFancyStuff(player: Player): void {
  // customEventname is the eventname for listen
}

@OnClient()
public youAwesomMethod(player: Player): void {
  // yourAwesomeMethod is the eventname for listen
}

Colshape Decorator

Dealing with colshapes can be really frustrating. For example, you want to use colshapes in your gamemode and check which entity is inside the colshape or what entity enters or leaves the colshape. That's why we create these decorators. Working with colshapes has never been easier.

Only the first parameter is required to identify the triggered colShape. If you want to be more specific, you can set the name, and the triggered entity type.

// Would be triggered if colshape is cylinder with name myColShape 
// and the entity is a player
@EntityEnterColShape(ColShapeType.Cylinder, 'myColShape', BaseObjectType.Player)
public testEnter1(colshape: Colshape, player: Player): void {
  UtilsService.log('cylinder, myColShape, player');
}

// Would be triggered if colshape is cylinder with name myColShape
@EntityEnterColShape(ColShapeType.Cylinder, 'myColShape')
public testEnter2(colshape: Colshape, entity: Entity): void {
  UtilsService.log('cylinder, myColShape');
}

// Would be triggered if colshape is cylinder
@EntityEnterColShape(ColShapeType.Cylinder)
public testEnter3(colshape: Colshape, entity: Entity): void {
  UtilsService.log('cylinder');
}

Last updated