Finished Implementing New Permissions System

This commit is contained in:
Stankman 2023-06-02 21:56:51 -05:00
parent cf55c2193d
commit 8cb172c605
266 changed files with 1379 additions and 1299 deletions

View File

@ -216,6 +216,11 @@
<version>${org.mockito.version}</version> <version>${org.mockito.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -9,7 +9,6 @@ import java.sql.SQLException;
@AllArgsConstructor @AllArgsConstructor
public class CommandLog implements DatabaseLoggable { public class CommandLog implements DatabaseLoggable {
private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)"; private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private final int userId; private final int userId;

View File

@ -51,7 +51,7 @@ public class CreditsScheduler extends Scheduler {
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED) if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
continue; continue;
habbo.giveCredits((int) (habbo.getHabboInfo().getRank().getCreditsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0))); habbo.giveCredits((int) (habbo.getHabboInfo().getPermissionGroup().getTimerAmount(-1) * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Caught exception", e); log.error("Caught exception", e);

View File

@ -61,7 +61,7 @@ public class GotwPointsScheduler extends Scheduler {
} }
type = Emulator.getConfig().getInt("seasonal.currency." + GOTW_POINTS_NAME, -1); type = Emulator.getConfig().getInt("seasonal.currency." + GOTW_POINTS_NAME, -1);
if (found || type != -1) { if (found || type != -1) {
habbo.givePoints(type, (int)(habbo.getHabboInfo().getRank().getGotwTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0))); habbo.givePoints(type, (int)(habbo.getHabboInfo().getPermissionGroup().getTimerAmount(type) * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
} }
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -46,7 +46,7 @@ public class PixelScheduler extends Scheduler {
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED) if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
continue; continue;
habbo.givePixels((int)(habbo.getHabboInfo().getRank().getPixelsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0))); habbo.givePixels((int)(habbo.getHabboInfo().getPermissionGroup().getTimerAmount(0) * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Caught exception", e); log.error("Caught exception", e);

View File

@ -51,7 +51,7 @@ public class PointsScheduler extends Scheduler {
continue; continue;
//habbo.givePoints(POINTS); //habbo.givePoints(POINTS);
habbo.givePoints((int)(habbo.getHabboInfo().getRank().getDiamondsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0))); habbo.givePoints((int)(habbo.getHabboInfo().getPermissionGroup().getTimerAmount(5) * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Caught exception", e); log.error("Caught exception", e);

View File

@ -1,6 +1,7 @@
package com.eu.habbo.core.consolecommands; package com.eu.habbo.core.consolecommands;
import com.eu.habbo.habbohotel.commands.ShutdownCommand; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.list.ShutdownCommand;
public class ConsoleShutdownCommand extends ConsoleCommand { public class ConsoleShutdownCommand extends ConsoleCommand {
public ConsoleShutdownCommand() { public ConsoleShutdownCommand() {
@ -9,6 +10,6 @@ public class ConsoleShutdownCommand extends ConsoleCommand {
@Override @Override
public void handle(String[] args) { public void handle(String[] args) {
new ShutdownCommand().handle(null, args); Emulator.getGameEnvironment().getCommandsManager().handleCommand(null, args.toString());
} }
} }

View File

@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.campaign.CalendarManager; import com.eu.habbo.habbohotel.campaign.CalendarManager;
import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.commands.CommandHandler; import com.eu.habbo.habbohotel.commands.CommandsManager;
import com.eu.habbo.habbohotel.crafting.CraftingManager; import com.eu.habbo.habbohotel.crafting.CraftingManager;
import com.eu.habbo.habbohotel.guides.GuideManager; import com.eu.habbo.habbohotel.guides.GuideManager;
import com.eu.habbo.habbohotel.guilds.GuildManager; import com.eu.habbo.habbohotel.guilds.GuildManager;
@ -37,7 +37,6 @@ public class GameEnvironment {
private PointsScheduler pointsScheduler; private PointsScheduler pointsScheduler;
private GotwPointsScheduler gotwPointsScheduler; private GotwPointsScheduler gotwPointsScheduler;
private SubscriptionScheduler subscriptionScheduler; private SubscriptionScheduler subscriptionScheduler;
private HabboManager habboManager; private HabboManager habboManager;
private NavigatorManager navigatorManager; private NavigatorManager navigatorManager;
private GuildManager guildManager; private GuildManager guildManager;
@ -45,7 +44,7 @@ public class GameEnvironment {
private CatalogManager catalogManager; private CatalogManager catalogManager;
private HotelViewManager hotelViewManager; private HotelViewManager hotelViewManager;
private RoomManager roomManager; private RoomManager roomManager;
private CommandHandler commandHandler; private CommandsManager commandsManager;
private PermissionsManager permissionsManager; private PermissionsManager permissionsManager;
private BotManager botManager; private BotManager botManager;
private ModToolManager modToolManager; private ModToolManager modToolManager;
@ -73,7 +72,7 @@ public class GameEnvironment {
this.catalogManager = new CatalogManager(); this.catalogManager = new CatalogManager();
this.roomManager = new RoomManager(); this.roomManager = new RoomManager();
this.navigatorManager = new NavigatorManager(); this.navigatorManager = new NavigatorManager();
this.commandHandler = new CommandHandler(); this.commandsManager = new CommandsManager();
this.modToolManager = new ModToolManager(); this.modToolManager = new ModToolManager();
this.modToolSanctions = new ModToolSanctions(); this.modToolSanctions = new ModToolSanctions();
this.achievementManager = new AchievementManager(); this.achievementManager = new AchievementManager();
@ -112,7 +111,7 @@ public class GameEnvironment {
this.gotwPointsScheduler.setDisposed(true); this.gotwPointsScheduler.setDisposed(true);
this.craftingManager.dispose(); this.craftingManager.dispose();
this.habboManager.dispose(); this.habboManager.dispose();
this.commandHandler.dispose(); this.commandsManager.dispose();
this.guildManager.dispose(); this.guildManager.dispose();
this.catalogManager.dispose(); this.catalogManager.dispose();
this.roomManager.dispose(); this.roomManager.dispose();

View File

@ -104,8 +104,8 @@ public class BotManager {
return; return;
if (room != null && bot != null && habbo != null) { if (room != null && bot != null && habbo != null) {
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_PLACEFURNI)) { if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_PLACEFURNI)) {
if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS)) { if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasRight(Permission.ACC_UNLIMITED_BOTS)) {
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS)); habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS));
return; return;
} }
@ -173,8 +173,8 @@ public class BotManager {
if (pickedUpEvent.isCancelled()) if (pickedUpEvent.isCancelled())
return; return;
if (habbo == null || (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER))) { if (habbo == null || (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasRight(Permission.ACC_ANYROOMOWNER))) {
if (habbo != null && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { if (habbo != null && !habbo.hasRight(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) {
habbo.alert(Emulator.getTexts().getValue("error.bots.max.inventory").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); habbo.alert(Emulator.getTexts().getValue("error.bots.max.inventory").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + ""));
return; return;
} }

View File

@ -121,7 +121,7 @@ public class CalendarManager {
if (object == null) return; if (object == null) return;
long daysBetween = ChronoUnit.DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant()); long daysBetween = ChronoUnit.DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
if (((daysBetween >= 0 && daysBetween <= campaign.getTotalDays()) && (((daysBetween - day <= 2 || !campaign.getLockExpired()) && daysBetween - day >= 0)) || (force && habbo.hasPermission("acc_calendar_force")))) { if (((daysBetween >= 0 && daysBetween <= campaign.getTotalDays()) && (((daysBetween - day <= 2 || !campaign.getLockExpired()) && daysBetween - day >= 0)) || (force && habbo.hasRight("acc_calendar_force")))) {
if (Emulator.getPluginManager().fireEvent(new UserClaimRewardEvent(habbo, campaign, day, object, force)).isCancelled()) { if (Emulator.getPluginManager().fireEvent(new UserClaimRewardEvent(habbo, campaign, day, object, force)).isCancelled()) {
return; return;
} }

View File

@ -43,7 +43,6 @@ import lombok.extern.slf4j.Slf4j;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION; import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION;
@ -618,7 +617,7 @@ public class CatalogManager {
this.catalogPages.get(parentId).childPages.forEachValue(object -> { this.catalogPages.get(parentId).childPages.forEachValue(object -> {
boolean isVisiblePage = object.visible; boolean isVisiblePage = object.visible;
boolean hasRightRank = object.getRank() <= habbo.getHabboInfo().getRank().getId(); boolean hasRightRank = object.getRank() <= habbo.getHabboInfo().getPermissionGroup().getId();
boolean clubRightsOkay = !object.isClubOnly() || habbo.getHabboInfo().getHabboStats().hasActiveClub(); boolean clubRightsOkay = !object.isClubOnly() || habbo.getHabboInfo().getHabboStats().hasActiveClub();
@ -1051,12 +1050,12 @@ public class CatalogManager {
UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges); UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges);
Emulator.getPluginManager().fireEvent(purchasedEvent); Emulator.getPluginManager().fireEvent(purchasedEvent);
if (!free && !habbo.getClient().getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS) && purchasedEvent.getTotalCredits() > 0) { if (!free && !habbo.getClient().getHabbo().hasRight(Permission.ACC_INFINITE_CREDITS) && purchasedEvent.getTotalCredits() > 0) {
habbo.getClient().getHabbo().getHabboInfo().addCredits(-purchasedEvent.getTotalCredits()); habbo.getClient().getHabbo().getHabboInfo().addCredits(-purchasedEvent.getTotalCredits());
habbo.getClient().sendResponse(new CreditBalanceComposer(habbo.getClient().getHabbo())); habbo.getClient().sendResponse(new CreditBalanceComposer(habbo.getClient().getHabbo()));
} }
if (!free && !habbo.getClient().getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS) && purchasedEvent.getTotalPoints() > 0) { if (!free && !habbo.getClient().getHabbo().hasRight(Permission.ACC_INFINITE_POINTS) && purchasedEvent.getTotalPoints() > 0) {
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -purchasedEvent.getTotalPoints()); habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -purchasedEvent.getTotalPoints());
habbo.getClient().sendResponse(new HabboActivityPointNotificationMessageComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.getTotalPoints(), item.getPointsType())); habbo.getClient().sendResponse(new HabboActivityPointNotificationMessageComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.getTotalPoints(), item.getPointsType()));
} }

View File

@ -1,20 +1,21 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.interfaces.ICommand;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import lombok.AllArgsConstructor; import lombok.Getter;
@AllArgsConstructor public abstract class Command implements ICommand {
public abstract class Command { @Getter
private final String name;
public final String permission;
public final String[] keys;
public Command(String name) {
this.name = name;
}
public abstract boolean handle(GameClient gameClient, String[] params) throws Exception; public abstract boolean handle(GameClient gameClient, String[] params) throws Exception;
protected Habbo getHabbo(String username) { protected Habbo getHabbo(String username) {
return Emulator.getGameEnvironment().getHabboManager().getHabbo(username); return Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
} }

View File

@ -1,337 +0,0 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.CommandLog;
import com.eu.habbo.habbohotel.commands.badge.BadgeCommand;
import com.eu.habbo.habbohotel.commands.badge.MassBadgeCommand;
import com.eu.habbo.habbohotel.commands.badge.RoomBadgeCommand;
import com.eu.habbo.habbohotel.commands.badge.TakeBadgeCommand;
import com.eu.habbo.habbohotel.commands.bans.BanCommand;
import com.eu.habbo.habbohotel.commands.bans.IPBanCommand;
import com.eu.habbo.habbohotel.commands.bans.MachineBanCommand;
import com.eu.habbo.habbohotel.commands.bans.SuperbanCommand;
import com.eu.habbo.habbohotel.commands.credits.CreditsCommand;
import com.eu.habbo.habbohotel.commands.credits.MassCreditsCommand;
import com.eu.habbo.habbohotel.commands.credits.RoomCreditsCommand;
import com.eu.habbo.habbohotel.commands.gift.GiftCommand;
import com.eu.habbo.habbohotel.commands.gift.MassGiftCommand;
import com.eu.habbo.habbohotel.commands.pixels.MassPixelsCommand;
import com.eu.habbo.habbohotel.commands.pixels.PixelCommand;
import com.eu.habbo.habbohotel.commands.pixels.RoomPixelsCommand;
import com.eu.habbo.habbohotel.commands.points.MassPointsCommand;
import com.eu.habbo.habbohotel.commands.points.PointsCommand;
import com.eu.habbo.habbohotel.commands.points.RoomPointsCommand;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.permissions.PermissionSetting;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetCommand;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.pets.RideablePet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
import com.eu.habbo.messages.outgoing.rooms.users.UserTypingMessageComposer;
import com.eu.habbo.plugin.events.users.UserCommandEvent;
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.NoSuchElementException;
@Slf4j
public class CommandHandler {
private static final THashMap<String, Command> commands = new THashMap<>(5);
private static final Comparator<Command> ALPHABETICAL_ORDER = (c1, c2) -> {
int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
return (res != 0) ? res : c1.permission.compareTo(c2.permission);
};
public CommandHandler() {
long millis = System.currentTimeMillis();
this.reloadCommands();
log.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public static void addCommand(Command command) {
if (command == null)
return;
commands.put(command.getClass().getName(), command);
}
public static void addCommand(Class<? extends Command> command) {
try {
//command.getConstructor().setAccessible(true);
addCommand(command.getDeclaredConstructor().newInstance());
log.debug("Added command: {}", command.getName());
} catch (Exception e) {
log.error("Caught exception", e);
}
}
public static boolean handleCommand(GameClient gameClient, String commandLine) {
if (gameClient != null) {
if (commandLine.startsWith(":")) {
commandLine = commandLine.replaceFirst(":", "");
String[] parts = commandLine.split(" ");
if (parts.length >= 1) {
for (Command command : commands.values()) {
for (String s : command.keys) {
if (s.equalsIgnoreCase(parts[0])) {
boolean succes = false;
if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))) {
try {
UserExecuteCommandEvent userExecuteCommandEvent = new UserExecuteCommandEvent(gameClient.getHabbo(), command, parts);
Emulator.getPluginManager().fireEvent(userExecuteCommandEvent);
if(userExecuteCommandEvent.isCancelled()) {
return userExecuteCommandEvent.isSuccess();
}
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null)
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserTypingMessageComposer(gameClient.getHabbo().getRoomUnit(), false).compose());
UserCommandEvent event = new UserCommandEvent(gameClient.getHabbo(), parts, command.handle(gameClient, parts));
Emulator.getPluginManager().fireEvent(event);
succes = event.succes;
} catch (Exception e) {
log.error("Caught exception", e);
}
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
Emulator.getDatabaseLogger().store(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, succes));
}
}
return succes;
}
}
}
}
} else {
String[] args = commandLine.split(" ");
if (args.length <= 1)
return false;
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
if (room.getCurrentPets().isEmpty())
return false;
TIntObjectIterator<Pet> petIterator = room.getCurrentPets().iterator();
for (int j = room.getCurrentPets().size(); j-- > 0; ) {
try {
petIterator.advance();
} catch (NoSuchElementException e) {
break;
}
Pet pet = petIterator.value();
if (pet != null && pet.getName().equalsIgnoreCase(args[0])) {
StringBuilder s = new StringBuilder();
for (int i = 1; i < args.length; i++) {
s.append(args[i]).append(" ");
}
s = new StringBuilder(s.substring(0, s.length() - 1));
for (PetCommand command : pet.getPetData().getPetCommands()) {
if (command.getKey().equalsIgnoreCase(s.toString())) {
if (pet instanceof RideablePet rideablePet && ((RideablePet) pet).getRider() != null) {
if (rideablePet.getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
rideablePet.getRider().getHabboInfo().dismountPet();
}
break;
}
if (command.getLevel() <= pet.getLevel())
pet.handleCommand(command, gameClient.getHabbo(), args);
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.UNKNOWN_COMMAND));
break;
}
}
}
}
}
}
}
return false;
}
public static Command getCommand(String key) {
for (Command command : commands.values()) {
for (String k : command.keys) {
if (key.equalsIgnoreCase(k)) {
return command;
}
}
}
return null;
}
public void reloadCommands() {
addCommand(new AboutCommand());
addCommand(new AlertCommand());
addCommand(new AllowTradingCommand());
addCommand(new ArcturusCommand());
addCommand(new BadgeCommand());
addCommand(new BanCommand());
addCommand(new BlockAlertCommand());
addCommand(new BotsCommand());
addCommand(new CalendarCommand());
addCommand(new ChangeNameCommand());
addCommand(new ChatTypeCommand());
addCommand(new CommandsCommand());
addCommand(new ConnectCameraCommand());
addCommand(new ControlCommand());
addCommand(new CoordsCommand());
addCommand(new CreditsCommand());
addCommand(new DiagonalCommand());
addCommand(new DisconnectCommand());
addCommand(new EjectAllCommand());
addCommand(new EmptyInventoryCommand());
addCommand(new EmptyBotsInventoryCommand());
addCommand(new EmptyPetsInventoryCommand());
addCommand(new EnableCommand());
addCommand(new EventCommand());
addCommand(new FacelessCommand());
addCommand(new FastwalkCommand());
addCommand(new FilterWordCommand());
addCommand(new FreezeBotsCommand());
addCommand(new FreezeCommand());
addCommand(new GiftCommand());
addCommand(new GiveRankCommand());
addCommand(new HabnamCommand());
addCommand(new HandItemCommand());
addCommand(new HappyHourCommand());
addCommand(new HideWiredCommand());
addCommand(new HotelAlertCommand());
addCommand(new HotelAlertLinkCommand());
addCommand(new InvisibleCommand());
addCommand(new IPBanCommand());
addCommand(new LayCommand());
addCommand(new MachineBanCommand());
addCommand(new MassBadgeCommand());
addCommand(new RoomBadgeCommand());
addCommand(new MassCreditsCommand());
addCommand(new MassGiftCommand());
addCommand(new MassPixelsCommand());
addCommand(new MassPointsCommand());
addCommand(new MimicCommand());
addCommand(new MoonwalkCommand());
addCommand(new MultiCommand());
addCommand(new MuteBotsCommand());
addCommand(new MuteCommand());
addCommand(new MutePetsCommand());
addCommand(new PetInfoCommand());
addCommand(new PickallCommand());
addCommand(new PixelCommand());
addCommand(new PluginsCommand());
addCommand(new PointsCommand());
addCommand(new PromoteTargetOfferCommand());
addCommand(new PullCommand());
addCommand(new PushCommand());
addCommand(new RedeemCommand());
addCommand(new ReloadRoomCommand());
addCommand(new RoomAlertCommand());
addCommand(new RoomBundleCommand());
addCommand(new RoomCreditsCommand());
addCommand(new RoomDanceCommand());
addCommand(new RoomEffectCommand());
addCommand(new RoomItemCommand());
addCommand(new RoomKickCommand());
addCommand(new RoomMuteCommand());
addCommand(new RoomPixelsCommand());
addCommand(new RoomPointsCommand());
addCommand(new SayAllCommand());
addCommand(new SayCommand());
addCommand(new SetMaxCommand());
addCommand(new SetPollCommand());
addCommand(new SetSpeedCommand());
addCommand(new ShoutAllCommand());
addCommand(new ShoutCommand());
addCommand(new ShutdownCommand());
addCommand(new SitCommand());
addCommand(new StandCommand());
addCommand(new SitDownCommand());
addCommand(new StaffAlertCommand());
addCommand(new StaffOnlineCommand());
addCommand(new StalkCommand());
addCommand(new SummonCommand());
addCommand(new SummonRankCommand());
addCommand(new SuperbanCommand());
addCommand(new SuperPullCommand());
addCommand(new TakeBadgeCommand());
addCommand(new TeleportCommand());
addCommand(new TransformCommand());
addCommand(new TrashCommand());
addCommand(new UnbanCommand());
addCommand(new UnloadRoomCommand());
addCommand(new UnmuteCommand());
addCommand(new UpdateAchievements());
addCommand(new UpdateBotsCommand());
addCommand(new UpdateCalendarCommand());
addCommand(new UpdateCatalogCommand());
addCommand(new UpdateConfigCommand());
addCommand(new UpdateGuildPartsCommand());
addCommand(new UpdateHotelViewCommand());
addCommand(new UpdateItemsCommand());
addCommand(new UpdateNavigatorCommand());
addCommand(new UpdatePermissionsCommand());
addCommand(new UpdatePetDataCommand());
addCommand(new UpdatePluginsCommand());
addCommand(new UpdatePollsCommand());
addCommand(new UpdateTextsCommand());
addCommand(new UpdateWordFilterCommand());
addCommand(new UserInfoCommand());
addCommand(new WordQuizCommand());
addCommand(new UpdateYoutubePlaylistsCommand());
addCommand(new AddYoutubePlaylistCommand());
addCommand(new SoftKickCommand());
addCommand(new SubscriptionCommand());
addCommand(new TestCommand());
}
public List<Command> getCommandsForRank(int rankId) {
List<Command> allowedCommands = new ArrayList<>();
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId)) {
THashMap<String, Permission> permissions = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId).getPermissions();
for (Command command : commands.values()) {
if (allowedCommands.contains(command))
continue;
if (permissions.contains(command.permission) && permissions.get(command.permission).getSetting() != PermissionSetting.DISALLOWED) {
allowedCommands.add(command);
}
}
}
allowedCommands.sort(CommandHandler.ALPHABETICAL_ORDER);
return allowedCommands;
}
public void dispose() {
commands.clear();
log.info("Command Handler -> Disposed!");
}
}

View File

@ -1,27 +0,0 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import java.util.List;
public class CommandsCommand extends Command {
public CommandsCommand() {
super("cmd_commands", Emulator.getTexts().getValue("commands.keys.cmd_commands").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) {
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_commands.text"));
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
message.append("(").append(commands.size()).append("):\r\n");
for (Command c : commands) {
message.append(getTextsValue("commands.description." + c.permission, "commands.description." + c.permission)).append("\r");
}
gameClient.getHabbo().alert(new String[]{message.toString()});
return true;
}
}

View File

@ -0,0 +1,297 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.CommandLog;
import com.eu.habbo.habbohotel.commands.list.*;
import com.eu.habbo.habbohotel.commands.list.badge.*;
import com.eu.habbo.habbohotel.commands.list.bans.*;
import com.eu.habbo.habbohotel.commands.list.credits.*;
import com.eu.habbo.habbohotel.commands.list.gift.*;
import com.eu.habbo.habbohotel.commands.list.pixels.*;
import com.eu.habbo.habbohotel.commands.list.points.*;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.permissions.PermissionCommand;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetCommand;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.pets.RideablePet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
import com.eu.habbo.messages.outgoing.rooms.users.UserTypingMessageComposer;
import com.eu.habbo.plugin.events.users.UserCommandEvent;
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class CommandsManager {
@Getter
private static final Map<String, Command> commands = new HashMap<>();
public CommandsManager() {
long millis = System.currentTimeMillis();
this.reloadCommands();
log.info("Command Handler -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public static void addCommand(Command command) {
if(command != null) {
commands.put(command.getName(), command);
}
}
public static void addCommand(Class<? extends Command> commandClass) {
try {
addCommand(commandClass.getDeclaredConstructor().newInstance());
log.debug("Added command: {}", commandClass.getName());
} catch (Exception e) {
log.error("Caught exception", e);
}
}
public boolean handleCommand(GameClient gameClient, String commandLine) {
if (gameClient == null) {
return false;
}
if (commandLine.startsWith(":")) {
return this.handleChatCommand(gameClient, commandLine.substring(1));
} else {
return this.handlePetCommand(gameClient, commandLine);
}
}
private boolean handleChatCommand(GameClient gameClient, String commandLine) {
String[] parts = commandLine.split(" ");
if(parts.length < 1) {
return false;
}
String commandKey = parts[0];
Room currentRoom = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
boolean hasRights = currentRoom != null &&
(currentRoom.hasRights(gameClient.getHabbo())) ||
gameClient.getHabbo().hasRight(Permission.ACC_PLACEFURNI) ||
currentRoom.getGuildId() > 0 && currentRoom.getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS);
if (!gameClient.getHabbo().canExecuteCommand(commandKey, hasRights)) {
return false;
}
PermissionCommand permissionCommand = Emulator.getGameEnvironment().getPermissionsManager().getCommandByKey(commandKey);
if (permissionCommand == null || !commands.containsKey(permissionCommand.getName())) {
return false;
}
Command command = commands.get(permissionCommand.getName());
if(command == null) {
return false;
}
try {
UserExecuteCommandEvent userExecuteCommandEvent = new UserExecuteCommandEvent(gameClient.getHabbo(), command, parts);
Emulator.getPluginManager().fireEvent(userExecuteCommandEvent);
if(userExecuteCommandEvent.isCancelled()) {
return userExecuteCommandEvent.isSuccess();
}
if (currentRoom != null) {
currentRoom.sendComposer(new UserTypingMessageComposer(gameClient.getHabbo().getRoomUnit(), false).compose());
}
UserCommandEvent event = new UserCommandEvent(gameClient.getHabbo(), parts, command.handle(gameClient, parts));
Emulator.getPluginManager().fireEvent(event);
if(gameClient.getHabbo().getHabboInfo().getPermissionGroup().isLogEnabled()) {
Emulator.getDatabaseLogger().store(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, event.succes));
}
return event.succes;
}
catch (Exception exception) {
log.error("Caught exception", exception);
}
return false;
}
private boolean handlePetCommand(GameClient gameClient, String commandLine) {
String[] args = commandLine.split(" ");
if (args.length <= 1 || gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null) {
return false;
}
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
if (room.getCurrentPets().isEmpty()) {
return false;
}
for(Pet pet : room.getCurrentPets().valueCollection()) {
if (pet != null && pet.getName().equalsIgnoreCase(args[0])) {
StringBuilder commandBuilder = new StringBuilder();
for (int i = 1; i < args.length; i++) {
commandBuilder.append(args[i]).append(" ");
}
String commandKey = commandBuilder.toString().trim();
for (PetCommand command : pet.getPetData().getPetCommands()) {
if (command.getKey().equalsIgnoreCase(commandKey)) {
if (pet instanceof RideablePet rideablePet && rideablePet.getRider() != null && rideablePet.getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
rideablePet.getRider().getHabboInfo().dismountPet();
break;
}
if (command.getLevel() <= pet.getLevel()) {
pet.handleCommand(command, gameClient.getHabbo(), args);
} else {
pet.say(pet.getPetData().randomVocal(PetVocalsType.UNKNOWN_COMMAND));
}
return true;
}
}
}
}
return false;
}
public void reloadCommands() {
addCommand(new AboutCommand());
addCommand(new AddYoutubePlaylistCommand());
addCommand(new AlertCommand());
addCommand(new AllowTradingCommand());
addCommand(new ArcturusCommand());
addCommand(new BadgeCommand());
addCommand(new BanCommand());
addCommand(new BlockAlertCommand());
addCommand(new BotsCommand());
addCommand(new CalendarCommand());
addCommand(new ChangeNameCommand());
addCommand(new ChatTypeCommand());
addCommand(new CommandsCommand());
addCommand(new ControlCommand());
addCommand(new CoordsCommand());
addCommand(new CreditsCommand());
addCommand(new DiagonalCommand());
addCommand(new DisconnectCommand());
addCommand(new EjectAllCommand());
addCommand(new EmptyInventoryCommand());
addCommand(new EmptyBotsInventoryCommand());
addCommand(new EmptyPetsInventoryCommand());
addCommand(new EnableCommand());
addCommand(new EventCommand());
addCommand(new FacelessCommand());
addCommand(new FastwalkCommand());
addCommand(new FilterWordCommand());
addCommand(new FreezeBotsCommand());
addCommand(new FreezeCommand());
addCommand(new GiftCommand());
addCommand(new GiveRankCommand());
addCommand(new HabnamCommand());
addCommand(new HandItemCommand());
addCommand(new HappyHourCommand());
addCommand(new HideWiredCommand());
addCommand(new HotelAlertCommand());
addCommand(new HotelAlertLinkCommand());
addCommand(new InvisibleCommand());
addCommand(new IPBanCommand());
addCommand(new LayCommand());
addCommand(new MachineBanCommand());
addCommand(new MassBadgeCommand());
addCommand(new RoomBadgeCommand());
addCommand(new MassCreditsCommand());
addCommand(new MassGiftCommand());
addCommand(new MassPixelsCommand());
addCommand(new MassPointsCommand());
addCommand(new MimicCommand());
addCommand(new MoonwalkCommand());
addCommand(new MultiCommand());
addCommand(new MuteBotsCommand());
addCommand(new MuteCommand());
addCommand(new MutePetsCommand());
addCommand(new PetInfoCommand());
addCommand(new PickallCommand());
addCommand(new PixelCommand());
addCommand(new PluginsCommand());
addCommand(new PointsCommand());
addCommand(new PromoteTargetOfferCommand());
addCommand(new PullCommand());
addCommand(new PushCommand());
addCommand(new RedeemCommand());
addCommand(new ReloadRoomCommand());
addCommand(new RoomAlertCommand());
addCommand(new RoomBundleCommand());
addCommand(new RoomCreditsCommand());
addCommand(new RoomDanceCommand());
addCommand(new RoomEffectCommand());
addCommand(new RoomItemCommand());
addCommand(new RoomKickCommand());
addCommand(new RoomMuteCommand());
addCommand(new RoomPixelsCommand());
addCommand(new RoomPointsCommand());
addCommand(new RoomSitCommand());
addCommand(new SayAllCommand());
addCommand(new SayCommand());
addCommand(new SetMaxCommand());
addCommand(new SetPollCommand());
addCommand(new SetSpeedCommand());
addCommand(new ShoutAllCommand());
addCommand(new ShoutCommand());
addCommand(new ShutdownCommand());
addCommand(new SitCommand());
addCommand(new StandCommand());
addCommand(new SoftKickCommand());
addCommand(new SubscriptionCommand());
addCommand(new StaffAlertCommand());
addCommand(new StaffOnlineCommand());
addCommand(new StalkCommand());
addCommand(new SummonCommand());
addCommand(new SummonRankCommand());
addCommand(new SuperbanCommand());
addCommand(new SuperPullCommand());
addCommand(new TakeBadgeCommand());
addCommand(new TeleportCommand());
addCommand(new TestCommand());
addCommand(new TransformCommand());
addCommand(new UnbanCommand());
addCommand(new UnloadRoomCommand());
addCommand(new UnmuteCommand());
addCommand(new UpdateAchievements());
addCommand(new UpdateBotsCommand());
addCommand(new UpdateCalendarCommand());
addCommand(new UpdateCatalogCommand());
addCommand(new UpdateConfigCommand());
addCommand(new UpdateGuildPartsCommand());
addCommand(new UpdateHotelViewCommand());
addCommand(new UpdateItemsCommand());
addCommand(new UpdateNavigatorCommand());
addCommand(new UpdatePermissionsCommand());
addCommand(new UpdatePetDataCommand());
addCommand(new UpdatePluginsCommand());
addCommand(new UpdatePollsCommand());
addCommand(new UpdateTextsCommand());
addCommand(new UpdateWordFilterCommand());
addCommand(new UpdateYoutubePlaylistsCommand());
addCommand(new UserInfoCommand());
addCommand(new WordQuizCommand());
}
public void dispose() {
commands.clear();
log.info("Command Handler -> Disposed!");
}
}

View File

@ -1,15 +0,0 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
public class ConnectCameraCommand extends Command {
public ConnectCameraCommand() {
super("cmd_connect_camera", Emulator.getTexts().getValue("commands.keys.cmd_connect_camera").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) {
return false;
}
}

View File

@ -1,16 +0,0 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
public class TrashCommand extends Command {
public TrashCommand() {
super("cmd_trash", Emulator.getTexts().getValue("commands.keys.cmd_trash").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) {
gameClient.getHabbo().whisper("Sorry. Lulz mode removed |");
return false;
}
}

View File

@ -1,23 +0,0 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room;
public class UnloadRoomCommand extends Command {
public UnloadRoomCommand() {
super("cmd_unload", Emulator.getTexts().getValue("commands.keys.cmd_unload").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) {
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() == gameClient.getHabbo().getHabboInfo().getId() || gameClient.getHabbo().getHabboInfo().getRank().getId() > 4) {
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
room.dispose();
return true;
}
return false;
}
}

View File

@ -0,0 +1,8 @@
package com.eu.habbo.habbohotel.commands.interfaces;
import com.eu.habbo.habbohotel.gameclients.GameClient;
public interface ICommand {
String getName();
boolean handle(GameClient gameClient, String[] params) throws Exception;
}

View File

@ -1,18 +1,15 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer; import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer;
import java.util.Collections; import java.util.Collections;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class AboutCommand extends Command { public class AboutCommand extends Command {
public AboutCommand() {
super(null, new String[]{"about", "info", "online", "server"});
}
public static final String CREDITS = """ public static final String CREDITS = """
Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral\s Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral\s
The Following people have all contributed to this emulator: The Following people have all contributed to this emulator:
@ -47,6 +44,11 @@ public class AboutCommand extends Command {
SenpaiDipper SenpaiDipper
Snaiker Snaiker
Thijmen"""; Thijmen""";
public AboutCommand() {
super("cmd_about");
}
@Override @Override
public boolean handle(GameClient gameClient, String[] params) { public boolean handle(GameClient gameClient, String[] params) {

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.YoutubeManager; import com.eu.habbo.habbohotel.items.YoutubeManager;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -11,9 +12,8 @@ import java.sql.SQLException;
@Slf4j @Slf4j
public class AddYoutubePlaylistCommand extends Command { public class AddYoutubePlaylistCommand extends Command {
public AddYoutubePlaylistCommand() { public AddYoutubePlaylistCommand() {
super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";")); super("cmd_add_youtube_playlist");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
@ -9,9 +9,8 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class AlertCommand extends Command { public class AlertCommand extends Command {
public AlertCommand() { public AlertCommand() {
super("cmd_alert", Emulator.getTexts().getValue("commands.keys.cmd_alert").split(";")); super("cmd_alert");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.users.UserPerksComposer; import com.eu.habbo.messages.outgoing.users.UserPerksComposer;
@ -10,7 +11,7 @@ import java.sql.PreparedStatement;
public class AllowTradingCommand extends Command { public class AllowTradingCommand extends Command {
public AllowTradingCommand() { public AllowTradingCommand() {
super("cmd_allow_trading", Emulator.getTexts().getValue("commands.keys.cmd_allow_trading").split(";")); super("cmd_allow_trading");
} }
@Override @Override

View File

@ -1,11 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class ArcturusCommand extends Command { public class ArcturusCommand extends Command {
public ArcturusCommand() { public ArcturusCommand() {
super(null, new String[]{"arcturus", "emulator"}); super("cmd_arcturus");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class BlockAlertCommand extends Command { public class BlockAlertCommand extends Command {
public BlockAlertCommand() { public BlockAlertCommand() {
super("cmd_blockalert", Emulator.getTexts().getValue("commands.keys.cmd_blockalert").split(";")); super("cmd_blockalert");
} }
@Override @Override

View File

@ -1,12 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
public class BotsCommand extends Command { public class BotsCommand extends Command {
public BotsCommand() { public BotsCommand() {
super("cmd_bots", Emulator.getTexts().getValue("commands.keys.cmd_bots").split(";")); super("cmd_bots");
} }
@Override @Override

View File

@ -1,7 +1,8 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.campaign.CalendarCampaign; import com.eu.habbo.habbohotel.campaign.CalendarCampaign;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDataMessageComposer; import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDataMessageComposer;
import com.eu.habbo.messages.outgoing.habboway.nux.InClientLinkMessageComposer; import com.eu.habbo.messages.outgoing.habboway.nux.InClientLinkMessageComposer;
@ -13,7 +14,7 @@ import static java.time.temporal.ChronoUnit.DAYS;
public class CalendarCommand extends Command { public class CalendarCommand extends Command {
public CalendarCommand() { public CalendarCommand() {
super("cmd_calendar", Emulator.getTexts().getValue("commands.keys.cmd_calendar").split(";")); super("cmd_calendar");
} }
@Override @Override
@ -21,7 +22,7 @@ public class CalendarCommand extends Command {
if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) { if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) {
String campaignName = Emulator.getConfig().getValue("hotel.calendar.default"); String campaignName = Emulator.getConfig().getValue("hotel.calendar.default");
if (params.length > 1 && gameClient.getHabbo().hasPermission("cmd_calendar_staff")) { if (params.length > 1 && gameClient.getHabbo().hasCommand("cmd_calendar_staff")) {
campaignName = params[1]; campaignName = params[1];
} }

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.users.UserObjectComposer; import com.eu.habbo.messages.outgoing.users.UserObjectComposer;
public class ChangeNameCommand extends Command { public class ChangeNameCommand extends Command {
public ChangeNameCommand() { public ChangeNameCommand() {
super("cmd_changename", Emulator.getTexts().getValue("commands.keys.cmd_changename").split(";")); super("cmd_change_name");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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;
@ -8,7 +9,7 @@ import com.eu.habbo.messages.outgoing.users.AccountPreferencesComposer;
public class ChatTypeCommand extends Command { public class ChatTypeCommand extends Command {
public ChatTypeCommand() { public ChatTypeCommand() {
super("cmd_chatcolor", Emulator.getTexts().getValue("commands.keys.cmd_chatcolor").split(";")); super("cmd_chat_color");
} }
@Override @Override
@ -32,7 +33,7 @@ public class ChatTypeCommand extends Command {
return true; return true;
} }
if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) { if (!gameClient.getHabbo().hasRight(Permission.ACC_ANYCHATCOLOR)) {
for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) { for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) {
if (Integer.parseInt(s) == chatColor) { if (Integer.parseInt(s) == chatColor) {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT);

View File

@ -0,0 +1,33 @@
package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.PermissionCommand;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class CommandsCommand extends Command {
public CommandsCommand() {
super("cmd_commands");
}
@Override
public boolean handle(GameClient gameClient, String[] params) {
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_commands.text"));
List<PermissionCommand> commands = gameClient.getHabbo().getHabboInfo().getPermissionGroup().getCommands();
Collections.sort(commands, Comparator.comparing(PermissionCommand::getName));
message.append("(").append(commands.size()).append("):\r\n");
for(PermissionCommand command : commands) {
message.append(command.getDescription()).append("\r");
}
gameClient.getHabbo().alert(new String[]{message.toString()});
return true;
}
}

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
public class ControlCommand extends Command { public class ControlCommand extends Command {
public ControlCommand() { public ControlCommand() {
super("cmd_control", Emulator.getTexts().getValue("commands.keys.cmd_control").split(";")); super("cmd_control");
} }
@Override @Override

View File

@ -1,14 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
public class CoordsCommand extends Command { public class CoordsCommand extends Command {
public CoordsCommand() { public CoordsCommand() {
super("cmd_coords", Emulator.getTexts().getValue("commands.keys.cmd_coords").split(";")); super("cmd_coords");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class DiagonalCommand extends Command { public class DiagonalCommand extends Command {
public DiagonalCommand() { public DiagonalCommand() {
super("cmd_diagonal", Emulator.getTexts().getValue("commands.keys.cmd_diagonal").split(";")); super("cmd_diagonal");
} }
@Override @Override

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
public class DisconnectCommand extends Command { public class DisconnectCommand extends Command {
public DisconnectCommand() { public DisconnectCommand() {
super("cmd_disconnect", Emulator.getTexts().getValue("commands.keys.cmd_disconnect").split(";")); super("cmd_disconnect");
} }
@Override @Override
@ -29,7 +29,7 @@ public class DisconnectCommand extends Command {
return true; return true;
} }
if (target.getHabboInfo().getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) { if (target.getHabboInfo().getPermissionGroup().getLevel() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getLevel()) {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_disconnect.higher_rank"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_disconnect.higher_rank"), RoomChatMessageBubbles.ALERT);
return true; return true;
} }

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomRightLevels; import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
public class EjectAllCommand extends Command { public class EjectAllCommand extends Command {
public EjectAllCommand() { public EjectAllCommand() {
super("cmd_ejectall", Emulator.getTexts().getValue("commands.keys.cmd_ejectall").split(";")); super("cmd_ejectall");
} }
@Override @Override

View File

@ -1,7 +1,8 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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;
@ -12,7 +13,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
public class EmptyBotsInventoryCommand extends Command { public class EmptyBotsInventoryCommand extends Command {
public EmptyBotsInventoryCommand() { public EmptyBotsInventoryCommand() {
super("cmd_empty_bots", Emulator.getTexts().getValue("commands.keys.cmd_empty_bots").split(";")); super("cmd_empty_bots");
} }
@Override @Override
@ -31,7 +32,7 @@ public class EmptyBotsInventoryCommand extends Command {
if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) { if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) {
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo(); Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasRight(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
if (habbo != null) { if (habbo != null) {
TIntObjectHashMap<Bot> bots = new TIntObjectHashMap<>(); TIntObjectHashMap<Bot> bots = new TIntObjectHashMap<>();

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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;
@ -14,7 +15,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
public class EmptyInventoryCommand extends Command { public class EmptyInventoryCommand extends Command {
public EmptyInventoryCommand() { public EmptyInventoryCommand() {
super("cmd_empty", Emulator.getTexts().getValue("commands.keys.cmd_empty").split(";")); super("cmd_empty");
} }
@Override @Override
@ -33,7 +34,7 @@ public class EmptyInventoryCommand extends Command {
if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) { if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) {
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo(); Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasRight(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
if (habbo != null) { if (habbo != null) {
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>(); TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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.pets.Pet; import com.eu.habbo.habbohotel.pets.Pet;
@ -12,7 +13,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
public class EmptyPetsInventoryCommand extends Command { public class EmptyPetsInventoryCommand extends Command {
public EmptyPetsInventoryCommand() { public EmptyPetsInventoryCommand() {
super("cmd_empty_pets", Emulator.getTexts().getValue("commands.keys.cmd_empty_pets").split(";")); super("cmd_empty_pets");
} }
@Override @Override
@ -31,7 +32,7 @@ public class EmptyPetsInventoryCommand extends Command {
if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) { if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) {
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo(); Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasRight(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
if (habbo != null) { if (habbo != null) {
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>(habbo.getInventory().getPetsComponent().getPets()); TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>(habbo.getInventory().getPetsComponent().getPets());

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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;
@ -10,7 +11,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class EnableCommand extends Command { public class EnableCommand extends Command {
public EnableCommand() { public EnableCommand() {
super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";")); super("cmd_enable");
} }
@Override @Override
@ -30,10 +31,10 @@ public class EnableCommand extends Command {
if (target == null) { if (target == null) {
return true; return true;
} }
if (target == gameClient.getHabbo() || gameClient.getHabbo().hasPermission(Permission.ACC_ENABLE_OTHERS)) { if (target == gameClient.getHabbo() || gameClient.getHabbo().hasRight(Permission.ACC_ENABLE_OTHERS)) {
try { try {
if (target.getHabboInfo().getCurrentRoom() != null && target.getHabboInfo().getRiding() == null) { if (target.getHabboInfo().getCurrentRoom() != null && target.getHabboInfo().getRiding() == null) {
if (Emulator.getGameEnvironment().getPermissionsManager().isEffectBlocked(effectId, target.getHabboInfo().getRank().getId())) { if (Emulator.getGameEnvironment().getPermissionsManager().isEffectBlocked(effectId, target.getHabboInfo().getPermissionGroup().getId())) {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_enable.not_allowed"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_enable.not_allowed"), RoomChatMessageBubbles.ALERT);
return true; return true;
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
@ -12,7 +13,7 @@ import java.util.stream.IntStream;
public class EventCommand extends Command { public class EventCommand extends Command {
public EventCommand() { public EventCommand() {
super("cmd_event", Emulator.getTexts().getValue("commands.keys.cmd_event").split(";")); super("cmd_event");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer; import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer;
import com.eu.habbo.messages.outgoing.users.FigureUpdateComposer; import com.eu.habbo.messages.outgoing.users.FigureUpdateComposer;
@ -8,7 +8,7 @@ import com.eu.habbo.messages.outgoing.users.FigureUpdateComposer;
public class FacelessCommand extends Command { public class FacelessCommand extends Command {
public FacelessCommand() { public FacelessCommand() {
super("cmd_faceless", Emulator.getTexts().getValue("commands.keys.cmd_faceless").split(";")); super("cmd_faceless");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
public class FastwalkCommand extends Command { public class FastwalkCommand extends Command {
public FastwalkCommand() { public FastwalkCommand() {
super("cmd_fastwalk", Emulator.getTexts().getValue("commands.keys.cmd_fastwalk").split(";")); super("cmd_fastwalk");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.modtool.WordFilter; import com.eu.habbo.habbohotel.modtool.WordFilter;
import com.eu.habbo.habbohotel.modtool.WordFilterWord; import com.eu.habbo.habbohotel.modtool.WordFilterWord;
@ -12,9 +13,8 @@ import java.sql.SQLException;
@Slf4j @Slf4j
public class FilterWordCommand extends Command { public class FilterWordCommand extends Command {
public FilterWordCommand() { public FilterWordCommand() {
super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";")); super("cmd_filterword");
} }
@Override @Override

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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;
public class FreezeBotsCommand extends Command { public class FreezeBotsCommand extends Command {
public FreezeBotsCommand() { public FreezeBotsCommand() {
super("cmd_freeze_bots", Emulator.getTexts().getValue("commands.keys.cmd_freeze_bots").split(";")); super("cmd_freeze_bots");
} }
@Override @Override
@ -17,7 +17,7 @@ public class FreezeBotsCommand extends Command {
} }
if (gameClient.getHabbo().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() if (gameClient.getHabbo().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId()
|| gameClient.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { || gameClient.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setAllowBotsWalk(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk()); gameClient.getHabbo().getHabboInfo().getCurrentRoom().setAllowBotsWalk(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk());
gameClient.getHabbo().whisper(gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk() ? getTextsValue("commands.succes.cmd_freeze_bots.unfrozen") : getTextsValue("commands.succes.cmd_freeze_bots.frozen"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk() ? getTextsValue("commands.succes.cmd_freeze_bots.unfrozen") : getTextsValue("commands.succes.cmd_freeze_bots.frozen"), RoomChatMessageBubbles.ALERT);
} else { } else {

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
public class FreezeCommand extends Command { public class FreezeCommand extends Command {
public FreezeCommand() { public FreezeCommand() {
super("cmd_freeze", Emulator.getTexts().getValue("commands.keys.cmd_freeze").split(";")); super("cmd_freeze");
} }
@Override @Override

View File

@ -1,8 +1,9 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Rank; import com.eu.habbo.habbohotel.permissions.PermissionGroup;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.HabboManager;
@ -10,12 +11,12 @@ import org.apache.commons.lang3.StringUtils;
public class GiveRankCommand extends Command { public class GiveRankCommand extends Command {
public GiveRankCommand() { public GiveRankCommand() {
super("cmd_give_rank", Emulator.getTexts().getValue("commands.keys.cmd_give_rank").split(";")); super("cmd_give_rank");
} }
@Override @Override
public boolean handle(GameClient gameClient, String[] params) throws Exception { public boolean handle(GameClient gameClient, String[] params) throws Exception {
Rank rank = null; PermissionGroup group = null;
switch (params.length) { switch (params.length) {
case 1 -> { case 1 -> {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_give_rank.missing_username") + getTextsValue("commands.description.cmd_give_rank"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_give_rank.missing_username") + getTextsValue("commands.description.cmd_give_rank"), RoomChatMessageBubbles.ALERT);
@ -27,31 +28,31 @@ public class GiveRankCommand extends Command {
} }
case 3 -> { case 3 -> {
if (StringUtils.isNumeric(params[2])) { if (StringUtils.isNumeric(params[2])) {
int rankId = Integer.parseInt(params[2]); int groupId = Integer.parseInt(params[2]);
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId)) if (Emulator.getGameEnvironment().getPermissionsManager().groupExists(groupId))
rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId); group = Emulator.getGameEnvironment().getPermissionsManager().getGroup(groupId);
} else { } else {
rank = Emulator.getGameEnvironment().getPermissionsManager().getRankByName(params[2]); group = Emulator.getGameEnvironment().getPermissionsManager().getGroupByName(params[2]);
} }
if (rank != null) { if (group != null) {
if (rank.getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) { if (group.getId() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) {
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher"), params[1]).replace("%id%", group.getName()), RoomChatMessageBubbles.ALERT);
return true; return true;
} }
HabboInfo habbo = HabboManager.getOfflineHabboInfo(params[1]); HabboInfo habbo = HabboManager.getOfflineHabboInfo(params[1]);
if (habbo != null) { if (habbo != null) {
if (habbo.getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) { if (habbo.getPermissionGroup().getId() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) {
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher.other"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher.other"), params[1]).replace("%id%", group.getName()), RoomChatMessageBubbles.ALERT);
return true; return true;
} }
Emulator.getGameEnvironment().getHabboManager().setRank(habbo.getId(), rank.getId()); Emulator.getGameEnvironment().getHabboManager().setRank(habbo.getId(), group.getId());
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_give_rank.updated"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_give_rank.updated"), params[1]).replace("%id%", group.getName()), RoomChatMessageBubbles.ALERT);
} else { } else {
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.user_offline"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.user_offline"), params[1]).replace("%id%", group.getName()), RoomChatMessageBubbles.ALERT);
} }
return true; return true;
} }

View File

@ -1,10 +1,11 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
public class HabnamCommand extends Command { public class HabnamCommand extends Command {
public HabnamCommand() { public HabnamCommand() {
super(null, new String[]{"habnam", "gangnam"}); super("cmd_habnam");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.rooms.users.CarryObjectMessageComposer; import com.eu.habbo.messages.outgoing.rooms.users.CarryObjectMessageComposer;
public class HandItemCommand extends Command { public class HandItemCommand extends Command {
public HandItemCommand() { public HandItemCommand() {
super("cmd_hand_item", Emulator.getTexts().getValue("commands.keys.cmd_hand_item").split(";")); super("cmd_hand_item");
} }
@Override @Override

View File

@ -1,16 +1,14 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
import java.util.Map;
public class HappyHourCommand extends Command { public class HappyHourCommand extends Command {
public HappyHourCommand() { public HappyHourCommand() {
super("cmd_happyhour", Emulator.getTexts().getValue("commands.keys.cmd_happyhour").split(";")); super("cmd_happyhour");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
public class HideWiredCommand extends Command { public class HideWiredCommand extends Command {
public HideWiredCommand() { public HideWiredCommand() {
super("cmd_hidewired", Emulator.getTexts().getValue("commands.keys.cmd_hidewired").split(";")); super("cmd_hidewired");
} }
@Override @Override

View File

@ -1,20 +1,18 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class HotelAlertCommand extends Command { public class HotelAlertCommand extends Command {
public HotelAlertCommand() { public HotelAlertCommand() {
super("cmd_ha", Emulator.getTexts().getValue("commands.keys.cmd_ha").split(";")); super("cmd_ha");
} }
@Override @Override

View File

@ -1,12 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer;
public class HotelAlertLinkCommand extends Command { public class HotelAlertLinkCommand extends Command {
public HotelAlertLinkCommand() { public HotelAlertLinkCommand() {
super("cmd_hal", Emulator.getTexts().getValue("commands.keys.cmd_hal").split(";")); super("cmd_hal");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -13,7 +13,7 @@ import com.eu.habbo.threading.runnables.RoomUnitTeleport;
public class InvisibleCommand extends Command { public class InvisibleCommand extends Command {
public InvisibleCommand() { public InvisibleCommand() {
super("cmd_invisible", Emulator.getTexts().getValue("commands.keys.cmd_invisible").split(";")); super("cmd_invisible");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
@ -11,7 +11,7 @@ import java.util.stream.IntStream;
public class LayCommand extends Command { public class LayCommand extends Command {
public LayCommand() { public LayCommand() {
super(null, Emulator.getTexts().getValue("commands.keys.cmd_lay").split(";")); super("cmd_lay");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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;
@ -13,7 +13,7 @@ import com.eu.habbo.util.figure.FigureUtil;
public class MimicCommand extends Command { public class MimicCommand extends Command {
public MimicCommand() { public MimicCommand() {
super("cmd_mimic", Emulator.getTexts().getValue("commands.keys.cmd_mimic").split(";")); super("cmd_mimic");
} }
@Override @Override
@ -29,10 +29,10 @@ public class MimicCommand extends Command {
if (habbo == gameClient.getHabbo()) { if (habbo == gameClient.getHabbo()) {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.not_self"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.not_self"), RoomChatMessageBubbles.ALERT);
return true; return true;
} else if (habbo.hasPermission(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasPermission(Permission.ACC_NOT_MIMICED)) { } else if (habbo.hasRight(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasRight(Permission.ACC_NOT_MIMICED)) {
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mimic.blocked"), params[1]).replace("%gender_name%", getGenderName(habbo)), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mimic.blocked"), params[1]).replace("%gender_name%", getGenderName(habbo)), RoomChatMessageBubbles.ALERT);
return true; return true;
} else if (!habbo.hasPermission("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) { } else if (!habbo.hasRight("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.forbidden_clothing"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.forbidden_clothing"), RoomChatMessageBubbles.ALERT);
return true; return true;
} else { } else {

View File

@ -1,11 +1,11 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
public class MoonwalkCommand extends Command { public class MoonwalkCommand extends Command {
public MoonwalkCommand() { public MoonwalkCommand() {
super("cmd_moonwalk", Emulator.getTexts().getValue("commands.keys.cmd_moonwalk").split(";")); super("cmd_moonwalk");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.rooms.items.RequestSpamWallPostItMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.RequestSpamWallPostItMessageComposer;
public class MultiCommand extends Command { public class MultiCommand extends Command {
public MultiCommand() { public MultiCommand() {
super("cmd_multi", Emulator.getTexts().getValue("commands.keys.cmd_multi").split(";")); super("cmd_multi");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class MuteBotsCommand extends Command { public class MuteBotsCommand extends Command {
public MuteBotsCommand() { public MuteBotsCommand() {
super(null, Emulator.getTexts().getValue("commands.keys.cmd_mute_bots").split(";")); super("cmd_mute_bots");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
@ -8,7 +9,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.IgnoreResultMessageComposer;
public class MuteCommand extends Command { public class MuteCommand extends Command {
public MuteCommand() { public MuteCommand() {
super("cmd_mute", Emulator.getTexts().getValue("commands.keys.cmd_mute").split(";")); super("cmd_mute");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class MutePetsCommand extends Command { public class MutePetsCommand extends Command {
public MutePetsCommand() { public MutePetsCommand() {
super(null, Emulator.getTexts().getValue("commands.keys.cmd_mute_pets").split(";")); super("cmd_mute_pets");
} }
@Override @Override

View File

@ -1,13 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class PetInfoCommand extends Command { public class PetInfoCommand extends Command {
public PetInfoCommand() { public PetInfoCommand() {
super("cmd_pet_info", Emulator.getTexts().getValue("commands.keys.cmd_pet_info").split(";")); super("cmd_pet_info");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
public class PickallCommand extends Command { public class PickallCommand extends Command {
public PickallCommand() { public PickallCommand() {
super("cmd_pickall", Emulator.getTexts().getValue("commands.keys.cmd_pickall").split(";")); super("cmd_pickall");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer; import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer;
import com.eu.habbo.plugin.HabboPlugin; import com.eu.habbo.plugin.HabboPlugin;
@ -9,7 +10,7 @@ import java.util.Collections;
public class PluginsCommand extends Command { public class PluginsCommand extends Command {
public PluginsCommand() { public PluginsCommand() {
super(null, Emulator.getTexts().getValue("commands.keys.cmd_plugins").split(";")); super("cmd_plugins");
} }
@Override @Override

View File

@ -1,9 +1,9 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.TargetOffer; import com.eu.habbo.habbohotel.catalog.TargetOffer;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.catalog.TargetedOfferComposer; import com.eu.habbo.messages.outgoing.catalog.TargetedOfferComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer; import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
@ -12,9 +12,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class PromoteTargetOfferCommand extends Command { public class PromoteTargetOfferCommand extends Command {
public PromoteTargetOfferCommand() { public PromoteTargetOfferCommand() {
super("cmd_promote_offer", Emulator.getTexts().getValue("commands.keys.cmd_promote_offer").split(";")); super("cmd_promote_offer");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -11,7 +11,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.ChatMessageComposer;
public class PullCommand extends Command { public class PullCommand extends Command {
public PullCommand() { public PullCommand() {
super("cmd_pull", Emulator.getTexts().getValue("commands.keys.cmd_pull").split(";")); super("cmd_pull");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -11,7 +11,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.ChatMessageComposer;
public class PushCommand extends Command { public class PushCommand extends Command {
public PushCommand() { public PushCommand() {
super("cmd_push", Emulator.getTexts().getValue("commands.keys.cmd_push").split(";")); super("cmd_push");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -14,7 +15,7 @@ import java.util.ArrayList;
public class RedeemCommand extends Command { public class RedeemCommand extends Command {
public RedeemCommand() { public RedeemCommand() {
super("cmd_redeem", Emulator.getTexts().getValue("commands.keys.cmd_redeem").split(";")); super("cmd_redeem");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -12,7 +13,7 @@ import java.util.Collection;
public class ReloadRoomCommand extends Command { public class ReloadRoomCommand extends Command {
public ReloadRoomCommand() { public ReloadRoomCommand() {
super("cmd_reload_room", Emulator.getTexts().getValue("commands.keys.cmd_reload_room").split(";")); super("cmd_reload_room");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -11,7 +11,7 @@ import java.util.stream.IntStream;
public class RoomAlertCommand extends Command { public class RoomAlertCommand extends Command {
public RoomAlertCommand() { public RoomAlertCommand() {
super("cmd_roomalert", Emulator.getTexts().getValue("commands.keys.cmd_roomalert").split(";")); super("cmd_room_alert");
} }
@Override @Override

View File

@ -1,10 +1,11 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts; import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts;
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -13,9 +14,8 @@ import java.sql.*;
@Slf4j @Slf4j
public class RoomBundleCommand extends Command { public class RoomBundleCommand extends Command {
public RoomBundleCommand() { public RoomBundleCommand() {
super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";")); super("cmd_bundle");
} }
@Override @Override
@ -40,7 +40,7 @@ public class RoomBundleCommand extends Command {
points = Integer.parseInt(params[3]); points = Integer.parseInt(params[3]);
pointsType = Integer.parseInt(params[4]); pointsType = Integer.parseInt(params[4]);
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().createCatalogPage("Room Bundle: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName(), "room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), 0, CatalogPageLayouts.room_bundle, gameClient.getHabbo().getHabboInfo().getRank().getId(), parentId); CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().createCatalogPage("Room Bundle: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName(), "room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), 0, CatalogPageLayouts.room_bundle, gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId(), parentId);
if (page instanceof RoomBundleLayout roomBundleLayout) { if (page instanceof RoomBundleLayout roomBundleLayout) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO catalog_items (page_id, item_ids, catalog_name, cost_credits, cost_points, points_type ) VALUES (?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO catalog_items (page_id, item_ids, catalog_name, cost_credits, cost_points, points_type ) VALUES (?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) {

View File

@ -1,15 +1,14 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.DanceType; import com.eu.habbo.habbohotel.users.DanceType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.users.DanceMessageComposer; import com.eu.habbo.messages.outgoing.rooms.users.DanceMessageComposer;
public class RoomDanceCommand extends Command { public class RoomDanceCommand extends Command {
public RoomDanceCommand() { public RoomDanceCommand() {
super("cmd_danceall", Emulator.getTexts().getValue("commands.keys.cmd_danceall").split(";")); super("cmd_room_dance");
} }
@Override @Override

View File

@ -1,14 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
public class RoomEffectCommand extends Command { public class RoomEffectCommand extends Command {
public RoomEffectCommand() { public RoomEffectCommand() {
super("cmd_roomeffect", Emulator.getTexts().getValue("commands.keys.cmd_roomeffect").split(";")); super("cmd_room_effect");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
@ -8,7 +8,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.CarryObjectMessageComposer;
public class RoomItemCommand extends Command { public class RoomItemCommand extends Command {
public RoomItemCommand() { public RoomItemCommand() {
super("cmd_roomitem", Emulator.getTexts().getValue("commands.keys.cmd_roomitem").split(";")); super("cmd_room_item");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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.Room; import com.eu.habbo.habbohotel.rooms.Room;
@ -12,7 +12,7 @@ import java.util.stream.IntStream;
public class RoomKickCommand extends Command { public class RoomKickCommand extends Command {
public RoomKickCommand() { public RoomKickCommand() {
super("cmd_kickall", Emulator.getTexts().getValue("commands.keys.cmd_kickall").split(";")); super("cmd_room_kick");
} }
@Override @Override
@ -25,7 +25,7 @@ public class RoomKickCommand extends Command {
} }
for (Habbo habbo : room.getHabbos()) { for (Habbo habbo : room.getHabbos()) {
if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) { if (!(habbo.hasRight(Permission.ACC_UNKICKABLE) || habbo.hasRight(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) {
room.kickHabbo(habbo, true); room.kickHabbo(habbo, true);
} }
} }

View File

@ -1,13 +1,14 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class RoomMuteCommand extends Command { public class RoomMuteCommand extends Command {
public RoomMuteCommand() { public RoomMuteCommand() {
super("cmd_roommute", Emulator.getTexts().getValue("commands.keys.cmd_roommute").split(";")); super("cmd_room_mute");
} }
@Override @Override

View File

@ -1,13 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
public class SitDownCommand extends Command { public class RoomSitCommand extends Command {
public SitDownCommand() { public RoomSitCommand() {
super("cmd_sitdown", Emulator.getTexts().getValue("commands.keys.cmd_sitdown").split(";")); super("cmd_room_sit");
} }
@Override @Override

View File

@ -1,16 +1,15 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class SayAllCommand extends Command { public class SayAllCommand extends Command {
public SayAllCommand() { public SayAllCommand() {
super("cmd_say_all", Emulator.getTexts().getValue("commands.keys.cmd_say_all").split(";")); super("cmd_say_all");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -12,7 +12,7 @@ import java.util.stream.IntStream;
public class SayCommand extends Command { public class SayCommand extends Command {
public SayCommand() { public SayCommand() {
super("cmd_say", Emulator.getTexts().getValue("commands.keys.cmd_say").split(";")); super("cmd_say");
} }
@Override @Override

View File

@ -1,12 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class SetMaxCommand extends Command { public class SetMaxCommand extends Command {
public SetMaxCommand() { public SetMaxCommand() {
super("cmd_setmax", Emulator.getTexts().getValue("commands.keys.cmd_setmax").split(";")); super("cmd_setmax");
} }
@Override @Override

View File

@ -1,12 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class SetPollCommand extends Command { public class SetPollCommand extends Command {
public SetPollCommand() { public SetPollCommand() {
super("cmd_set_poll", Emulator.getTexts().getValue("commands.keys.cmd_set_poll").split(";")); super("cmd_set_poll");
} }
@Override @Override

View File

@ -1,13 +1,14 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class SetSpeedCommand extends Command { public class SetSpeedCommand extends Command {
public SetSpeedCommand() { public SetSpeedCommand() {
super("cmd_setspeed", Emulator.getTexts().getValue("commands.keys.cmd_setspeed").split(";")); super("cmd_set_speed");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
@ -10,7 +10,7 @@ import java.util.stream.IntStream;
public class ShoutAllCommand extends Command { public class ShoutAllCommand extends Command {
public ShoutAllCommand() { public ShoutAllCommand() {
super("cmd_shout_all", Emulator.getTexts().getValue("commands.keys.cmd_shout_all").split(";")); super("cmd_shout_all");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -11,9 +12,8 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class ShoutCommand extends Command { public class ShoutCommand extends Command {
public ShoutCommand() { public ShoutCommand() {
super("cmd_shout", Emulator.getTexts().getValue("commands.keys.cmd_shout").split(";")); super("cmd_shout");
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomTrade; import com.eu.habbo.habbohotel.rooms.RoomTrade;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
@ -10,7 +11,7 @@ import com.eu.habbo.threading.runnables.ShutdownEmulator;
public class ShutdownCommand extends Command { public class ShutdownCommand extends Command {
public ShutdownCommand() { public ShutdownCommand() {
super("cmd_shutdown", Emulator.getTexts().getValue("commands.keys.cmd_shutdown").split(";")); super("cmd_shutdown");
} }
@Override @Override

View File

@ -1,11 +1,11 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
public class SitCommand extends Command { public class SitCommand extends Command {
public SitCommand() { public SitCommand() {
super(null, Emulator.getTexts().getValue("commands.keys.cmd_sit").split(";")); super("cmd_sit");
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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.Room; import com.eu.habbo.habbohotel.rooms.Room;
@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.users.Habbo;
public class SoftKickCommand extends Command { public class SoftKickCommand extends Command {
public SoftKickCommand() { public SoftKickCommand() {
super("cmd_softkick", Emulator.getTexts().getValue("commands.keys.cmd_softkick").split(";")); super("cmd_soft_kick");
} }
@Override @Override
@ -29,7 +29,7 @@ public class SoftKickCommand extends Command {
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
if (room != null && (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo)))) { if (room != null && (!(habbo.hasRight(Permission.ACC_UNKICKABLE) || habbo.hasRight(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo)))) {
room.kickHabbo(habbo, false); room.kickHabbo(habbo, false);
} }
return true; return true;

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.messenger.Message; import com.eu.habbo.habbohotel.messenger.Message;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -11,7 +12,7 @@ import java.util.stream.IntStream;
public class StaffAlertCommand extends Command { public class StaffAlertCommand extends Command {
public StaffAlertCommand() { public StaffAlertCommand() {
super("cmd_staffalert", Emulator.getTexts().getValue("commands.keys.cmd_staffalert").split(";")); super("cmd_staff_alert");
} }
@Override @Override

View File

@ -1,19 +1,18 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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 java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class StaffOnlineCommand extends Command { public class StaffOnlineCommand extends Command {
public StaffOnlineCommand() { public StaffOnlineCommand() {
super("cmd_staffonline", Emulator.getTexts().getValue("commands.keys.cmd_staffonline").split(";")); super("cmd_staff_online");
} }
@Override @Override
@ -39,12 +38,12 @@ public class StaffOnlineCommand extends Command {
synchronized (Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos()) { synchronized (Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos()) {
int finalMinRank = minRank; int finalMinRank = minRank;
List<Habbo> staffs = Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values().stream() List<Habbo> staffs = Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values().stream()
.filter(habbo -> habbo.getHabboInfo().getRank().getId() >= finalMinRank) .filter(habbo -> habbo.getHabboInfo().getPermissionGroup().getId() >= finalMinRank)
.sorted(Comparator.comparingInt(o->o.getHabboInfo().getId())) .sorted(Comparator.comparingInt(o->o.getHabboInfo().getId()))
.toList(); .toList();
String message = staffs.stream() String message = staffs.stream()
.map(habbo -> habbo.getHabboInfo().getUsername() + ": " + habbo.getHabboInfo().getRank().getName() + "\r") .map(habbo -> habbo.getHabboInfo().getUsername() + ": " + habbo.getHabboInfo().getPermissionGroup().getName() + "\r")
.collect(Collectors.joining("", getTextsValue("commands.generic.cmd_staffonline.staffs") + "\r\n", "")); .collect(Collectors.joining("", getTextsValue("commands.generic.cmd_staffonline.staffs") + "\r\n", ""));
gameClient.getHabbo().alert(message); gameClient.getHabbo().alert(message);

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
@ -8,7 +8,7 @@ import com.eu.habbo.messages.outgoing.rooms.GetGuestRoomResultComposer;
public class StalkCommand extends Command { public class StalkCommand extends Command {
public StalkCommand() { public StalkCommand() {
super("cmd_stalk", Emulator.getTexts().getValue("commands.keys.cmd_stalk").split(";")); super("cmd_stalk");
} }
@Override @Override

View File

@ -1,13 +1,12 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
public class StandCommand extends Command { public class StandCommand extends Command {
public StandCommand() { public StandCommand() {
super(null, Emulator.getTexts().getValue("commands.keys.cmd_stand").split(";")); super("cmd_stand");
} }
@Override @Override
public boolean handle(GameClient gameClient, String[] params) { public boolean handle(GameClient gameClient, String[] params) {

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
@ -16,7 +17,7 @@ import java.util.stream.IntStream;
*/ */
public class SubscriptionCommand extends Command { public class SubscriptionCommand extends Command {
public SubscriptionCommand() { public SubscriptionCommand() {
super("cmd_subscription", Emulator.getTexts().getValue("commands.keys.cmd_subscription").split(";")); super("cmd_subscription");
} }
/** /**

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -9,7 +10,7 @@ import com.eu.habbo.messages.outgoing.rooms.RoomForwardMessageComposer;
public class SummonCommand extends Command { public class SummonCommand extends Command {
public SummonCommand() { public SummonCommand() {
super("cmd_summon", Emulator.getTexts().getValue("commands.keys.cmd_summon").split(";")); super("cmd_summon");
} }
@Override @Override

View File

@ -1,17 +1,16 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
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.rooms.RoomForwardMessageComposer; import com.eu.habbo.messages.outgoing.rooms.RoomForwardMessageComposer;
import java.util.Map;
public class SummonRankCommand extends Command { public class SummonRankCommand extends Command {
public SummonRankCommand() { public SummonRankCommand() {
super("cmd_summonrank", Emulator.getTexts().getValue("commands.keys.cmd_summonrank").split(";")); super("cmd_summon_rank");
} }
@Override @Override
@ -27,7 +26,7 @@ public class SummonRankCommand extends Command {
} }
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) { for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
if (habbo.getHabboInfo().getRank().getId() >= minRank) { if (habbo.getHabboInfo().getPermissionGroup().getId() >= minRank) {
if (habbo == gameClient.getHabbo()) if (habbo == gameClient.getHabbo())
continue; continue;

View File

@ -1,6 +1,6 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -11,7 +11,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.ChatMessageComposer;
public class SuperPullCommand extends Command { public class SuperPullCommand extends Command {
public SuperPullCommand() { public SuperPullCommand() {
super("cmd_superpull", Emulator.getTexts().getValue("commands.keys.cmd_superpull").split(";")); super("cmd_super_pull");
} }
@Override @Override

View File

@ -1,12 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class TeleportCommand extends Command { public class TeleportCommand extends Command {
public TeleportCommand() { public TeleportCommand() {
super("cmd_teleport", Emulator.getTexts().getValue("commands.keys.cmd_teleport").split(";")); super("cmd_teleport");
} }
@Override @Override

View File

@ -1,18 +1,19 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; 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.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
public class TestCommand extends Command { public class TestCommand extends Command {
public TestCommand() { public TestCommand() {
super("acc_debug", new String[]{"test"}); super("cmd_test");
} }
@Override @Override
public boolean handle(GameClient gameClient, String[] params) { public boolean handle(GameClient gameClient, String[] params) {
if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL) || !Emulator.debugging) if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL) || !Emulator.debugging)
return false; return false;
int header = Integer.parseInt(params[1]); int header = Integer.parseInt(params[1]);

View File

@ -1,7 +1,8 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.core.RoomUserPetComposer; import com.eu.habbo.core.RoomUserPetComposer;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.pets.PetData; import com.eu.habbo.habbohotel.pets.PetData;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -13,8 +14,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
public class TransformCommand extends Command { public class TransformCommand extends Command {
protected TransformCommand() { public TransformCommand() {
super("cmd_transform", new String[]{"transform"}); super("cmd_transform");
} }
@Override @Override

View File

@ -1,12 +1,13 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
public class UnbanCommand extends Command { public class UnbanCommand extends Command {
public UnbanCommand() { public UnbanCommand() {
super("cmd_unban", Emulator.getTexts().getValue("commands.keys.cmd_unban").split(";")); super("cmd_unban");
} }
@Override @Override

View File

@ -0,0 +1,25 @@
package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.habbohotel.commands.Command;
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.RoomRightLevels;
public class UnloadRoomCommand extends Command {
public UnloadRoomCommand() {
super("cmd_unload");
}
@Override
public boolean handle(GameClient gameClient, String[] params) {
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
if (room != null && (room.isOwner(gameClient.getHabbo()) || (room.hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) || gameClient.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
room.dispose();
return true;
}
return false;
}
}

View File

@ -1,13 +1,14 @@
package com.eu.habbo.habbohotel.commands; package com.eu.habbo.habbohotel.commands.list;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
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;
public class UnmuteCommand extends Command { public class UnmuteCommand extends Command {
public UnmuteCommand() { public UnmuteCommand() {
super("cmd_unmute", Emulator.getTexts().getValue("commands.keys.cmd_unmute").split(";")); super("cmd_unmute");
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show More