Skip to content

Commit a06a81c

Browse files
committed
New command /customtext - This command is intended to be used with bukkit.yml aliases to make custom commands.
1 parent a29e1bf commit a06a81c

File tree

4 files changed

+61
-2
lines changed

4 files changed

+61
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.earth2me.essentials.commands;
2+
3+
import com.earth2me.essentials.textreader.IText;
4+
import com.earth2me.essentials.textreader.KeywordReplacer;
5+
import com.earth2me.essentials.textreader.TextInput;
6+
import com.earth2me.essentials.textreader.TextPager;
7+
import org.bukkit.Server;
8+
import org.bukkit.command.CommandSender;
9+
10+
11+
public class Commandcustomtext extends EssentialsCommand
12+
{
13+
public Commandcustomtext()
14+
{
15+
super("customtext");
16+
}
17+
18+
@Override
19+
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
20+
{
21+
final IText input = new TextInput(sender, "custom", true, ess);
22+
final IText output = new KeywordReplacer(input, sender, ess);
23+
final TextPager pager = new TextPager(output);
24+
pager.showPage(commandLabel, args.length > 0 ? args[0] : null, null, sender);
25+
}
26+
}

Essentials/src/custom.txt

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#Customtext
2+
&6This is the custom text commands file.
3+
4+
&6This file allows you to define custom text commands.
5+
6+
&6You can create a specific file for a user or a group:
7+
&6Name it custom_username.txt or custom_groupname.txt
8+
9+
&6You can use multiple pages, for example type:
10+
&c/customtext 2
11+
12+
&6To add a custom command you need to do two things:
13+
&e-&9 Add a section below in the custom.txt
14+
&e-&9 Add a line to the bukkit.yml aliases section
15+
&e-&9 Give players access to 'essentials.customtext'
16+
17+
&6If you don't yet have an 'aliases' section, add it like this:
18+
aliases:
19+
vote: customtext
20+
21+
&6The following commands can also be customized:
22+
&c/rules /motd /news /help
23+
24+
&6These support chapter customization such as:&c /rules grief
25+
&6You can use custom aliases with these commands too.
26+
27+
#vote
28+
If you add the correct alias to bukkit.yml
29+
This text here will be shown if you type /vote

Essentials/src/info.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
This is the info file.
22

3-
This file format works for the info.txt, motd.txt and rules.txt
3+
This file format works with the following files:
4+
info.txt, motd.txt, help.txt, custom.txt and rules.txt
45

56
You can create a specific file for a user or a group:
67
Name it info_username.txt or info_groupname.txt
78

8-
This also works with motd and rules.
9+
This also works with the other files.
910

1011
Extra pages:
1112
Type /info Colors

Essentials/src/plugin.yml

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ commands:
6767
description: Describes your current bearing.
6868
usage: /<command>
6969
aliases: [ecompass,direction,edirection]
70+
customtext:
71+
description: Allows you to create custom text commands.
72+
usage: /<alias> - Define in bukkit.yml
7073
delhome:
7174
description: Removes a home.
7275
usage: /<command> [player:]<name>

0 commit comments

Comments
 (0)