Skip to main content

Protection

Deprecated region engine with flags and region events. Use the official Region extension for new projects.

FreeDeprecatedv1.3World & building
This extension is deprecated and no longer receives new features. Use Region (official TypeWriter extension) instead.

Overview​

Deprecated

Protection is deprecated. It receives no new features, and v1.3 is the final compatibility release. New projects should use the official Region extension of TypeWriter, documented at docs.typewritermc.com. This page remains for servers that already run Protection.

Protection lets you define regions in the TypeWriter web panel and give them rules, called flags. A region is a cuboid or a polygon prism stored in an artifact, with a priority, owners, members, an optional parent region and a list of flags such as build, pvp or mob-spawning. When players act inside a region, the extension cancels or changes the action according to the flags.

Regions are also TypeWriter objects. You can start a sequence when a player enters or leaves a region, filter an audience by region, group players by region, read a fact that tells whether a player is inside, and show regions on a BlueMap map.

Features​

  • Cuboid and polygon regions — draw a region in game with a toolbar, or import a WorldEdit selection.
  • World-wide regions — a global artifact covers whole worlds between two heights.
  • Overlap and priority — regions can overlap; they are evaluated from the highest priority down.
  • Parent regions — a child region inherits the flags, owners and members of its parent.
  • Many flags — 99 flag keys covering building, combat, explosions, environment, movement and chat.
  • Owners and members — these players are never restricted inside their region.
  • Region events — enter and exit events, an audience filter, a group and a fact.
  • Inspection tools — /typewriter protection inspect, info and flags show which flags apply where you stand.
  • BlueMap markers — display a region on BlueMap with your own colours.
  • PlaceholderAPI — read the regions around a player and their flag values.

Installation​

  1. Install PacketEvents, which TypeWriter already requires.
  2. Optional: install WorldEdit or FastAsyncWorldEdit to import selections with /typewriter protection import-we.
  3. Optional: install MythicMobs so the mob-spawning flag also applies to Mythic mobs, and BlueMap to show regions on the map.
  4. Optional: PlaceholderAPI for the placeholders.
  5. Put the Protection JAR in plugins/Typewriter/extensions/ and restart the server.

Getting started​

Protect a spawn area against building and PvP:

  1. In the TypeWriter web panel, open a manifest page and add a Protection Region Artifact. Leave artifactId as generated: it stores the shape of the region.
  2. Add a Protection Region Definition and link the artifact in artifact. Set a priority (for example 10).
  3. In flags, add a flag with the key build and a boolean value set to false. Add pvp the same way. A false boolean flag denies the action.
  4. Publish the page.
  5. In game, run /typewriter protection edit <definition>. A toolbar appears in your hotbar: the blaze rod adds a point at the block you look at, the redstone removes the last point, the compass switches between cuboid and polygon mode, the lime dye applies the selection and the barrier cancels. For a cuboid, add two opposite corners and apply.
  6. Walk into the area and try to break a block. You can check what applies with /typewriter protection inspect.
Import a WorldEdit selection

Make a selection with WorldEdit, then run /typewriter protection import-we <definition>. Your selection is converted into points that you can then apply.

Owners and members

Owners and members of a region, and players with typewriter.protection.bypass, ignore every flag of that region. Test with a player who is not listed, and not an operator with the bypass permission.

How it works​

A region only exists while its definition entry exists and is published. Its shape is stored in the artifact, and the definition holds everything else.

Overlap. Several regions can contain the same point. They are checked from the highest priority to the lowest. For boolean flags, one false flag is enough to deny the action: a region with build true does not cancel the denial of a lower priority region. Flags that change something (messages, actions, teleports) are applied by the first region that defines them.

Inheritance. A region with a parentRegion also evaluates the flags of its parents. Owners and members of the parents are added to the child. The child uses its own priority, or the parent one when its own is 0.

Region borders. Enter and exit are detected when a player moves to another block or teleports. A player who joins inside a region triggers the enter event on their first block of movement.

Configuration​

Messages and inspection. Add one Protection Settings entry to change how denied actions are shown: chat, action bar or boss bar, MiniMessage templates ({reason}, {reason_line}, {region}, {flag}), the refresh rate of the inspection mode (inspectRefreshTicks, at least 5 ticks) and the text of the command messages in messages. Without this entry, defaults are used. Only the first entry found is read.

BlueMap. In a region definition, turn on bluemapSettings.enabled to draw the region on BlueMap. You choose the marker set, the line and fill colours, the label ({name}, {id}, {priority}) and whether the marker is extruded or flat. Regions are synchronised when BlueMap starts and whenever a region changes.

Owners and members. owners and members hold player UUIDs. The commands addowner and addmember accept a player name and store the UUID when the player is known to the server.

Flags​

Flags are added to the flags list of a region definition. Each flag has a key and a typed value. Most flags are booleans: a false value denies the action. The flag keys below are the ones used in the web panel and in commands.

Building and interaction​

FlagWhat a false value does
buildCancels block break and place. Checked before block-break and block-place.
block-break, block-placeCancels breaking or placing blocks.
useCancels right-clicks on doors, buttons, levers, gates, trapdoors, signs, chests, barrels, shulker boxes, furnaces, anvils, crafting and other stations, redstone components and similar blocks.
interactCancels every player interaction, including clicks in the air. Use with care.
chest-accessCancels opening containers (chests, barrels, shulker boxes, hoppers, dispensers, droppers, furnaces, brewing stands).
sleepCancels using beds.
lighterCancels flint and steel and fire charges.
vehicle-place, vehicle-destroyCancels placing minecarts and boats, or a player destroying a vehicle.
entity-painting-destroyCancels a player breaking paintings and item frames.
crop-tramplingCancels farmland being trampled.
pistonsCancels pistons moving blocks into or out of the region.
item-pickup, item-dropCancels picking up or dropping items.

Combat and mobs​

FlagWhat a false value does
pvpCancels damage between players.
mob-damageCancels damage to a player caused by an entity that is not a player.
damage-animalsCancels a player hitting animals.
tnt-damage, firework-damageCancels damage from TNT and explosive minecarts, or from fireworks.
mob-spawningCancels creature spawns, whatever the reason. It also applies to MythicMobs when MythicMobs is installed.
btcmob-spawning, btcmob-damageSame for BTC Mobs creatures, when BTC Mobs is installed.
exp-dropsMobs killed in the region drop no experience.
potion-splashCancels splash potions landing in the region.

Explosions and environment​

FlagWhat a false value does
creeper-explosion, tntCancels creeper explosions, or TNT, TNT minecarts and respawn anchor explosions.
ghast-fireballCancels explosions of fireballs, wither skulls, dragon fireballs and wind charges.
fire-spreadCancels fire spreading, burning blocks and ignition that is not lava or lightning.
lava-fire, lightningCancels ignition by lava, and lightning strikes and ignition.
lava-flow, water-flowCancels lava or water flowing into the region.
ice-melt, snow-meltCancels ice or snow melting.
ice-form, snow-fallCancels ice or snow forming.
frostwalkerCancels frost walker ice.
leaf-decay, grass-growth, vine-growthCancels leaves decaying, grass, mycelium, paths and mushrooms spreading, and vines growing.
enderman-grief, ravager-griefCancels endermen and ravagers changing blocks.
chunk-unloadA true value keeps the chunks of the region force-loaded.

Movement​

FlagValueEffect
entry, exitbooleanA false value blocks entering or leaving the region. Blocked players get the deniedEntry message.
entry-deny-action, exit-deny-actionactionsTypeWriter actions run for the player when they enter or leave, and when an entry or exit is denied. Use the enter and exit event entries for ordinary logic.
ender-pearlbooleanA false value cancels ender pearl teleports to the region.
fall-damagebooleanA false value cancels fall damage.
flybooleanA false value turns flight off for players in the region.
walk-speed, fly-speednumberSets the walk or fly speed of players inside, between 0 and 1. Bukkit scale: 0.2 is the normal walk speed and 0.1 the normal fly speed. The default is restored outside.
glidetextdeny stops elytra gliding and flight toggling. allow and default do nothing.
join-locationpositionPlayers who log in or respawn inside the region are moved to this position.

Player state, chat and commands​

FlagValueEffect
hungerbooleanA false value stops hunger loss.
heal-amount, heal-min-health, heal-max-healthnumberHeals players in the region by heal-amount health points every second, between the minimum and maximum health. Healing pauses for 5 seconds after any damage.
item-durabilitybooleanA true value stops tools, weapons and armor losing durability.
send-chat, receive-chatbooleanA false value blocks messages sent from, or received inside, the region.
chat-prefix, chat-suffixtextAdds text before or after chat messages sent from the region.
blocked-cmds, allowed-cmdslistCommand names (without the slash) that are blocked, or that are always allowed. * blocks every command. allowed-cmds wins.
worldeditbooleanA true value blocks WorldEdit commands for players in the region.

Not enforced by this extension​

The following flags can be added to a region but nothing in Protection acts on them: passthrough, teleport, godmode, nether-portals, entry-min-level, entry-max-level, permit-completely, mobtrap-use, blocked-effects, heal-delay, biome (the biome is not changed), and the RPG flags mana-regen, mana-drain, double-drop, grappling-hook, fishing, alchemy, enchanting-override, elytra-auto-switch, ground-item-glow, pistol, corruption, auction, backpack, wardrobe, profession, experience, gathering and resin.

keep-inventory, keep-exp and invincible have no effect for regular players either: they only act for owners, members and players with the bypass permission.

Commands​

All commands are sub-commands of /typewriter (alias /tw), for example /typewriter protection list. They can only be used by players and need typewriter.protection. Commands marked admin need typewriter.protection.admin.

CommandDescription
/typewriter protection listList loaded regions, highest priority first.
/typewriter protection edit <definition>Start drawing the region in game with the hotbar toolbar. For a global artifact, it applies the artifact values immediately.
/typewriter protection applySave the current selection.
/typewriter protection cancelCancel the current selection.
/typewriter protection remove <1-16>Remove one point of the current selection.
/typewriter protection import-we <definition>Import your WorldEdit selection as the points of the region.
/typewriter protection info <region>Show the shape, priority, owners, members and flags of a region.
/typewriter protection flags <region>Show which flags are effective, inherited, overridden or blocked by inheritance.
/typewriter protection inspectToggle a live view of the regions and flags where you stand, in the action bar and boss bars.
/typewriter protection teleport <region>Teleport to the centre of a region (or the world spawn for a global region).
/typewriter protection wandGives a stick named Protection Wand. In this release, nothing reacts to it.
/typewriter protection setflag <region> <flag> <value> (admin)Change a flag in memory.
/typewriter protection clearflag <region> <flag> (admin)Clear a flag in memory.
/typewriter protection addowner|removeowner|addmember|removemember <region> <player> (admin)Change owners or members in memory.
/typewriter protection delete <region> (admin)Remove a region from memory.
/typewriter protection reload (admin)Reload regions from the published entries.
/typewriter protection migrate-from-worldguard (admin)Experimental import of the cuboid bounds of WorldGuard regions. See the page on artifact identity and migration.
In-memory commands

setflag, clearflag, addowner, removeowner, addmember, removemember and delete do not write to your entries. They change the loaded copy, and the changes are lost on reload or restart. Most flags are enforced from the region definition entry, so a setflag does not change how build, pvp or most other flags behave. Edit flags in the web panel and publish.

Permissions​

PermissionGrants
typewriter.protectionThe /typewriter protection commands that are not admin only.
typewriter.protection.adminThe admin commands: flags, owners, members, delete, reload and WorldGuard migration.
typewriter.protection.bypassIgnore every flag, in every region.

Placeholders​

PlaceholderAPI placeholders use the form %typewriter_regions:<path>%. They read the regions at the player position, sorted by priority; primary is the first one.

PlaceholderReturns
%typewriter_regions:count%How many regions contain the player.
%typewriter_regions:list%, %typewriter_regions:list_names%The ids, or the names, of those regions, separated by commas.
%typewriter_regions:stack%Priority and name of each region, separated by |.
%typewriter_regions:has:<id1>,<id2>%true if the player is in one of the listed regions.
%typewriter_regions:primary%The name of the highest priority region. Add :id, :name, :priority, :overlap_count, :parent, :parent_name, :owner_count, :member_count, :is_global, :depth or :path for other fields.
%typewriter_regions:active:<n>%The same fields for the n-th region of the stack, starting at 1, for example %typewriter_regions:active:2:id%.
%typewriter_regions:flag:<flag>%The value of a flag in the primary region. Add :state, :source or :source_name for where it comes from.
%typewriter_regions:by_id:<region>:<field>%A field of a given region, for example %typewriter_regions:by_id:spawn:priority%.
%typewriter_regions:exists:<region>%true if the region exists.
%typewriter_regions:nearest%The region whose minimum corner is nearest to the player. The same fields are available.
%typewriter_regions:can_build%, %typewriter_regions:can_interact%false when the first region, by priority, that sets build (or interact) has it set to false, otherwise true.

Migrating to Region​

Protection will not receive new features, so plan to move to the official Region extension of TypeWriter, documented at docs.typewritermc.com. This page does not describe Region: follow its own documentation.

Protection contains no tool to convert its regions to Region. The general approach is:

  1. List your regions with /typewriter protection list and note, for each one, its shape, priority, parent, owners and members, and flags (/typewriter protection info <region>).
  2. Recreate each region in the new extension and map each flag to the equivalent setting there. Some Protection flags are not enforced (see above), so you may not need them.
  3. Test on a copy of your server, with players who are not owners, members or bypass holders.
  4. Remove the Protection entries and the JAR once the new regions behave as expected. Keep a backup of your TypeWriter pages and assets first.

Entries​

9 entries, generated from the extension source.

Events2
Facts1
Audiences1
Groups1
Artifacts2
Manifests2

Troubleshooting​

A flag does nothing. Check the flag in Flags: some keys are not enforced. Also check that the region is saved and published, that the player is not an owner, a member or a holder of typewriter.protection.bypass, and that the value is a boolean set to false for denying flags.

The region exists but players are not inside it. The shape comes from the artifact. A definition without an artifact, or an artifact where you never applied a selection, covers nothing. Run /typewriter protection edit <definition> and apply a selection, then check with /typewriter protection info <region>. All points must be in the same world, and a cuboid needs 2 points, a polygon 3.

The selection toolbar does not appear. edit needs a published region definition linked to an artifact. If the message says the definition is not linked to any artifact, link one. For a global artifact there is no toolbar: set worlds, minY and maxY on the artifact.

/typewriter protection import-we says no selection or no adapter. WorldEdit or FastAsyncWorldEdit must be installed and you must have made a selection in the world you are standing in.

A setflag change disappears. The command only changes memory. Put the flag in the region definition and publish.

A WorldGuard migration did not create regions. The migration does not create region definitions, flags, owners or members: it only handles the cuboid bounds of each region, and it reads the regions of WorldGuard through the first loaded world. Create the definitions in the web panel.

Players are not teleported or blocked by entry. The check happens when a player moves to another block or teleports. Entering by a plugin that moves the player without a movement or teleport event is not seen.

  • MythicMobs — mob-spawning also applies to Mythic mobs.