Luck Perms is actually based but also not based

This commit is contained in:
Paul Reilly
2023-04-05 15:59:20 -05:00
parent cb818c0056
commit d1569cb3c0
10 changed files with 110 additions and 316 deletions

View File

@ -9,9 +9,7 @@ import net.luckperms.api.model.group.Group;
import net.luckperms.api.node.types.InheritanceNode;
import net.luckperms.api.node.types.PrefixNode;
import net.luckperms.api.node.types.WeightNode;
import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.StringUtils;
import org.bukkit.util.FileUtil;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
@ -52,20 +50,23 @@ public class DisplayableGroup implements Displayable
{
Group matched = TotalFreedomMod.getPlugin().lpb.getAPI().getGroupManager().getGroup(group);
if (matched == null) {
if (matched == null)
{
CompletableFuture<Group> cfg = TotalFreedomMod.getPlugin()
.lpb
.getAPI()
.getGroupManager()
.createAndLoadGroup(group);
cfg.thenAcceptAsync(g -> {
cfg.thenAcceptAsync(g ->
{
WeightNode weightNode = WeightNode.builder(weight).build();
PrefixNode prefixNode = PrefixNode.builder()
.prefix(FUtil.miniMessage(GroupProvider.OPEN.append(tag.color(color)).append(GroupProvider.CLOSE)))
.priority(1)
.build();
if (inheritance != null) {
if (inheritance != null)
{
InheritanceNode inheritanceNode = InheritanceNode.builder(inheritance).build();
g.getData(DataType.NORMAL).add(inheritanceNode);
}
@ -75,7 +76,8 @@ public class DisplayableGroup implements Displayable
matched = TotalFreedomMod.getPlugin().lpb.getAPI().getGroupManager().getGroup(group);
if (matched == null) throw new IllegalArgumentException("Group " + group + " does not exist and could not be created.");
if (matched == null)
throw new IllegalArgumentException("Group " + group + " does not exist and could not be created.");
}
this.group = matched;
@ -103,7 +105,8 @@ public class DisplayableGroup implements Displayable
return weight;
}
public Group getLuckPermsGroup() {
public Group getLuckPermsGroup()
{
return this.group;
}