[trunk] tpall command

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1159 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-09 00:58:41 +00:00
parent 76ba31d1a3
commit 8dda02da99
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,45 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import org.bukkit.entity.Player;
public class Commandtpall extends EssentialsCommand
{
public Commandtpall()
{
super("tpall");
}
@Override
public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
user.charge(this);
user.sendMessage("§7Teleporting...");
for (Player player : server.getOnlinePlayers()) {
User p = User.get(player);
if (p == user) {
continue;
}
p.teleportToNow(user);
}
}
else
{
User p = getPlayer(server, args, 0);
user.charge(this);
user.sendMessage("§7Teleporting...");
for (Player player : server.getOnlinePlayers()) {
User u = User.get(player);
if (p == u) {
continue;
}
u.teleportToNow(p);
}
}
}
}

View File

@ -207,6 +207,9 @@ commands:
tpahere:
description: Request that the specified player teleport to you.
usage: /<command> <player>
tpall:
desctiption: Teleport all online players to another player.
usage: /<command> <player>
tpdeny:
description: Reject a teleport request.
usage: /<command>