Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Making GM Commands

Initiate Mage
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?
 
Initiate Mage
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
Initiate Mage
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