Fix some minor issues

This commit is contained in:
Paul Reilly 2023-04-10 20:02:42 -05:00
parent 6c0856d647
commit f4f60a7993
3 changed files with 24 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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("<name>")))
{
player.sendMessage(FUtil.miniMessage("<red>You did not include the <name> tag in your login message! We will append it for you."));
message = "<aqua><name> is " + message;
}
return FUtil.miniMessage(message,
Placeholder.unparsed("name", player.getName()),
Placeholder.component("rank", display.getName()),

View File

@ -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;