aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
blob: 10b303710e11c1ff13612dfdb77c865d5c1a0352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
package de.hype.bbsentials.client.Commands;

import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import de.hype.bbsentials.client.BBsentials;
import de.hype.bbsentials.communication.BBsentialConnection;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.minecraft.command.CommandSource;

import static de.hype.bbsentials.client.BBsentials.*;

public class CommandsOLD {
    public CommandsOLD() {
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(ClientCommandManager.literal("warp").then(ClientCommandManager.argument("destination", StringArgumentType.string()).suggests((context, builder) -> {
                // Provide tab-completion options for menu subfolder
                return CommandSource.suggestMatching(new String[]{"desert", "hub", "dhub", "nether", "isle", "wizard", "portal", "mines", "forge", "ch", "crystals", "nucleus", "end", "drag", "void", "castle", "howl", "park", "jungle", "nest", "arachne", "spider", "deep", "barn", "home", "kuurda", "wasteland", "dragontail", "scarleton", "smold", "garden", "da", "crypt", "museum", "trapper", "dungeon_hub"}, builder);
            }).executes((context) -> {
                // Handle "variableName" and "variableValue" logic here
                String destination = StringArgumentType.getString(context, "destination");
                getConfig().sender.addSendTask("/warp " + destination, 0);
                return 1;
            })));
        }); //warp test
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(ClientCommandManager.literal("creport")
                    .then(ClientCommandManager.argument("Player_Name", StringArgumentType.string())
                            .executes((context) -> {
                                String playerName = StringArgumentType.getString(context, "Player_Name");
                                getConfig().sender.addSendTask("/creport " + playerName, 0);
                                getConfig().addReported(playerName);
                                return 1;
                            })));
        });//creport helper → no double report during same launch
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(ClientCommandManager.literal("hp").then(ClientCommandManager.literal("accept").then(ClientCommandManager.argument("player", StringArgumentType.string()).executes((context) -> {
                String player = StringArgumentType.getString(context, "player");
                getConfig().sender.addImmediateSendTask("/party accept " + player);
                return 1;
            }))).then(ClientCommandManager.literal("chat").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party chat");
                return 1;
            })).then(ClientCommandManager.literal("demote").then(ClientCommandManager.argument("player", StringArgumentType.string()).suggests((context, builder) -> {
                // Provide tab-completion options for menu subfolder
                return CommandSource.suggestMatching(getConfig().getPlayersInParty(), builder);
            }).executes((context) -> {
                String player = StringArgumentType.getString(context, "player");
                getConfig().sender.addImmediateSendTask("/party demote " + player);
                return 1;
            }))).then(ClientCommandManager.literal("disband").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party disband");
                return 1;
            })).then(ClientCommandManager.literal("kick").then(ClientCommandManager.argument("player", StringArgumentType.string()).suggests((context, builder) -> {
                // Provide tab-completion options for menu subfolder
                return CommandSource.suggestMatching(getConfig().getPlayersInParty(), builder);
            }).executes((context) -> {
                String player = StringArgumentType.getString(context, "player");
                getConfig().sender.addImmediateSendTask("/party kick " + player);
                return 1;
            }))).then(ClientCommandManager.literal("kickoffline").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party kickoffline");
                return 1;
            })).then(ClientCommandManager.literal("leave").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party leave");
                return 1;
            })).then(ClientCommandManager.literal("list").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party list");
                return 1;
            })).then(ClientCommandManager.literal("mute").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party mute");
                return 1;
            })).then(ClientCommandManager.literal("poll").then(ClientCommandManager.argument("question/answer/answer/answer", StringArgumentType.greedyString()).executes((context) -> {
                String questionAndAnswers = StringArgumentType.getString(context, "question answer answer (answer)");
                getConfig().sender.addImmediateSendTask("/party poll " + questionAndAnswers);
                return 1;
            }))).then(ClientCommandManager.literal("private").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party private");
                return 1;
            })).then(ClientCommandManager.literal("promote").then(ClientCommandManager.argument("player", StringArgumentType.string()).suggests((context, builder) -> {
                // Provide tab-completion options for menu subfolder
                return CommandSource.suggestMatching(getConfig().getPlayersInParty(), builder);
            }).executes((context) -> {
                String player = StringArgumentType.getString(context, "player");
                getConfig().sender.addImmediateSendTask("/party promote " + player);
                return 1;
            }))).then(ClientCommandManager.literal("setting").then(ClientCommandManager.literal("allinvite")).executes((context) -> {
                        String setting = StringArgumentType.getString(context, "setting");
                        getConfig().sender.addImmediateSendTask("/party setting " + setting);
                        return 1;
                    })

            ).then(ClientCommandManager.literal("transfer").then(ClientCommandManager.argument("player", StringArgumentType.string()).suggests((context, builder) -> {
                // Provide tab-completion options for menu subfolder
                return CommandSource.suggestMatching(getConfig().getPlayersInParty(), builder);
            }).executes((context) -> {
                String player = StringArgumentType.getString(context, "player");
                getConfig().sender.addImmediateSendTask("/party transfer " + player);
                return 1;
            }))).then(ClientCommandManager.literal("warp").executes((context) -> {
                getConfig().sender.addImmediateSendTask("/party warp");
                return 1;
            })).executes(context -> {
                getConfig().sender.addImmediateSendTask("/p");
                return 1;
            }));
        }); //party test
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("goblinraid")
                            .executes((context) -> {
                                bbserver.sendMessage("?dwevent goblinraid");
                                return 1;
                            })
            );
        });/*goblinraid*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("2xpowder")
                            .executes((context) -> {
                                bbserver.sendMessage("?dwevent 2xpowder");
                                return 1;
                            })
            );
        });/*2xpowder*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("bettertogether")
                            .executes((context) -> {
                                bbserver.sendMessage("?dwevent bettertogether");
                                return 1;
                            })
            );
        });/*b2g*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("raffle")
                            .executes((context) -> {
                                bbserver.sendMessage("?dwevent raffle");
                                return 1;
                            })
            );
        });/*raffle*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("gonewiththewind")
                            .executes((context) -> {
                                bbserver.sendMessage("?dwevent gonewiththewind");
                                return 1;
                            })
            );
        });/*gonewiththewind*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(ClientCommandManager.literal("chchest")
                    .then(ClientCommandManager.argument("Item", StringArgumentType.string())
                            .suggests((context, builder) -> {
                                return CommandSource.suggestMatching(new String[]{"PrehistoricEgg", "Pickonimbus2000", "ElectronTransmitter", "FTX3070", "RobotronReflector", "ControlSwitch", "SyntheticHeart", "SuperliteMotor", "BlueGoblinEgg", "YellowGoblinEgg", "FlawlessAmberGemstone", "FlawlessJadeGemstone", "FlawlessSapphireGemstone", "FlawlessRubyGemstone", "FlawlessAmethystGemstone", "JungleHeart", "FlawlessTopazGemstone", "FlawlessJasperGemstone"}, builder);
                            })
                            .then(ClientCommandManager.argument("X", IntegerArgumentType.integer())
                                    .then(ClientCommandManager.argument("Y", IntegerArgumentType.integer())
                                            .then(ClientCommandManager.argument("Z", IntegerArgumentType.integer())
                                                    .then(ClientCommandManager.argument("ContactWay", StringArgumentType.greedyString())
                                                            .suggests(((context, builder) -> {
                                                                return CommandSource.suggestMatching(new String[]{"/msg " + getConfig().getUsername() + " bb:party me", "/p join " + config.getUsername()}, builder);
                                                            }))
                                                            .executes((context) -> {
                                                                        String destination = StringArgumentType.getString(context, "Item");
                                                                        int x = IntegerArgumentType.getInteger(context, "X");
                                                                        int y = IntegerArgumentType.getInteger(context, "Y");
                                                                        int z = IntegerArgumentType.getInteger(context, "Z");
                                                                        String contactWay = StringArgumentType.getString(context, "ContactWay");

                                                                        String combinedString = "?chchest " + destination + " " + x + " " + y + " " + z + " " + contactWay;
                                                                        bbserver.sendMessage(combinedString);
                                                                        return 1;
                                                                    }
                                                            )
                                                    )
                                            )
                                    )
                            )
                    )
            );
        }); /*chchest*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("bbserver")
                            .then(ClientCommandManager.argument("Message", StringArgumentType.greedyString())
                                    .executes((context) -> {
                                        String message = StringArgumentType.getString(context, "Message");
                                        if (message.equals("bb:reconnect")) {
                                            BBsentials.connectToBBserver();
                                        } else {
                                            BBsentials.bbserver.sendMessage(message);
                                        }
                                        return 1;
                                    })
                            )
            );
        });/*BBserver*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("bc")
                            .then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString())
                                    .executes((context) -> {
                                        String message = StringArgumentType.getString(context, "Message to Bingo Chat");
                                        sendCommand("?bingochat " + message);
                                        return 1;
                                    })
                            )
            );
        });/*BincoChatShort*/
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
            dispatcher.register(
                    ClientCommandManager.literal("bingochat")
                            .then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString())
                                    .executes((context) -> {
                                        String message = StringArgumentType.getString(context, "Message to Bingo Chat");
                                        sendCommand("?bingochat " + message);
                                        return 1;
                                    })
                            )
            );
        });/*BingoChatLong*/
        if (getConfig().bbsentialsRoles != null) {
            if (getConfig().bbsentialsRoles.contains("mod")) {
                ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
                    dispatcher.register(
                            ClientCommandManager.literal("bannounce")
                                    .then(ClientCommandManager.argument("message", StringArgumentType.greedyString())
                                            .executes((context) -> {
                                                String message = StringArgumentType.getString(context, "message");
                                                sendCommand("?announce " + message);
                                                return 1;
                                            })
                                    )
                    );
                });/*bAnnounce*/
                ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
                    dispatcher.register(
                            ClientCommandManager.literal("bmute")
                                    .then(ClientCommandManager.argument("message", StringArgumentType.greedyString())
                                            .executes((context) -> {
                                                String message = StringArgumentType.getString(context, "message");
                                                sendCommand("?mute " + message);
                                                return 1;
                                            })
                                    )
                    );
                });/*bmute*/
                ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
                    dispatcher.register(
                            ClientCommandManager.literal("bban")
                                    .then(ClientCommandManager.argument("message", StringArgumentType.greedyString())
                                            .executes((context) -> {
                                                String message = StringArgumentType.getString(context, "message");
                                                sendCommand("?bban " + message);
                                                return 1;
                                            })
                                    )
                    );
                });/*bmute*/
            }
            if (getConfig().bbsentialsRoles.contains("splasher")) {
                ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
                    dispatcher.register(
                            ClientCommandManager.literal("splashAnnounce")
                                    .then(ClientCommandManager.argument("Hub", IntegerArgumentType.integer(1, 28))
                                            .then(ClientCommandManager.argument("location", StringArgumentType.string())
                                                    .suggests((context, builder) -> {
                                                        return CommandSource.suggestMatching(new String[]{"kat","bea","guild-house"}, builder);
                                                    })
                                                    .then(ClientCommandManager.argument("extramessage", StringArgumentType.greedyString())
                                                            .executes((context) -> {
                                                                int hub_Number = IntegerArgumentType.getInteger(context, "Hub");
                                                                String extramessage = StringArgumentType.getString(context, "extramessage");
                                                                String location = StringArgumentType.getString(context, "location");
                                                                sendCommand("?splash " + hub_Number + " " + location+" "+extramessage);
                                                                return 1;
                                                            })
                                                    )
                                                    .executes((context) -> {
                                                        int hub_Number = IntegerArgumentType.getInteger(context, "Hub");
                                                        String message = "";
                                                        String location = "bea";
                                                        sendCommand("?splash " + hub_Number + " "+location+" " + message);
                                                        return 1;
                                                    })
                                            )
                                            .executes((context) -> {
                                                int hub_Number = IntegerArgumentType.getInteger(context, "Hub");
                                                String message = "";
                                                String location = StringArgumentType.getString(context, "location");
                                                sendCommand("?splash " + hub_Number + " "+location+" " + message);
                                                return 1;
                                            })
                                    )
                    );
                });/*SplashAnnounce*/
            } else {
            }
        }
    }
    public void sendCommand(String message){
        BBsentials.bbserver.sendCommand(message);
    }
}