Date: 2023/07/19 08:47:06 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
ChunkLoad_Data:
type: data
debug: false
# Specify the worlds to disable flight in here.
Disabled_Worlds:
- Spawn
- SpawnBuilds
- Events
ChunkLoad_Command:
type: command
debug: true
name: chunkload
description: Keeps a single chunk loaded
usage: /chunkload [remove]
tab completions:
1: remove
permission: servername.user.chunkload
script:
- if <context.args.get[1].if_null[null]> == remove:
- if <player.has_flag[LoadedChunk].not>:
- narrate "<server.flag[ServerName]> <&7>» <&c>You do not have a loaded chunk"
- stop
- else:
- define chunk <player.flag[LoadedChunk]>
- chunkload remove <[chunk]>
- flag server LoadedChunks:<-:<[chunk]>
- flag <player> LoadedChunk:!
- narrate "<server.flag[ServerName]> <&7>» <&6><[chunk].x>,<[chunk].z>,<[chunk].world.name> <&color[#87CEEB]>will no longer stay loaded."
- stop
- else:
- define chunk <player.location.chunk>
- if <script[ChunkLoad_Data].data_key[Disabled_Worlds].contains[<[chunk].world.name>]>:
- narrate "<server.flag[ServerName]> <&7>» <&c>You cannot use this command in this world!"
- stop
- if <server.flag[LoadedChunks].if_null[<list>].contains[<[chunk]>]>:
- narrate "<server.flag[ServerName]> <&7>» <&c>This command has already been used on this chunk!"
- stop
- if <player.has_flag[LoadedChunk].not>:
- flag <player> LoadedChunk:<[chunk]>
- flag server LoadedChunks:->:<[chunk]>
- chunkload <[chunk]>
- narrate "<server.flag[ServerName]> <&7>» <&6><[chunk].x>,<[chunk].z>,<[chunk].world.name> <&color[#87CEEB]>will now stay loaded while you are online"
- stop
- else:
- chunkload remove <player.flag[LoadedChunk]>
- flag server LoadedChunks:<-:<player.flag[LoadedChunk]>
- flag <player> LoadedChunk:<[chunk]>
- flag server LoadedChunks:->:<[chunk]>
- chunkload <[chunk]>
- narrate "<server.flag[ServerName]> <&7>» <&6><[chunk].x>,<[chunk].z>,<[chunk].world.name> <&color[#87CEEB]>will now stay loaded while you are online."
- stop
ChunkLoad_Handler:
type: world
debug: false
events:
after player joins flagged:loadedchunk:
- chunkload <player.flag[LoadedChunk]>
after player quits flagged:loadedchunk:
- chunkload remove <player.flag[LoadedChunk]>