• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Making GM Commands

Newbie Spellweaver
Joined
Jun 18, 2011
Messages
46
Reaction score
0
Hi,

I have attempted to make/modify gm commands, but whenever I do so,all the gm commands stop working. Is there a way to make/modify my own gm commands and have them work in-game?
 
Newbie Spellweaver
Joined
Oct 30, 2013
Messages
34
Reaction score
3
You need to edit the admin commands java file and then create a new command java file of that same name and give a specific gm lvl and you will be okay :)
 
Upvote 0
Newbie Spellweaver
Joined
Jun 18, 2011
Messages
46
Reaction score
0
So can you guys tell me what is wrong with my code?
package admincommands;

import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.utils.chathandlers.AdminCommand;

public class Testt extends AdminCommand {
public Testt() {
super("Testt");
}

@Override
public void execute(Player admin, String... params) {
Player target = null;
VisibleObject creature = admin.getTarget();
if (admin.getTarget() instanceof Player) {
target = (Player) creature;
} if (target == null) {
PacketSendUtility.sendMessage(admin, "You should select a target first!");
return;
} if (params.length < 2) {
PacketSendUtility.sendMessage(admin, "You should enter Value!");
return;
}
String paramValue = params[1];
if (params[0].equals("block")) {
if (admin.getAccessLevel() < CommandsConfig.SET) {
PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
return;
}
int index;
try {
index = Integer.parseInt(paramValue);

catch (NumberFormatException ex) {
PacketSendUtility.sendMessage(admin, "Wrong input");
return;
}
catch (Exception ex2) {
PacketSendUtility.sendMessage(admin, "Error.");
return;
}
player.getGameStats().setStat(StatEnum.BLOCK, admin.getGameStats().getStatBonus(StatEnum.BLOCK) * paramValue);
}
}
}
}
 
Upvote 0
Back
Top