Skip to content

Commit 2c43754

Browse files
committed
Add BLOCK_CHAT_MESSAGE_TEXT_INPUTS examples
1 parent caebd1f commit 2c43754

File tree

6 files changed

+80
-7
lines changed

6 files changed

+80
-7
lines changed

bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/AutoTextHotkeyApiExample.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,9 @@ public void setBlockedTextInputs(List<String> blockedTextInputs) {
4040
options.set(AutoTextHotkeyModule.BLOCKED_TEXT_INPUTS, blockedTextInputs);
4141
}
4242

43+
@Override
44+
public void setBlockChatMesssageTextInputs(boolean value) {
45+
this.autoTextHotkeyModule.getOptions().set(AutoTextHotkeyModule.BLOCK_CHAT_MESSAGE_TEXT_INPUTS, value);
46+
}
47+
4348
}

bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/AutoTextHotkeyCommand.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,37 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
4545
Player player = (Player) sender;
4646

4747
if (args.length < 2) {
48-
player.sendMessage("Usage: /autotexthotkey blockedTextInputs <inputs>");
48+
player.sendMessage("/autotexthotkey blockedTextInputs <inputs>");
49+
player.sendMessage("/autotexthotkey blockChatMessageTextInputs <true/false>");
4950
return true;
5051
}
5152

5253
AutoTextHotkeyExample autoTextHotkeyExample = ApolloExamplePlugin.getInstance().getAutoTextHotkeyExample();
5354

54-
if (args[0].equalsIgnoreCase("blockedTextInputs")) {
55-
List<String> blockedInputs = Arrays.asList(Arrays.copyOfRange(args, 1, args.length));
56-
autoTextHotkeyExample.setBlockedTextInputs(blockedInputs);
55+
switch (args[0].toLowerCase()) {
56+
case "blockedtextinputs": {
57+
List<String> blockedInputs = Arrays.asList(Arrays.copyOfRange(args, 1, args.length));
58+
autoTextHotkeyExample.setBlockedTextInputs(blockedInputs);
5759

58-
player.sendMessage("Blocked text inputs have been set to: " + String.join(", ", blockedInputs));
59-
return true;
60+
player.sendMessage("Blocked text inputs have been set to: " + String.join(", ", blockedInputs));
61+
break;
62+
}
63+
64+
case "blockchatmessagetextinputs": {
65+
boolean value = Boolean.parseBoolean(args[1]);
66+
autoTextHotkeyExample.setBlockChatMesssageTextInputs(value);
67+
68+
player.sendMessage("Block chat message text inputs has been set to " + value);
69+
break;
70+
}
71+
72+
default: {
73+
player.sendMessage("/autotexthotkey blockedTextInputs <inputs>");
74+
player.sendMessage("/autotexthotkey blockChatMessageTextInputs <true/false>");
75+
break;
76+
}
6077
}
6178

62-
player.sendMessage("Usage: /autotexthotkey blockedTextInputs <inputs>");
6379
return true;
6480
}
6581
}

bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/AutoTextHotkeyExample.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ public abstract class AutoTextHotkeyExample extends ApolloModuleExample {
3030

3131
public abstract void setBlockedTextInputs(List<String> blockedTextInputs);
3232

33+
public abstract void setBlockChatMesssageTextInputs(boolean value);
34+
3335
}

bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/AutoTextHotkeyJsonExample.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,13 @@ public void setBlockedTextInputs(List<String> blockedTextInputs) {
4343
JsonPacketUtil.broadcastPacket(message);
4444
}
4545

46+
@Override
47+
public void setBlockChatMesssageTextInputs(boolean value) {
48+
Map<String, Object> properties = new HashMap<>();
49+
properties.put("block-chat-message-text-inputs", value);
50+
51+
JsonObject message = JsonUtil.createEnableModuleObjectWithType("auto_text_hotkey", properties);
52+
JsonPacketUtil.broadcastPacket(message);
53+
}
54+
4655
}

bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/AutoTextHotkeyProtoExample.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,13 @@ public void setBlockedTextInputs(List<String> blockedTextInputs) {
5151
ProtobufPacketUtil.broadcastPacket(settings);
5252
}
5353

54+
@Override
55+
public void setBlockChatMesssageTextInputs(boolean value) {
56+
Map<String, Value> properties = new HashMap<>();
57+
properties.put("block-chat-message-text-inputs", Value.newBuilder().setBoolValue(value).build());
58+
59+
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("auto_text_hotkey", properties);
60+
ProtobufPacketUtil.broadcastPacket(settings);
61+
}
62+
5463
}

docs/developers/modules/autotexthotkey.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ public void setBlockedTextInputs(List<String> blockedTextInputs) {
2626
}
2727
```
2828

29+
### Block Chat Message Text Inputs
30+
31+
```java
32+
public void setBlockChatMesssageTextInputs(boolean value) {
33+
this.autoTextHotkeyModule.getOptions().set(AutoTextHotkeyModule.BLOCK_CHAT_MESSAGE_TEXT_INPUTS, value);
34+
}
35+
```
36+
2937
</Tab>
3038

3139
<Tab>
@@ -49,6 +57,18 @@ public void setBlockedTextInputs(List<String> blockedTextInputs) {
4957
}
5058
```
5159

60+
### Block Chat Message Text Inputs
61+
62+
```java
63+
public void setBlockChatMesssageTextInputs(boolean value) {
64+
Map<String, Value> properties = new HashMap<>();
65+
properties.put("block-chat-message-text-inputs", Value.newBuilder().setBoolValue(value).build());
66+
67+
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("auto_text_hotkey", properties);
68+
ProtobufPacketUtil.broadcastPacket(settings);
69+
}
70+
```
71+
5272
</Tab>
5373

5474
<Tab>
@@ -66,6 +86,18 @@ public void setBlockedTextInputs(List<String> blockedTextInputs) {
6686
}
6787
```
6888

89+
### Block Chat Message Text Inputs
90+
91+
```java
92+
public void setBlockChatMesssageTextInputs(boolean value) {
93+
Map<String, Object> properties = new HashMap<>();
94+
properties.put("block-chat-message-text-inputs", value);
95+
96+
JsonObject message = JsonUtil.createEnableModuleObjectWithType("auto_text_hotkey", properties);
97+
JsonPacketUtil.broadcastPacket(message);
98+
}
99+
```
100+
69101
</Tab>
70102

71103
</Tabs>

0 commit comments

Comments
 (0)