Skip to content

Commit 4aa3cdc

Browse files
committed
add BetterDialogs
1 parent 77de7b3 commit 4aa3cdc

File tree

19 files changed

+832
-0
lines changed

19 files changed

+832
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
+++
2+
title = "BetterDialogs"
3+
weight = 1
4+
+++
5+
6+
This is an addon for those who want to work with the new **Dialog System**, in **BetterGUI**'s style.
7+
8+
## Requirement
9+
10+
Your server must meet **one** of the following requirements:
11+
12+
- Is a **PaperMC** server in 1.21.7 or higher
13+
- Is a **SpigotMC** server in 1.21.6 or higher (Make sure to use the latest build)
14+
- Have installed [**PacketEvents**](https://www.spigotmc.org/resources/80279/)
15+
16+
### Limitation
17+
18+
- SpigotMC: Does not support Item Body
19+
- PacketEvents: Item Body only displays the material and no components (See [the pull request](https://github.com/retrooper/packetevents/pull/1277))
20+
21+
## Getting Started
22+
23+
- Download the addon
24+
- [Install the addon]({{% ref "basic/addon" %}})
25+
- Start using it!
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
+++
2+
title = "Component"
3+
weight = 2
4+
+++
5+
6+
This is a new chapter.
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
+++
2+
title = "Action"
3+
weight = 4
4+
+++
5+
6+
This is a button component, one that can be used to perform an action when clicked.
7+
8+
## Common Format
9+
10+
```yaml
11+
action-name:
12+
# The label of the button
13+
label: "Click me!"
14+
15+
# The tooltip of the button
16+
# If the tooltip is not provided, there will be no tooltip
17+
tooltip: "This is a tooltip"
18+
19+
# The width of the button
20+
# If the width is not provided, it will default to 150
21+
width: 150
22+
```
23+
24+
## Button Types
25+
26+
### Copy To Clipboard
27+
28+
This button copies the specified text to the clipboard.
29+
30+
#### Format
31+
32+
```yaml
33+
action-name:
34+
# The type of the button
35+
type: copy
36+
37+
# The text to copy to the clipboard
38+
text: "Hello, world!"
39+
```
40+
41+
#### Example
42+
43+
```yaml
44+
copy-command:
45+
type: copy
46+
label: "Click here to copy a command"
47+
tooltip: "Copy the command to your clipboard"
48+
text: "/kill {player}"
49+
```
50+
51+
### Open URL
52+
53+
This button will prompt the player to open a URL.
54+
55+
#### Format
56+
57+
```yaml
58+
action-name:
59+
# The type of the button
60+
type: url
61+
62+
# The URL to open
63+
url: "https://example.com"
64+
```
65+
66+
#### Example
67+
68+
```yaml
69+
open-url:
70+
type: url
71+
label: "Click here to open a URL"
72+
tooltip: "Open a URL in your browser"
73+
url: "https://bettergui-mc.github.io/Docs/"
74+
```
75+
76+
### Suggest Command
77+
78+
This button will suggest a command to the player.
79+
80+
#### Format
81+
82+
```yaml
83+
action-name:
84+
# The type of the button
85+
type: suggest
86+
87+
# The command to suggest
88+
command: "/kill {player}"
89+
```
90+
91+
#### Example
92+
93+
```yaml
94+
suggest-command:
95+
type: suggest
96+
label: "Click here to suggest a command"
97+
tooltip: "Suggest a command to your player"
98+
command: "/kill {player}"
99+
```
100+
101+
### Run Command
102+
103+
This button will control the player to execute a command.
104+
105+
#### Format
106+
107+
```yaml
108+
action-name:
109+
# The type of the button
110+
type: run
111+
112+
# The command to execute
113+
command: "/kill {player}"
114+
```
115+
116+
#### Example
117+
118+
```yaml
119+
run-command:
120+
type: run
121+
label: "Click here to run a command"
122+
tooltip: "Run a command on your player"
123+
command: "/kill {player}"
124+
```
125+
126+
### Custom Action
127+
128+
This button will execute custom actions on the server.
129+
130+
#### Format
131+
132+
```yaml
133+
action-name:
134+
# The type of the button
135+
type: action
136+
137+
# The list of actions to execute
138+
command:
139+
- action1
140+
- action2
141+
142+
# The requirement to check when clicking the button
143+
click-requirement:
144+
<requirement-set>
145+
<requirement-set>
146+
<requirement-set>
147+
```
148+
149+
Check [Action]({{% ref "action/overview" %}}) for more information about the available actions in `command`.
150+
151+
Check [Requirement]({{% ref "requirement/overview" %}}) for more information about the available requirements in `click-requirement`.
152+
153+
### Example
154+
155+
```yaml
156+
action-custom:
157+
type: action
158+
label: "Click here to execute custom actions"
159+
tooltip: "Execute custom actions on your player"
160+
command:
161+
- "tell: &aYou met the requirement"
162+
- "tell: &aHere is your reward"
163+
- "console: give {player} diamond 64"
164+
click-requirement:
165+
check-level:
166+
level:
167+
value: 10
168+
take: false
169+
fail-action: "tell: &cYou don't have enough level"
170+
```
171+
172+
## Full Example
173+
174+
```yaml
175+
menu-settings:
176+
menu-type: action-dialog
177+
title: "Example Dialog"
178+
command: exampledialog
179+
180+
copy-command:
181+
type: copy
182+
label: "Click here to copy a command"
183+
text: "/kill {player}"
184+
185+
open-url:
186+
type: url
187+
label: "Click here to open a URL"
188+
tooltip: "Open a URL in your browser"
189+
url: "https://bettergui-mc.github.io/Docs/"
190+
191+
suggest-command:
192+
type: suggest
193+
label: "Click here to suggest a command"
194+
tooltip: "Suggest a command to your player"
195+
command: "/kill {player}"
196+
197+
run-command:
198+
type: run
199+
label: "Click here to run a command"
200+
tooltip: "Run a command on your player"
201+
command: "/kill {player}"
202+
203+
action-custom:
204+
type: action
205+
label: "Click here to execute custom actions"
206+
tooltip: "Execute custom actions on your player"
207+
command:
208+
- "tell: &aYou met the requirement"
209+
- "tell: &aHere is your reward"
210+
- "console: give {player} diamond 64"
211+
click-requirement:
212+
check-level:
213+
level:
214+
value: 10
215+
take: false
216+
fail-action: "tell: &cYou don't have enough level"
217+
```
218+
219+
![Example](example.png)
760 KB
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
+++
2+
title = "Input"
3+
weight = 3
4+
+++
5+
6+
This is a component for inputs from the player. It allows the player to interact with the dialog and provide user input so that the dialog can send the information to the server.
7+
8+
The next sections will provide more information about each type of input component.
9+
10+
## Get Input Value
11+
12+
For each input, you can retrieve the value using the `{dialog_<name>}` variable, where `<name>` is the name of the input component.
13+
14+
For example, if you have an dialog with an input component like this:
15+
16+
```yaml
17+
menu-settings:
18+
menu-type: notice-dialog
19+
title: "Example Dialog"
20+
command: exampledialog
21+
22+
name:
23+
type: input
24+
label: "Name"
25+
26+
hello:
27+
type: action
28+
command: "tell: &b&lHello, &f&l{dialog_name}"
29+
```
30+
31+
You can retrieve the value of the `name` component using the `{dialog_name}` variable, as shown in the `hello` action.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
+++
2+
title = "Checkbox"
3+
weight = 2
4+
+++
5+
6+
This is an input component that allows players to check a box.
7+
8+
## Format
9+
10+
```yaml
11+
checkbox-input-name:
12+
# The type of the input component
13+
type: checkbox
14+
15+
# The label of the input component
16+
label: Checkbox Label
17+
18+
# The initial state of the checkbox
19+
# If not specified, the checkbox will be unchecked by default
20+
initial: false
21+
22+
# The value of the checkbox when checked
23+
# If not specified, the value will be "true"
24+
on-true: "Checked"
25+
26+
# The value of the checkbox when unchecked
27+
# If not specified, the value will be "false"
28+
on-false: "Unchecked"
29+
```
30+
31+
## Example
32+
33+
```yaml
34+
menu-settings:
35+
menu-type: notice-dialog
36+
title: "Example Dialog"
37+
command: exampledialog
38+
39+
gender:
40+
type: checkbox
41+
label: "Are you male?"
42+
on-true: "Male"
43+
on-false: "Female"
44+
45+
hello:
46+
type: action
47+
command: "tell: &b&lYour gender is &f&l{dialog_gender}"
48+
```
49+
50+
![Example](example.png)
698 KB
Loading

0 commit comments

Comments
 (0)