diff --git a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundGiveSaraPacket.java b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundGiveSaraPacket.java
index c469713..cb9f1fe 100644
--- a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundGiveSaraPacket.java
+++ b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundGiveSaraPacket.java
@@ -5,7 +5,6 @@
import net.azisaba.azipluginmessaging.api.protocol.message.ProxyboundGiveSaraMessage;
import net.azisaba.azipluginmessaging.api.server.PacketSender;
import net.azisaba.azipluginmessaging.api.server.ServerConnection;
-import net.azisaba.azipluginmessaging.api.util.Constants;
import net.azisaba.azipluginmessaging.api.util.LuckPermsUtil;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
@@ -14,6 +13,7 @@
import net.luckperms.api.model.data.NodeMap;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node;
+import net.luckperms.api.track.Track;
import org.jetbrains.annotations.NotNull;
import java.io.DataInputStream;
@@ -34,8 +34,10 @@ public void handle(@NotNull PacketSender sender, @NotNull ProxyboundGiveSaraMess
if (user == null || user.getUsername() == null) {
throw new IllegalArgumentException("User " + msg.getPlayer().getUniqueId() + " could not be found in the LuckPerms database.");
}
- if (!Constants.SARA_GROUPS.contains(msg.getAmount())) {
- throw new IllegalArgumentException("Invalid sara group: " + msg.getAmount());
+ String groupName = msg.getAmount() + "sara";
+ Track track = api.getTrackManager().createAndLoadTrack("sara").join();
+ if (!track.containsGroup(groupName)) {
+ throw new IllegalArgumentException("Group is not in a track: " + groupName);
}
String username = user.getUsername();
boolean modified = false;
diff --git a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundSetRankPacket.java b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundSetRankPacket.java
index b7d651c..7a718bc 100644
--- a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundSetRankPacket.java
+++ b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundSetRankPacket.java
@@ -58,7 +58,7 @@ public void handle(@NotNull PacketSender sender, @NotNull ProxyboundSetRankMessa
}
boolean modified = false;
for (String group : track.getGroups()) {
- if (msg.getServer().equals(group)) continue;
+ if (msg.getRank().equals(group)) continue;
Node node = LuckPermsUtil.findParentNode(nodes, group, msg.getServer());
if (node != null) {
nodes.remove(node);
diff --git a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraHidePacket.java b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraHidePacket.java
index a2f03b8..afa5382 100644
--- a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraHidePacket.java
+++ b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraHidePacket.java
@@ -6,7 +6,6 @@
import net.azisaba.azipluginmessaging.api.protocol.message.ServerboundActionResponseMessage;
import net.azisaba.azipluginmessaging.api.server.PacketSender;
import net.azisaba.azipluginmessaging.api.server.ServerConnection;
-import net.azisaba.azipluginmessaging.api.util.Constants;
import net.azisaba.azipluginmessaging.api.util.LuckPermsUtil;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
@@ -15,6 +14,7 @@
import net.luckperms.api.model.data.NodeMap;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node;
+import net.luckperms.api.track.Track;
import org.jetbrains.annotations.NotNull;
import java.io.DataInputStream;
@@ -38,26 +38,28 @@ public void handle(@NotNull PacketSender sender, @NotNull PlayerMessage msg) {
String username = user.getUsername();
NodeMap map = user.getData(DataType.NORMAL);
boolean modified = false;
- for (int saraGroup : Constants.SARA_GROUPS) {
- Node nodeSara = LuckPermsUtil.findParentNode(map, saraGroup + "yen", null);
- Node nodeHideSara = LuckPermsUtil.findParentNode(map, "hide" + saraGroup, null);
+ Track track = api.getTrackManager().createAndLoadTrack("sara").join();
+ for (String groupName : track.getGroups()) {
+ int yen = Integer.parseInt(groupName.replace("yen", ""));
+ Node nodeSara = LuckPermsUtil.findParentNode(map, groupName, null);
+ Node nodeHideSara = LuckPermsUtil.findParentNode(map, "hide" + yen, null);
String desc = null;
if (nodeSara != null) {
// hide
map.remove(nodeSara);
if (nodeHideSara == null) {
- LuckPermsUtil.addGroup(map, "hide" + saraGroup, null, -1);
+ LuckPermsUtil.addGroup(map, "hide" + yen, null, -1);
}
modified = true;
- desc = "Toggled " + saraGroup + "yen -> hide" + saraGroup + " for " + username;
- Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + saraGroup + "円皿を非表示にしました。"));
+ desc = "Toggled " + groupName + " -> hide" + yen + " for " + username;
+ Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + yen + "円皿を非表示にしました。"));
} else if (nodeHideSara != null) {
// show
map.remove(nodeHideSara);
- LuckPermsUtil.addGroup(map, saraGroup + "yen", null, -1);
+ LuckPermsUtil.addGroup(map, groupName, null, -1);
modified = true;
- desc = "Toggled hide" + saraGroup + " -> " + saraGroup + "yen for " + username;
- Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + saraGroup + "円皿を表示しました。"));
+ desc = "Toggled hide" + yen + " -> " + groupName + " for " + username;
+ Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + yen + "円皿を表示しました。"));
}
if (desc != null) {
api.getActionLogger().submit(
diff --git a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraShowPacket.java b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraShowPacket.java
index eaaf661..f7c0322 100644
--- a/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraShowPacket.java
+++ b/api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/ProxyboundToggleSaraShowPacket.java
@@ -7,7 +7,6 @@
import net.azisaba.azipluginmessaging.api.protocol.message.ServerboundActionResponseMessage;
import net.azisaba.azipluginmessaging.api.server.PacketSender;
import net.azisaba.azipluginmessaging.api.server.ServerConnection;
-import net.azisaba.azipluginmessaging.api.util.Constants;
import net.azisaba.azipluginmessaging.api.util.LuckPermsUtil;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
@@ -16,6 +15,7 @@
import net.luckperms.api.model.data.NodeMap;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node;
+import net.luckperms.api.track.Track;
import org.jetbrains.annotations.NotNull;
import java.io.DataInputStream;
@@ -43,22 +43,24 @@ public void handle(@NotNull PacketSender sender, @NotNull PlayerWithServerMessag
String username = user.getUsername();
NodeMap map = user.getData(DataType.NORMAL);
boolean modified = false;
- for (int saraGroup : Constants.SARA_GROUPS) {
- Node nodeSara = LuckPermsUtil.findParentNode(map, saraGroup + "yen", null);
- Node nodeHideSara = LuckPermsUtil.findParentNode(map, "hide" + saraGroup, null);
+ Track track = api.getTrackManager().createAndLoadTrack("sara").join();
+ for (String groupName : track.getGroups()) {
+ int yen = Integer.parseInt(groupName.replace("sara", ""));
+ Node nodeSara = LuckPermsUtil.findParentNode(map, groupName, null);
+ Node nodeHideSara = LuckPermsUtil.findParentNode(map, "hide" + yen, null);
if (nodeSara != null || nodeHideSara != null) {
String actionDesc;
- Node nodeSaraShow = LuckPermsUtil.findParentNode(map, "show" + saraGroup + "yen", msg.getServer());
+ Node nodeSaraShow = LuckPermsUtil.findParentNode(map, "show" + yen + "yen", msg.getServer());
if (nodeSaraShow != null) {
// hide
map.remove(nodeSaraShow);
- actionDesc = "Removed show" + saraGroup + "yen from " + username + " in server=" + msg.getServer();
- Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + saraGroup + "円皿を非表示にしました。"));
+ actionDesc = "Removed show" + yen + "yen from " + username + " in server=" + msg.getServer();
+ Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + yen + "円皿を非表示にしました。"));
} else {
// show
- LuckPermsUtil.addGroup(map, "show" + saraGroup + "yen", msg.getServer(), -1);
- actionDesc = "Added show" + saraGroup + "yen to " + username + " in server=" + msg.getServer();
- Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + saraGroup + "円皿を表示しました。"));
+ LuckPermsUtil.addGroup(map, "show" + yen + "yen", msg.getServer(), -1);
+ actionDesc = "Added show" + yen + "yen to " + username + " in server=" + msg.getServer();
+ Protocol.S_ACTION_RESPONSE.sendPacket(sender, new ServerboundActionResponseMessage(msg.getPlayer().getUniqueId(), "\u00a7a" + yen + "円皿を表示しました。"));
}
modified = true;
api.getActionLogger().submit(
diff --git a/api/src/main/java/net/azisaba/azipluginmessaging/api/util/Constants.java b/api/src/main/java/net/azisaba/azipluginmessaging/api/util/Constants.java
deleted file mode 100644
index 6822839..0000000
--- a/api/src/main/java/net/azisaba/azipluginmessaging/api/util/Constants.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.azisaba.azipluginmessaging.api.util;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @deprecated Deprecated because {@link #SARA_GROUPS} is deprecated.
- */
-@Deprecated
-public class Constants {
- /**
- * @deprecated sara
track in LuckPerms should be used instead
- */
- @Deprecated
- public static final List SARA_GROUPS = Arrays.asList(50000, 20000, 10000, 5000, 2000, 1000, 500, 100);
-}
diff --git a/build.gradle.kts b/build.gradle.kts
index 7004d6d..bf8b86a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,7 +6,7 @@ plugins {
}
group = "net.azisaba.azipluginmessaging"
-version = "2.2.0-SNAPSHOT"
+version = "2.2.1-SNAPSHOT"
repositories {
mavenCentral()
diff --git a/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/VelocityPlugin.java b/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/VelocityPlugin.java
index 8f4518d..75a1c86 100644
--- a/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/VelocityPlugin.java
+++ b/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/VelocityPlugin.java
@@ -16,7 +16,7 @@
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
-@Plugin(id = "azi-plugin-messaging", name = "AziPluginMessaging", version = "1.0.0",
+@Plugin(id = "azi-plugin-messaging", name = "AziPluginMessaging", version = "2.2.1-SNAPSHOT",
dependencies = @Dependency(id = "luckperms"))
public class VelocityPlugin {
@Inject