Justice is available in the game once a Sheriff or Captain of the Guard has been appointed through the screen, and is used to deal with dwarves violating mandates, breaking furniture, starting fights, etc. The dwarven justice screen shows details of crimes and punishments, and is available through the obles -status screen (even if no nobles are appointed yet).
- Violation of Production Order - failing to produce items mandated by a noble.
- Violation of Export Prohibition - selling items to a caravan which a noble forbade exporting.
- Violation of Job Order - failing to complete guild jobs mandated by the mayor (currently does not happen).
- Conspiracy to Slow Labor - unknown
- Murder - killing a fellow dwarf or a tame animal. Alternatively, being caught sucking blood out of another dwarf.
- Disorderly Conduct - attacking another dwarf while throwing a tantrum.
- Building destruction - destroying a building during a tantrum.
- Vandalism - toppling furniture or doors during a tantrum.
If a vampire is caught feeding on another dwarf, even if the victim survives, it is still considered a murder. The vampire will typically make a false report, to try to frame another dwarf. Witnesses will also sometimes make false reports to try and frame dwarves they have grudges against.
"Violating an export ban" happens when a dwarf carelessly carries a banned item to the trade depot and a merchant leaves the map with it. It often happens when a noble decides to ban an export after you've traded away a relevant item.
If your dwarves start throwing tantrums, then you'll see the harsher crimes, as they let off steam by throwing items around, breaking furniture, toppling doors, and punching fellow dwarves who are just trying to clean up the mess. Often instead of punches, they'll use the weapons they're carrying.
Dwarves who misbehave can receive punishments if a sheriff has been assigned. In increasing order of severity ( at least that's what your dwarves think):
- Beating by a fortress guard (results in death unless you take precautions, see below)
- Imprisonment for a period of time.
- Hammering by the Hammerer.
The punishment for a crime, or series of crimes, will be issued by the Sheriff or by a member of the Fortress Guard. If the crime calls for imprisonment, then the guard will try to put the prisoner in jail; if no jails are available, the guard will "downgrade" the punishment to a beating (giving the criminal a happy thought and the injured party an unhappy thought). If the crime calls for hammerstrikes, then the Hammerer will attach the prisoner to a restraint before carrying out the sentence; if no justice restraints are available, the punishment will be downgraded to a beating. All punishments will give the criminal an unhappy thought (and the guard/Hammerer a happy thought).
Note that it is usually not a good idea to train your guards to physical perfection if you want your dwarves to survive beatings; furthermore, due to a bug, guards will use their weapons when delivering beatingsBug:1016, so equipping them with steel blades is fatal. Wooden crossbows (especially those made of feather wood) make an easily accessible and excellent weapon choice, as this will not reduce the effectiveness of the Fortress Guard in actual combat - the Guard will fire bolts at enemies, but will use the crossbows as clubs for Justice beatings. An adamantine crossbow could potentially be even better, though it is far more difficult to make.
Due to a second bug, dwarves have very thin skulls,Bug:2907 so any beating of an unarmored dwarf has a high chance of causing death by fracturing the skull. Therefore it is wise to ensure that any criminals scheduled for beating are fitted with a metal helm as quickly as possible (if you want them to live).
Punishments are performed sequentially; a criminal who has been sentenced to jail time and a hammering will not be hammered until the entire jail term has been served.
 Cages and Chains
Metal cages, metal chains, and ropes can be built and designated as jails ( uery -> make a oom -> use for ustice), where dwarves can be imprisoned for a time as part of their punishment. If the dwarf is particularly unhappy and decides to throw a tantrum, she may end up destroying the restraint (even if it is made of metal) and escaping, leading to further punishment (for building destruction).
 Happiness management
A dwarf that is carelessly thrown in a cage is subject to several unhappy thoughts. Most can be avoided or offset with some care:
Putting food and booze stockpiles right next to the chain allows for happy thoughts from both instead of having to drink water when someone finally brings some. Decorating your jail with numerous valuable engravings and furniture is helpful too. Finally, with a bed and a table next to a chair all within a square of the chain itself, negative thoughts approach zero.
Crimes do not seem to lapse, so if you've delayed appointing the "executive" nobles for some time, there might be a long list of delinquents and open sentences pending. The law will swiftly proceed to caging all delinquents and, once the cages are full, beating up any remaining free "criminals". Therefore, beatings are avoided only by constructing cages first, and possibly way more than recommended in the z-screen.