Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java
2019-06-23 23:08:29 +03:00

47 lines
1.6 KiB
Java

package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
public class TestCommand extends Command {
public TestCommand() {
super("acc_debug", new String[]{"test"});
}
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasPermission("acc_supporttool") || !Emulator.debugging)
return false;
int header = Integer.valueOf(params[1]);
ServerMessage message = new ServerMessage(header);
for (int i = 1; i < params.length; i++) {
String[] data = params[i].split(":");
if (data[0].equalsIgnoreCase("b")) {
message.appendBoolean(data[1].equalsIgnoreCase("1"));
} else if (data[0].equalsIgnoreCase("s")) {
if (data.length > 1) {
message.appendString(data[1]);
} else {
message.appendString("");
}
} else if (data[0].equals("i")) {
message.appendInt(Integer.valueOf(data[1]));
} else if (data[0].equalsIgnoreCase("by")) {
message.appendByte(Integer.valueOf(data[1]));
} else if (data[0].equalsIgnoreCase("sh")) {
message.appendShort(Integer.valueOf(data[1]));
}
}
gameClient.sendResponse(message);
return true;
}
}