summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-08-19 00:41:21 +0100
committerKHobbits <rob@khobbits.co.uk>2013-08-19 21:37:33 +0100
commitab3ad25fb63eda11a72fea193291c2a62a80be9f (patch)
treefaba2044bf4f4d5fb271b42bf97bd1b875273be0
parentb30a873e45783f12a14995925a20c4ccf26c45c9 (diff)
downloadEssentials-ab3ad25fb63eda11a72fea193291c2a62a80be9f.tar
Essentials-ab3ad25fb63eda11a72fea193291c2a62a80be9f.tar.gz
Essentials-ab3ad25fb63eda11a72fea193291c2a62a80be9f.tar.lz
Essentials-ab3ad25fb63eda11a72fea193291c2a62a80be9f.tar.xz
Essentials-ab3ad25fb63eda11a72fea193291c2a62a80be9f.zip
New command /customtext - This command is intended to be used with bukkit.yml aliases to make custom commands.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java26
-rw-r--r--Essentials/src/custom.txt29
-rw-r--r--Essentials/src/info.txt5
-rw-r--r--Essentials/src/plugin.yml3
4 files changed, 61 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java b/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java
new file mode 100644
index 000000000..4d56fa705
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java
@@ -0,0 +1,26 @@
+package com.earth2me.essentials.commands;
+
+import com.earth2me.essentials.textreader.IText;
+import com.earth2me.essentials.textreader.KeywordReplacer;
+import com.earth2me.essentials.textreader.TextInput;
+import com.earth2me.essentials.textreader.TextPager;
+import org.bukkit.Server;
+import org.bukkit.command.CommandSender;
+
+
+public class Commandcustomtext extends EssentialsCommand
+{
+ public Commandcustomtext()
+ {
+ super("customtext");
+ }
+
+ @Override
+ protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
+ {
+ final IText input = new TextInput(sender, "custom", true, ess);
+ final IText output = new KeywordReplacer(input, sender, ess);
+ final TextPager pager = new TextPager(output);
+ pager.showPage(commandLabel, args.length > 0 ? args[0] : null, null, sender);
+ }
+}
diff --git a/Essentials/src/custom.txt b/Essentials/src/custom.txt
new file mode 100644
index 000000000..1b01e9588
--- /dev/null
+++ b/Essentials/src/custom.txt
@@ -0,0 +1,29 @@
+#Customtext
+&6This is the custom text commands file.
+
+&6This file allows you to define custom text commands.
+
+&6You can create a specific file for a user or a group:
+&6Name it custom_username.txt or custom_groupname.txt
+
+&6You can use multiple pages, for example type:
+&c/customtext 2
+
+&6To add a custom command you need to do two things:
+&e-&9 Add a section below in the custom.txt
+&e-&9 Add a line to the bukkit.yml aliases section
+&e-&9 Give players access to 'essentials.customtext'
+
+&6If you don't yet have an 'aliases' section, add it like this:
+aliases:
+ vote: customtext
+
+&6The following commands can also be customized:
+&c/rules /motd /news /help
+
+&6These support chapter customization such as:&c /rules grief
+&6You can use custom aliases with these commands too.
+
+#vote
+If you add the correct alias to bukkit.yml
+This text here will be shown if you type /vote
diff --git a/Essentials/src/info.txt b/Essentials/src/info.txt
index cd535fea3..6a89c2201 100644
--- a/Essentials/src/info.txt
+++ b/Essentials/src/info.txt
@@ -1,11 +1,12 @@
This is the info file.
-This file format works for the info.txt, motd.txt and rules.txt
+This file format works with the following files:
+info.txt, motd.txt, help.txt, custom.txt and rules.txt
You can create a specific file for a user or a group:
Name it info_username.txt or info_groupname.txt
-This also works with motd and rules.
+This also works with the other files.
Extra pages:
Type /info Colors
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 474e6c538..e6494ab1d 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -67,6 +67,9 @@ commands:
description: Describes your current bearing.
usage: /<command>
aliases: [ecompass,direction,edirection]
+ customtext:
+ description: Allows you to create custom text commands.
+ usage: /<alias> - Define in bukkit.yml
delhome:
description: Removes a home.
usage: /<command> [player:]<name>