feat: Add worldedit.schematic.save.global permission (#1406)

This commit is contained in:
Desjardins Jérôme 2021-11-12 15:21:06 +01:00 committed by GitHub
parent 6f33c5223d
commit a2df590fae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -416,7 +416,7 @@ public class SchematicCommands {
name = "save", name = "save",
desc = "Save your clipboard into a schematic file" desc = "Save your clipboard into a schematic file"
) )
@CommandPermissions({"worldedit.clipboard.save", "worldedit.schematic.save", "worldedit.schematic.save.other"}) @CommandPermissions({"worldedit.clipboard.save", "worldedit.schematic.save", "worldedit.schematic.save.other", "worldedit.schematic.save.global"})
public void save( public void save(
Actor actor, LocalSession session, Actor actor, LocalSession session,
@Arg(desc = "File name.") @Arg(desc = "File name.")
@ -429,6 +429,12 @@ public class SchematicCommands {
@Switch(name = 'g', desc = "Bypasses per-player-schematic folders") @Switch(name = 'g', desc = "Bypasses per-player-schematic folders")
boolean global boolean global
) throws WorldEditException { ) throws WorldEditException {
if (global && !actor.hasPermission("worldedit.schematic.save.global")) {
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.save.global"));
return;
}
//FAWE end //FAWE end
if (worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getDataVersion() == -1) { if (worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getDataVersion() == -1) {
actor.print(TranslatableComponent.of("worldedit.schematic.unsupported-minecraft-version")); actor.print(TranslatableComponent.of("worldedit.schematic.unsupported-minecraft-version"));