From 95465a676dd66fd680a3d95ccd987d1f2e1f77d3 Mon Sep 17 00:00:00 2001 From: Refrac Date: Mon, 27 Sep 2021 02:47:24 -0500 Subject: [PATCH] Fixed user and group parents, version push --- pom.xml | 2 +- .../me/AsVaidas/LuckPemsGUI/groups/Parents.java | 15 +++++++++------ .../me/AsVaidas/LuckPemsGUI/users/Parents.java | 14 +++++++++----- .../me/AsVaidas/LuckPemsGUI/util/Settings.java | 2 +- src/main/resources/plugin.yml | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 6014528..434639f 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ me.AsVaidas.LuckPermsGUI LuckPermsGUI - 3.1 + 4.1 jar LuckPermsGUI diff --git a/src/main/java/me/AsVaidas/LuckPemsGUI/groups/Parents.java b/src/main/java/me/AsVaidas/LuckPemsGUI/groups/Parents.java index 4e4672e..9374326 100644 --- a/src/main/java/me/AsVaidas/LuckPemsGUI/groups/Parents.java +++ b/src/main/java/me/AsVaidas/LuckPemsGUI/groups/Parents.java @@ -16,6 +16,7 @@ import net.luckperms.api.model.group.Group; import net.luckperms.api.node.Node; import net.luckperms.api.node.NodeType; +import net.luckperms.api.node.types.InheritanceNode; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -92,15 +93,15 @@ public static void open(Player p, Group group, int page) { int from = 45*page-1; int to = 45*(page+1)-1; for (Node permission : group.getDistinctNodes()) { - if (permission.getType() != NodeType.META) continue; + if (permission.getType() != NodeType.INHERITANCE) continue; if (from <= sk && sk < to) { - + InheritanceNode parent = ((InheritanceNode)permission); String expiration = permission.hasExpiry() ? Tools.getTime(permission.getExpiry().toEpochMilli()) : "Never"; String server = permission.getContexts().getAnyValue(DefaultContextKeys.SERVER_KEY).orElse("global"); String world = permission.getContexts().getAnyValue(DefaultContextKeys.WORLD_KEY).orElse("global"); ItemStack item = Tools.button(Material.TNT, - "&6"+group.getName(), + "&6"+parent.getGroupName(), Arrays.asList( "&cID: &e"+sk, "&cExpires in: &e"+expiration, @@ -154,16 +155,18 @@ public void onInventoryClickEvent(InventoryClickEvent e) { int sk = 0; for (Node permission : g.getDistinctNodes()) { - if (permission.getType() != NodeType.META) continue; + if (permission.getType() != NodeType.INHERITANCE) continue; + + InheritanceNode parent = ((InheritanceNode)permission); String server = permission.getContexts().getAnyValue(DefaultContextKeys.SERVER_KEY).orElse("global"); String world = permission.getContexts().getAnyValue(DefaultContextKeys.WORLD_KEY).orElse("global"); if (sk == id) { if (permission.hasExpiry()) - Tools.sendCommand(p, "lp group "+g.getName()+" parent removetemp "+'"'+permission.getKey()+'"'+" "+server+" "+world); + Tools.sendCommand(p, "lp group "+g.getName()+" parent removetemp "+'"'+parent.getGroupName()+'"'+" "+server+" "+world); else - Tools.sendCommand(p, "lp group "+g.getName()+" parent remove "+'"'+permission.getKey()+'"'+" "+server+" "+world); + Tools.sendCommand(p, "lp group "+g.getName()+" parent remove "+'"'+parent.getGroupName()+'"'+" "+server+" "+world); break; } sk++; diff --git a/src/main/java/me/AsVaidas/LuckPemsGUI/users/Parents.java b/src/main/java/me/AsVaidas/LuckPemsGUI/users/Parents.java index 4d32640..8e37b53 100644 --- a/src/main/java/me/AsVaidas/LuckPemsGUI/users/Parents.java +++ b/src/main/java/me/AsVaidas/LuckPemsGUI/users/Parents.java @@ -16,6 +16,7 @@ import net.luckperms.api.model.user.User; import net.luckperms.api.node.Node; import net.luckperms.api.node.NodeType; +import net.luckperms.api.node.types.InheritanceNode; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -95,13 +96,14 @@ public static void open(Player p, User user, int page) { int from = 45*page-1; int to = 45*(page+1)-1; for (Node permission : user.getDistinctNodes()) { - if (permission.getType() != NodeType.META) continue; + if (permission.getType() != NodeType.INHERITANCE) continue; if (from <= sk && sk < to) { + InheritanceNode parent = ((InheritanceNode)permission); String expiration = permission.hasExpiry() ? Tools.getTime(permission.getExpiry().toEpochMilli()) : "Never"; String server = permission.getContexts().getAnyValue(DefaultContextKeys.SERVER_KEY).orElse("global"); String world = permission.getContexts().getAnyValue(DefaultContextKeys.WORLD_KEY).orElse("global"); ItemStack item = Tools.button(Material.TNT, - "&6"+permission.getKey(), + "&6"+parent.getGroupName(), Arrays.asList( "&cID: &e"+sk, "&cExpires in: &e"+expiration, @@ -155,16 +157,18 @@ public void onInventoryClickEvent(InventoryClickEvent e) { int sk = 0; for (Node permission : g.getDistinctNodes()) { - if (permission.getType() != NodeType.META) continue; + if (permission.getType() != NodeType.INHERITANCE) continue; + + InheritanceNode parent = ((InheritanceNode)permission); String server = permission.getContexts().getAnyValue(DefaultContextKeys.SERVER_KEY).orElse("global"); String world = permission.getContexts().getAnyValue(DefaultContextKeys.WORLD_KEY).orElse("global"); if (sk == id) { if (permission.hasExpiry()) - Tools.sendCommand(p, "lp user " + g.getUsername() + " parent removetemp " + '"' + permission.getKey() + '"' + " " + server + " " + world); + Tools.sendCommand(p, "lp user " + g.getUsername() + " parent removetemp " + '"' + parent.getGroupName() + '"' + " " + server + " " + world); else - Tools.sendCommand(p, "lp user " + g.getUsername() + " parent remove " + '"' + permission.getKey() + '"' + " " + server + " " + world); + Tools.sendCommand(p, "lp user " + g.getUsername() + " parent remove " + '"' + parent.getGroupName() + '"' + " " + server + " " + world); break; } sk++; diff --git a/src/main/java/me/AsVaidas/LuckPemsGUI/util/Settings.java b/src/main/java/me/AsVaidas/LuckPemsGUI/util/Settings.java index b006f37..5216dae 100644 --- a/src/main/java/me/AsVaidas/LuckPemsGUI/util/Settings.java +++ b/src/main/java/me/AsVaidas/LuckPemsGUI/util/Settings.java @@ -18,6 +18,6 @@ public class Settings { public static String SUPPORT_DISCORD_URL = "https://bghddevelopment.com/discord"; public static String FEEDBACK = "https://feedback.bghddevelopment.com"; public static String WIKI = "https://wiki.bghddevelopment.com"; - public static String VERSION = "3.5"; + public static String VERSION = "4.1"; public static String NAME = "LuckPermsGUI"; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 56f0442..359e9fc 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: LuckPermsGUI main: me.AsVaidas.LuckPemsGUI.Main -version: 4.0 +version: 4.1 author: BGHDDevelopment website: https://bghddevelopment.com depend: [LuckPerms]