Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.froobworld.nabsuite.data.SchemaEntries;
import com.froobworld.nabsuite.data.SimpleDataSchema;
import com.froobworld.nabsuite.modules.protect.area.flag.Flags;
import com.froobworld.nabsuite.user.User;
import com.froobworld.nabsuite.user.UserManager;
import org.bukkit.Location;
Expand Down Expand Up @@ -177,7 +178,7 @@ public boolean isUser(Player player) {
return true;
}
}
return false;
return hasFlag(Flags.INHERIT_USERS) && parent != null && parent.isUser(player);
}

public boolean isManager(Player player) {
Expand All @@ -186,7 +187,7 @@ public boolean isManager(Player player) {
return true;
}
}
return false;
return hasFlag(Flags.INHERIT_USERS) && parent != null && parent.isManager(player);
}

public boolean isOwner(Player player) {
Expand All @@ -195,7 +196,7 @@ public boolean isOwner(Player player) {
return true;
}
}
return false;
return hasFlag(Flags.INHERIT_USERS) && parent != null && parent.isOwner(player);
}

public void addUser(User user) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ private Flags() {}
public static final String KEEP_INVENTORY = "keep-inventory";
public static final String NO_WITHER = "no-wither";
public static final String NO_HOME = "no-home";
public static final String INHERIT_USERS = "inherit-users";

public static final Set<String> flags = Set.of(
NO_BUILD,
Expand All @@ -33,7 +34,8 @@ private Flags() {}
NO_MOB_GRIEF,
KEEP_INVENTORY,
NO_WITHER,
NO_HOME
NO_HOME,
INHERIT_USERS
);

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.froobworld.nabsuite.modules.protect.ProtectModule;
import com.froobworld.nabsuite.modules.protect.area.Area;
import com.froobworld.nabsuite.modules.protect.area.AreaManager;
import com.froobworld.nabsuite.modules.protect.area.flag.Flags;
import com.froobworld.nabsuite.modules.protect.command.argument.AreaArgument;
import com.froobworld.nabsuite.modules.protect.command.argument.FlagArgument;
import net.kyori.adventure.text.Component;
Expand Down Expand Up @@ -75,6 +76,14 @@ public Command.Builder<CommandSender> populateBuilder(Command.Builder<CommandSen
return !area.hasFlag(flag);
},
"The area already has that flag."
),
new ArgumentPredicate<>(
false,
(context, flag) -> {
Area area = context.get("area");
return !flag.equals(Flags.INHERIT_USERS) || area.getParent() != null;
},
"The flag is only available for subareas."
)
)
);
Expand Down