Package games.stendhal.server.actions.admin

Source Code of games.stendhal.server.actions.admin.TeleClickModeAction

/* $Id: TeleClickModeAction.java,v 1.8 2010/09/19 02:21:43 nhnb Exp $ */
/***************************************************************************
*                   (C) Copyright 2003-2010 - Stendhal                    *
***************************************************************************
***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
***************************************************************************/
package games.stendhal.server.actions.admin;

import static games.stendhal.common.constants.Actions.TELECLICKMODE;
import games.stendhal.server.actions.CommandCenter;
import games.stendhal.server.core.engine.GameEvent;
import games.stendhal.server.entity.player.Player;
import marauroa.common.game.RPAction;


public class TeleClickModeAction extends AdministrationAction {


  public static void register() {
    CommandCenter.register(TELECLICKMODE, new TeleClickModeAction(), 500);

  }

  @Override
  public void perform(final Player player, final RPAction action) {

    if (player.isTeleclickEnabled()) {
      player.setTeleclickEnabled(false);
      new GameEvent(player.getName(), TELECLICKMODE, "off").raise();
    } else {
      player.setTeleclickEnabled(true);
      new GameEvent(player.getName(), TELECLICKMODE, "on").raise();
    }
  }

}
TOP

Related Classes of games.stendhal.server.actions.admin.TeleClickModeAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.