Facebook
From Morose Cat, 4 Years ago, written in Plain Text.
This paste is a reply to Untitled from Emerald Flamingo - go back
Embed
Viewing differences between Untitled and Re: Untitled
/**
 * This file is part of Aion-Lightning .
 *
 *  Aion-Lightning 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 3 of the License, or
 *  (at your option) any later version.
 *
 *  Aion-Lightning is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details. *
 *  You should have received a copy of the GNU General Public License
 *  along with Aion-Lightning.
 *  If not, see .
 */
package admincommands;

import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_MOTION;
import com.aionemu.gameserver.network.aion.serverpackets.SM_PLAYER_INFO;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.audit.GMService;
import com.aionemu.gameserver.utils.chathandlers.AdminCommand;

/**
 * @author Cura
Eloann
 */
public class Cooldown GMMode extends AdminCommand {

        public Cooldown() GMMode() {
                super("cooldown");
super("gm");
        }

        @Override
        public void execute(Player player, admin, String... params) {
                if (player.isCoolDownZero()) (admin.getAccessLevel() < 1) {
                        PacketSendUtility.sendMessage(player, "Cooldown time of all skills has been recovered.sendMessage(admin, "You cannot use this command.");
                        player.setCoolDownZero(false);
return;
                }

                if (params.length != 1) {
                        onFail(admin, null);
                        return;
                }

                if (params[0].toLowerCase().equals("on")) {
                        if (!admin.isGmMode()) {
                                admin.setGmMode(true);
                                admin.setWispable();

                                GMService.getInstance().onPlayerLogin(admin); // put gm into
                                // gmlist
                                GMService.getInstance().onPlayerAvailable(admin); // send
                                // available
                                // message
                                admin.clearKnownlist();
                                PacketSendUtility.sendPacket(admin, new SM_PLAYER_INFO(admin, false));
                                PacketSendUtility.sendPacket(admin, new SM_MOTION(admin.getObjectId(), admin.getMotions().getActiveMotions()));
                                admin.updateKnownlist();
                                PacketSendUtility.sendMessage(admin, "you are now Available and Wispable by players");

                        }
                }
                else if (params[0].equals("off")) {
                        if (admin.isGmMode()) {
                                admin.setGmMode(false);
                                admin.setUnWispable();

                                GMService.getInstance().onPlayerLogedOut(admin); // remove gm
                                // into
                                // gmlist
                                GMService.getInstance().onPlayerUnavailable(admin); // send
                                // unavailable
                                // message
                                admin.clearKnownlist();
                                
PacketSendUtility.sendMessage(player, "Cooldown time of all skills is set to 0.");
                        player.setCoolDownZero(true);
sendPacket(admin, new SM_PLAYER_INFO(admin, false));
                                PacketSendUtility.sendPacket(admin, new SM_MOTION(admin.getObjectId(), admin.getMotions().getActiveMotions()));
                                admin.updateKnownlist();
                                PacketSendUtility.sendMessage(admin, "you are now Unavailable and Unwispable by players");
                        }
                }
        }

        @Override
        public void onFail(Player player, admin, String message) {
                // TODO Auto-generated method stub
String syntax = "syntax //gm ";
                PacketSendUtility.sendMessage(admin, syntax);
        }
}
}