Most visitors online was 8830 , on 6 Feb 2024
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!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);
}
}
}
}
So can you guys tell me what is wrong with my code?