11-04-2011, 07:49 PM
Код:
public class MoveToMe extends AdminCommand
{
public MoveToMe()
{
super("movetome");
}
@Override
public void executeCommand(Player admin, final String[] params)
{
World.getInstance().doOnAllPlayers(new Executor<Player>()
{
@Override
public boolean run(Player player)
{
if (player.getCommonData().getRace() == Race.ELYOS && params[0].equals("ely"))
{
TeleportService.teleportTo(player, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 0);
}else if (player.getCommonData().getRace() == Race.ASMODIANS && params[0].equals("asmo"))
{
TeleportService.teleportTo(player, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 0);
}
return true;
}
});
Player playerToMove = World.getInstance().findPlayer(Util.convertName(params[0]));
if (playerToMove == admin)
{
PacketSendUtility.sendMessage(admin, "Cannot use this command on yourself.");
return;
}
if(params.length == 2)
{
if(params[1].equals("alliance"))
{
if(playerToMove.getPlayerAlliance() != null)
{
for(PlayerAllianceMember m : playerToMove.getPlayerAlliance().getMembers())
{
if(m != null && m.getPlayer() != null)
{
port(admin, m.getPlayer());
}
}
}
else
{
PacketSendUtility.sendMessage(admin, "This player is not in alliance.");
port(admin, playerToMove);
}
}
}
}
private void port(Player admin, Player playerToMove)
{
TeleportService.teleportTo(playerToMove, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 0);
PacketSendUtility.sendMessage(admin, "Teleported player " + playerToMove.getName() + " to your location.");
PacketSendUtility.sendMessage(playerToMove, "You have been teleported by " + admin.getName() + ".");
}
}
Конкретно суть проблемы:
TeleportService.teleportTo(player, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 0)
Не понимает кто такой admin, как ему объяснить?
И без @Override не обойтись
Консоль GameServer не советует:"Вы настраивайте сервер уже 1 час. Советуем вам немного отдохнуть".