diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/Hierarchy.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/Hierarchy.java index 495fab62..e3546cd4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/Hierarchy.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/Hierarchy.java @@ -159,14 +159,14 @@ public class Hierarchy public void addUserToGroup(DisplayableGroup group, Player player) { userWrapper.getUserData(player).thenAccept(user -> - userWrapper.addToGroup(user.getUser(), group)) + userWrapper.addToGroup(user.getUser(), group)) .whenComplete((a, b) -> - { - if (b != null) - { - FLog.severe(b); - } - }); + { + if (b != null) + { + FLog.severe(b); + } + }); } public void dropUserFromAll(Track track, Player player) @@ -208,6 +208,12 @@ public class Hierarchy subscriptions.put(new NamespacedKey(TotalFreedomMod.getPlugin(), "node_remove"), eventBus.subscribe(TotalFreedomMod.getPlugin(), NodeRemoveEvent.class, this::onNodeRemove)); } + public void unregister() + { + subscriptions.forEach((key, subscription) -> subscription.close()); + subscriptions.clear(); + } + private void onNodeAdd(NodeAddEvent event) { if (event.isUser()) @@ -216,6 +222,7 @@ public class Hierarchy Player player = Bukkit.getPlayer(user.getUniqueId()); if (player != null) { + TotalFreedomMod.getPlugin().rm.updateDisplay(player); updateUserData(player); } } diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java index 3cf3a09c..fa0fbee8 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java @@ -7,6 +7,7 @@ import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.command.CommandSender; @@ -189,7 +190,8 @@ public class RankManager extends FreedomService } @EventHandler(priority = EventPriority.MONITOR) - public void onPlayerLeave(PlayerQuitEvent event) { + public void onPlayerLeave(PlayerQuitEvent event) + { Hierarchy.getHierarchy().dropUserData(event.getPlayer()); } @@ -251,6 +253,12 @@ public class RankManager extends FreedomService } if (message != null) { + if (!(message.contains(""))) + { + player.sendMessage(FUtil.miniMessage("You did not include the tag in your login message! We will append it for you.")); + message = " is " + message; + } + return FUtil.miniMessage(message, Placeholder.unparsed("name", player.getName()), Placeholder.component("rank", display.getName()), diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/util/PermissibleCompletion.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/util/PermissibleCompletion.java index 251cab73..d2c5e703 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/util/PermissibleCompletion.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/util/PermissibleCompletion.java @@ -5,7 +5,7 @@ public class PermissibleCompletion private final String permission; private final String completion; - public PermissibleCompletion(String permission, String completion) + protected PermissibleCompletion(String permission, String completion) { this.completion = completion; this.permission = permission;