mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
Fixed Empty Commands, Added %username% to Succes** Message.
This commit is contained in:
parent
d808ccda9c
commit
0b81268a9d
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.InventoryBotsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.procedure.TObjectProcedure;
|
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"))) {
|
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 habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
||||||
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
TIntObjectHashMap<Bot> bots = new TIntObjectHashMap<>();
|
TIntObjectHashMap<Bot> bots = new TIntObjectHashMap<>();
|
||||||
bots.putAll(habbo.getInventory().getBotsComponent().getBots());
|
bots.putAll(habbo.getInventory().getBotsComponent().getBots());
|
||||||
habbo.getInventory().getBotsComponent().getBots().clear();
|
habbo.getInventory().getBotsComponent().getBots().clear();
|
||||||
bots.forEachValue(new TObjectProcedure<Bot>() {
|
bots.forEachValue(object -> {
|
||||||
@Override
|
|
||||||
public boolean execute(Bot object) {
|
|
||||||
Emulator.getGameEnvironment().getBotManager().deleteBot(object);
|
Emulator.getGameEnvironment().getBotManager().deleteBot(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new InventoryRefreshComposer());
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,8 @@ package com.eu.habbo.habbohotel.commands;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
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.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
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.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer;
|
import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer;
|
||||||
@ -34,28 +32,21 @@ public class EmptyInventoryCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
|
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 habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
||||||
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
|
|
||||||
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();
|
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();
|
||||||
items.putAll(habbo.getInventory().getItemsComponent().getItems());
|
items.putAll(habbo.getInventory().getItemsComponent().getItems());
|
||||||
habbo.getInventory().getItemsComponent().getItems().clear();
|
habbo.getInventory().getItemsComponent().getItems().clear();
|
||||||
|
|
||||||
for (HabboItem item : items.valueCollection()) {
|
|
||||||
if(item instanceof InteractionJukeBox)
|
|
||||||
TraxManager.removeAllSongs((InteractionJukeBox) item);
|
|
||||||
}
|
|
||||||
|
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItems(items));
|
Emulator.getThreading().run(new QueryDeleteHabboItems(items));
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new InventoryRefreshComposer());
|
habbo.getClient().sendResponse(new InventoryRefreshComposer());
|
||||||
habbo.getClient().sendResponse(new InventoryItemsComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems()));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.permissions.Permission;
|
|||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.InventoryPetsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.procedure.TObjectProcedure;
|
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"))) {
|
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 habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
||||||
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>();
|
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>();
|
||||||
pets.putAll(habbo.getInventory().getPetsComponent().getPets());
|
pets.putAll(habbo.getInventory().getPetsComponent().getPets());
|
||||||
habbo.getInventory().getPetsComponent().getPets().clear();
|
habbo.getInventory().getPetsComponent().getPets().clear();
|
||||||
pets.forEachValue(new TObjectProcedure<Pet>() {
|
pets.forEachValue(object -> {
|
||||||
@Override
|
|
||||||
public boolean execute(Pet object) {
|
|
||||||
Emulator.getGameEnvironment().getPetManager().deletePet(object);
|
Emulator.getGameEnvironment().getPetManager().deletePet(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new InventoryRefreshComposer());
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user