mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-24 01:58:16 +01:00
Make /npc chunkload persistent by default
This commit is contained in:
parent
fd3833deba
commit
780899cbad
@ -307,16 +307,21 @@ public class NPCCommands {
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "chunkload",
|
||||
usage = "chunkload (-t(emporary))",
|
||||
desc = "Toggle the NPC forcing chunks to stay loaded",
|
||||
modifiers = { "chunkload", "cload" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
flags = "t",
|
||||
permission = "citizens.npc.chunkload")
|
||||
@Requirements(selected = true, ownership = true)
|
||||
public void chunkload(CommandContext args, CommandSender sender, NPC npc) {
|
||||
boolean enabled = !npc.data().get(NPC.KEEP_CHUNK_LOADED_METADATA, Setting.KEEP_CHUNKS_LOADED.asBoolean());
|
||||
npc.data().set(NPC.KEEP_CHUNK_LOADED_METADATA, enabled);
|
||||
if (args.hasFlag('t')) {
|
||||
npc.data().set(NPC.KEEP_CHUNK_LOADED_METADATA, enabled);
|
||||
} else {
|
||||
npc.data().setPersistent(NPC.KEEP_CHUNK_LOADED_METADATA, enabled);
|
||||
}
|
||||
Messaging.sendTr(sender, enabled ? Messages.CHUNKLOAD_SET : Messages.CHUNKLOAD_UNSET, npc.getName());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user