Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java

47 lines
1.6 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
2020-06-05 10:12:49 +02:00
import com.eu.habbo.habbohotel.permissions.Permission;
2018-07-06 15:30:00 +02:00
import com.eu.habbo.messages.ServerMessage;
2019-05-26 20:14:53 +02:00
public class TestCommand extends Command {
public TestCommand() {
super("acc_debug", new String[]{"test"});
2018-07-06 15:30:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public boolean handle(GameClient gameClient, String[] params) throws Exception {
2020-06-05 10:12:49 +02:00
if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL) || !Emulator.debugging)
2019-06-23 22:08:29 +02:00
return false;
2018-07-06 15:30:00 +02:00
2019-06-23 22:08:29 +02:00
int header = Integer.valueOf(params[1]);
2018-07-06 15:30:00 +02:00
2019-06-23 22:08:29 +02:00
ServerMessage message = new ServerMessage(header);
2018-07-06 15:30:00 +02:00
2019-06-23 22:08:29 +02:00
for (int i = 1; i < params.length; i++) {
String[] data = params[i].split(":");
2018-07-06 15:30:00 +02:00
2019-06-23 22:08:29 +02:00
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("");
2018-07-06 15:30:00 +02:00
}
2019-06-23 22:08:29 +02:00
} 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]));
2018-07-06 15:30:00 +02:00
}
}
2019-06-23 22:08:29 +02:00
gameClient.sendResponse(message);
2018-07-08 23:32:00 +02:00
2018-07-06 15:30:00 +02:00
return true;
}
}