Merge this if statement with the enclosing one.

This commit is contained in:
brenoepic 2022-04-28 23:47:05 -03:00
parent 73c5aa78b3
commit 572961c2fa

View File

@ -14,12 +14,11 @@ public class SoftKickCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
if (params.length == 2) {
final String username = params[1];
final Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(username);
if (params.length != 2) return true;
final Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
if (habbo == null) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", username), RoomChatMessageBubbles.ALERT);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
}
@ -30,12 +29,9 @@ public class SoftKickCommand extends Command {
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
if (room != null) {
if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) {
if (room != null && (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo)))) {
room.kickHabbo(habbo, false);
}
}
}
return true;
}
}