aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-04 11:58:31 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-04 11:59:12 +0200
commit1a6dc6ad26494c6769159a9b404ccfb837065bcf (patch)
treef23d69c082d1b7fa64a788eeae757699f3c5689f /src/main/java/at/hannibal2/skyhanni/features
parentb2439b1a5d4efca754d2da00f695d71b5ffaf1d8 (diff)
downloadskyhanni-1a6dc6ad26494c6769159a9b404ccfb837065bcf.tar.gz
skyhanni-1a6dc6ad26494c6769159a9b404ccfb837065bcf.tar.bz2
skyhanni-1a6dc6ad26494c6769159a9b404ccfb837065bcf.zip
Added /pt <player> alias for /party transfer
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/PartyTransferCommand.kt26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyTransferCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyTransferCommand.kt
new file mode 100644
index 000000000..485a3569f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyTransferCommand.kt
@@ -0,0 +1,26 @@
+package at.hannibal2.skyhanni.features.commands
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import net.minecraft.network.play.client.C01PacketChatMessage
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class PartyTransferCommand {
+ @SubscribeEvent
+ fun onSendPacket(event: PacketEvent.SendEvent) {
+ if (!SkyHanniMod.feature.commands.usePartyTransferAlias) return
+
+ val packet = event.packet
+ if (packet is C01PacketChatMessage) {
+ val pattern = "/pt (?<args>.*)".toPattern()
+ pattern.matchMatcher(packet.message.lowercase()) {
+ event.isCanceled = true
+ val args = group("args")
+ LorenzUtils.sendCommandToServer("party transfer $args")
+ }
+ }
+ }
+
+} \ No newline at end of file