11package xyz .omegaware .addon .modules ;
22
33import meteordevelopment .meteorclient .settings .*;
4+ import meteordevelopment .meteorclient .systems .friends .Friends ;
45import meteordevelopment .meteorclient .utils .player .ChatUtils ;
56import net .minecraft .text .Text ;
67import net .minecraft .util .Formatting ;
@@ -22,23 +23,20 @@ public TPAAutomationModule() {
2223 private final SettingGroup sgApprovedUsers = this .settings .createGroup ("Approved Users" );
2324 private final SettingGroup sgGeneral = this .settings .createGroup ("General" );
2425
25- String [] TSRKitBotUsers = {
26- "royalburner" ,
27- "Poolyin" ,
28- "PoolyinHelper" ,
29- "RoyalHelper" ,
30- "TSRMANIA" ,
31- "WomenAreScary" ,
32- "ElectricCallboy"
33- };
34-
3526 private final Setting <List <String >> approvedUsers = sgApprovedUsers .add (new StringListSetting .Builder ()
3627 .name ("approved-users-list" )
3728 .description ("A list of users to filter." )
3829 .defaultValue (List .of ("user1" , "user2" , "user3" ))
3930 .build ()
4031 );
4132
33+ private final Setting <Boolean > acceptFriends = sgGeneral .add (new BoolSetting .Builder ()
34+ .name ("accept-friends" )
35+ .description ("Automatically accept teleport requests from your Meteor friend list." )
36+ .defaultValue (true )
37+ .build ()
38+ );
39+
4240 private final Setting <Boolean > acceptTSRBots = sgGeneral .add (new BoolSetting .Builder ()
4341 .name ("accept-tsr-bots" )
4442 .description ("Automatically accept teleport requests that are from the TSR bot users." )
@@ -86,6 +84,16 @@ public TPAAutomationModule() {
8684 private static final Pattern TPA_DENIED_PATTERN = Pattern .compile ("^Request from ([A-Za-z0-9_]{3,16}) denied!$" );
8785 private static final Pattern TPA_REQUEST_PATTERN = Pattern .compile ("^([A-Za-z0-9_]{3,16}) wants to teleport to you\\ .$" );
8886
87+ private static final Set <String > TSR_KIT_BOT_USERS = Set .of (
88+ "royalburner" ,
89+ "Poolyin" ,
90+ "PoolyinHelper" ,
91+ "RoyalHelper" ,
92+ "TSRMANIA" ,
93+ "WomenAreScary" ,
94+ "ElectricCallboy"
95+ );
96+
8997 @ Override
9098 public void onActivate () {
9199 if (!OmegawareAddons .is6B6T ()) {
@@ -145,20 +153,15 @@ private void onMessageReceive(ReceiveMessageEvent event) {
145153 .append (Text .literal (username ).formatted (Formatting .WHITE ))
146154 .append (Text .literal ("!" ).formatted (Formatting .WHITE ));
147155
148- if (approvedUsers .get ().contains (username ) || (acceptTSRBots .get () && Set . of ( TSRKitBotUsers ) .contains (username ))) {
156+ if (approvedUsers .get ().contains (username ) || (acceptFriends .get () && Friends . get (). get ( username ) != null ) || ( acceptTSRBots . get () && TSR_KIT_BOT_USERS .contains (username ))) {
149157 ChatUtils .sendPlayerMsg ("/tpy " + username );
150158
151- if (printTpaAccepted .get ()) {
152- ChatUtils .sendMsg (accepted );
153- }
154- } else {
155- if (autoDeny .get ()) {
156- ChatUtils .sendPlayerMsg ("/tpn " + username );
159+ if (printTpaAccepted .get ()) ChatUtils .sendMsg (accepted );
157160
158- if (printTpaIgnored .get ()) {
159- ChatUtils .sendMsg ( ignored );
160- }
161- }
161+ } else if (autoDeny .get ()){
162+ ChatUtils .sendPlayerMsg ( "/tpn " + username );
163+
164+ if ( printTpaIgnored . get ()) ChatUtils . sendMsg ( ignored );
162165 }
163166
164167 if (filterTpaMessages .get () && printTpaDetected .get ()) {
0 commit comments