summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-11-16 03:00:31 +0000
committerKHobbits <rob@khobbits.co.uk>2011-11-16 03:00:31 +0000
commit4be1797592cded0d123c9378ca5afb393195f469 (patch)
tree633561844af3fabbcf7443757709e0f74e2105ad
parentc0d046841fe2a1f21f81e43649d7b8a4068864c7 (diff)
downloadEssentials-4be1797592cded0d123c9378ca5afb393195f469.tar
Essentials-4be1797592cded0d123c9378ca5afb393195f469.tar.gz
Essentials-4be1797592cded0d123c9378ca5afb393195f469.tar.lz
Essentials-4be1797592cded0d123c9378ca5afb393195f469.tar.xz
Essentials-4be1797592cded0d123c9378ca5afb393195f469.zip
Sudo Command
This might never make it to release, needs tidying first at least.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsudo.java39
-rw-r--r--Essentials/src/plugin.yml4
2 files changed, 43 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
new file mode 100644
index 000000000..19b1fd084
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
@@ -0,0 +1,39 @@
+package com.earth2me.essentials.commands;
+
+import com.earth2me.essentials.User;
+import org.bukkit.Server;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.PluginCommand;
+
+
+public class Commandsudo extends EssentialsCommand
+{
+ public Commandsudo()
+ {
+ super("sudo");
+ }
+
+ @Override
+ public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
+ {
+ if (args.length < 2)
+ {
+ throw new NotEnoughArgumentsException();
+ }
+
+ final User user = getPlayer(server, args, 0, true);
+ final String command = args[1];
+ String[] arguments = new String[args.length - 2];
+ System.arraycopy(args, 2, arguments, 0, args.length - 2);
+
+ //TODO: Translate this.
+ sender.sendMessage("Running the command as " + user.getDisplayName());
+
+ final PluginCommand pc = ess.getServer().getPluginCommand(command);
+ if (pc != null)
+ {
+ pc.execute(user, command, arguments);
+ }
+
+ }
+}
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 3817234d5..dd7bb2ec3 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -274,6 +274,10 @@ commands:
description: Spawns a mob.
usage: /<command> <mob>[:data][,<mount>[:data]] [amount]
aliases: [espawnmob]
+ sudo:
+ description: Make another user do something.
+ usage: /<command> <player> <command [args]>
+ aliases: [esudo]
suicide:
description: Causes you to perish.
usage: /<command>