# Gamemode Locks

Gamemode Locks are a feature added by SWPM that allows hosts to designate specific areas/dimensions with a set gamemode.

- This gamemode will override the default setting of the world or server.
- This gamemode lock will automatically change the gamemode of any player that crosses into the area/dimension.
- This gamemode lock will not effect those with the correct keys to bypass. Please see [Role Permission Keys](https://wiki.swequestrian.com/books/star-worm-plus/page/role-permission-keys).
- This gamemode can be set to apply to a specific dimension, or even a specific area within a dimension.  
    
    - This gamemode can "nest". A Region Gamemode Lock will override a Dimension Gamemode Lock.

---

#### **View Gamemode Locks**

<p class="callout info">Gamemode Locks can only be viewed/edited by players with the Admin Key (SWPM) and within the applicable dimension.</p>

`/swpm gamemode list` List all Gamemode Locks in the current dimension.

---


#### **Create a Gamemode Lock (Basic)**

<p class="callout info">Gamemode Locks can only be set by players with the Admin Key (SWPM).</p>

<details id="bkmrk-%2Fsweconm-admin-balan"><summary>\[DIMENSION\] /swpm gamemode \[gamemode\] \[@/player\] dimension &lt;true/false&gt;</summary>

**Action:** Creates a gamemode lock in the current dimension, dis/allowing the /swpm fly command for the effected players.

**Example:** Puts all players (@a) into adventure mode when in the current dimension, disallowing /swpm fly.

```
/swpm gamemode set adventure @a dimension false
```

**Note:** N/A

</details><details id="bkmrk-%5Bregion%5D-%2Fswpm-gamem"><summary>\[REGION\] /swpm gamemode set \[gamemode\] \[@/player\] &lt;gamemode lock name&gt; \[coords\] &lt;true/false&gt;</summary>

**Action:** Creates a gamemode lock within a set coordinates, with a specific name, dis/allowing the /swpm fly command for the effected players.

**Example:** Puts all players (@a) into survival mode within the set coordinates (cube) of the Region Lock named 'Woot', disallowing the /swpm fly command.

```
/swpm gamemode set survival @a region Woot -377 78 -18 -415 75 40 false
```

**Note:** N/A

</details>---


#### **Create a Gamemode Lock (Advanced)**

Gamemode Locks can be set to exclude users in an approved group (such as those with a certain key or a staff/moderator [team](https://minecraft.fandom.com/wiki/Commands/team)).   
When specified, the mod will not alter the gamemode of any players in the excluded group.

<details id="bkmrk-%5Badvanced%3A-example%5D-"><summary>\[ADVANCED: EXAMPLE\] /swpm gamemode set adventure @a\[key=!swpm:admin\] dimension</summary>

**Action:** Creates a Gamemode Lock that affects all players (@a) EXCEPT those specified.

**Example:** Puts all players (@a) that do NOT have the Admin Key into survival mode when in the current dimension.

```
/swpm gamemode set adventure @a[key=!swpm:admin] dimension
```

**Note:** This was used extensively to allow staff members access to the gamemodes they required to complete their work. This was also used in conjunction with command blocks to create 'staff-only' spaces.  
**Note:** Currently, only one Key can be selected at a time, otherwise it works as an AND statement. Meaning "/swpm gamemode set adventure @a\[key=!swpm:admin,!swpm:mod\] dimension" will affect all players that don't have BOTH the Admin Key and Mod Key. All players with only one or neither will be affected.

</details><p class="callout info">If you prefer to use Minecraft Teams - Teams needs to be set up separately (Minecraft feature) and players manually added to the team. Read more **[here](https://minecraft.fandom.com/wiki/Commands/team).**</p>

---


#### **Options (Explained)**

**Gamemode**

<table border="1" id="bkmrk-adventure-the-player" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 15.0797%;"></col><col style="width: 84.9203%;"></col></colgroup><tbody><tr><td>[**Adventure**](https://minecraft.fandom.com/wiki/Adventure)

</td><td>The player is mortal (can be killed), can explore the world but cannot place or destroy blocks.</td></tr><tr><td>**[Survival](https://minecraft.fandom.com/wiki/Survival)**</td><td>The player is mortal (can be killed) and may explore the world, place and destroy blocks.</td></tr><tr><td>**[Creative](https://minecraft.fandom.com/wiki/Creative)**</td><td>The player is immortal, has free access to any block in the game, instant destruction of blocks, creative flight.</td></tr><tr><td>**[Spectator](https://minecraft.fandom.com/wiki/Spectator)**</td><td>The player is immortal, can fly through objects or the world, cannot interact with any items or entities.</td></tr></tbody></table>

**Target**

<table border="1" id="bkmrk-target-selector-a-se" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 15.0762%;"></col><col style="width: 84.9238%;"></col></colgroup><tbody><tr><td>[**Target Selector**](https://minecraft.fandom.com/wiki/Target_selectors)

</td><td>A selector such as @a (all players)</td></tr><tr><td>**Player UN**</td><td>A specific player's username</td></tr><tr><td>**Player [UUID](https://minecraft.fandom.com/wiki/UUID)**</td><td>A specific player's user ID (UUID)</td></tr></tbody></table>

**Range / Area**

<table border="1" id="bkmrk-dimension-a-selector" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 15.0762%;"></col><col style="width: 84.9238%;"></col></colgroup><tbody><tr><td>**Dimension**

</td><td>A selector such as @a (all players)</td></tr><tr><td>[Region](https://minecraft.fandom.com/wiki/Argument_types#block_pos "Region")</td><td>Determine a cube selection of the desired area (selection) including **height** and **depth**. Specify the coordinates of two opposing corner blocks.</td></tr></tbody></table>

---


#### **Edit or Remove a Gamemode Lock**

<p class="callout info">Gamemode Locks can only be removed by players with the Admin Key (SWPM) who are located within the region/dimension Lock.</p>

`/swpm gamemode remove <name>` Removes a gamemode lock in the current region (position).

`/swpm gamemode remove dimension` Removes a gamemode lock in the current dimension.

`/swpm gamemode rename` Renames the specified region Gamemode Lock.

<p class="callout warning">It's recommended to keep track of the full commands used to create multiple Gamemode Locks. If your server uses a Region Lock per plot like ours did, then editing them can be tedious unless you have the full commands (including coordinates) in a copy/paste list for easy editing.</p>

---


#### **Troubleshooting**

**Command fails**

- Player has incorrect permissions to use the command
- Server has ranks that override or forbid the use of the command
- Player has incorrectly written the arguments (command)

**Cannot remove a Gamemode Lock**

- Not standing in a valid region with a gamemode lock to be deleted (none present, outside the region).

---


#### **Changelog**

<details id="bkmrk-this-is-not-a-comple"><summary>View Changes</summary>

<p class="callout info">This is not a complete list of version changes / fixes. It is a changelog of relevant wiki-related version information.</p>

<table border="1" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 13.3504%; height: 29.7969px;">**MC Version**</td><td class="align-center" style="width: 20.0257%; height: 29.7969px;">**Release**</td><td class="align-center" style="width: 66.6239%; height: 29.7969px;">**Notes**</td></tr><tr style="height: 29.7969px;"><td style="width: 13.3504%; height: 29.7969px;">1.18.2</td><td style="width: 20.0257%; height: 29.7969px;">1.18.2-2.1.0</td><td style="width: 66.6239%; height: 29.7969px;">New feature - added **/gamemode** command</td></tr></tbody></table>

</details>