This commit is contained in:
harmonic 2020-07-28 21:15:31 +01:00
commit ad2f8fdb0a
5 changed files with 29 additions and 43 deletions

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.inventory.InventoryBotsComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure;
@ -30,26 +31,24 @@ public class EmptyBotsInventoryCommand extends Command {
}
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
Habbo habbo = gameClient.getHabbo();
if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) {
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
}
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
if (habbo != null) {
TIntObjectHashMap<Bot> bots = new TIntObjectHashMap<>();
bots.putAll(habbo.getInventory().getBotsComponent().getBots());
habbo.getInventory().getBotsComponent().getBots().clear();
bots.forEachValue(new TObjectProcedure<Bot>() {
@Override
public boolean execute(Bot object) {
Emulator.getGameEnvironment().getBotManager().deleteBot(object);
return true;
}
bots.forEachValue(object -> {
Emulator.getGameEnvironment().getBotManager().deleteBot(object);
return true;
});
habbo.getClient().sendResponse(new InventoryRefreshComposer());
habbo.getClient().sendResponse(new InventoryBotsComposer(habbo));
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.cleared"), RoomChatMessageBubbles.ALERT);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty_bots"), RoomChatMessageBubbles.ALERT);
}
}

View File

@ -2,10 +2,8 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.rooms.TraxManager;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer;
@ -34,31 +32,24 @@ public class EmptyInventoryCommand extends Command {
}
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
Habbo habbo = gameClient.getHabbo();
if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) {
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
}
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
if (habbo != null) {
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();
items.putAll(habbo.getInventory().getItemsComponent().getItems());
habbo.getInventory().getItemsComponent().getItems().clear();
for (HabboItem item : items.valueCollection()) {
if(item instanceof InteractionJukeBox)
TraxManager.removeAllSongs((InteractionJukeBox) item);
}
Emulator.getThreading().run(new QueryDeleteHabboItems(items));
habbo.getClient().sendResponse(new InventoryRefreshComposer());
habbo.getClient().sendResponse(new InventoryItemsComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems()));
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared"), RoomChatMessageBubbles.ALERT);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty"), RoomChatMessageBubbles.ALERT);
}
}
return true;
}
}
}

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.inventory.InventoryPetsComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure;
@ -30,25 +31,24 @@ public class EmptyPetsInventoryCommand extends Command {
}
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
Habbo habbo = gameClient.getHabbo();
if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) {
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
}
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
if (habbo != null) {
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>();
pets.putAll(habbo.getInventory().getPetsComponent().getPets());
habbo.getInventory().getPetsComponent().getPets().clear();
pets.forEachValue(new TObjectProcedure<Pet>() {
@Override
public boolean execute(Pet object) {
Emulator.getGameEnvironment().getPetManager().deletePet(object);
return true;
}
pets.forEachValue(object -> {
Emulator.getGameEnvironment().getPetManager().deletePet(object);
return true;
});
habbo.getClient().sendResponse(new InventoryRefreshComposer());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.cleared"), RoomChatMessageBubbles.ALERT);
habbo.getClient().sendResponse(new InventoryPetsComposer(habbo));
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty_pets"), RoomChatMessageBubbles.ALERT);
}
}

View File

@ -3005,7 +3005,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
public void talk(Habbo habbo, RoomChatMessage roomChatMessage, RoomChatType chatType) {
this.talk(habbo, roomChatMessage, chatType, false);
this.talk(habbo, roomChatMessage, chatType, true);
}
public void talk(final Habbo habbo, final RoomChatMessage roomChatMessage, RoomChatType chatType, boolean ignoreWired) {
@ -3570,7 +3570,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
HabboItem lowestChair = this.getLowestChair(x, y);
if (lowestChair != null && lowestChair != exclude) {
canStack = true;
height = lowestChair.getZ() + Item.getCurrentHeight(lowestChair);
height = lowestChair.getZ();
}
}
}

View File

@ -25,10 +25,6 @@ public class FriendRequestEvent extends MessageHandler {
String username = this.packet.readString();
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(username);
if (habbo.getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) {
return;
}
if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, habbo)).isCancelled()) {
this.client.sendResponse(new FriendRequestErrorComposer(2));
return;