Changes by Swirny, squashed to make merging easier

This commit is contained in:
Mike 2020-06-03 03:15:09 +02:00
parent e2013c8451
commit 25c9f88718
3 changed files with 20 additions and 10 deletions

View File

@ -1,7 +1,3 @@
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1');
ALTER TABLE `permissions` ADD `cmd_softkick` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_kickall`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1');

View File

@ -0,0 +1,4 @@
ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_not_found', '%user% not found');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!');

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
public class SoftKickCommand extends Command {
@ -13,13 +14,22 @@ public class SoftKickCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
if (params.length == 2) {
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
for (Habbo habbo : room.getHabbos()) {
if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) {
room.kickHabbo(habbo, false);
}
if (habbo == null) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
}
else if (habbo == gameClient.getHabbo()) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error_self"), RoomChatMessageBubbles.ALERT);
return true;
}
else {
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
room.kickHabbo(habbo, false);
}
}
return true;
}
}