SwitchCase - Switch (Section) — SkBee

Addon: SkBee · Category: Section · Since: 3.8.0

Syntax

switch %object%

Description

Switch an object and use cases to manage different actions.

Examples

on break:
	switch event-block:
		case dirt:
			give player a stick named "Dirt"
		case stone:
			give player an apple named "Stone"
		case grass block:
			give player an iron ingot named "Iron Ingot"
		default:
			kill player

on damage of a mob by a player:
	switch type of victim:
		case zombie, husk, a drowned:
			spawn 3 baby zombies at victim
		case skeleton, stray:
			spawn a skeleton horse at victim:
				set {_h} to entity
			spawn a skeleton at victim:
				set {_s} to entity
			make {_s} ride {_h}
		case sheep, cow, chicken, pig:
			kill attacker
		default:
			give attacker a diamond

View source