diff --git a/pom.xml b/pom.xml index e2c144a9..4f2ad716 100644 --- a/pom.xml +++ b/pom.xml @@ -216,6 +216,11 @@ ${org.mockito.version} test + + org.reflections + reflections + 0.10.2 + \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/CommandLog.java b/src/main/java/com/eu/habbo/core/CommandLog.java index 41040efa..5ab05b63 100644 --- a/src/main/java/com/eu/habbo/core/CommandLog.java +++ b/src/main/java/com/eu/habbo/core/CommandLog.java @@ -9,7 +9,6 @@ import java.sql.SQLException; @AllArgsConstructor public class CommandLog implements DatabaseLoggable { - private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)"; private final int userId; diff --git a/src/main/java/com/eu/habbo/core/CreditsScheduler.java b/src/main/java/com/eu/habbo/core/CreditsScheduler.java index 2fe24faa..2c691133 100644 --- a/src/main/java/com/eu/habbo/core/CreditsScheduler.java +++ b/src/main/java/com/eu/habbo/core/CreditsScheduler.java @@ -51,7 +51,7 @@ public class CreditsScheduler extends Scheduler { if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED) 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) { log.error("Caught exception", e); diff --git a/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java b/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java index 8a816274..8b19429c 100644 --- a/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java +++ b/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java @@ -61,7 +61,7 @@ public class GotwPointsScheduler extends Scheduler { } type = Emulator.getConfig().getInt("seasonal.currency." + GOTW_POINTS_NAME, -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) { diff --git a/src/main/java/com/eu/habbo/core/PixelScheduler.java b/src/main/java/com/eu/habbo/core/PixelScheduler.java index 993ac885..ac36ec14 100644 --- a/src/main/java/com/eu/habbo/core/PixelScheduler.java +++ b/src/main/java/com/eu/habbo/core/PixelScheduler.java @@ -46,7 +46,7 @@ public class PixelScheduler extends Scheduler { if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED) 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) { log.error("Caught exception", e); diff --git a/src/main/java/com/eu/habbo/core/PointsScheduler.java b/src/main/java/com/eu/habbo/core/PointsScheduler.java index 8f74569d..1fce2860 100644 --- a/src/main/java/com/eu/habbo/core/PointsScheduler.java +++ b/src/main/java/com/eu/habbo/core/PointsScheduler.java @@ -51,7 +51,7 @@ public class PointsScheduler extends Scheduler { continue; //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) { log.error("Caught exception", e); diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java index 06c9f341..4b5ad9d6 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java @@ -1,6 +1,7 @@ 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 ConsoleShutdownCommand() { @@ -9,6 +10,6 @@ public class ConsoleShutdownCommand extends ConsoleCommand { @Override public void handle(String[] args) { - new ShutdownCommand().handle(null, args); + Emulator.getGameEnvironment().getCommandsManager().handleCommand(null, args.toString()); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java index f79bbf98..8c38c442 100644 --- a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java +++ b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java @@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.campaign.CalendarManager; 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.guides.GuideManager; import com.eu.habbo.habbohotel.guilds.GuildManager; @@ -37,7 +37,6 @@ public class GameEnvironment { private PointsScheduler pointsScheduler; private GotwPointsScheduler gotwPointsScheduler; private SubscriptionScheduler subscriptionScheduler; - private HabboManager habboManager; private NavigatorManager navigatorManager; private GuildManager guildManager; @@ -45,7 +44,7 @@ public class GameEnvironment { private CatalogManager catalogManager; private HotelViewManager hotelViewManager; private RoomManager roomManager; - private CommandHandler commandHandler; + private CommandsManager commandsManager; private PermissionsManager permissionsManager; private BotManager botManager; private ModToolManager modToolManager; @@ -73,7 +72,7 @@ public class GameEnvironment { this.catalogManager = new CatalogManager(); this.roomManager = new RoomManager(); this.navigatorManager = new NavigatorManager(); - this.commandHandler = new CommandHandler(); + this.commandsManager = new CommandsManager(); this.modToolManager = new ModToolManager(); this.modToolSanctions = new ModToolSanctions(); this.achievementManager = new AchievementManager(); @@ -112,7 +111,7 @@ public class GameEnvironment { this.gotwPointsScheduler.setDisposed(true); this.craftingManager.dispose(); this.habboManager.dispose(); - this.commandHandler.dispose(); + this.commandsManager.dispose(); this.guildManager.dispose(); this.catalogManager.dispose(); this.roomManager.dispose(); diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 461c306f..2d5e03b8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -104,8 +104,8 @@ public class BotManager { return; 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.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS)) { + if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_PLACEFURNI)) { + if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasRight(Permission.ACC_UNLIMITED_BOTS)) { habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS)); return; } @@ -173,8 +173,8 @@ public class BotManager { if (pickedUpEvent.isCancelled()) return; - if (habbo == null || (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(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 || (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasRight(Permission.ACC_ANYROOMOWNER))) { + 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 + "")); return; } diff --git a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java index 025db31e..97000234 100644 --- a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java @@ -121,7 +121,7 @@ public class CalendarManager { if (object == null) return; 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()) { return; } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 8dd2a96c..33fb7916 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -43,7 +43,6 @@ import lombok.extern.slf4j.Slf4j; import java.sql.*; import java.util.*; -import java.util.stream.Collectors; import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION; @@ -618,7 +617,7 @@ public class CatalogManager { this.catalogPages.get(parentId).childPages.forEachValue(object -> { 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(); @@ -1051,12 +1050,12 @@ public class CatalogManager { UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges); 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().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().sendResponse(new HabboActivityPointNotificationMessageComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.getTotalPoints(), item.getPointsType())); } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/Command.java b/src/main/java/com/eu/habbo/habbohotel/commands/Command.java index 1fe51d85..6593ba31 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/Command.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/Command.java @@ -1,20 +1,21 @@ package com.eu.habbo.habbohotel.commands; 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.users.Habbo; -import lombok.AllArgsConstructor; +import lombok.Getter; -@AllArgsConstructor -public abstract class Command { - - public final String permission; - public final String[] keys; +public abstract class Command implements ICommand { + @Getter + private final String name; + public Command(String name) { + this.name = name; + } public abstract boolean handle(GameClient gameClient, String[] params) throws Exception; - protected Habbo getHabbo(String username) { return Emulator.getGameEnvironment().getHabboManager().getHabbo(username); } @@ -42,4 +43,4 @@ public abstract class Command { protected String booleanToIntString(boolean value) { return value ? "1" : "0"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java deleted file mode 100644 index 3b1c4720..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java +++ /dev/null @@ -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 commands = new THashMap<>(5); - private static final Comparator 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 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 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 getCommandsForRank(int rankId) { - List allowedCommands = new ArrayList<>(); - if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId)) { - THashMap 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!"); - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandsCommand.java deleted file mode 100644 index 9be6e3b1..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CommandsCommand.java +++ /dev/null @@ -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 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; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandsManager.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandsManager.java new file mode 100644 index 00000000..f1317e41 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CommandsManager.java @@ -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 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 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!"); + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java deleted file mode 100644 index e5160958..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TrashCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/TrashCommand.java deleted file mode 100644 index 5d2c91eb..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TrashCommand.java +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UnloadRoomCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/UnloadRoomCommand.java deleted file mode 100644 index c75a9436..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UnloadRoomCommand.java +++ /dev/null @@ -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; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/interfaces/ICommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/interfaces/ICommand.java new file mode 100644 index 00000000..f184db98 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/commands/interfaces/ICommand.java @@ -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; +} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AboutCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/AboutCommand.java similarity index 96% rename from src/main/java/com/eu/habbo/habbohotel/commands/AboutCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/AboutCommand.java index 489aef83..afac49f1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AboutCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/AboutCommand.java @@ -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.habbohotel.catalog.CatalogManager; +import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer; import java.util.Collections; import java.util.concurrent.TimeUnit; - public class AboutCommand extends Command { - public AboutCommand() { - super(null, new String[]{"about", "info", "online", "server"}); - } public static final String CREDITS = """ Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral\s The Following people have all contributed to this emulator: @@ -47,6 +44,11 @@ public class AboutCommand extends Command { SenpaiDipper Snaiker Thijmen"""; + + public AboutCommand() { + super("cmd_about"); + } + @Override public boolean handle(GameClient gameClient, String[] params) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/AddYoutubePlaylistCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/AddYoutubePlaylistCommand.java index 03a2cea4..2acca5ea 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/AddYoutubePlaylistCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.YoutubeManager; import lombok.extern.slf4j.Slf4j; @@ -11,9 +12,8 @@ import java.sql.SQLException; @Slf4j public class AddYoutubePlaylistCommand extends Command { - public AddYoutubePlaylistCommand() { - super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";")); + super("cmd_add_youtube_playlist"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/AlertCommand.java similarity index 89% rename from src/main/java/com/eu/habbo/habbohotel/commands/AlertCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/AlertCommand.java index 4af606f0..b7aaf284 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/AlertCommand.java @@ -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.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -9,9 +9,8 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public class AlertCommand extends Command { - public AlertCommand() { - super("cmd_alert", Emulator.getTexts().getValue("commands.keys.cmd_alert").split(";")); + super("cmd_alert"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/AllowTradingCommand.java similarity index 95% rename from src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/AllowTradingCommand.java index 6d216a86..7093eabc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/AllowTradingCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.users.UserPerksComposer; @@ -10,7 +11,7 @@ import java.sql.PreparedStatement; public class AllowTradingCommand extends Command { public AllowTradingCommand() { - super("cmd_allow_trading", Emulator.getTexts().getValue("commands.keys.cmd_allow_trading").split(";")); + super("cmd_allow_trading"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ArcturusCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ArcturusCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/ArcturusCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ArcturusCommand.java index eed94fd2..6b3d8c94 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ArcturusCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ArcturusCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class ArcturusCommand extends Command { public ArcturusCommand() { - super(null, new String[]{"arcturus", "emulator"}); + super("cmd_arcturus"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/BlockAlertCommand.java similarity index 82% rename from src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/BlockAlertCommand.java index c23e0f74..70144310 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/BlockAlertCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class BlockAlertCommand extends Command { public BlockAlertCommand() { - super("cmd_blockalert", Emulator.getTexts().getValue("commands.keys.cmd_blockalert").split(";")); + super("cmd_blockalert"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BotsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/BotsCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/BotsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/BotsCommand.java index 096c39b1..a5e8ac1d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/BotsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/BotsCommand.java @@ -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.habbohotel.bots.Bot; +import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; public class BotsCommand extends Command { public BotsCommand() { - super("cmd_bots", Emulator.getTexts().getValue("commands.keys.cmd_bots").split(";")); + super("cmd_bots"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/CalendarCommand.java similarity index 86% rename from src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/CalendarCommand.java index f4e6210e..d996bebc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/CalendarCommand.java @@ -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.habbohotel.campaign.CalendarCampaign; +import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDataMessageComposer; 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 CalendarCommand() { - super("cmd_calendar", Emulator.getTexts().getValue("commands.keys.cmd_calendar").split(";")); + super("cmd_calendar"); } @Override @@ -21,7 +22,7 @@ public class CalendarCommand extends Command { if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) { 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]; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java index aedd2342..3952b300 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java @@ -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.users.Habbo; import com.eu.habbo.messages.outgoing.users.UserObjectComposer; public class ChangeNameCommand extends Command { public ChangeNameCommand() { - super("cmd_changename", Emulator.getTexts().getValue("commands.keys.cmd_changename").split(";")); + super("cmd_change_name"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ChatTypeCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ChatTypeCommand.java index 56c69289..95e25cef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ChatTypeCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; 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 ChatTypeCommand() { - super("cmd_chatcolor", Emulator.getTexts().getValue("commands.keys.cmd_chatcolor").split(";")); + super("cmd_chat_color"); } @Override @@ -32,7 +33,7 @@ public class ChatTypeCommand extends Command { 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(";")) { if (Integer.parseInt(s) == chatColor) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/CommandsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/CommandsCommand.java new file mode 100644 index 00000000..32a6727f --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/CommandsCommand.java @@ -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 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; + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ControlCommand.java similarity index 93% rename from src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ControlCommand.java index 4b25bf51..76442da4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ControlCommand.java @@ -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.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class ControlCommand extends Command { public ControlCommand() { - super("cmd_control", Emulator.getTexts().getValue("commands.keys.cmd_control").split(";")); + super("cmd_control"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/CoordsCommand.java similarity index 95% rename from src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/CoordsCommand.java index d8011e4b..0bbac1d8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/CoordsCommand.java @@ -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.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; public class CoordsCommand extends Command { - public CoordsCommand() { - super("cmd_coords", Emulator.getTexts().getValue("commands.keys.cmd_coords").split(";")); + super("cmd_coords"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/DiagonalCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/DiagonalCommand.java similarity index 85% rename from src/main/java/com/eu/habbo/habbohotel/commands/DiagonalCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/DiagonalCommand.java index cc5d9099..6b841eea 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/DiagonalCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/DiagonalCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class DiagonalCommand extends Command { public DiagonalCommand() { - super("cmd_diagonal", Emulator.getTexts().getValue("commands.keys.cmd_diagonal").split(";")); + super("cmd_diagonal"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/DisconnectCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/DisconnectCommand.java index fc642268..e39bb70e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/DisconnectCommand.java @@ -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.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class DisconnectCommand extends Command { public DisconnectCommand() { - super("cmd_disconnect", Emulator.getTexts().getValue("commands.keys.cmd_disconnect").split(";")); + super("cmd_disconnect"); } @Override @@ -29,7 +29,7 @@ public class DisconnectCommand extends Command { 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); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EjectAllCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/EjectAllCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/EjectAllCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/EjectAllCommand.java index 37b674c4..b68e8c12 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EjectAllCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/EjectAllCommand.java @@ -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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomRightLevels; public class EjectAllCommand extends Command { public EjectAllCommand() { - super("cmd_ejectall", Emulator.getTexts().getValue("commands.keys.cmd_ejectall").split(";")); + super("cmd_ejectall"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyBotsInventoryCommand.java similarity index 89% rename from src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyBotsInventoryCommand.java index 5a77cfb4..316c5421 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyBotsInventoryCommand.java @@ -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.habbohotel.bots.Bot; +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.RoomChatMessageBubbles; @@ -12,7 +13,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; public class EmptyBotsInventoryCommand extends Command { public EmptyBotsInventoryCommand() { - super("cmd_empty_bots", Emulator.getTexts().getValue("commands.keys.cmd_empty_bots").split(";")); + super("cmd_empty_bots"); } @Override @@ -31,7 +32,7 @@ public class EmptyBotsInventoryCommand extends Command { 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) { TIntObjectHashMap bots = new TIntObjectHashMap<>(); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyInventoryCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyInventoryCommand.java index b384fbe3..4298201e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyInventoryCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -14,7 +15,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; public class EmptyInventoryCommand extends Command { public EmptyInventoryCommand() { - super("cmd_empty", Emulator.getTexts().getValue("commands.keys.cmd_empty").split(";")); + super("cmd_empty"); } @Override @@ -33,7 +34,7 @@ public class EmptyInventoryCommand extends Command { 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) { TIntObjectMap items = new TIntObjectHashMap<>(); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyPetsInventoryCommand.java similarity index 89% rename from src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyPetsInventoryCommand.java index 4a2eef38..d1679b9c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/EmptyPetsInventoryCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.pets.Pet; @@ -12,7 +13,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; public class EmptyPetsInventoryCommand extends Command { public EmptyPetsInventoryCommand() { - super("cmd_empty_pets", Emulator.getTexts().getValue("commands.keys.cmd_empty_pets").split(";")); + super("cmd_empty_pets"); } @Override @@ -31,7 +32,7 @@ public class EmptyPetsInventoryCommand extends Command { 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) { TIntObjectHashMap pets = new TIntObjectHashMap<>(habbo.getInventory().getPetsComponent().getPets()); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/EnableCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/EnableCommand.java index 92d6d6b8..d1ea3825 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/EnableCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -10,7 +11,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class EnableCommand extends Command { public EnableCommand() { - super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";")); + super("cmd_enable"); } @Override @@ -30,10 +31,10 @@ public class EnableCommand extends Command { if (target == null) { 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 { 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); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/EventCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/EventCommand.java index 9abbb388..1ea5bf86 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/EventCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; @@ -12,7 +13,7 @@ import java.util.stream.IntStream; public class EventCommand extends Command { public EventCommand() { - super("cmd_event", Emulator.getTexts().getValue("commands.keys.cmd_event").split(";")); + super("cmd_event"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/FacelessCommand.java similarity index 89% rename from src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/FacelessCommand.java index 2ead7b04..88d9a95e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/FacelessCommand.java @@ -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.messages.outgoing.rooms.users.UserChangeMessageComposer; 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 FacelessCommand() { - super("cmd_faceless", Emulator.getTexts().getValue("commands.keys.cmd_faceless").split(";")); + super("cmd_faceless"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FastwalkCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/FastwalkCommand.java similarity index 85% rename from src/main/java/com/eu/habbo/habbohotel/commands/FastwalkCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/FastwalkCommand.java index cec64352..fc790173 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FastwalkCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/FastwalkCommand.java @@ -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.users.Habbo; public class FastwalkCommand extends Command { public FastwalkCommand() { - super("cmd_fastwalk", Emulator.getTexts().getValue("commands.keys.cmd_fastwalk").split(";")); + super("cmd_fastwalk"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/FilterWordCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/FilterWordCommand.java index 597b32d6..d216b41a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/FilterWordCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.modtool.WordFilter; import com.eu.habbo.habbohotel.modtool.WordFilterWord; @@ -12,9 +13,8 @@ import java.sql.SQLException; @Slf4j public class FilterWordCommand extends Command { - public FilterWordCommand() { - super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";")); + super("cmd_filterword"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FreezeBotsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/FreezeBotsCommand.java similarity index 81% rename from src/main/java/com/eu/habbo/habbohotel/commands/FreezeBotsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/FreezeBotsCommand.java index 7707c170..3e579fa8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FreezeBotsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/FreezeBotsCommand.java @@ -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.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class FreezeBotsCommand extends Command { public FreezeBotsCommand() { - super("cmd_freeze_bots", Emulator.getTexts().getValue("commands.keys.cmd_freeze_bots").split(";")); + super("cmd_freeze_bots"); } @Override @@ -17,7 +17,7 @@ public class FreezeBotsCommand extends Command { } 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().whisper(gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk() ? getTextsValue("commands.succes.cmd_freeze_bots.unfrozen") : getTextsValue("commands.succes.cmd_freeze_bots.frozen"), RoomChatMessageBubbles.ALERT); } else { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/FreezeCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/FreezeCommand.java index 8f67258f..de2ed0b0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/FreezeCommand.java @@ -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.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class FreezeCommand extends Command { public FreezeCommand() { - super("cmd_freeze", Emulator.getTexts().getValue("commands.keys.cmd_freeze").split(";")); + super("cmd_freeze"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java similarity index 67% rename from src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java index 90ddfb27..3c832360 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java @@ -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.habbohotel.commands.Command; 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.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboManager; @@ -10,12 +11,12 @@ import org.apache.commons.lang3.StringUtils; public class GiveRankCommand extends Command { public GiveRankCommand() { - super("cmd_give_rank", Emulator.getTexts().getValue("commands.keys.cmd_give_rank").split(";")); + super("cmd_give_rank"); } @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { - Rank rank = null; + PermissionGroup group = null; switch (params.length) { case 1 -> { 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 -> { if (StringUtils.isNumeric(params[2])) { - int rankId = Integer.parseInt(params[2]); - if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId)) - rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId); + int groupId = Integer.parseInt(params[2]); + if (Emulator.getGameEnvironment().getPermissionsManager().groupExists(groupId)) + group = Emulator.getGameEnvironment().getPermissionsManager().getGroup(groupId); } else { - rank = Emulator.getGameEnvironment().getPermissionsManager().getRankByName(params[2]); + group = Emulator.getGameEnvironment().getPermissionsManager().getGroupByName(params[2]); } - if (rank != null) { - if (rank.getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) { - gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT); + if (group != null) { + if (group.getId() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { + gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher"), params[1]).replace("%id%", group.getName()), RoomChatMessageBubbles.ALERT); return true; } HabboInfo habbo = HabboManager.getOfflineHabboInfo(params[1]); if (habbo != null) { - if (habbo.getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) { - gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher.other"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT); + 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%", group.getName()), RoomChatMessageBubbles.ALERT); 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 { - 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; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HabnamCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/HabnamCommand.java similarity index 80% rename from src/main/java/com/eu/habbo/habbohotel/commands/HabnamCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/HabnamCommand.java index 83d9586c..7c637fd4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HabnamCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/HabnamCommand.java @@ -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; public class HabnamCommand extends Command { public HabnamCommand() { - super(null, new String[]{"habnam", "gangnam"}); + super("cmd_habnam"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HandItemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/HandItemCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/HandItemCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/HandItemCommand.java index 77175958..c14fba16 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HandItemCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/HandItemCommand.java @@ -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.messages.outgoing.rooms.users.CarryObjectMessageComposer; public class HandItemCommand extends Command { public HandItemCommand() { - super("cmd_hand_item", Emulator.getTexts().getValue("commands.keys.cmd_hand_item").split(";")); + super("cmd_hand_item"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HappyHourCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/HappyHourCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/HappyHourCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/HappyHourCommand.java index 7f5c3e5c..732f4940 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HappyHourCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/HappyHourCommand.java @@ -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.habbohotel.achievements.AchievementManager; +import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer; -import java.util.Map; - public class HappyHourCommand extends Command { public HappyHourCommand() { - super("cmd_happyhour", Emulator.getTexts().getValue("commands.keys.cmd_happyhour").split(";")); + super("cmd_happyhour"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HideWiredCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/HideWiredCommand.java similarity index 82% rename from src/main/java/com/eu/habbo/habbohotel/commands/HideWiredCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/HideWiredCommand.java index 1b9fa239..a1a37ac0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HideWiredCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/HideWiredCommand.java @@ -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.rooms.Room; public class HideWiredCommand extends Command { public HideWiredCommand() { - super("cmd_hidewired", Emulator.getTexts().getValue("commands.keys.cmd_hidewired").split(";")); + super("cmd_hidewired"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/HotelAlertCommand.java similarity index 86% rename from src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/HotelAlertCommand.java index e3a7c946..d9386f1e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/HotelAlertCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; 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.outgoing.generic.alerts.ModeratorMessageComposer; -import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; public class HotelAlertCommand extends Command { - public HotelAlertCommand() { - super("cmd_ha", Emulator.getTexts().getValue("commands.keys.cmd_ha").split(";")); + super("cmd_ha"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertLinkCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/HotelAlertLinkCommand.java similarity index 87% rename from src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertLinkCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/HotelAlertLinkCommand.java index 9b689ae9..6acee5d2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertLinkCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/HotelAlertLinkCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer; public class HotelAlertLinkCommand extends Command { public HotelAlertLinkCommand() { - super("cmd_hal", Emulator.getTexts().getValue("commands.keys.cmd_hal").split(";")); + super("cmd_hal"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/InvisibleCommand.java similarity index 91% rename from src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/InvisibleCommand.java index 40316af2..a89cf853 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/InvisibleCommand.java @@ -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.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -13,7 +13,7 @@ import com.eu.habbo.threading.runnables.RoomUnitTeleport; public class InvisibleCommand extends Command { public InvisibleCommand() { - super("cmd_invisible", Emulator.getTexts().getValue("commands.keys.cmd_invisible").split(";")); + super("cmd_invisible"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/LayCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java similarity index 91% rename from src/main/java/com/eu/habbo/habbohotel/commands/LayCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java index d1cb0d87..0961d2ba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/LayCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java @@ -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.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; @@ -11,7 +11,7 @@ import java.util.stream.IntStream; public class LayCommand extends Command { public LayCommand() { - super(null, Emulator.getTexts().getValue("commands.keys.cmd_lay").split(";")); + super("cmd_lay"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/MimicCommand.java similarity index 85% rename from src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/MimicCommand.java index 4b984686..6c59a45c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/MimicCommand.java @@ -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.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -13,7 +13,7 @@ import com.eu.habbo.util.figure.FigureUtil; public class MimicCommand extends Command { public MimicCommand() { - super("cmd_mimic", Emulator.getTexts().getValue("commands.keys.cmd_mimic").split(";")); + super("cmd_mimic"); } @Override @@ -29,10 +29,10 @@ public class MimicCommand extends Command { if (habbo == gameClient.getHabbo()) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.not_self"), RoomChatMessageBubbles.ALERT); 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); 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); return true; } else { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MoonwalkCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/MoonwalkCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/MoonwalkCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/MoonwalkCommand.java index 4a4af3c7..5c03d536 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MoonwalkCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/MoonwalkCommand.java @@ -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; public class MoonwalkCommand extends Command { public MoonwalkCommand() { - super("cmd_moonwalk", Emulator.getTexts().getValue("commands.keys.cmd_moonwalk").split(";")); + super("cmd_moonwalk"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MultiCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/MultiCommand.java similarity index 71% rename from src/main/java/com/eu/habbo/habbohotel/commands/MultiCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/MultiCommand.java index e5d482d6..828d59ab 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MultiCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/MultiCommand.java @@ -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.messages.outgoing.rooms.items.RequestSpamWallPostItMessageComposer; public class MultiCommand extends Command { public MultiCommand() { - super("cmd_multi", Emulator.getTexts().getValue("commands.keys.cmd_multi").split(";")); + super("cmd_multi"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/MuteBotsCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/MuteBotsCommand.java index 4f7a1e3c..6e9fdfc0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/MuteBotsCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class MuteBotsCommand extends Command { public MuteBotsCommand() { - super(null, Emulator.getTexts().getValue("commands.keys.cmd_mute_bots").split(";")); + super("cmd_mute_bots"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/MuteCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/MuteCommand.java index a4e39464..b92589b8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/MuteCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; 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 MuteCommand() { - super("cmd_mute", Emulator.getTexts().getValue("commands.keys.cmd_mute").split(";")); + super("cmd_mute"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/MutePetsCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/MutePetsCommand.java index 6e59c0d9..e9ad8ff0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/MutePetsCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class MutePetsCommand extends Command { public MutePetsCommand() { - super(null, Emulator.getTexts().getValue("commands.keys.cmd_mute_pets").split(";")); + super("cmd_mute_pets"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/PetInfoCommand.java similarity index 93% rename from src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/PetInfoCommand.java index a588964d..5ffafb07 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/PetInfoCommand.java @@ -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.pets.PetManager; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class PetInfoCommand extends Command { public PetInfoCommand() { - super("cmd_pet_info", Emulator.getTexts().getValue("commands.keys.cmd_pet_info").split(";")); + super("cmd_pet_info"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PickallCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/PickallCommand.java similarity index 78% rename from src/main/java/com/eu/habbo/habbohotel/commands/PickallCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/PickallCommand.java index 30138ac8..875ab16d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PickallCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/PickallCommand.java @@ -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.rooms.Room; public class PickallCommand extends Command { public PickallCommand() { - super("cmd_pickall", Emulator.getTexts().getValue("commands.keys.cmd_pickall").split(";")); + super("cmd_pickall"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/PluginsCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/PluginsCommand.java index ad0f1824..b96a6d3d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/PluginsCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.outgoing.generic.alerts.MOTDNotificationComposer; import com.eu.habbo.plugin.HabboPlugin; @@ -9,7 +10,7 @@ import java.util.Collections; public class PluginsCommand extends Command { public PluginsCommand() { - super(null, Emulator.getTexts().getValue("commands.keys.cmd_plugins").split(";")); + super("cmd_plugins"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/PromoteTargetOfferCommand.java similarity index 93% rename from src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/PromoteTargetOfferCommand.java index c5f649fd..68178288 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/PromoteTargetOfferCommand.java @@ -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.habbohotel.catalog.TargetOffer; +import com.eu.habbo.habbohotel.commands.Command; 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.generic.alerts.MOTDNotificationComposer; import gnu.trove.map.hash.THashMap; @@ -12,9 +12,8 @@ import java.util.ArrayList; import java.util.List; public class PromoteTargetOfferCommand extends Command { - public PromoteTargetOfferCommand() { - super("cmd_promote_offer", Emulator.getTexts().getValue("commands.keys.cmd_promote_offer").split(";")); + super("cmd_promote_offer"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PullCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/PullCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/PullCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/PullCommand.java index 90929c83..3b78f9db 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PullCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/PullCommand.java @@ -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.rooms.RoomChatMessage; 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 PullCommand() { - super("cmd_pull", Emulator.getTexts().getValue("commands.keys.cmd_pull").split(";")); + super("cmd_pull"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/PushCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/PushCommand.java index 3d49edd4..e440af6f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/PushCommand.java @@ -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.rooms.RoomChatMessage; 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 PushCommand() { - super("cmd_push", Emulator.getTexts().getValue("commands.keys.cmd_push").split(";")); + super("cmd_push"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java similarity index 96% rename from src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java index 34ae90b5..a0b32f1c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.HabboItem; @@ -14,7 +15,7 @@ import java.util.ArrayList; public class RedeemCommand extends Command { public RedeemCommand() { - super("cmd_redeem", Emulator.getTexts().getValue("commands.keys.cmd_redeem").split(";")); + super("cmd_redeem"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java index 141f5bd2..0dbd9e8c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; @@ -12,7 +13,7 @@ import java.util.Collection; public class ReloadRoomCommand extends Command { public ReloadRoomCommand() { - super("cmd_reload_room", Emulator.getTexts().getValue("commands.keys.cmd_reload_room").split(";")); + super("cmd_reload_room"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomAlertCommand.java similarity index 86% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomAlertCommand.java index c54aad3d..36fff7ee 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomAlertCommand.java @@ -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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -11,7 +11,7 @@ import java.util.stream.IntStream; public class RoomAlertCommand extends Command { public RoomAlertCommand() { - super("cmd_roomalert", Emulator.getTexts().getValue("commands.keys.cmd_roomalert").split(";")); + super("cmd_room_alert"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomBundleCommand.java similarity index 95% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomBundleCommand.java index 71753696..958be816 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomBundleCommand.java @@ -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.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts; 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.rooms.RoomChatMessageBubbles; import lombok.extern.slf4j.Slf4j; @@ -13,9 +14,8 @@ import java.sql.*; @Slf4j public class RoomBundleCommand extends Command { - public RoomBundleCommand() { - super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";")); + super("cmd_bundle"); } @Override @@ -40,7 +40,7 @@ public class RoomBundleCommand extends Command { points = Integer.parseInt(params[3]); 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) { 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)) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomDanceCommand.java similarity index 87% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomDanceCommand.java index ad890783..bf39fef0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomDanceCommand.java @@ -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.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.DanceType; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.rooms.users.DanceMessageComposer; public class RoomDanceCommand extends Command { public RoomDanceCommand() { - super("cmd_danceall", Emulator.getTexts().getValue("commands.keys.cmd_danceall").split(";")); + super("cmd_room_dance"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomEffectCommand.java similarity index 84% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomEffectCommand.java index 336610ef..d164a3a0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomEffectCommand.java @@ -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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.Habbo; public class RoomEffectCommand extends Command { public RoomEffectCommand() { - super("cmd_roomeffect", Emulator.getTexts().getValue("commands.keys.cmd_roomeffect").split(";")); + super("cmd_room_effect"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomItemCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomItemCommand.java index da108f84..0fd9b203 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomItemCommand.java @@ -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.rooms.RoomChatMessageBubbles; 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 RoomItemCommand() { - super("cmd_roomitem", Emulator.getTexts().getValue("commands.keys.cmd_roomitem").split(";")); + super("cmd_room_item"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomKickCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomKickCommand.java similarity index 78% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomKickCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomKickCommand.java index 5c525a0e..6b0e8ae9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomKickCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomKickCommand.java @@ -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.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; @@ -12,7 +12,7 @@ import java.util.stream.IntStream; public class RoomKickCommand extends Command { public RoomKickCommand() { - super("cmd_kickall", Emulator.getTexts().getValue("commands.keys.cmd_kickall").split(";")); + super("cmd_room_kick"); } @Override @@ -25,7 +25,7 @@ public class RoomKickCommand extends Command { } 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); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomMuteCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomMuteCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/RoomMuteCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomMuteCommand.java index 689ee263..3e97d0e6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomMuteCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomMuteCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class RoomMuteCommand extends Command { public RoomMuteCommand() { - super("cmd_roommute", Emulator.getTexts().getValue("commands.keys.cmd_roommute").split(";")); + super("cmd_room_mute"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SitDownCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomSitCommand.java similarity index 68% rename from src/main/java/com/eu/habbo/habbohotel/commands/SitDownCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/RoomSitCommand.java index c539d0b6..0f375fbe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SitDownCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RoomSitCommand.java @@ -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.rooms.RoomUnitStatus; -import com.eu.habbo.habbohotel.users.Habbo; -public class SitDownCommand extends Command { - public SitDownCommand() { - super("cmd_sitdown", Emulator.getTexts().getValue("commands.keys.cmd_sitdown").split(";")); +public class RoomSitCommand extends Command { + public RoomSitCommand() { + super("cmd_room_sit"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SayAllCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SayAllCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/SayAllCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SayAllCommand.java index d2eeced7..262a6ee0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SayAllCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SayAllCommand.java @@ -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.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.Habbo; import java.util.stream.Collectors; import java.util.stream.IntStream; public class SayAllCommand extends Command { public SayAllCommand() { - super("cmd_say_all", Emulator.getTexts().getValue("commands.keys.cmd_say_all").split(";")); + super("cmd_say_all"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SayCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SayCommand.java similarity index 91% rename from src/main/java/com/eu/habbo/habbohotel/commands/SayCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SayCommand.java index 2d1b4279..3320b9d3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SayCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SayCommand.java @@ -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.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -12,7 +12,7 @@ import java.util.stream.IntStream; public class SayCommand extends Command { public SayCommand() { - super("cmd_say", Emulator.getTexts().getValue("commands.keys.cmd_say").split(";")); + super("cmd_say"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SetMaxCommand.java similarity index 86% rename from src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SetMaxCommand.java index a0b40549..c512e42d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SetMaxCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class SetMaxCommand extends Command { public SetMaxCommand() { - super("cmd_setmax", Emulator.getTexts().getValue("commands.keys.cmd_setmax").split(";")); + super("cmd_setmax"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SetPollCommand.java similarity index 91% rename from src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SetPollCommand.java index 3ee22856..3682b784 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SetPollCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class SetPollCommand extends Command { public SetPollCommand() { - super("cmd_set_poll", Emulator.getTexts().getValue("commands.keys.cmd_set_poll").split(";")); + super("cmd_set_poll"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SetSpeedCommand.java similarity index 91% rename from src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SetSpeedCommand.java index 08e26036..9525c6fc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SetSpeedCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class SetSpeedCommand extends Command { public SetSpeedCommand() { - super("cmd_setspeed", Emulator.getTexts().getValue("commands.keys.cmd_setspeed").split(";")); + super("cmd_set_speed"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ShoutAllCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ShoutAllCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/ShoutAllCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ShoutAllCommand.java index aebda31e..128339ac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ShoutAllCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ShoutAllCommand.java @@ -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.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -10,7 +10,7 @@ import java.util.stream.IntStream; public class ShoutAllCommand extends Command { public ShoutAllCommand() { - super("cmd_shout_all", Emulator.getTexts().getValue("commands.keys.cmd_shout_all").split(";")); + super("cmd_shout_all"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ShoutCommand.java similarity index 93% rename from src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ShoutCommand.java index d6e9733b..a19529e2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ShoutCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -11,9 +12,8 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public class ShoutCommand extends Command { - public ShoutCommand() { - super("cmd_shout", Emulator.getTexts().getValue("commands.keys.cmd_shout").split(";")); + super("cmd_shout"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ShutdownCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ShutdownCommand.java similarity index 93% rename from src/main/java/com/eu/habbo/habbohotel/commands/ShutdownCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/ShutdownCommand.java index fbce855d..78abb4e2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ShutdownCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ShutdownCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomTrade; import com.eu.habbo.messages.ServerMessage; @@ -10,7 +11,7 @@ import com.eu.habbo.threading.runnables.ShutdownEmulator; public class ShutdownCommand extends Command { public ShutdownCommand() { - super("cmd_shutdown", Emulator.getTexts().getValue("commands.keys.cmd_shutdown").split(";")); + super("cmd_shutdown"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SitCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SitCommand.java similarity index 75% rename from src/main/java/com/eu/habbo/habbohotel/commands/SitCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SitCommand.java index 808ced5c..0e8703f0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SitCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SitCommand.java @@ -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; public class SitCommand extends Command { public SitCommand() { - super(null, Emulator.getTexts().getValue("commands.keys.cmd_sit").split(";")); + super("cmd_sit"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SoftKickCommand.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SoftKickCommand.java index 005e9f6e..8bd98051 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SoftKickCommand.java @@ -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.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; @@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.users.Habbo; public class SoftKickCommand extends Command { public SoftKickCommand() { - super("cmd_softkick", Emulator.getTexts().getValue("commands.keys.cmd_softkick").split(";")); + super("cmd_soft_kick"); } @Override @@ -29,7 +29,7 @@ public class SoftKickCommand extends Command { 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); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/StaffAlertCommand.java similarity index 89% rename from src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/StaffAlertCommand.java index 2169a2d1..6302081f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/StaffAlertCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.messenger.Message; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -11,7 +12,7 @@ import java.util.stream.IntStream; public class StaffAlertCommand extends Command { public StaffAlertCommand() { - super("cmd_staffalert", Emulator.getTexts().getValue("commands.keys.cmd_staffalert").split(";")); + super("cmd_staff_alert"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/StaffOnlineCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/StaffOnlineCommand.java index 5be956af..57d33b48 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/StaffOnlineCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; -import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; public class StaffOnlineCommand extends Command { public StaffOnlineCommand() { - super("cmd_staffonline", Emulator.getTexts().getValue("commands.keys.cmd_staffonline").split(";")); + super("cmd_staff_online"); } @Override @@ -39,12 +38,12 @@ public class StaffOnlineCommand extends Command { synchronized (Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos()) { int finalMinRank = minRank; List 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())) .toList(); 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", "")); gameClient.getHabbo().alert(message); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/StalkCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/StalkCommand.java index f7f3fb44..928a1d55 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/StalkCommand.java @@ -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.rooms.RoomChatMessageBubbles; 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 StalkCommand() { - super("cmd_stalk", Emulator.getTexts().getValue("commands.keys.cmd_stalk").split(";")); + super("cmd_stalk"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/StandCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java similarity index 70% rename from src/main/java/com/eu/habbo/habbohotel/commands/StandCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java index 07077977..f14e36b6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/StandCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java @@ -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; public class StandCommand extends Command { public StandCommand() { - super(null, Emulator.getTexts().getValue("commands.keys.cmd_stand").split(";")); - } - + super("cmd_stand"); + } @Override public boolean handle(GameClient gameClient, String[] params) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java similarity index 97% rename from src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java index 089a3415..70618942 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.HabboInfo; @@ -16,7 +17,7 @@ import java.util.stream.IntStream; */ public class SubscriptionCommand extends Command { public SubscriptionCommand() { - super("cmd_subscription", Emulator.getTexts().getValue("commands.keys.cmd_subscription").split(";")); + super("cmd_subscription"); } /** diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SummonCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SummonCommand.java index 0bd17d72..f889259b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SummonCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; 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 SummonCommand() { - super("cmd_summon", Emulator.getTexts().getValue("commands.keys.cmd_summon").split(";")); + super("cmd_summon"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SummonRankCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SummonRankCommand.java index 62757e39..efc1ef4b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SummonRankCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.rooms.RoomForwardMessageComposer; -import java.util.Map; - public class SummonRankCommand extends Command { public SummonRankCommand() { - super("cmd_summonrank", Emulator.getTexts().getValue("commands.keys.cmd_summonrank").split(";")); + super("cmd_summon_rank"); } @Override @@ -27,7 +26,7 @@ public class SummonRankCommand extends Command { } for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) { - if (habbo.getHabboInfo().getRank().getId() >= minRank) { + if (habbo.getHabboInfo().getPermissionGroup().getId() >= minRank) { if (habbo == gameClient.getHabbo()) continue; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SuperPullCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SuperPullCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/SuperPullCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/SuperPullCommand.java index 39106cf0..a783adea 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SuperPullCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SuperPullCommand.java @@ -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.rooms.RoomChatMessage; 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 SuperPullCommand() { - super("cmd_superpull", Emulator.getTexts().getValue("commands.keys.cmd_superpull").split(";")); + super("cmd_super_pull"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TeleportCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/TeleportCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/TeleportCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/TeleportCommand.java index c6a29ed8..b39d024a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TeleportCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/TeleportCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class TeleportCommand extends Command { public TeleportCommand() { - super("cmd_teleport", Emulator.getTexts().getValue("commands.keys.cmd_teleport").split(";")); + super("cmd_teleport"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/TestCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/TestCommand.java index 317a9123..6647cc5e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/TestCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.ServerMessage; public class TestCommand extends Command { public TestCommand() { - super("acc_debug", new String[]{"test"}); + super("cmd_test"); } @Override 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; int header = Integer.parseInt(params[1]); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/TransformCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/TransformCommand.java index fe3513e7..f59c6498 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/TransformCommand.java @@ -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.core.RoomUserPetComposer; +import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.pets.PetData; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -13,8 +14,8 @@ import java.util.ArrayList; import java.util.Collections; public class TransformCommand extends Command { - protected TransformCommand() { - super("cmd_transform", new String[]{"transform"}); + public TransformCommand() { + super("cmd_transform"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UnbanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UnbanCommand.java similarity index 87% rename from src/main/java/com/eu/habbo/habbohotel/commands/UnbanCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UnbanCommand.java index c509789e..c0a1f048 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UnbanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UnbanCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UnbanCommand extends Command { public UnbanCommand() { - super("cmd_unban", Emulator.getTexts().getValue("commands.keys.cmd_unban").split(";")); + super("cmd_unban"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/UnloadRoomCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UnloadRoomCommand.java new file mode 100644 index 00000000..99c157f5 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UnloadRoomCommand.java @@ -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; + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UnmuteCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UnmuteCommand.java index d54fdf1a..29b65f1d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UnmuteCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class UnmuteCommand extends Command { public UnmuteCommand() { - super("cmd_unmute", Emulator.getTexts().getValue("commands.keys.cmd_unmute").split(";")); + super("cmd_unmute"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateAchievements.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateAchievements.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateAchievements.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateAchievements.java index 88cf2fbf..3cf693e4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateAchievements.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateAchievements.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdateAchievements extends Command { public UpdateAchievements() { - super("cmd_update_achievements", Emulator.getTexts().getValue("commands.keys.cmd_update_achievements").split(";")); + super("cmd_update_achievements"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateBotsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateBotsCommand.java similarity index 68% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateBotsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateBotsCommand.java index 6bdbf946..b4be45ca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateBotsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateBotsCommand.java @@ -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; public class UpdateBotsCommand extends Command { public UpdateBotsCommand() { - super("cmd_update_bots", Emulator.getTexts().getValue("commands.keys.cmd_update_bots").split(";")); + super("cmd_update_bots"); } - @Override public boolean handle(GameClient gameClient, String[] params) { return Emulator.getGameEnvironment().getBotManager().reload(); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateCalendarCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateCalendarCommand.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateCalendarCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateCalendarCommand.java index d7d28215..b81fbad0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateCalendarCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateCalendarCommand.java @@ -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.rooms.RoomChatMessageBubbles; public class UpdateCalendarCommand extends Command { - public UpdateCalendarCommand() { - super("cmd_update_calendar", Emulator.getTexts().getValue("commands.keys.cmd_update_calendar").split(";")); + super("cmd_update_calendar"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateCatalogCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateCatalogCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateCatalogCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateCatalogCommand.java index 11ab8c8e..b8af1be9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateCatalogCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateCatalogCommand.java @@ -1,15 +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.rooms.RoomChatMessageBubbles; import com.eu.habbo.messages.outgoing.catalog.*; import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigurationComposer; public class UpdateCatalogCommand extends Command { - public UpdateCatalogCommand() { - super("cmd_update_catalogue", Emulator.getTexts().getValue("commands.keys.cmd_update_catalogue").split(";")); + super("cmd_update_catalogue"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateConfigCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateConfigCommand.java similarity index 76% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateConfigCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateConfigCommand.java index f8502bf9..2ccf0a05 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateConfigCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateConfigCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdateConfigCommand extends Command { public UpdateConfigCommand() { - super("cmd_update_config", Emulator.getTexts().getValue("commands.keys.cmd_update_config").split(";")); + super("cmd_update_config"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateGuildPartsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateGuildPartsCommand.java similarity index 72% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateGuildPartsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateGuildPartsCommand.java index c34ff591..b27893bb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateGuildPartsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateGuildPartsCommand.java @@ -1,11 +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; public class UpdateGuildPartsCommand extends Command { public UpdateGuildPartsCommand() { - super("cmd_update_guildparts", Emulator.getTexts().getValue("commands.keys.cmd_update_guildparts").split(";")); + super("cmd_update_guildparts"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateHotelViewCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateHotelViewCommand.java similarity index 72% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateHotelViewCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateHotelViewCommand.java index 78edfe38..98b736cf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateHotelViewCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateHotelViewCommand.java @@ -1,11 +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; public class UpdateHotelViewCommand extends Command { - protected UpdateHotelViewCommand() { - super("cmd_update_hotel_view", Emulator.getTexts().getValue("commands.keys.cmd_update_hotel_view").split(";")); + public UpdateHotelViewCommand() { + super("cmd_update_hotel_view"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateItemsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateItemsCommand.java similarity index 85% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateItemsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateItemsCommand.java index 8eb69620..ccfeae37 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateItemsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateItemsCommand.java @@ -1,14 +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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.messages.outgoing.rooms.HeightMapComposer; public class UpdateItemsCommand extends Command { public UpdateItemsCommand() { - super("cmd_update_items", Emulator.getTexts().getValue("commands.keys.cmd_update_items").split(";")); + super("cmd_update_items"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateNavigatorCommand.java similarity index 81% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateNavigatorCommand.java index 991210e9..ab68718c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateNavigatorCommand.java @@ -1,14 +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.rooms.RoomChatMessageBubbles; public class UpdateNavigatorCommand extends Command { public UpdateNavigatorCommand() { - super("cmd_update_navigator", Emulator.getTexts().getValue("commands.keys.cmd_update_navigator").split(";")); + super("cmd_update_navigator"); } - @Override public boolean handle(GameClient gameClient, String[] params) { Emulator.getGameEnvironment().getNavigatorManager().loadNavigator(); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePermissionsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePermissionsCommand.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdatePermissionsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePermissionsCommand.java index 5ec84097..24a37b26 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePermissionsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePermissionsCommand.java @@ -1,14 +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.rooms.RoomChatMessageBubbles; public class UpdatePermissionsCommand extends Command { public UpdatePermissionsCommand() { - super("cmd_update_permissions", Emulator.getTexts().getValue("commands.keys.cmd_update_permissions").split(";")); + super("cmd_update_permissions"); } - @Override public boolean handle(GameClient gameClient, String[] params) { Emulator.getGameEnvironment().getPermissionsManager().reload(); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePetDataCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePetDataCommand.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdatePetDataCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePetDataCommand.java index 7ace3c20..f98af0ca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePetDataCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePetDataCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdatePetDataCommand extends Command { public UpdatePetDataCommand() { - super("cmd_update_pet_data", Emulator.getTexts().getValue("commands.keys.cmd_update_pet_data").split(";")); + super("cmd_update_pet_data"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePluginsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePluginsCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdatePluginsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePluginsCommand.java index a5bb09e3..3f3b9361 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePluginsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePluginsCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdatePluginsCommand extends Command { public UpdatePluginsCommand() { - super("cmd_update_plugins", Emulator.getTexts().getValue("commands.keys.cmd_update_plugins").split(";")); + super("cmd_update_plugins"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePollsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePollsCommand.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdatePollsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePollsCommand.java index 949d0779..a1a0274d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdatePollsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdatePollsCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdatePollsCommand extends Command { public UpdatePollsCommand() { - super("cmd_update_polls", Emulator.getTexts().getValue("commands.keys.cmd_update_polls").split(";")); + super("cmd_update_polls"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateTextsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateTextsCommand.java similarity index 75% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateTextsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateTextsCommand.java index 510bca33..7baf8760 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateTextsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateTextsCommand.java @@ -1,19 +1,20 @@ -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.rooms.RoomChatMessageBubbles; public class UpdateTextsCommand extends Command { public UpdateTextsCommand() { - super("cmd_update_texts", Emulator.getTexts().getValue("commands.keys.cmd_update_texts").split(";")); + super("cmd_update_texts"); } @Override public boolean handle(GameClient gameClient, String[] params) { try { Emulator.getTexts().reload(); - Emulator.getGameEnvironment().getCommandHandler().reloadCommands(); + Emulator.getGameEnvironment().getCommandsManager().reloadCommands(); gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_texts"), RoomChatMessageBubbles.ALERT); } catch (Exception e) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_update_texts.failed"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateWordFilterCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateWordFilterCommand.java similarity index 77% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateWordFilterCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateWordFilterCommand.java index 9cd66cd7..80357d27 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateWordFilterCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateWordFilterCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdateWordFilterCommand extends Command { public UpdateWordFilterCommand() { - super("cmd_update_wordfilter", Emulator.getTexts().getValue("commands.keys.update_wordfilter").split(";")); + super("cmd_update_wordfilter"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateYoutubePlaylistsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateYoutubePlaylistsCommand.java similarity index 76% rename from src/main/java/com/eu/habbo/habbohotel/commands/UpdateYoutubePlaylistsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateYoutubePlaylistsCommand.java index aae0d920..a60a80f4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateYoutubePlaylistsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UpdateYoutubePlaylistsCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class UpdateYoutubePlaylistsCommand extends Command { public UpdateYoutubePlaylistsCommand() { - super("cmd_update_youtube_playlists", Emulator.getTexts().getValue("commands.keys.cmd_update_youtube_playlists").split(";")); + super("cmd_update_youtube_playlists"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java index 643361ba..39cb7f8f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java @@ -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.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.modtool.ModToolBan; import com.eu.habbo.habbohotel.permissions.Permission; @@ -15,7 +16,7 @@ import java.util.*; public class UserInfoCommand extends Command { public UserInfoCommand() { - super("cmd_userinfo", Emulator.getTexts().getValue("commands.keys.cmd_userinfo").split(";")); + super("cmd_userinfo"); } @Override @@ -41,11 +42,11 @@ public class UserInfoCommand extends Command { getTextsValue("command.cmd_userinfo.user_id") + ": " + habbo.getId() + "\r" + getTextsValue("command.cmd_userinfo.user_name") + ": " + habbo.getUsername() + "\r" + getTextsValue("command.cmd_userinfo.motto") + ": " + habbo.getMotto().replace("<", "[").replace(">", "]") + "\r" + - getTextsValue("command.cmd_userinfo.rank") + ": " + habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" + + getTextsValue("command.cmd_userinfo.rank") + ": " + habbo.getPermissionGroup().getName() + " (" + habbo.getPermissionGroup().getId() + ") \r" + getTextsValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? getTextsValue("generic.no") : getTextsValue("generic.yes")) + "\r" + - ((habbo.getRank().hasPermission(Permission.ACC_HIDE_MAIL, true)) ? "" : getTextsValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") + - ((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) ? "" : getTextsValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") + - ((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : getTextsValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getHabboInfo().getIpLogin() + "\r") + + ((habbo.getPermissionGroup().hasRight(Permission.ACC_HIDE_MAIL, true)) ? "" : getTextsValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") + + ((habbo.getPermissionGroup().hasRight(Permission.ACC_HIDE_IP, true)) ? "" : getTextsValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") + + ((habbo.getPermissionGroup().hasRight(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : getTextsValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getHabboInfo().getIpLogin() + "\r") + (onlineHabbo != null ? getTextsValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().getAchievementScore() + "\r" : "")); ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/WordQuizCommand.java similarity index 87% rename from src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/WordQuizCommand.java index 87afee6c..8c5b8508 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/WordQuizCommand.java @@ -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.rooms.RoomChatMessageBubbles; @@ -8,7 +8,7 @@ import java.util.Arrays; public class WordQuizCommand extends Command { public WordQuizCommand() { - super("cmd_word_quiz", Emulator.getTexts().getValue("commands.keys.cmd_word_quiz").split(";")); + super("cmd_word_quiz"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/badge/BadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/badge/BadgeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java index 82325e6f..51a57aec 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/badge/BadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java @@ -1,7 +1,6 @@ -package com.eu.habbo.habbohotel.commands.badge; +package com.eu.habbo.habbohotel.commands.list.badge; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -16,9 +15,8 @@ import java.sql.SQLException; @Slf4j public class BadgeCommand extends BaseBadgeCommand { - public BadgeCommand() { - super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";")); + super("cmd_badge"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/badge/BaseBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BaseBadgeCommand.java similarity index 90% rename from src/main/java/com/eu/habbo/habbohotel/commands/badge/BaseBadgeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BaseBadgeCommand.java index e930ff4a..eb57185b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/badge/BaseBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BaseBadgeCommand.java @@ -1,6 +1,5 @@ -package com.eu.habbo.habbohotel.commands.badge; +package com.eu.habbo.habbohotel.commands.list.badge; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; @@ -12,8 +11,9 @@ import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer; import gnu.trove.map.hash.THashMap; public abstract class BaseBadgeCommand extends Command { - public BaseBadgeCommand(String permission, String[] keys) { - super(permission, keys); + public BaseBadgeCommand(String name) + { + super(name); } protected ServerMessage createServerMessage(String badge) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/badge/MassBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/MassBadgeCommand.java similarity index 65% rename from src/main/java/com/eu/habbo/habbohotel/commands/badge/MassBadgeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/badge/MassBadgeCommand.java index 05ae78ba..08a6afe4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/badge/MassBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/MassBadgeCommand.java @@ -1,23 +1,16 @@ -package com.eu.habbo.habbohotel.commands.badge; +package com.eu.habbo.habbohotel.commands.list.badge; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboBadge; -import com.eu.habbo.habbohotel.users.inventory.BadgesComponent; import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; -import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer; -import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer; -import gnu.trove.map.hash.THashMap; import java.util.Map; public class MassBadgeCommand extends BaseBadgeCommand { public MassBadgeCommand() { - super("cmd_massbadge", Emulator.getTexts().getValue("commands.keys.cmd_massbadge").split(";")); + super("cmd_massbadge"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/badge/RoomBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/RoomBadgeCommand.java similarity index 83% rename from src/main/java/com/eu/habbo/habbohotel/commands/badge/RoomBadgeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/badge/RoomBadgeCommand.java index 8156ca72..45b38c4b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/badge/RoomBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/RoomBadgeCommand.java @@ -1,13 +1,12 @@ -package com.eu.habbo.habbohotel.commands.badge; +package com.eu.habbo.habbohotel.commands.list.badge; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.messages.ServerMessage; public class RoomBadgeCommand extends BaseBadgeCommand { public RoomBadgeCommand() { - super("cmd_roombadge", Emulator.getTexts().getValue("commands.keys.cmd_roombadge").split(";")); + super("cmd_room_badge"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/badge/TakeBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/badge/TakeBadgeCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java index a31802d8..9ed7ffe4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/badge/TakeBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java @@ -1,7 +1,6 @@ -package com.eu.habbo.habbohotel.commands.badge; +package com.eu.habbo.habbohotel.commands.list.badge; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -14,7 +13,7 @@ import com.eu.habbo.messages.outgoing.users.UserBadgesComposer; public class TakeBadgeCommand extends BaseBadgeCommand { public TakeBadgeCommand() { - super("cmd_take_badge", Emulator.getTexts().getValue("commands.keys.cmd_take_badge").split(";")); + super("cmd_take_badge"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/bans/BanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/bans/BanCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java index c24ed0f0..3215fb19 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/bans/BanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java @@ -1,4 +1,4 @@ -package com.eu.habbo.habbohotel.commands.bans; +package com.eu.habbo.habbohotel.commands.list.bans; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command; @@ -15,7 +15,7 @@ import java.util.stream.IntStream; public class BanCommand extends Command { public BanCommand() { - super("cmd_ban", Emulator.getTexts().getValue("commands.keys.cmd_ban").split(";")); + super("cmd_ban"); } @Override @@ -62,7 +62,7 @@ public class BanCommand extends Command { return true; } - if (target.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { + if (target.getPermissionGroup().getId() >= gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/bans/BaseBanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/bans/BaseBanCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java index 749a8430..a0073c31 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/bans/BaseBanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java @@ -1,6 +1,5 @@ -package com.eu.habbo.habbohotel.commands.bans; +package com.eu.habbo.habbohotel.commands.list.bans; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.users.Habbo; @@ -17,11 +16,11 @@ public abstract class BaseBanCommand extends Command { protected String reason; protected int count; - public BaseBanCommand(String permission, String[] keys) { - super(permission, keys); + public BaseBanCommand(String name) + { + super(name); } - @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { this.reason = getReason(params); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/bans/IPBanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/IPBanCommand.java similarity index 79% rename from src/main/java/com/eu/habbo/habbohotel/commands/bans/IPBanCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/bans/IPBanCommand.java index c0e212f2..36ac562c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/bans/IPBanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/IPBanCommand.java @@ -1,22 +1,14 @@ -package com.eu.habbo.habbohotel.commands.bans; +package com.eu.habbo.habbohotel.commands.list.bans; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.modtool.ModToolBanType; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; - -import java.util.stream.Collectors; -import java.util.stream.IntStream; public class IPBanCommand extends BaseBanCommand { - - public IPBanCommand() { - super("cmd_ip_ban", Emulator.getTexts().getValue("commands.keys.cmd_ip_ban").split(";")); + super("cmd_ip_ban"); } @Override @@ -28,7 +20,7 @@ public class IPBanCommand extends BaseBanCommand { return true; } - if (habboInfo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { + if (habboInfo.getPermissionGroup().getId() >= gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/bans/MachineBanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/MachineBanCommand.java similarity index 84% rename from src/main/java/com/eu/habbo/habbohotel/commands/bans/MachineBanCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/bans/MachineBanCommand.java index a99ea7d7..870765d6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/bans/MachineBanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/MachineBanCommand.java @@ -1,4 +1,4 @@ -package com.eu.habbo.habbohotel.commands.bans; +package com.eu.habbo.habbohotel.commands.list.bans; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; @@ -7,7 +7,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class MachineBanCommand extends BaseBanCommand { public MachineBanCommand() { - super("cmd_machine_ban", Emulator.getTexts().getValue("commands.keys.cmd_machine_ban").split(";")); + super("cmd_machine_ban"); } @Override @@ -20,7 +20,7 @@ public class MachineBanCommand extends BaseBanCommand { return true; } - if (habboInfo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { + if (habboInfo.getPermissionGroup().getId() >= gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/bans/SuperbanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/SuperbanCommand.java similarity index 84% rename from src/main/java/com/eu/habbo/habbohotel/commands/bans/SuperbanCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/bans/SuperbanCommand.java index 1497d42a..8eeff2a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/bans/SuperbanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/SuperbanCommand.java @@ -1,4 +1,4 @@ -package com.eu.habbo.habbohotel.commands.bans; +package com.eu.habbo.habbohotel.commands.list.bans; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; @@ -7,7 +7,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; public class SuperbanCommand extends BaseBanCommand { public SuperbanCommand() { - super("cmd_super_ban", Emulator.getTexts().getValue("commands.keys.cmd_super_ban").split(";")); + super("cmd_super_ban"); } @Override @@ -20,7 +20,7 @@ public class SuperbanCommand extends BaseBanCommand { return true; } - if (habboInfo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { + if (habboInfo.getPermissionGroup().getId() >= gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/credits/BaseCreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/BaseCreditsCommand.java similarity index 72% rename from src/main/java/com/eu/habbo/habbohotel/commands/credits/BaseCreditsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/credits/BaseCreditsCommand.java index f7e66c2b..c3dbc9ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/credits/BaseCreditsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/BaseCreditsCommand.java @@ -1,10 +1,12 @@ -package com.eu.habbo.habbohotel.commands.credits; +package com.eu.habbo.habbohotel.commands.list.credits; import com.eu.habbo.habbohotel.commands.Command; public abstract class BaseCreditsCommand extends Command { - public BaseCreditsCommand(String permission, String[] keys) { - super(permission, keys); + + public BaseCreditsCommand(String name) + { + super(name); } protected String replaceAmount(String input, String amount) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/credits/CreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java similarity index 94% rename from src/main/java/com/eu/habbo/habbohotel/commands/credits/CreditsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java index 7da60d12..def03e2a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/credits/CreditsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java @@ -1,4 +1,4 @@ -package com.eu.habbo.habbohotel.commands.credits; +package com.eu.habbo.habbohotel.commands.list.credits; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; @@ -8,11 +8,10 @@ import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboManager; public class CreditsCommand extends BaseCreditsCommand { - private static final String INVALID_AMOUNT = "commands.error.cmd_credits.invalid_amount"; public CreditsCommand() { - super("cmd_credits", Emulator.getTexts().getValue("commands.keys.cmd_credits").split(";")); + super("cmd_credits"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/credits/MassCreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/MassCreditsCommand.java similarity index 88% rename from src/main/java/com/eu/habbo/habbohotel/commands/credits/MassCreditsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/credits/MassCreditsCommand.java index 330952a9..74f1ed68 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/credits/MassCreditsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/MassCreditsCommand.java @@ -1,7 +1,6 @@ -package com.eu.habbo.habbohotel.commands.credits; +package com.eu.habbo.habbohotel.commands.list.credits; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -11,7 +10,7 @@ import java.util.Map; public class MassCreditsCommand extends BaseCreditsCommand { public MassCreditsCommand() { - super("cmd_masscredits", Emulator.getTexts().getValue("commands.keys.cmd_masscredits").split(";")); + super("cmd_mass_credits"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/credits/RoomCreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/RoomCreditsCommand.java similarity index 81% rename from src/main/java/com/eu/habbo/habbohotel/commands/credits/RoomCreditsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/credits/RoomCreditsCommand.java index 972a6d36..cb895fbb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/credits/RoomCreditsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/RoomCreditsCommand.java @@ -1,14 +1,11 @@ -package com.eu.habbo.habbohotel.commands.credits; +package com.eu.habbo.habbohotel.commands.list.credits; -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.Habbo; public class RoomCreditsCommand extends BaseCreditsCommand { public RoomCreditsCommand() { - super("cmd_roomcredits", Emulator.getTexts().getValue("commands.keys.cmd_roomcredits").split(";")); + super("cmd_room_credits"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/gift/BaseGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/BaseGiftCommand.java similarity index 95% rename from src/main/java/com/eu/habbo/habbohotel/commands/gift/BaseGiftCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/gift/BaseGiftCommand.java index 604af266..efd07557 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/gift/BaseGiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/BaseGiftCommand.java @@ -1,4 +1,4 @@ -package com.eu.habbo.habbohotel.commands.gift; +package com.eu.habbo.habbohotel.commands.list.gift; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command; @@ -13,8 +13,9 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public abstract class BaseGiftCommand extends Command { - public BaseGiftCommand(String permission, String[] keys) { - super(permission, keys); + public BaseGiftCommand(String name) + { + super(name); } protected boolean validateGiftCommand(GameClient gameClient, String[] params) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/gift/GiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java similarity index 95% rename from src/main/java/com/eu/habbo/habbohotel/commands/gift/GiftCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java index d9e3798a..c360e3d6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/gift/GiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java @@ -1,7 +1,6 @@ -package com.eu.habbo.habbohotel.commands.gift; +package com.eu.habbo.habbohotel.commands.list.gift; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -19,7 +18,7 @@ import java.util.stream.IntStream; public class GiftCommand extends BaseGiftCommand { public GiftCommand() { - super("cmd_gift", Emulator.getTexts().getValue("commands.keys.cmd_gift").split(";")); + super("cmd_gift"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/gift/MassGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/MassGiftCommand.java similarity index 75% rename from src/main/java/com/eu/habbo/habbohotel/commands/gift/MassGiftCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/gift/MassGiftCommand.java index e8341a76..8c604c38 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/gift/MassGiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/MassGiftCommand.java @@ -1,25 +1,16 @@ -package com.eu.habbo.habbohotel.commands.gift; +package com.eu.habbo.habbohotel.commands.list.gift; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer; -import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; import gnu.trove.map.hash.THashMap; -import java.util.Map; - public class MassGiftCommand extends BaseGiftCommand { public MassGiftCommand() { - super("cmd_massgift", Emulator.getTexts().getValue("commands.keys.cmd_massgift").split(";")); + super("cmd_mass_gift"); } - @Override public boolean handle(final GameClient gameClient, String[] params) { if (params.length >= 2) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/gift/RoomGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/RoomGiftCommand.java similarity index 65% rename from src/main/java/com/eu/habbo/habbohotel/commands/gift/RoomGiftCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/gift/RoomGiftCommand.java index f9df93e1..f36f9886 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/gift/RoomGiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/RoomGiftCommand.java @@ -1,18 +1,11 @@ -package com.eu.habbo.habbohotel.commands.gift; +package com.eu.habbo.habbohotel.commands.list.gift; -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; import com.eu.habbo.messages.outgoing.wired.WiredRewardResultMessageComposer; public class RoomGiftCommand extends BaseGiftCommand { public RoomGiftCommand() { - super("cmd_roomgift", Emulator.getTexts().getValue("commands.keys.cmd_roomgift").split(";")); + super("cmd_roomgift"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/BasePixelsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/BasePixelsCommand.java similarity index 72% rename from src/main/java/com/eu/habbo/habbohotel/commands/pixels/BasePixelsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/BasePixelsCommand.java index d784b5da..f54e1719 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/BasePixelsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/BasePixelsCommand.java @@ -1,12 +1,12 @@ -package com.eu.habbo.habbohotel.commands.pixels; +package com.eu.habbo.habbohotel.commands.list.pixels; import com.eu.habbo.habbohotel.commands.Command; public abstract class BasePixelsCommand extends Command { - public BasePixelsCommand(String permission, String[] keys) { - super(permission, keys); + public BasePixelsCommand(String name) + { + super(name); } - protected String replaceAmount(String input, String amount) { return input.replace("%amount%", amount); } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/MassPixelsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/MassPixelsCommand.java similarity index 87% rename from src/main/java/com/eu/habbo/habbohotel/commands/pixels/MassPixelsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/MassPixelsCommand.java index 9011a3ca..447f8cea 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/MassPixelsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/MassPixelsCommand.java @@ -1,7 +1,6 @@ -package com.eu.habbo.habbohotel.commands.pixels; +package com.eu.habbo.habbohotel.commands.list.pixels; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -10,7 +9,7 @@ import java.util.Map; public class MassPixelsCommand extends BasePixelsCommand { public MassPixelsCommand() { - super("cmd_massduckets", Emulator.getTexts().getValue("commands.keys.cmd_massduckets").split(";")); + super("cmd_mass_duckets"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/PixelCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/PixelCommand.java similarity index 89% rename from src/main/java/com/eu/habbo/habbohotel/commands/pixels/PixelCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/PixelCommand.java index de50f2c3..ec4c0a28 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/PixelCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/PixelCommand.java @@ -1,14 +1,12 @@ -package com.eu.habbo.habbohotel.commands.pixels; +package com.eu.habbo.habbohotel.commands.list.pixels; -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class PixelCommand extends BasePixelsCommand { public PixelCommand() { - super("cmd_duckets", Emulator.getTexts().getValue("commands.keys.cmd_duckets").split(";")); + super("cmd_duckets"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/RoomPixelsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/RoomPixelsCommand.java similarity index 81% rename from src/main/java/com/eu/habbo/habbohotel/commands/pixels/RoomPixelsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/RoomPixelsCommand.java index a771f052..ef838f7f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/pixels/RoomPixelsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/pixels/RoomPixelsCommand.java @@ -1,14 +1,11 @@ -package com.eu.habbo.habbohotel.commands.pixels; +package com.eu.habbo.habbohotel.commands.list.pixels; -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.Habbo; public class RoomPixelsCommand extends BasePixelsCommand { public RoomPixelsCommand() { - super("cmd_roompixels", Emulator.getTexts().getValue("commands.keys.cmd_roompixels").split(";")); + super("cmd_room_duckets"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/points/BasePointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/BasePointsCommand.java similarity index 76% rename from src/main/java/com/eu/habbo/habbohotel/commands/points/BasePointsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/points/BasePointsCommand.java index 4f657b6d..20afe770 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/points/BasePointsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/BasePointsCommand.java @@ -1,11 +1,11 @@ -package com.eu.habbo.habbohotel.commands.points; +package com.eu.habbo.habbohotel.commands.list.points; import com.eu.habbo.habbohotel.commands.Command; public abstract class BasePointsCommand extends Command { - - public BasePointsCommand(String permission, String[] keys) { - super(permission, keys); + public BasePointsCommand(String name) + { + super(name); } protected String replaceAmountAndType(String input, String amount, String type) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/points/MassPointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/MassPointsCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/points/MassPointsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/points/MassPointsCommand.java index e9a0264e..c8890cdc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/points/MassPointsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/MassPointsCommand.java @@ -1,16 +1,13 @@ -package com.eu.habbo.habbohotel.commands.points; +package com.eu.habbo.habbohotel.commands.list.points; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; -import java.util.Map; - public class MassPointsCommand extends BasePointsCommand { public MassPointsCommand() { - super("cmd_masspoints", Emulator.getTexts().getValue("commands.keys.cmd_masspoints").split(";")); + super("cmd_mass_points"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/points/PointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/PointsCommand.java similarity index 95% rename from src/main/java/com/eu/habbo/habbohotel/commands/points/PointsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/points/PointsCommand.java index 044abf67..23b3451b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/points/PointsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/PointsCommand.java @@ -1,4 +1,4 @@ -package com.eu.habbo.habbohotel.commands.points; +package com.eu.habbo.habbohotel.commands.list.points; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; @@ -6,11 +6,10 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class PointsCommand extends BasePointsCommand { - private static final String INVALID_AMOUNT_TEXTS = "commands.error.cmd_points.invalid_amount"; public PointsCommand() { - super("cmd_points", Emulator.getTexts().getValue("commands.keys.cmd_points").split(";")); + super("cmd_points"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/points/RoomPointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/RoomPointsCommand.java similarity index 92% rename from src/main/java/com/eu/habbo/habbohotel/commands/points/RoomPointsCommand.java rename to src/main/java/com/eu/habbo/habbohotel/commands/list/points/RoomPointsCommand.java index 90528818..40f82a89 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/points/RoomPointsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/points/RoomPointsCommand.java @@ -1,14 +1,13 @@ -package com.eu.habbo.habbohotel.commands.points; +package com.eu.habbo.habbohotel.commands.list.points; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class RoomPointsCommand extends BasePointsCommand { public RoomPointsCommand() { - super("cmd_roompoints", Emulator.getTexts().getValue("commands.keys.cmd_roompoints").split(";")); + super("cmd_room_points"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java index 056c566b..354429a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java @@ -152,7 +152,7 @@ public class GameClientManager { continue; if (client.getHabbo() != null) { - if (client.getHabbo().hasPermission(minPermission)) { + if (client.getHabbo().hasRight(minPermission)) { client.sendResponse(message); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java index 41290215..7e836dab 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java @@ -37,7 +37,7 @@ public class InteractionGuildGate extends InteractionGuildFurni implements Condi Habbo habbo = room.getHabbo(roomUnit); - return habbo != null && (habbo.getHabboStats().hasGuild(super.getGuildId()) || habbo.hasPermission(Permission.ACC_GUILDGATE)); + return habbo != null && (habbo.getHabboStats().hasGuild(super.getGuildId()) || habbo.hasRight(Permission.ACC_GUILDGATE)); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java index a4b6d0c4..161cea9b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java @@ -232,7 +232,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable { Emulator.getThreading().run(new GameTimer(this), 1000); } } else if (client != null) { - if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER))) + if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER))) return; InteractionGameTimerAction state = InteractionGameTimerAction.START_STOP; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java index 3383270f..da0c9b36 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java @@ -126,7 +126,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); - if (client.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { + if (client.getHabbo().hasRight(Permission.ACC_SUPERWIRED)) { client.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.superwired.info"), RoomChatMessageBubbles.BOT); } } @@ -172,7 +172,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { @Override public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { + if (gameClient.getHabbo().hasRight(Permission.ACC_SUPERWIRED)) { if (settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data"); this.rewardTime = settings.getIntParams()[0]; this.uniqueRewards = settings.getIntParams()[1] == 1; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java index 28673eaf..180b15e1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java @@ -44,7 +44,7 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect { Habbo habbo = room.getHabbo(roomUnit); if (habbo != null) { - if (habbo.hasPermission(Permission.ACC_UNKICKABLE)) { + if (habbo.hasRight(Permission.ACC_UNKICKABLE)) { habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.unkickable")); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java index 780157ca..3aa3543d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; @@ -18,7 +17,6 @@ import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.rooms.users.WhisperMessageComposer; -import gnu.trove.procedure.TObjectProcedure; import java.sql.ResultSet; import java.sql.SQLException; @@ -72,7 +70,7 @@ public class WiredEffectWhisper extends InteractionWiredEffect { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { String message = settings.getStringParam(); - if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { + if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasRight(Permission.ACC_SUPERWIRED)) { message = Emulator.getGameEnvironment().getWordFilter().filter(message, null); message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100))); } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index 592409d9..96ea6976 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -386,7 +386,7 @@ public class ModToolManager { } public void alert(Habbo moderator, Habbo target, String message, SupportUserAlertedReason reason) { - if (!moderator.hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (!moderator.hasRight(Permission.ACC_SUPPORTTOOL)) { ScripterManager.scripterDetected(moderator.getClient(), Emulator.getTexts().getValue("scripter.warning.modtools.alert").replace("%username%", moderator.getHabboInfo().getUsername()).replace("%message%", message)); return; } @@ -401,7 +401,7 @@ public class ModToolManager { } public void kick(Habbo moderator, Habbo target, String message) { - if (moderator.hasPermission(Permission.ACC_SUPPORTTOOL) && !target.hasPermission(Permission.ACC_UNKICKABLE)) { + if (moderator.hasRight(Permission.ACC_SUPPORTTOOL) && !target.hasRight(Permission.ACC_UNKICKABLE)) { if (target.getHabboInfo().getCurrentRoom() != null) { Emulator.getGameEnvironment().getRoomManager().leaveRoom(target, target.getHabboInfo().getCurrentRoom()); } @@ -417,7 +417,7 @@ public class ModToolManager { Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(targetUserId); HabboInfo offlineInfo = target != null ? target.getHabboInfo() : HabboManager.getOfflineHabboInfo(targetUserId); - if (moderator.getHabboInfo().getRank().getId() < offlineInfo.getRank().getId()) { + if (moderator.getHabboInfo().getPermissionGroup().getId() < offlineInfo.getPermissionGroup().getId()) { return bans; } @@ -442,7 +442,7 @@ public class ModToolManager { if ((type == ModToolBanType.IP || type == ModToolBanType.SUPER) && target != null && !ban.getIp().equals("offline")) { for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithIP(ban.getIp())) { - if (h.getHabboInfo().getRank().getId() >= moderator.getHabboInfo().getRank().getId()) continue; + if (h.getHabboInfo().getPermissionGroup().getId() >= moderator.getHabboInfo().getPermissionGroup().getId()) continue; ban = new ModToolBan(h.getHabboInfo().getId(), h.getHabboInfo().getIpLogin(), h.getClient().getMachineId(), moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic); Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, h, ban)); @@ -454,7 +454,7 @@ public class ModToolManager { if ((type == ModToolBanType.MACHINE || type == ModToolBanType.SUPER) && target != null && !ban.getMachineId().equals("offline")) { for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithMachineId(ban.getMachineId())) { - if (h.getHabboInfo().getRank().getId() >= moderator.getHabboInfo().getRank().getId()) continue; + if (h.getHabboInfo().getPermissionGroup().getId() >= moderator.getHabboInfo().getPermissionGroup().getId()) continue; ban = new ModToolBan(h.getHabboInfo().getId(), h.getHabboInfo().getIpLogin(), h.getClient().getMachineId(), moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic); Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, h, ban)); @@ -483,7 +483,7 @@ public class ModToolManager { if (roomActionEvent.isKickUsers()) { 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, false); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java index b4cd0433..8310645f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java @@ -125,7 +125,7 @@ public class WordFilter { public String filter(String message, Habbo habbo) { String filteredMessage = message; - if (!Emulator.getConfig().getBoolean("hotel.wordfilter.enabled", true) || (habbo != null && habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER))) { + if (!Emulator.getConfig().getBoolean("hotel.wordfilter.enabled", true) || (habbo != null && habbo.hasRight(Permission.ACC_CHAT_NO_FILTER))) { return message; } if (Emulator.getConfig().getBoolean("hotel.wordfilter.normalise")) { diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java index b8999b16..012cce5f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java @@ -19,7 +19,7 @@ public class NavigatorHotelFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo) { - boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasRight(Permission.ACC_ENTERANYROOM) || habbo.hasRight(Permission.ACC_ANYROOMOWNER); List resultLists = new ArrayList<>(); int i = 0; @@ -41,7 +41,7 @@ public class NavigatorHotelFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo, NavigatorFilterField filterField, String value, int roomCategory) { - boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasRight(Permission.ACC_ENTERANYROOM) || habbo.hasRight(Permission.ACC_ANYROOMOWNER); if (!filterField.getDatabaseQuery().isEmpty()) { List resultLists = new ArrayList<>(); int i = 0; diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java index 9dbef5dc..1a50fd4a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java @@ -16,7 +16,7 @@ public class NavigatorPublicFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo) { - boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasRight(Permission.ACC_ENTERANYROOM) || habbo.hasRight(Permission.ACC_ANYROOMOWNER); List resultLists = new ArrayList<>(); int i = 0; diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java index d9e34c64..84baf63f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java @@ -16,7 +16,7 @@ public class NavigatorRoomAdsFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo) { - boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasRight(Permission.ACC_ENTERANYROOM) || habbo.hasRight(Permission.ACC_ANYROOMOWNER); List resultList = new ArrayList<>(); resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().getNavigatorWindowSettings().getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().getNavigatorWindowSettings().getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("categories", habbo), false, showInvisible, DisplayOrder.ACTIVITY, 0)); return resultList; diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java index 1497b33e..5adb83d9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java @@ -48,6 +48,7 @@ public class Permission { public static final String ACC_HELPER_GIVE_GUIDE_TOURS = "acc_helper_give_guide_tours"; public static final String ACC_HELPER_JUDGE_CHAT_REVIEWS = "acc_helper_judge_chat_reviews"; public static final String ACC_FLOORPLAN_EDITOR = "acc_floorplan_editor"; + public static final String ACC_CAMERA = "acc_camera"; private final String key; private final PermissionSetting setting; diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionCommand.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionCommand.java new file mode 100644 index 00000000..b0326644 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionCommand.java @@ -0,0 +1,40 @@ +package com.eu.habbo.habbohotel.permissions; + +import lombok.Getter; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Arrays; + +public class PermissionCommand { + @Getter + private final String name; + + private final String description; + @Getter + private final String[] keys; + + public PermissionCommand(ResultSet set) throws SQLException { + this.name = set.getString("name"); + this.description = set.getString("description"); + this.keys = set.getString("keys").split(";"); + } + + public PermissionCommand(String name, String description, String[] keys) { + this.name = name; + this.description = description; + this.keys = keys; + } + + public String getDescription() { + if(this.description == null || this.description.length() == 0) { + return this.name + " - No description provided."; + } + + return this.description; + } + + public boolean hasKey(String key) { + return Arrays.asList(this.keys).contains(key); + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionCurrencyTimer.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionCurrencyTimer.java new file mode 100644 index 00000000..fc4a6c29 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionCurrencyTimer.java @@ -0,0 +1,27 @@ +package com.eu.habbo.habbohotel.permissions; + +import lombok.Getter; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class PermissionCurrencyTimer { + @Getter + private final int id; + + @Getter + private final int groupId; + + @Getter + private final int currencyType; + + @Getter + private final int amount; + + public PermissionCurrencyTimer(ResultSet set) throws SQLException { + this.id = set.getInt("id"); + this.groupId = set.getInt("group_id"); + this.currencyType = set.getInt("currency_type"); + this.amount = set.getInt("amount"); + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java new file mode 100644 index 00000000..6baa56f1 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java @@ -0,0 +1,162 @@ +package com.eu.habbo.habbohotel.permissions; + +import com.eu.habbo.Emulator; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +import java.sql.*; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Slf4j +public class PermissionGroup { + @Getter + private final int id; + @Getter + private final int level; + @Getter + private final String name; + @Getter + private final String description; + @Getter + private final String badge; + @Getter + private final int roomEffect; + @Getter + private final boolean logEnabled; + @Getter + private final String prefix; + @Getter + private final String prefixColor; + private final Map commands; + @Getter + private final Map rights; + + @Getter final Map timers; + + public PermissionGroup(ResultSet set, Map commandsAvailable) throws SQLException { + this.id = set.getInt("id"); + this.name = set.getString("name"); + this.description = set.getString("description"); + this.level = set.getInt("level"); + this.prefix = set.getString("prefix"); + this.prefixColor = set.getString("prefix_color"); + this.badge = set.getString("badge"); + this.roomEffect = set.getInt("room_effect"); + this.logEnabled = set.getString("log_enabled").equals("1"); + + this.commands = new HashMap<>(); + this.rights = new HashMap<>(); + this.timers = new HashMap<>(); + + this.loadCommands(commandsAvailable); + this.loadRights(); + this.loadTimers(); + + log.info("Loaded " + this.name + " rank with " + this.commands.size() + " commands and " + this.rights.size() + " rights!"); + } + + private void loadCommands(Map commandsAvailable) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM permission_group_commands WHERE group_id = ?")) { + statement.setInt(1, this.id); + try(ResultSet set = statement.executeQuery()) { + while (set.next()) { + String commandName = set.getString("command_name"); + PermissionCommand command = commandsAvailable.values().stream().filter(commandAvailable -> commandAvailable.getName().equalsIgnoreCase(commandName)).findFirst().orElse(null); + this.commands.put(command, PermissionSetting.fromString(set.getString("setting_type"))); + } + } + } catch (SQLException e) { + log.error("Caught SQL exception", e); + } + } + + private void loadRights() { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM permission_group_rights WHERE group_id = ?")) { + statement.setInt(1, this.id); + try(ResultSet set = statement.executeQuery()) { + while (set.next()) { + PermissionRight right = Emulator.getGameEnvironment().getPermissionsManager().getRight(set.getString("name")); + this.rights.put(right, PermissionSetting.fromString(set.getString("setting_type"))); + } + } + } catch (SQLException e) { + log.error("Caught SQL exception", e); + } + } + + private void loadTimers() { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM permission_group_timers WHERE group_id = ? ORDER BY id ASC")) { + statement.setInt(1, this.id); + try(ResultSet set = statement.executeQuery()) { + while (set.next()) { + PermissionCurrencyTimer currencyTimer = new PermissionCurrencyTimer(set); + this.timers.put(currencyTimer.getCurrencyType(), currencyTimer); + } + } + } catch (SQLException e) { + log.error("Caught SQL exception", e); + } + } + + public boolean canExecuteCommand(String key, boolean hasRoomRights) { + PermissionsManager permissionsManager = Emulator.getGameEnvironment().getPermissionsManager(); + PermissionCommand command = permissionsManager.getCommandByKey(key); + + if(command == null) { + return false; + } + + if (permissionsManager.isFixedCommand(command.getName())) { + return true; + } + + PermissionSetting setting = this.commands.get(command); + return setting == PermissionSetting.ALLOWED || (setting == PermissionSetting.HAS_ROOM_RIGHTS && hasRoomRights); + } + + public boolean hasCommand(String name, boolean hasRoomRights) { + PermissionCommand command = Emulator.getGameEnvironment().getPermissionsManager().getCommand(name); + if (this.commands.containsKey(command)) { + PermissionSetting setting = this.commands.get(command); + return (setting == PermissionSetting.ALLOWED || (setting == PermissionSetting.HAS_ROOM_RIGHTS && hasRoomRights)); + } + return false; + } + + public boolean hasRight(String name, boolean hasRoomRights) { + PermissionRight right = Emulator.getGameEnvironment().getPermissionsManager().getRight(name); + if(this.rights.containsKey(right)) { + PermissionSetting setting = this.rights.get(right); + return (setting == PermissionSetting.ALLOWED || (setting == PermissionSetting.HAS_ROOM_RIGHTS && hasRoomRights)); + } + + return false; + } + + public int getTimerAmount(int currencyType) { + if(this.timers.containsKey(currencyType)) { + return this.timers.get(currencyType).getAmount(); + } + + return 0; + } + + public List getCommands() { + Collection fixedCommands = Emulator.getGameEnvironment().getPermissionsManager().getFixedCommands(); + Set commands = this.commands.keySet(); + + return Stream.concat(fixedCommands.stream(), commands.stream()).collect(Collectors.toList()); + } + + public boolean hasPrefix() { + return !this.prefix.isEmpty(); + } + + public boolean hasBadge() { + return !this.badge.isEmpty(); + } + +} + diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionRight.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionRight.java new file mode 100644 index 00000000..9d2802b4 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionRight.java @@ -0,0 +1,18 @@ +package com.eu.habbo.habbohotel.permissions; + +import lombok.Getter; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class PermissionRight { + @Getter + private String name; + @Getter + private String description; + + public PermissionRight(ResultSet set) throws SQLException { + this.name = set.getString("name"); + this.description = set.getString("description"); + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionSetting.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionSetting.java index 2232d90a..112fff27 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionSetting.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionSetting.java @@ -3,12 +3,12 @@ package com.eu.habbo.habbohotel.permissions; public enum PermissionSetting { DISALLOWED, ALLOWED, - ROOM_OWNER; + HAS_ROOM_RIGHTS; public static PermissionSetting fromString(String value) { return switch (value) { case "1" -> ALLOWED; - case "2" -> ROOM_OWNER; + case "2" -> HAS_ROOM_RIGHTS; default -> DISALLOWED; }; } diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java index 060beed3..e8fca734 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java @@ -1,64 +1,100 @@ package com.eu.habbo.habbohotel.permissions; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.plugin.HabboPlugin; -import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntIntHashMap; -import gnu.trove.map.hash.TIntObjectHashMap; import lombok.extern.slf4j.Slf4j; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; @Slf4j public class PermissionsManager { - private final TIntObjectHashMap ranks; - private final TIntIntHashMap enables; - private final THashMap> badges; + private final Map permissionGroups; + private final Map permissionCommands; + private final Map fixedCommands; + private final Map permissionRights; + private final TIntIntHashMap specialEnables; public PermissionsManager() { long millis = System.currentTimeMillis(); - this.ranks = new TIntObjectHashMap<>(); - this.enables = new TIntIntHashMap(); - this.badges = new THashMap<>(); - + this.permissionGroups = new HashMap<>(); + this.permissionCommands = new HashMap<>(); + this.fixedCommands = new HashMap<>(); + this.permissionRights = new HashMap<>(); + this.specialEnables = new TIntIntHashMap(); this.reload(); - log.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public void reload() { - this.loadPermissions(); + this.loadPermissionCommands(); + this.loadPermissionRights(); + this.loadPermissionGroups(); this.loadEnables(); + log.info(this.permissionGroups.size() + " ranks, " + this.permissionCommands.size() + " commands " + this.permissionRights.size() + " rights -> Loaded!"); } - private void loadPermissions() { - this.badges.clear(); - - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM permissions ORDER BY id ASC")) { + private void loadPermissionGroups() { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM permission_groups ORDER BY id ASC")) { while (set.next()) { - Rank rank; - if (!this.ranks.containsKey(set.getInt("id"))) { - rank = new Rank(set); - this.ranks.put(set.getInt("id"), rank); - } else { - rank = this.ranks.get(set.getInt("id")); - rank.load(set); - } + PermissionGroup permissionGroup = new PermissionGroup(set, this.permissionCommands); + this.permissionGroups.put(permissionGroup.getId(), permissionGroup); + } + } catch (SQLException e) { + log.error("Caught SQL exception", e); + } + } - if (!rank.getBadge().isEmpty()) { - if (!this.badges.containsKey(rank.getBadge())) { - this.badges.put(rank.getBadge(), new ArrayList<>()); - } + private void loadPermissionCommands() { + this.loadFixedCommands(); - this.badges.get(rank.getBadge()).add(rank); - } + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM permission_commands")) { + while (set.next()) { + PermissionCommand permissionCommand = new PermissionCommand(set); + this.permissionCommands.put(permissionCommand.getName(), permissionCommand); + } + } catch (SQLException e) { + log.error("Caught SQL exception", e); + } + } + + private void loadFixedCommands() { + String[] fixedCommandNames = { + "cmd_about", + "cmd_arcturus", + "cmd_commands", + "cmd_habnam", + "cmd_lay", + "cmd_mute_bots", + "cmd_mute_pets", + "cmd_plugins", + "cmd_sit", + "cmd_stand" + }; + + for(String command : fixedCommandNames) { + String description = Emulator.getTexts().getValue("commands.description." + command, "commands.description." + command); + String[] keys = Emulator.getTexts().getValue("commands.keys." + command).split(";"); + + this.fixedCommands.put(command, new PermissionCommand(command, description, keys)); + } + } + + public void addFixedCommand(PermissionCommand fixedCommand) { + this.fixedCommands.put(fixedCommand.getName(), fixedCommand); + } + + private void loadPermissionRights() { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM permission_rights")) { + while (set.next()) { + PermissionRight permissionRight = new PermissionRight(set); + this.permissionRights.put(permissionRight.getName(), permissionRight); } } catch (SQLException e) { log.error("Caught SQL exception", e); @@ -66,12 +102,12 @@ public class PermissionsManager { } private void loadEnables() { - synchronized (this.enables) { - this.enables.clear(); + synchronized (this.specialEnables) { + this.specialEnables.clear(); try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM special_enables")) { while (set.next()) { - this.enables.put(set.getInt("effect_id"), set.getInt("min_rank")); + this.specialEnables.put(set.getInt("effect_id"), set.getInt("min_rank")); } } catch (SQLException e) { log.error("Caught SQL exception", e); @@ -80,64 +116,43 @@ public class PermissionsManager { } - public boolean rankExists(int rankId) { - return this.ranks.containsKey(rankId); + public boolean groupExists(int groupId) { + return this.permissionGroups.containsKey(groupId); } - public Rank getRank(int rankId) { - return this.ranks.get(rankId); + public PermissionGroup getGroup(int groupId) { + return this.permissionGroups.get(groupId); } - - public Rank getRankByName(String rankName) { - for (Rank rank : this.ranks.valueCollection()) { - if (rank.getName().equalsIgnoreCase(rankName)) - return rank; - } - - return null; + public PermissionGroup getGroupByName(String name) { + return this.permissionGroups.values().stream().filter(group -> group.getName().equalsIgnoreCase(name)).findFirst().orElse(null); } - - public boolean isEffectBlocked(int effectId, int rank) { - return this.enables.contains(effectId) && this.enables.get(effectId) > rank; + public PermissionCommand getCommand(String name) { + return this.fixedCommands.getOrDefault(name, this.permissionCommands.get(name)); } - - public boolean hasPermission(Habbo habbo, String permission) { - return this.hasPermission(habbo, permission, false); + public PermissionCommand getCommandByKey(String key) { + return Stream.concat(this.fixedCommands.values().stream(), this.permissionCommands.values().stream()) + .filter(command -> command.hasKey(key)) + .findFirst() + .orElseGet(() -> null); } - - public boolean hasPermission(Habbo habbo, String permission, boolean withRoomRights) { - if (!this.hasPermission(habbo.getHabboInfo().getRank(), permission, withRoomRights)) { - for (HabboPlugin plugin : Emulator.getPluginManager().getPlugins()) { - if (plugin.hasPermission(habbo, permission)) { - return true; - } - } - - return false; - } - - return true; + public Collection getFixedCommands() { + return this.fixedCommands.values(); } - - public boolean hasPermission(Rank rank, String permission, boolean withRoomRights) { - return rank.hasPermission(permission, withRoomRights); + public boolean isFixedCommand(String name) { + return this.fixedCommands.containsKey(name); } - public Set getStaffBadges() { - return this.badges.keySet(); + public PermissionRight getRight(String name) { + return this.permissionRights.get(name); } - public List getRanksByBadgeCode(String code) { - return this.badges.get(code); - } - - public List getAllRanks() { - return new ArrayList<>(this.ranks.valueCollection()); + public boolean isEffectBlocked(int effectId, int groupId) { + return this.specialEnables.contains(effectId) && this.specialEnables.get(effectId) > groupId; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/Rank.java b/src/main/java/com/eu/habbo/habbohotel/permissions/Rank.java deleted file mode 100644 index 44e4de52..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/Rank.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.eu.habbo.habbohotel.permissions; - -import gnu.trove.map.hash.THashMap; -import lombok.Getter; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - -public class Rank { - - @Getter - private final int id; - - - @Getter - private final int level; - @Getter - private final THashMap permissions; - @Getter - private final THashMap variables; - @Getter - private String name; - @Getter - private String badge; - @Getter - private int roomEffect; - - - @Getter - private boolean logCommands; - - - @Getter - private String prefix; - - - @Getter - private String prefixColor; - - - private boolean hasPrefix; - @Getter - private int diamondsTimerAmount; - @Getter - private int creditsTimerAmount; - @Getter - private int pixelsTimerAmount; - @Getter - private int gotwTimerAmount; - - public Rank(ResultSet set) throws SQLException { - this.permissions = new THashMap<>(); - this.variables = new THashMap<>(); - this.id = set.getInt("id"); - this.level = set.getInt("level"); - this.diamondsTimerAmount = 1; - this.creditsTimerAmount = 1; - this.pixelsTimerAmount = 1; - this.gotwTimerAmount = 1; - - this.load(set); - } - - public void load(ResultSet set) throws SQLException { - ResultSetMetaData meta = set.getMetaData(); - this.name = set.getString("rank_name"); - this.badge = set.getString("badge"); - this.roomEffect = set.getInt("room_effect"); - this.logCommands = set.getString("log_commands").equals("1"); - this.prefix = set.getString("prefix"); - this.prefixColor = set.getString("prefix_color"); - this.diamondsTimerAmount = set.getInt("auto_points_amount"); - this.creditsTimerAmount = set.getInt("auto_credits_amount"); - this.pixelsTimerAmount = set.getInt("auto_pixels_amount"); - this.gotwTimerAmount = set.getInt("auto_gotw_amount"); - this.hasPrefix = !this.prefix.isEmpty(); - for (int i = 1; i < meta.getColumnCount() + 1; i++) { - String columnName = meta.getColumnName(i); - if (columnName.startsWith("cmd_") || columnName.startsWith("acc_")) { - this.permissions.put(meta.getColumnName(i), new Permission(columnName, PermissionSetting.fromString(set.getString(i)))); - } else { - this.variables.put(meta.getColumnName(i), set.getString(i)); - } - } - } - - public boolean hasPermission(String key, boolean isRoomOwner) { - if (this.permissions.containsKey(key)) { - Permission permission = this.permissions.get(key); - - return permission.getSetting() == PermissionSetting.ALLOWED || permission.getSetting() == PermissionSetting.ROOM_OWNER && isRoomOwner; - - } - - return false; - } - - public boolean hasPrefix() { - return this.hasPrefix; - } - -} - diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index acb5d87d..afb0a400 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -5,7 +5,6 @@ import com.eu.habbo.database.DatabaseConstants; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.VisitorBot; -import com.eu.habbo.habbohotel.commands.CommandHandler; import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; @@ -2611,7 +2610,7 @@ public class Room implements Comparable, ISerialize, Runnable { return; if (habbo.getRoomUnit().isInvisible() && Emulator.getConfig().getBoolean("invisible.prevent.chat", false)) { - if (!CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) { + if (!Emulator.getGameEnvironment().getCommandsManager().handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) { habbo.whisper(Emulator.getTexts().getValue("invisible.prevent.chat.error")); } @@ -2645,7 +2644,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (roomChatMessage == null || roomChatMessage.getMessage() == null || roomChatMessage.getMessage().equals("")) return; - if (!habbo.hasPermission(Permission.ACC_NOMUTE) && (!MUTEAREA_CAN_WHISPER || chatType != RoomChatType.WHISPER)) { + if (!habbo.hasRight(Permission.ACC_NOMUTE) && (!MUTEAREA_CAN_WHISPER || chatType != RoomChatType.WHISPER)) { for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionMuteArea.class)) { if (((InteractionMuteArea) area).inSquare(habbo.getRoomUnit().getCurrentLocation())) { return; @@ -2653,13 +2652,13 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if (!this.wordFilterWords.isEmpty() && !habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) { + if (!this.wordFilterWords.isEmpty() && !habbo.hasRight(Permission.ACC_CHAT_NO_FILTER)) { for (String string : this.wordFilterWords) { roomChatMessage.setMessage(roomChatMessage.getMessage().replaceAll("(?i)" + Pattern.quote(string), "bobba")); } } - if (!habbo.hasPermission(Permission.ACC_NOMUTE)) { + if (!habbo.hasRight(Permission.ACC_NOMUTE)) { if (this.isMuted() && !this.hasRights(habbo)) { return; } @@ -2671,7 +2670,7 @@ public class Room implements Comparable, ISerialize, Runnable { } if (chatType != RoomChatType.WHISPER) { - if (CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) { + if (Emulator.getGameEnvironment().getCommandsManager().handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) { WiredHandler.handle(WiredTriggerType.SAY_COMMAND, habbo.getRoomUnit(), habbo.getHabboInfo().getCurrentRoom(), new Object[]{roomChatMessage.getMessage()}); roomChatMessage.isCommand = true; return; @@ -2685,7 +2684,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD)) { + if (!habbo.hasRight(Permission.ACC_CHAT_NO_FLOOD)) { final int chatCounter = habbo.getHabboStats().getChatCounter().addAndGet(1); if (chatCounter > 3) { @@ -2711,7 +2710,7 @@ public class Room implements Comparable, ISerialize, Runnable { } if (prefixMessage == null) { - prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new UserNameChangedMessageComposer(habbo, true).compose() : null; + prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getPermissionGroup().hasPrefix() ? new UserNameChangedMessageComposer(habbo, true).compose() : null; } ServerMessage clearPrefixMessage = prefixMessage != null ? new UserNameChangedMessageComposer(habbo).compose() : null; @@ -2749,13 +2748,13 @@ public class Room implements Comparable, ISerialize, Runnable { continue; } - if (h.hasPermission(Permission.ACC_SEE_WHISPERS)) { + if (h.hasRight(Permission.ACC_SEE_WHISPERS)) { h.getClient().sendResponse(staffMessage); } } } else if (chatType == RoomChatType.TALK) { ServerMessage message = new ChatMessageComposer(roomChatMessage).compose(); - boolean noChatLimit = habbo.hasPermission(Permission.ACC_CHAT_NO_LIMIT); + boolean noChatLimit = habbo.hasRight(Permission.ACC_CHAT_NO_LIMIT); for (Habbo h : this.getHabbos()) { if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || @@ -2858,7 +2857,7 @@ public class Room implements Comparable, ISerialize, Runnable { * @param tentRectangle The whole tent area from where the sending Habbo is saying something */ private void showTentChatMessageOutsideTentIfPermitted(Habbo receivingHabbo, RoomChatMessage roomChatMessage, Rectangle tentRectangle) { - if (receivingHabbo != null && receivingHabbo.hasPermission(Permission.ACC_SEE_TENTCHAT) && tentRectangle != null && !RoomLayout.tileInSquare(tentRectangle, receivingHabbo.getRoomUnit().getCurrentLocation())) { + if (receivingHabbo != null && receivingHabbo.hasRight(Permission.ACC_SEE_TENTCHAT) && tentRectangle != null && !RoomLayout.tileInSquare(tentRectangle, receivingHabbo.getRoomUnit().getCurrentLocation())) { RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); staffChatMessage.setMessage("[" + Emulator.getTexts().getValue("hotel.room.tent.prefix") + "] " + staffChatMessage.getMessage()); final ServerMessage staffMessage = new WhisperMessageComposer(staffChatMessage).compose(); @@ -3386,7 +3385,7 @@ public class Room implements Comparable, ISerialize, Runnable { } public boolean isOwner(Habbo habbo) { - return habbo.getHabboInfo().getId() == this.ownerId || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + return habbo.getHabboInfo().getId() == this.ownerId || habbo.hasRight(Permission.ACC_ANYROOMOWNER); } public boolean hasRights(Habbo habbo) { @@ -3495,7 +3494,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if (habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || this.isOwner(habbo)) { + if (habbo.hasRight(Permission.ACC_ANYROOMOWNER) || this.isOwner(habbo)) { habbo.getClient().sendResponse(new YouAreOwnerMessageComposer()); flatCtrl = RoomRightLevels.MODERATOR; } else if (this.hasRights(habbo) && !this.hasGuild()) { @@ -3546,7 +3545,7 @@ public class Room implements Comparable, ISerialize, Runnable { public boolean isBanned(Habbo habbo) { RoomBan ban = this.bannedHabbos.get(habbo.getHabboInfo().getId()); - boolean banned = ban != null && ban.getEndTimestamp() > Emulator.getIntUnixTimestamp() && !habbo.hasPermission(Permission.ACC_ANYROOMOWNER) && !habbo.hasPermission("acc_enteranyroom"); + boolean banned = ban != null && ban.getEndTimestamp() > Emulator.getIntUnixTimestamp() && !habbo.hasRight(Permission.ACC_ANYROOMOWNER) && !habbo.hasRight(Permission.ACC_ENTERANYROOM); if (!banned && ban != null) { this.unbanHabbo(habbo.getHabboInfo().getId()); @@ -3796,7 +3795,7 @@ public class Room implements Comparable, ISerialize, Runnable { public void refreshGuildRightsInRoom() { for (Habbo habbo : this.getHabbos()) { if ((habbo.getHabboInfo().getCurrentRoom() == this && habbo.getHabboInfo().getId() != this.ownerId) - && (!(habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_MOVEROTATE)))) + && (!(habbo.hasRight(Permission.ACC_ANYROOMOWNER) || habbo.hasRight(Permission.ACC_MOVEROTATE)))) this.refreshRightsForHabbo(habbo); } } @@ -3961,7 +3960,7 @@ public class Room implements Comparable, ISerialize, Runnable { } rotation %= 8; - if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) { + if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasRight(Permission.ACC_MOVEROTATE)) { return FurnitureMovementError.NONE; } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java index b98fb364..f5ae4749 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java @@ -59,7 +59,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { this.bubble = RoomChatMessageBubbles.NORMAL; } - if (!message.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) { + if (!message.client.getHabbo().hasRight(Permission.ACC_ANYCHATCOLOR)) { for (Integer i : RoomChatMessage.BANNED_BUBBLES) { if (i == this.bubble.getType()) { this.bubble = RoomChatMessageBubbles.NORMAL; @@ -154,7 +154,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { @Override public void serialize(ServerMessage message) { if (this.habbo != null && this.bubble.isOverridable()) { - if (!this.habbo.hasPermission(Permission.ACC_ANYCHATCOLOR)) { + if (!this.habbo.hasRight(Permission.ACC_ANYCHATCOLOR)) { for (Integer i : RoomChatMessage.BANNED_BUBBLES) { if (i == this.bubble.getType()) { this.bubble = RoomChatMessageBubbles.NORMAL; @@ -165,7 +165,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { } if (!this.getBubble().getPermission().isEmpty()) { - if (this.habbo != null && !this.habbo.hasPermission(this.getBubble().getPermission())) { + if (this.habbo != null && !this.habbo.hasRight(this.getBubble().getPermission())) { this.bubble = RoomChatMessageBubbles.NORMAL; } } @@ -190,7 +190,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { } if (Emulator.getConfig().getBoolean("hotel.wordfilter.enabled", true) && Emulator.getConfig().getBoolean("hotel.wordfilter.rooms")) { - if (!this.habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) { + if (!this.habbo.hasRight(Permission.ACC_CHAT_NO_FILTER)) { if (!Emulator.getGameEnvironment().getWordFilter().autoReportCheck(this)) { if (!Emulator.getGameEnvironment().getWordFilter().hideMessageCheck(this.message)) { Emulator.getGameEnvironment().getWordFilter().filter(this, this.habbo); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 18c8e819..17bbb7e8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -192,7 +192,7 @@ public class RoomManager { public List roomCategoriesForHabbo(Habbo habbo) { List categories = new ArrayList<>(); for (RoomCategory category : this.roomCategories.values()) { - if (category.getMinRank() <= habbo.getHabboInfo().getRank().getId()) + if (category.getMinRank() <= habbo.getHabboInfo().getPermissionGroup().getId()) categories.add(category); } @@ -202,7 +202,7 @@ public class RoomManager { } public boolean hasCategory(int categoryId, Habbo habbo) { - return roomCategories.values().stream().anyMatch(c -> c.getId() == categoryId && c.getMinRank() <= habbo.getHabboInfo().getRank().getId()); + return roomCategories.values().stream().anyMatch(c -> c.getId() == categoryId && c.getMinRank() <= habbo.getHabboInfo().getPermissionGroup().getId()); } public List getRoomsByScore() { @@ -479,7 +479,7 @@ public class RoomManager { return; } - if (room.isBanned(habbo) && !habbo.hasPermission(Permission.ACC_ANYROOMOWNER) && !habbo.hasPermission(Permission.ACC_ENTERANYROOM)) { + if (room.isBanned(habbo) && !habbo.hasRight(Permission.ACC_ANYROOMOWNER) && !habbo.hasRight(Permission.ACC_ENTERANYROOM)) { habbo.getClient().sendResponse(new CantConnectMessageComposer(CantConnectMessageComposer.ROOM_ERROR_BANNED)); return; } @@ -495,8 +495,8 @@ public class RoomManager { if (overrideChecks || room.isOwner(habbo) || room.getState() == RoomState.OPEN || - habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || - habbo.hasPermission(Permission.ACC_ENTERANYROOM) || + habbo.hasRight(Permission.ACC_ANYROOMOWNER) || + habbo.hasRight(Permission.ACC_ENTERANYROOM) || room.hasRights(habbo) || (room.getState().equals(RoomState.INVISIBLE) && room.hasRights(habbo)) || (room.hasGuild() && room.getGuildRightLevel(habbo).isGreaterThan(RoomRightLevels.GUILD_RIGHTS))) { @@ -593,7 +593,7 @@ public class RoomManager { return; } - if (room.getUserCount() >= room.getUsersMax() && !habbo.hasPermission(Permission.ACC_FULLROOMS) && !room.hasRights(habbo)) { + if (room.getUserCount() >= room.getUsersMax() && !habbo.hasRight(Permission.ACC_FULLROOMS) && !room.hasRights(habbo)) { habbo.getClient().sendResponse(new CantConnectMessageComposer(CantConnectMessageComposer.ROOM_ERROR_GUESTROOM_FULL)); return; } @@ -633,7 +633,7 @@ public class RoomManager { habbo.getClient().sendResponse(new RoomRatingComposer(room.getScore(), !this.hasVotedForRoom(habbo, room))); - habbo.getRoomUnit().setFastWalk(habbo.getRoomUnit().isFastWalk() && habbo.hasPermission("cmd_fastwalk", room.hasRights(habbo))); + habbo.getRoomUnit().setFastWalk(habbo.getRoomUnit().isFastWalk() && habbo.hasCommand("cmd_fastwalk", room.hasRights(habbo))); if (room.isPromoted()) { habbo.getClient().sendResponse(new RoomEventComposer(room, room.getPromotion())); @@ -1370,7 +1370,7 @@ public class RoomManager { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); if (habbo != null) { - if (habbo.hasPermission(Permission.ACC_UNKICKABLE)) { + if (habbo.hasRight(Permission.ACC_UNKICKABLE)) { return; } @@ -1379,7 +1379,7 @@ public class RoomManager { HabboInfo info = HabboManager.getOfflineHabboInfo(userId); if (info != null) { - if (info.getRank().hasPermission(Permission.ACC_UNKICKABLE, false)) { + if (info.getPermissionGroup().hasRight(Permission.ACC_UNKICKABLE, false)) { return; } name = info.getUsername(); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java index cfdb7a3e..9ea87b62 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java @@ -187,14 +187,29 @@ public class Habbo implements Runnable { } } + public boolean canExecuteCommand(String key) { + return this.getHabboInfo().getPermissionGroup().canExecuteCommand(key, false); + } - public boolean hasPermission(String key) { - return this.hasPermission(key, false); + public boolean canExecuteCommand(String key, boolean hasRoomRights) { + return this.getHabboInfo().getPermissionGroup().canExecuteCommand(key, hasRoomRights); + } + + public boolean hasCommand(String key) { + return this.hasCommand(key, false); } - public boolean hasPermission(String key, boolean hasRoomRights) { - return Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this, key, hasRoomRights); + public boolean hasCommand(String name, boolean hasRoomRights) { + return this.getHabboInfo().getPermissionGroup().hasCommand(name, hasRoomRights); + } + + public boolean hasRight(String key) { + return this.hasRight(key, false); + } + + public boolean hasRight(String key, boolean hasRoomRights) { + return this.getHabboInfo().getPermissionGroup().hasRight(key, hasRoomRights); } @@ -390,7 +405,7 @@ public class Habbo implements Runnable { return; } - if (!this.hasPermission("acc_no_mute")) { + if (!this.hasRight("acc_no_mute")) { int remaining = this.habboStats.addMuteTime(seconds); this.client.sendResponse(new FloodControlMessageComposer(remaining)); this.client.sendResponse(new RemainingMutePeriodComposer(remaining)); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java index 1aee0e2c..43aa908d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java @@ -7,7 +7,7 @@ import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.games.GamePlayer; import com.eu.habbo.habbohotel.messenger.MessengerCategory; import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch; -import com.eu.habbo.habbohotel.permissions.Rank; +import com.eu.habbo.habbohotel.permissions.PermissionGroup; import com.eu.habbo.habbohotel.pets.PetTasks; import com.eu.habbo.habbohotel.pets.RideablePet; import com.eu.habbo.habbohotel.rooms.Room; @@ -50,7 +50,7 @@ public class HabboInfo implements Runnable { @Setter private int accountCreated; @Setter - private Rank rank; + private PermissionGroup permissionGroup; private int credits; @Setter private int lastOnline; @@ -98,12 +98,12 @@ public class HabboInfo implements Runnable { this.sso = set.getString("auth_ticket"); this.ipRegister = set.getString("ip_register"); this.ipLogin = set.getString("ip_current"); - this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank")); + this.permissionGroup = Emulator.getGameEnvironment().getPermissionsManager().getGroup(set.getInt("rank")); - if (this.rank == null) { + if (this.permissionGroup == null) { log.error("No existing rank found with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists."); log.warn(this.username + " has an invalid rank with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists."); - this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1); + this.permissionGroup = Emulator.getGameEnvironment().getPermissionsManager().getGroup(1); } this.accountCreated = set.getInt("account_created"); @@ -361,7 +361,7 @@ public class HabboInfo implements Runnable { statement.setInt(6, Emulator.getIntUnixTimestamp()); statement.setInt(8, this.homeRoom); statement.setString(9, this.ipLogin); - statement.setInt(10, this.rank != null ? this.rank.getId() : 1); + statement.setInt(10, this.permissionGroup != null ? this.permissionGroup.getId() : 1); statement.setString(11, this.machineID); statement.setString(12, this.username); statement.setInt(13, this.id); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index 2614bf47..f8a69995 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -3,7 +3,7 @@ package com.eu.habbo.habbohotel.users; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ModToolBan; import com.eu.habbo.habbohotel.permissions.Permission; -import com.eu.habbo.habbohotel.permissions.Rank; +import com.eu.habbo.habbohotel.permissions.PermissionGroup; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.catalog.*; import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigurationComposer; @@ -179,7 +179,7 @@ public class HabboManager { public void sendPacketToHabbosWithPermission(ServerMessage message, String perm) { synchronized (this.onlineHabbos) { for (Habbo habbo : this.onlineHabbos.values()) { - if (habbo.hasPermission(perm)) { + if (habbo.hasRight(perm)) { habbo.getClient().sendResponse(message); } } @@ -238,33 +238,33 @@ public class HabboManager { public void setRank(int userId, int rankId) throws Exception { Habbo habbo = this.getHabbo(userId); - if (!Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId)) { + if (!Emulator.getGameEnvironment().getPermissionsManager().groupExists(rankId)) { throw new Exception("Rank ID (" + rankId + ") does not exist"); } - Rank newRank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId); + PermissionGroup newPermissionGroup = Emulator.getGameEnvironment().getPermissionsManager().getGroup(rankId); if (habbo != null && habbo.getHabboStats() != null) { - Rank oldRank = habbo.getHabboInfo().getRank(); - if (!oldRank.getBadge().isEmpty()) { - habbo.deleteBadge(habbo.getInventory().getBadgesComponent().getBadge(oldRank.getBadge())); + PermissionGroup oldPermissionGroup = habbo.getHabboInfo().getPermissionGroup(); + if (!oldPermissionGroup.getBadge().isEmpty()) { + habbo.deleteBadge(habbo.getInventory().getBadgesComponent().getBadge(oldPermissionGroup.getBadge())); } - if(oldRank.getRoomEffect() > 0) { - habbo.getInventory().getEffectsComponent().getEffects().remove(oldRank.getRoomEffect()); + if(oldPermissionGroup.getRoomEffect() > 0) { + habbo.getInventory().getEffectsComponent().getEffects().remove(oldPermissionGroup.getRoomEffect()); } - habbo.getHabboInfo().setRank(newRank); + habbo.getHabboInfo().setPermissionGroup(newPermissionGroup); - if (!newRank.getBadge().isEmpty()) { - habbo.addBadge(newRank.getBadge()); + if (!newPermissionGroup.getBadge().isEmpty()) { + habbo.addBadge(newPermissionGroup.getBadge()); } - if(newRank.getRoomEffect() > 0) { - habbo.getInventory().getEffectsComponent().createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect()); + if(newPermissionGroup.getRoomEffect() > 0) { + habbo.getInventory().getEffectsComponent().createRankEffect(habbo.getHabboInfo().getPermissionGroup().getRoomEffect()); } habbo.getClient().sendResponse(new UserRightsMessageComposer(habbo)); habbo.getClient().sendResponse(new UserPerksComposer(habbo)); - if (habbo.hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (habbo.hasRight(Permission.ACC_SUPPORTTOOL)) { habbo.getClient().sendResponse(new ModeratorInitMessageComposer(habbo)); } habbo.getHabboInfo().run(); @@ -275,7 +275,7 @@ public class HabboManager { habbo.getClient().sendResponse(new MarketplaceConfigurationComposer()); habbo.getClient().sendResponse(new GiftWrappingConfigurationComposer()); habbo.getClient().sendResponse(new RecyclerPrizesComposer()); - habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_give_rank.new_rank").replace("id", newRank.getName())); + habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_give_rank.new_rank").replace("id", newPermissionGroup.getName())); } else { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users SET `rank` = ? WHERE id = ? LIMIT 1")) { statement.setInt(1, rankId); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 91266d72..122bac4d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -722,8 +722,8 @@ public class HabboStats implements Runnable { final Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); if (!Emulator.getConfig().getBoolean("hotel.allow.ignore.staffs")) { - final int ownRank = gameClient.getHabbo().getHabboInfo().getRank().getId(); - final int targetRank = target.getHabboInfo().getRank().getId(); + final int ownRank = gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId(); + final int targetRank = target.getHabboInfo().getPermissionGroup().getId(); if (targetRank >= ownRank) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.ignore_higher_rank"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java index e26be2df..56920133 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java @@ -1,7 +1,7 @@ package com.eu.habbo.habbohotel.users.inventory; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.permissions.Rank; +import com.eu.habbo.habbohotel.permissions.PermissionGroup; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; import gnu.trove.set.hash.THashSet; @@ -28,7 +28,7 @@ public class BadgesComponent { private static THashSet loadBadges(Habbo habbo) { THashSet badgesList = new THashSet<>(); - Set staffBadges = Emulator.getGameEnvironment().getPermissionsManager().getStaffBadges(); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users_badges WHERE user_id = ?")) { statement.setInt(1, habbo.getHabboInfo().getId()); @@ -36,20 +36,9 @@ public class BadgesComponent { while (set.next()) { HabboBadge badge = new HabboBadge(set, habbo); - if (staffBadges.contains(badge.getCode())) { - boolean delete = true; - - for (Rank rank : Emulator.getGameEnvironment().getPermissionsManager().getRanksByBadgeCode(badge.getCode())) { - if (rank.getId() == habbo.getHabboInfo().getRank().getId()) { - delete = false; - break; - } - } - - if (delete) { - deleteBadge(habbo.getHabboInfo().getId(), badge.getCode()); - continue; - } + if(!(habbo.getHabboInfo().getPermissionGroup().hasBadge() && habbo.getHabboInfo().getPermissionGroup().getBadge() == badge.getCode())) { + deleteBadge(habbo.getHabboInfo().getId(), badge.getCode()); + continue; } badgesList.add(badge); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java index 9602a21c..3ac89048 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java @@ -39,8 +39,8 @@ public class EffectsComponent { } catch (SQLException e) { log.error(CAUGHT_SQL_EXCEPTION, e); } - if(habbo.getHabboInfo().getRank().getRoomEffect() > 0) - this.createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect()); + if(habbo.getHabboInfo().getPermissionGroup().getRoomEffect() > 0) + this.createRankEffect(habbo.getHabboInfo().getPermissionGroup().getRoomEffect()); } public HabboEffect createEffect(int effectId) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertEvent.java b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertEvent.java index d86c44c6..45dfd6b6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertEvent.java @@ -12,7 +12,7 @@ import com.eu.habbo.plugin.events.support.SupportUserAlertedReason; public class AmbassadorAlertEvent extends MessageHandler { @Override public void handle() { - if (!this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) { ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.modtools.alert").replace("%username%", client.getHabbo().getHabboInfo().getUsername()).replace("%message%", "${notification.ambassador.alert.warning.message}")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/FollowFriendEvent.java b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/FollowFriendEvent.java index 0d73a799..4f3f7304 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/FollowFriendEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/FollowFriendEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.outgoing.rooms.RoomForwardMessageComposer; public class FollowFriendEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { + if (this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) { String username = this.packet.readString(); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username); diff --git a/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomEvent.java index ab8c181b..5e7762d4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.util.crypto.ZIP; public class RenderRoomEvent extends MessageHandler { @Override public void handle() { - if (!this.client.getHabbo().hasPermission("acc_camera")) { + if (!this.client.getHabbo().hasRight("acc_camera")) { this.client.getHabbo().alert(Emulator.getTexts().getValue("camera.permission")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomThumbnailEvent.java b/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomThumbnailEvent.java index aae3db4c..80c9c0f9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomThumbnailEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/camera/RenderRoomThumbnailEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.util.crypto.ZIP; public class RenderRoomThumbnailEvent extends MessageHandler { @Override public void handle() { - if (!this.client.getHabbo().hasPermission("acc_camera")) { + if (!this.client.getHabbo().hasRight("acc_camera")) { this.client.getHabbo().alert(Emulator.getTexts().getValue("camera.permission")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/GetCatalogPageEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/GetCatalogPageEvent.java index 0eb12453..ec24b22d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/GetCatalogPageEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/GetCatalogPageEvent.java @@ -17,7 +17,7 @@ public class GetCatalogPageEvent extends MessageHandler { CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(catalogPageId); if (catalogPageId > 0 && page != null) { - if (page.getRank() <= this.client.getHabbo().getHabboInfo().getRank().getId() && page.isEnabled()) { + if (page.getRank() <= this.client.getHabbo().getHabboInfo().getPermissionGroup().getId() && page.isEnabled()) { this.client.sendResponse(new CatalogPageMessageComposer(page, this.client.getHabbo(), offerId, mode)); } else { if (!page.isVisible()) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseEvent.java index 1657e79c..508253eb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseEvent.java @@ -19,10 +19,10 @@ public abstract class PurchaseEvent extends MessageHandler { if (this.client.getHabbo().getHabboInfo().getCredits() < totalCredits) return; - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_CREDITS)) this.client.getHabbo().giveCredits(-totalCredits); - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_POINTS)) this.client.getHabbo().givePoints(deal.getPointsType(), -totalDuckets); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java index 79970a88..8d9a156a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java @@ -133,7 +133,7 @@ public class PurchaseFromCatalogAsGiftEvent extends MessageHandler { return; } - if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId() || !page.isEnabled() || !page.isVisible()) { + if (page.getRank() > this.client.getHabbo().getHabboInfo().getPermissionGroup().getId() || !page.isEnabled() || !page.isVisible()) { this.client.sendResponse(new PurchaseNotAllowedMessageComposer(PurchaseNotAllowedMessageComposer.ILLEGAL)); return; } @@ -347,15 +347,15 @@ public class PurchaseFromCatalogAsGiftEvent extends MessageHandler { AchievementManager.progressAchievement(userId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftReceiver")); } - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_CREDITS)) { if (totalCredits > 0) { this.client.getHabbo().giveCredits(-totalCredits); } } if (totalPoints > 0) { - if (item.getPointsType() == 0 && !this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_PIXELS)) { + if (item.getPointsType() == 0 && !this.client.getHabbo().hasRight(Permission.ACC_INFINITE_PIXELS)) { this.client.getHabbo().givePixels(-totalPoints); - } else if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { + } else if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_POINTS)) { this.client.getHabbo().givePoints(item.getPointsType(), -totalPoints); } this.client.sendResponse(new HabboActivityPointNotificationMessageComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -totalPoints, item.getPointsType())); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogEvent.java index 12b2ebba..b0652399 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogEvent.java @@ -10,15 +10,12 @@ import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.rooms.RoomManager; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; -import com.eu.habbo.habbohotel.users.subscriptions.Subscription; -import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.catalog.PurchaseErrorMessageComposer; import com.eu.habbo.messages.outgoing.catalog.PurchaseNotAllowedMessageComposer; import com.eu.habbo.messages.outgoing.catalog.PurchaseOKMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComposer; import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer; -import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer; import com.eu.habbo.messages.outgoing.users.ActivityPointsMessageComposer; import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer; @@ -68,7 +65,7 @@ public class PurchaseFromCatalogEvent extends PurchaseEvent { if(page != null) { if (page.getCatalogItem(itemId).getOfferId() <= 0) { page = null; - } else if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) { + } else if (page.getRank() > this.client.getHabbo().getHabboInfo().getPermissionGroup().getId()) { page = null; } else if (page.getLayout() != null && page.getLayout().equalsIgnoreCase(CatalogPageLayouts.club_gift.name())) { page = null; @@ -103,11 +100,11 @@ public class PurchaseFromCatalogEvent extends PurchaseEvent { return; } ((RoomBundleLayout) page).buyRoom(this.client.getHabbo()); - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { //if the player has this perm disabled + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_CREDITS)) { //if the player has this perm disabled this.client.getHabbo().getHabboInfo().addCredits(-roomBundleItem.getCredits()); // takes their credits away this.client.sendResponse(new CreditBalanceComposer(this.client.getHabbo())); // Sends the updated currency composer window } - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { //if the player has this perm disabled + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_POINTS)) { //if the player has this perm disabled this.client.getHabbo().getHabboInfo().addCurrencyAmount(roomBundleItem.getPointsType(), -roomBundleItem.getPoints()); // takes their points away this.client.sendResponse(new ActivityPointsMessageComposer(this.client.getHabbo())); // Sends the updated currency composer window } @@ -139,7 +136,7 @@ public class PurchaseFromCatalogEvent extends PurchaseEvent { return; } - if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) { + if (page.getRank() > this.client.getHabbo().getHabboInfo().getPermissionGroup().getId()) { this.client.sendResponse(new PurchaseNotAllowedMessageComposer(PurchaseNotAllowedMessageComposer.ILLEGAL)); return; } @@ -175,13 +172,13 @@ public class PurchaseFromCatalogEvent extends PurchaseEvent { item = page.getCatalogItem(itemId); // temp patch, can a dev with better knowledge than me look into this asap pls. if (page instanceof BotsLayout) { - if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { + if (!this.client.getHabbo().hasRight(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { this.client.getHabbo().alert(Emulator.getTexts().getValue("error.bots.max.inventory").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); return; } } if (page instanceof PetsLayout) { // checks it's the petlayout - if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) { + if (!this.client.getHabbo().hasRight(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) { this.client.getHabbo().alert(Emulator.getTexts().getValue("error.pets.max.inventory").replace("%amount%", PetManager.MAXIMUM_PET_INVENTORY_SIZE + "")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java index d834243c..262e8530 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java @@ -22,7 +22,7 @@ public class PresentOpenEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { HabboItem item = room.getHabboItem(this.packet.readInt()); if (item == null) diff --git a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java index ac1cbec8..a6727ac1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java @@ -23,7 +23,7 @@ public class UpdateFloorPropertiesEvent extends MessageHandler { @Override public void handle() { - if (!this.client.getHabbo().hasPermission(Permission.ACC_FLOORPLAN_EDITOR)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_FLOORPLAN_EDITOR)) { this.client.sendResponse(new HabboBroadcastMessageComposer(Emulator.getTexts().getValue("floorplan.permission"))); return; } @@ -33,7 +33,7 @@ public class UpdateFloorPropertiesEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { StringJoiner errors = new StringJoiner("
"); String map = this.packet.readString(); map = map.replace("X", "x"); diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java index ed63d16c..95e44a1d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java @@ -64,12 +64,12 @@ public class AcceptFriendEvent extends MessageHandler { continue; } - if(this.client.getHabbo().getMessenger().getFriends().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasPermission("acc_infinite_friends")) { + if(this.client.getHabbo().getMessenger().getFriends().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasRight("acc_infinite_friends")) { this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_OWN_FULL)); break; } - if(target.getMessenger().getFriends().size() >= target.getHabboStats().getMaxFriends() && !target.hasPermission("acc_infinite_friends")) { + if(target.getMessenger().getFriends().size() >= target.getHabboStats().getMaxFriends() && !target.hasRight("acc_infinite_friends")) { this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_TARGET_FULL)); continue; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/RequestFriendEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/RequestFriendEvent.java index 0716d713..bba6e3cf 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/RequestFriendEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/RequestFriendEvent.java @@ -63,13 +63,13 @@ public class RequestFriendEvent extends MessageHandler { } // You can only have x friends - if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasPermission("acc_infinite_friends")) { + if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasRight("acc_infinite_friends")) { this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_OWN_FULL)); return; } // Check if targets friendlist is full - if (targetHabbo.getMessenger().getFriends().values().size() >= targetHabbo.getHabboStats().getMaxFriends() && !targetHabbo.hasPermission("acc_infinite_friends")) { + if (targetHabbo.getMessenger().getFriends().values().size() >= targetHabbo.getHabboStats().getMaxFriends() && !targetHabbo.hasRight("acc_infinite_friends")) { this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_TARGET_FULL)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/VisitUserEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/VisitUserEvent.java index e9563b8d..d41605f9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/VisitUserEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/VisitUserEvent.java @@ -29,7 +29,7 @@ public class VisitUserEvent extends MessageHandler { return; } - if (habbo.getHabboStats().isBlockFollowing() && !this.client.getHabbo().hasPermission("acc_can_stalk")) { + if (habbo.getHabboStats().isBlockFollowing() && !this.client.getHabbo().hasRight("acc_can_stalk")) { this.client.sendResponse(new FollowFriendFailedComposer(FollowFriendFailedComposer.FRIEND_BLOCKED_STALKING)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/guides/GuideSessionOnDutyUpdateEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guides/GuideSessionOnDutyUpdateEvent.java index d875b6bc..a3a50337 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guides/GuideSessionOnDutyUpdateEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guides/GuideSessionOnDutyUpdateEvent.java @@ -15,13 +15,13 @@ public class GuideSessionOnDutyUpdateEvent extends MessageHandler { boolean helperRequests = this.packet.readBoolean(); boolean bullyReports = this.packet.readBoolean(); - if (!this.client.getHabbo().hasPermission(Permission.ACC_HELPER_USE_GUIDE_TOOL)) + if (!this.client.getHabbo().hasRight(Permission.ACC_HELPER_USE_GUIDE_TOOL)) return; - if (helperRequests && !this.client.getHabbo().hasPermission(Permission.ACC_HELPER_GIVE_GUIDE_TOURS)) + if (helperRequests && !this.client.getHabbo().hasRight(Permission.ACC_HELPER_GIVE_GUIDE_TOURS)) helperRequests = false; - if (bullyReports && !this.client.getHabbo().hasPermission(Permission.ACC_HELPER_JUDGE_CHAT_REVIEWS)) + if (bullyReports && !this.client.getHabbo().hasRight(Permission.ACC_HELPER_JUDGE_CHAT_REVIEWS)) bullyReports = false; if (helperRequests) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/AddAdminRightsToMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/AddAdminRightsToMemberEvent.java index f73fa9fa..a8c6faa6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/AddAdminRightsToMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/AddAdminRightsToMemberEvent.java @@ -18,7 +18,7 @@ public class AddAdminRightsToMemberEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); - if (guild != null && (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN))) { + if (guild != null && (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN))) { Emulator.getGameEnvironment().getGuildManager().setAdmin(guild, userId); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java index bec851c2..ff32b0d2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java @@ -30,7 +30,7 @@ public class ApproveMembershipRequestEvent extends MessageHandler { else userInfo = habbo.getHabboInfo(); - if (userInfo == null || groupMember == null || userId == this.client.getHabbo().getHabboInfo().getId() || (!this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN) && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !groupMember.getRank().equals(GuildRank.ADMIN) && !groupMember.getRank().equals(GuildRank.OWNER))) + if (userInfo == null || groupMember == null || userId == this.client.getHabbo().getHabboInfo().getId() || (!this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN) && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !groupMember.getRank().equals(GuildRank.ADMIN) && !groupMember.getRank().equals(GuildRank.OWNER))) return; if (!userInfo.getHabboStats().hasGuild(guild.getId())) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/CreateGuildEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/CreateGuildEvent.java index 4a36ac88..26945507 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/CreateGuildEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/CreateGuildEvent.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.modtool.ScripterManager; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.catalog.PurchaseErrorMessageComposer; import com.eu.habbo.messages.outgoing.catalog.PurchaseOKMessageComposer; import com.eu.habbo.messages.outgoing.guilds.GuildCreatedMessageComposer; @@ -32,7 +31,7 @@ public class CreateGuildEvent extends GuildBadgeEvent { return; } - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_CREDITS)) { int guildPrice = Emulator.getConfig().getInt("catalog.guild.price"); if (this.client.getHabbo().getHabboInfo().getCredits() >= guildPrice) { this.client.getHabbo().giveCredits(-guildPrice); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/DeactivateGuildEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/DeactivateGuildEvent.java index 1967de36..8e36cedf 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/DeactivateGuildEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/DeactivateGuildEvent.java @@ -20,7 +20,7 @@ public class DeactivateGuildEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) //TODO Add staff permission override. + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) //TODO Add staff permission override. { THashSet members = Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GetGuildMembersEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GetGuildMembersEvent.java index 03a92203..1fdfe6f4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GetGuildMembersEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GetGuildMembersEvent.java @@ -19,7 +19,7 @@ public class GetGuildMembersEvent extends MessageHandler { Guild g = Emulator.getGameEnvironment().getGuildManager().getGuild(groupId); if (g != null) { - boolean isAdmin = this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN); + boolean isAdmin = this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN); if (!isAdmin && this.client.getHabbo().getHabboStats().hasGuild(g.getId())) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(g, this.client.getHabbo()); isAdmin = member != null && (member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GetMemberGuildItemCountEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GetMemberGuildItemCountEvent.java index b2e20383..472001bb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GetMemberGuildItemCountEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GetMemberGuildItemCountEvent.java @@ -19,7 +19,7 @@ public class GetMemberGuildItemCountEvent extends MessageHandler { if (guild == null) return; GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && (member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN))) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && (member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN))) || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId()); int count = 0; if (room != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/KickMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/KickMemberEvent.java index b769d9b9..ff80c26d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/KickMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/KickMemberEvent.java @@ -24,7 +24,7 @@ public class KickMemberEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN) || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo); Emulator.getPluginManager().fireEvent(removedMemberEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RejectMembershipRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RejectMembershipRequestEvent.java index 400c2d81..b2eb9cb4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RejectMembershipRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RejectMembershipRequestEvent.java @@ -23,7 +23,7 @@ public class RejectMembershipRequestEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN)|| member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN)|| member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { guild.decreaseRequestCount(); Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId); this.client.sendResponse(new GuildMembersComposer(guild, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild, 0, 0, ""), this.client.getHabbo(), 0, 0, "", true, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(guild, 0, ""))); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RemoveAdminRightsFromMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RemoveAdminRightsFromMemberEvent.java index 10bad279..81a38874 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RemoveAdminRightsFromMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RemoveAdminRightsFromMemberEvent.java @@ -19,7 +19,7 @@ public class RemoveAdminRightsFromMemberEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { int userId = this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildBadgeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildBadgeEvent.java index 713ed406..434857b9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildBadgeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildBadgeEvent.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.guilds.GuildChangedBadgeEvent; public class UpdateGuildBadgeEvent extends GuildBadgeEvent { @@ -14,7 +13,7 @@ public class UpdateGuildBadgeEvent extends GuildBadgeEvent { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId()); if (room == null || room.getId() != guild.getRoomId()) diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildColorsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildColorsEvent.java index 700ec0c3..37bc64e6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildColorsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildColorsEvent.java @@ -15,7 +15,7 @@ public class UpdateGuildColorsEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { GuildChangedColorsEvent colorsEvent = new GuildChangedColorsEvent(guild, this.packet.readInt(), this.packet.readInt()); Emulator.getPluginManager().fireEvent(colorsEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildIdentityEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildIdentityEvent.java index 488b15cc..3e89e0e1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildIdentityEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildIdentityEvent.java @@ -15,7 +15,7 @@ public class UpdateGuildIdentityEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { GuildChangedNameEvent nameEvent = new GuildChangedNameEvent(guild, this.packet.readString(), this.packet.readString()); Emulator.getPluginManager().fireEvent(nameEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildSettingsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildSettingsEvent.java index 2231b9f1..5edff097 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildSettingsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/UpdateGuildSettingsEvent.java @@ -16,7 +16,7 @@ public class UpdateGuildSettingsEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN)) { GuildChangedSettingsEvent settingsEvent = new GuildChangedSettingsEvent(guild, this.packet.readInt(), this.packet.readInt() == 0); Emulator.getPluginManager().fireEvent(settingsEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GetMessagesEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GetMessagesEvent.java index ade09389..81b7c012 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GetMessagesEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GetMessagesEvent.java @@ -27,7 +27,7 @@ public class GetMessagesEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); ForumThread thread = ForumThread.getById(threadId); - boolean hasStaffPermissions = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); + boolean hasStaffPermissions = this.client.getHabbo().hasRight(Permission.ACC_MODTOOL_TICKET_Q); if (guild == null || thread == null) { this.client.sendResponse(new ErrorReportComposer(404)); return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateMessageEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateMessageEvent.java index a92b5c88..5a23932d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateMessageEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateMessageEvent.java @@ -37,7 +37,7 @@ public class ModerateMessageEvent extends MessageHandler { return; } - boolean hasStaffPermissions = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); + boolean hasStaffPermissions = this.client.getHabbo().hasRight(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); if (member == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateThreadEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateThreadEvent.java index 77dd0e52..fa36ff78 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateThreadEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/ModerateThreadEvent.java @@ -33,7 +33,7 @@ public class ModerateThreadEvent extends MessageHandler { } GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); - boolean hasStaffPerms = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); // check for if they have staff perm + boolean hasStaffPerms = this.client.getHabbo().hasRight(Permission.ACC_MODTOOL_TICKET_Q); // check for if they have staff perm boolean isGuildAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/PostMessageEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/PostMessageEvent.java index 2789a3ba..90723b3d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/PostMessageEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/PostMessageEvent.java @@ -39,7 +39,7 @@ public class PostMessageEvent extends MessageHandler { return; } - boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); + boolean isStaff = this.client.getHabbo().hasRight(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/UpdateThreadEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/UpdateThreadEvent.java index 1e6d1fd8..9f3b433b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/UpdateThreadEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/UpdateThreadEvent.java @@ -30,7 +30,7 @@ public class UpdateThreadEvent extends MessageHandler { return; } - boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); + boolean isStaff = this.client.getHabbo().hasRight(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); if (member == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SSOTicketEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SSOTicketEvent.java index 9180e8b4..7b4ddfdb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SSOTicketEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SSOTicketEvent.java @@ -103,7 +103,7 @@ public class SSOTicketEvent extends MessageHandler { return; } - if (this.client.getHabbo().getHabboInfo().getRank() == null) { + if (this.client.getHabbo().getHabboInfo().getPermissionGroup() == null) { throw new NullPointerException(habbo.getHabboInfo().getUsername() + " has a NON EXISTING RANK!"); } @@ -217,7 +217,7 @@ public class SSOTicketEvent extends MessageHandler { messages.add(new ScrSendUserInfoComposer(this.client.getHabbo(), SubscriptionHabboClub.HABBO_CLUB, ScrSendUserInfoComposer.RESPONSE_TYPE_LOGIN).compose()); - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { messages.add(new ModeratorInitMessageComposer(this.client.getHabbo()).compose()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssueDefaultActionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssueDefaultActionEvent.java index 7fbeffa5..50458749 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssueDefaultActionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssueDefaultActionEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class CloseIssueDefaultActionEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int issueId = this.packet.readInt(); int unknown = this.packet.readInt(); int category = this.packet.readInt(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssuesEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssuesEvent.java index f5775215..48b78115 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssuesEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/CloseIssuesEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class CloseIssuesEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int state = this.packet.readInt(); int something = this.packet.readInt(); int ticketId = this.packet.readInt(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetCfhChatlogEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetCfhChatlogEvent.java index 987aeb43..d8bfa94f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetCfhChatlogEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetCfhChatlogEvent.java @@ -15,7 +15,7 @@ import java.util.stream.Collectors; public class GetCfhChatlogEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { ModToolIssue issue = Emulator.getGameEnvironment().getModToolManager().getTicket(this.packet.readInt()); if (issue != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorRoomInfoEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorRoomInfoEvent.java index 41d1e869..06b9e539 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorRoomInfoEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorRoomInfoEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.messages.outgoing.modtool.ModeratorRoomInfoComposer; public class GetModeratorRoomInfoEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int roomId = this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorUserInfoEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorUserInfoEvent.java index 64f49f14..5b234a01 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorUserInfoEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetModeratorUserInfoEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class GetModeratorUserInfoEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { ModToolManager.requestUserInfo(this.client, this.packet); } else { ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.userinfo").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername())); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomChatlogEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomChatlogEvent.java index 19c1304e..827fcd57 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomChatlogEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomChatlogEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.messages.outgoing.modtool.RoomChatlogComposer; public class GetRoomChatlogEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.packet.readInt()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomVisitsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomVisitsEvent.java index 7c78de42..449df7c5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomVisitsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetRoomVisitsEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.outgoing.modtool.RoomVisitsComposer; public class GetRoomVisitsEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int userId = this.packet.readInt(); HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java index eff8002f..355ae337 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.messages.outgoing.modtool.UserChatlogComposer; public class GetUserChatlogEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int userId = this.packet.readInt(); String username = HabboManager.getOfflineHabboInfo(userId).getUsername(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModAlertEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModAlertEvent.java index 02c1e659..99df9398 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModAlertEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModAlertEvent.java @@ -18,7 +18,7 @@ public class ModAlertEvent extends MessageHandler { String message = this.packet.readString(); int cfhTopic = this.packet.readInt(); - if (!this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) return; + if (!this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) return; Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); if (habbo == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModBanEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModBanEvent.java index c6b64030..8e3ec701 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModBanEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModBanEvent.java @@ -52,7 +52,7 @@ public class ModBanEvent extends MessageHandler { case BAN_AVATAR_ONLY_100_YEARS: duration = Emulator.getIntUnixTimestamp(); } - if (!this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.modtools.ban").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername())); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMessageEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMessageEvent.java index 5bba9bf0..6b041f63 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMessageEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMessageEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.plugin.events.support.SupportUserAlertedReason; public class ModMessageEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { Habbo alertedUser = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.packet.readInt()); if (alertedUser != null) diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMuteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMuteEvent.java index 063ebc29..4bca6e02 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMuteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModMuteEvent.java @@ -20,7 +20,7 @@ public class ModMuteEvent extends MessageHandler { String message = this.packet.readString(); int cfhTopic = this.packet.readInt(); - if (!this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) return; + if (!this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) return; Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); if (habbo == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolRequestRoomUserChatlogEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolRequestRoomUserChatlogEvent.java index f0d5a835..6bfdaa56 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolRequestRoomUserChatlogEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolRequestRoomUserChatlogEvent.java @@ -11,7 +11,7 @@ import com.eu.habbo.messages.outgoing.modtool.RoomChatlogComposer; public class ModToolRequestRoomUserChatlogEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int userId = this.packet.readInt(); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolSanctionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolSanctionEvent.java index 1352c98f..a9c62836 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolSanctionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolSanctionEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.threading.runnables.UpdateModToolIssue; public class ModToolSanctionEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int ticketId = this.packet.readInt(); int unknownInt = this.packet.readInt(); int categoryId = this.packet.readInt(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolWarnEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolWarnEvent.java index 713ca5f5..ee1e38aa 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolWarnEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolWarnEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.plugin.events.support.SupportUserAlertedReason; public class ModToolWarnEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { Habbo alertedUser = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.packet.readInt()); if (alertedUser != null) diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModTradingLockEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModTradingLockEvent.java index f46d1e95..2a0fbf6f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModTradingLockEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModTradingLockEvent.java @@ -19,7 +19,7 @@ public class ModTradingLockEvent extends MessageHandler { int duration = this.packet.readInt(); int cfhTopic = this.packet.readInt(); - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); if (habbo != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModerateRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModerateRoomEvent.java index ff49f916..7d08216d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModerateRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModerateRoomEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class ModerateRoomEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.packet.readInt()); if (room != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModeratorActionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModeratorActionEvent.java index b5ae08d4..a9c7171e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModeratorActionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModeratorActionEvent.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class ModeratorActionEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int type = this.packet.readInt(); Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/PickIssuesEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/PickIssuesEvent.java index baca0eba..df10877e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/PickIssuesEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/PickIssuesEvent.java @@ -13,7 +13,7 @@ public class PickIssuesEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { this.packet.readInt(); ModToolIssue issue = Emulator.getGameEnvironment().getModToolManager().getTicket(this.packet.readInt()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReleaseIssuesEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReleaseIssuesEvent.java index ac0d562c..2a832cfc 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReleaseIssuesEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReleaseIssuesEvent.java @@ -10,7 +10,7 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class ReleaseIssuesEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { + if (this.client.getHabbo().hasRight(Permission.ACC_SUPPORTTOOL)) { int count = this.packet.readInt(); while (count != 0) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/CreateFlatEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/CreateFlatEvent.java index f5e949db..b8eb6de7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/CreateFlatEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/CreateFlatEvent.java @@ -28,7 +28,7 @@ public class CreateFlatEvent extends MessageHandler { RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(categoryId); - if (category == null || category.getMinRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) { + if (category == null || category.getMinRank() > this.client.getHabbo().getHabboInfo().getPermissionGroup().getId()) { log.error("[SCRIPTER] Incorrect rank or non existing category ID: \"" + categoryId + "\"." + this.client.getHabbo().getHabboInfo().getUsername()); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/NewNavigatorSearchEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/NewNavigatorSearchEvent.java index 1ba345b6..e58b2b30 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/NewNavigatorSearchEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/NewNavigatorSearchEvent.java @@ -128,7 +128,7 @@ public class NewNavigatorSearchEvent extends MessageHandler { } } - SearchResultList list = new SearchResultList(0, "query", "", SearchAction.NONE, ListMode.LIST, DisplayMode.VISIBLE, new ArrayList<>(searchRooms.values()), true, this.client.getHabbo().hasPermission(Permission.ACC_ENTERANYROOM) || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER), DisplayOrder.ACTIVITY, -1); + SearchResultList list = new SearchResultList(0, "query", "", SearchAction.NONE, ListMode.LIST, DisplayMode.VISIBLE, new ArrayList<>(searchRooms.values()), true, this.client.getHabbo().hasRight(Permission.ACC_ENTERANYROOM) || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER), DisplayOrder.ACTIVITY, -1); nList.add(list); return nList; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RoomTextSearchEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RoomTextSearchEvent.java index 25989407..b3ce898b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RoomTextSearchEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RoomTextSearchEvent.java @@ -1,7 +1,7 @@ package com.eu.habbo.messages.incoming.navigator; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.permissions.Rank; +import com.eu.habbo.habbohotel.permissions.PermissionGroup; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.MessageHandler; @@ -9,11 +9,10 @@ import com.eu.habbo.messages.outgoing.navigator.GuestRoomSearchResultComposer; import com.eu.habbo.plugin.events.navigator.NavigatorSearchResultEvent; import gnu.trove.map.hash.THashMap; -import java.util.ArrayList; import java.util.List; public class RoomTextSearchEvent extends MessageHandler { - public final static THashMap> cachedResults = new THashMap<>(4); + public final static THashMap> cachedResults = new THashMap<>(4); @Override public void handle() { @@ -24,10 +23,10 @@ public class RoomTextSearchEvent extends MessageHandler { List rooms; ServerMessage message = null; - if (cachedResults.containsKey(this.client.getHabbo().getHabboInfo().getRank())) { - message = cachedResults.get(this.client.getHabbo().getHabboInfo().getRank()).get((name + "\t" + query).toLowerCase()); + if (cachedResults.containsKey(this.client.getHabbo().getHabboInfo().getPermissionGroup())) { + message = cachedResults.get(this.client.getHabbo().getHabboInfo().getPermissionGroup()).get((name + "\t" + query).toLowerCase()); } else { - cachedResults.put(this.client.getHabbo().getHabboInfo().getRank(), new THashMap<>()); + cachedResults.put(this.client.getHabbo().getHabboInfo().getPermissionGroup(), new THashMap<>()); } if (message == null) { @@ -48,14 +47,14 @@ public class RoomTextSearchEvent extends MessageHandler { } message = new GuestRoomSearchResultComposer(rooms).compose(); - THashMap map = cachedResults.get(this.client.getHabbo().getHabboInfo().getRank()); + THashMap map = cachedResults.get(this.client.getHabbo().getHabboInfo().getPermissionGroup()); if (map == null) { map = new THashMap<>(1); } map.put((name + "\t" + query).toLowerCase(), message); - cachedResults.put(this.client.getHabbo().getHabboInfo().getRank(), map); + cachedResults.put(this.client.getHabbo().getHabboInfo().getPermissionGroup(), map); NavigatorSearchResultEvent event = new NavigatorSearchResultEvent(this.client.getHabbo(), prefix, query, rooms); if (Emulator.getPluginManager().fireEvent(event).isCancelled()) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/GetFlatControllersEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/GetFlatControllersEvent.java index 4c301c3a..6054e8f9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/GetFlatControllersEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/GetFlatControllersEvent.java @@ -13,7 +13,7 @@ public class GetFlatControllersEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { this.client.sendResponse(new FlatControllersComposer(room)); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RemoveAllRightsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RemoveAllRightsEvent.java index d7e18764..1a96ec8b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RemoveAllRightsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RemoveAllRightsEvent.java @@ -17,7 +17,7 @@ public class RemoveAllRightsEvent extends MessageHandler { if (room == null || room.getId() != this.packet.readInt()) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { room.getRights().forEach(value -> { Habbo habbo = room.getHabbo(value); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java index a9e9fc63..5809d1fd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java @@ -17,7 +17,7 @@ public class RequestRoomPropertySet extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) { int itemId = this.packet.readInt(); HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java index 7733496d..25f7df27 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java @@ -16,7 +16,7 @@ public class SetRoomBackgroundColorDataEvent extends MessageHandler { if (room == null) return; - if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI)) { + if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI)) { HabboItem item = room.getHabboItem(itemId); if (item == null) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/SubmitRoomToCompetitionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/SubmitRoomToCompetitionEvent.java index f6a1b5e4..d2e40610 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/SubmitRoomToCompetitionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/SubmitRoomToCompetitionEvent.java @@ -12,7 +12,7 @@ import com.eu.habbo.messages.outgoing.rooms.GetGuestRoomResultComposer; public class SubmitRoomToCompetitionEvent extends MessageHandler { @Override public void handle() { - if (this.client.getHabbo().hasPermission(Permission.ACC_STAFF_PICK)) { + if (this.client.getHabbo().hasRight(Permission.ACC_STAFF_PICK)) { int roomId = this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/ToggleStaffPickEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/ToggleStaffPickEvent.java index 0b46f0cd..af162d35 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/ToggleStaffPickEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/ToggleStaffPickEvent.java @@ -12,7 +12,7 @@ import com.eu.habbo.messages.outgoing.rooms.GetGuestRoomResultComposer; public class ToggleStaffPickEvent extends MessageHandler { @Override public void handle() throws Exception { - if (this.client.getHabbo().hasPermission(Permission.ACC_STAFF_PICK)) { + if (this.client.getHabbo().hasRight(Permission.ACC_STAFF_PICK)) { int roomId = this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/CommandBotEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/CommandBotEvent.java index 0c8bb4d7..91d18c51 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/CommandBotEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/CommandBotEvent.java @@ -26,7 +26,7 @@ public class CommandBotEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { int botId = this.packet.readInt(); Bot bot = room.getBot(Math.abs(botId)); @@ -74,7 +74,7 @@ public class CommandBotEvent extends MessageHandler { String result = Emulator.getGameEnvironment().getWordFilter().filter(s, this.client.getHabbo()); if (!result.isEmpty()) { - if (!this.client.getHabbo().hasPermission(Permission.ACC_CHAT_NO_FILTER)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_CHAT_NO_FILTER)) { result = Emulator.getGameEnvironment().getWordFilter().filter(result, this.client.getHabbo()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/GetBotCommandConfigurationDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/GetBotCommandConfigurationDataEvent.java index 2dbe51c3..1945016b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/GetBotCommandConfigurationDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/GetBotCommandConfigurationDataEvent.java @@ -14,7 +14,7 @@ public class GetBotCommandConfigurationDataEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { int botId = this.packet.readInt(); Bot bot = room.getBot(Math.abs(botId)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java index aa0c27d9..0e4fea1d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages.incoming.rooms.items; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.CommandHandler; import com.eu.habbo.habbohotel.items.PostItColor; import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt; import com.eu.habbo.habbohotel.rooms.Room; @@ -23,12 +22,12 @@ public class AddSpamWallPostItEvent extends MessageHandler { this.packet.readString(); String color = this.packet.readString(); if (itemId == -1234) { - if (this.client.getHabbo().hasPermission("cmd_multi")) { + if (this.client.getHabbo().hasCommand("cmd_multi")) { String[] commands = this.packet.readString().split("\r"); Arrays.stream(commands) .map(command -> command.replace("
", "\r")) - .forEach(command -> CommandHandler.handleCommand(this.client, command)); + .forEach(command -> Emulator.getGameEnvironment().getCommandsManager().handleCommand(this.client, command)); } else { log.info("Scripter Alert! " + this.client.getHabbo().getHabboInfo().getUsername() + " | " + this.packet.readString()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java index f81d31af..62609bfc 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java @@ -17,7 +17,7 @@ public class MoveWallItemEvent extends MessageHandler { if (room == null) return; - if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) && !(room.getGuildId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) { + if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI) && !(room.getGuildId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) { this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode())); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java index 8755eb93..162fd074 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java @@ -29,7 +29,7 @@ public class PickupObjectEvent extends MessageHandler { room.pickUpItem(item, this.client.getHabbo()); } else { if (room.hasRights(this.client.getHabbo())) { - if (this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { item.setUserId(this.client.getHabbo().getHabboInfo().getId()); } else if (this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId() && item.getUserId() == room.getOwnerId()) { return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java index 53c1f789..44b57ac3 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java @@ -23,7 +23,7 @@ public class RemoveItemEvent extends MessageHandler { HabboItem item = room.getHabboItem(itemId); if (item instanceof InteractionPostIt || item instanceof InteractionExternalImage) { - if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { item.setRoomId(0); room.removeHabboItem(item); room.sendComposer(new ItemRemoveMessageComposer(item).compose()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java index cc971be5..21782bc2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java @@ -22,7 +22,7 @@ public class SetObjectDataEvent extends MessageHandler { if (item == null) return; - if (item instanceof InteractionRoomAds && !this.client.getHabbo().hasPermission("acc_ads_background")) { + if (item instanceof InteractionRoomAds && !this.client.getHabbo().hasRight("acc_ads_background")) { this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.error.roomads.nopermission")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/rentablespace/RentableSpaceCancelRentEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/rentablespace/RentableSpaceCancelRentEvent.java index 5e9b15c9..b4e97674 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/rentablespace/RentableSpaceCancelRentEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/rentablespace/RentableSpaceCancelRentEvent.java @@ -19,7 +19,7 @@ public class RentableSpaceCancelRentEvent extends MessageHandler { HabboItem item = room.getHabboItem(itemId); if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || - this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { if (item instanceof InteractionRentableSpace) { ((InteractionRentableSpace) item).endRent(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeEvent.java index dfea8959..c7e43781 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeEvent.java @@ -17,7 +17,7 @@ public abstract class YoutubeEvent extends MessageHandler { if (room == null) { return false; } - if (!room.isOwner(habbo) && !habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (!room.isOwner(habbo) && !habbo.hasRight(Permission.ACC_ANYROOMOWNER)) { return false; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java index 51eda502..e99af933 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java @@ -17,7 +17,7 @@ public class PlacePetEvent extends MessageHandler { if (room == null) return; - if (this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId() && !room.isAllowPets() && !(this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI))) { + if (this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId() && !room.isAllowPets() && !(this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_PLACEFURNI))) { this.client.sendResponse(new PetPlacingErrorComposer(PetPlacingErrorComposer.ROOM_ERROR_PETS_FORBIDDEN_IN_FLAT)); return; } @@ -29,7 +29,7 @@ public class PlacePetEvent extends MessageHandler { if (pet == null) { return; } - if (room.getCurrentPets().size() >= Room.MAXIMUM_PETS && !this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS)) { + if (room.getCurrentPets().size() >= Room.MAXIMUM_PETS && !this.client.getHabbo().hasRight(Permission.ACC_UNLIMITED_PETS)) { this.client.sendResponse(new PetPlacingErrorComposer(PetPlacingErrorComposer.ROOM_ERROR_MAX_PETS)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/RemovePetFromFlatEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/RemovePetFromFlatEvent.java index abaf92c1..3ed3c6a4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/RemovePetFromFlatEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/RemovePetFromFlatEvent.java @@ -23,8 +23,8 @@ public class RemovePetFromFlatEvent extends MessageHandler { Pet pet = room.getPet(petId); if (pet != null) { - if (this.client.getHabbo().getHabboInfo().getId() == pet.getUserId() || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) { + if (this.client.getHabbo().getHabboInfo().getId() == pet.getUserId() || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) { this.client.getHabbo().alert(Emulator.getTexts().getValue("error.pets.max.inventory").replace("%amount%", PetManager.MAXIMUM_PET_INVENTORY_SIZE + "")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/EditEventEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/EditEventEvent.java index 1234438e..f6a10972 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/EditEventEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/EditEventEvent.java @@ -19,7 +19,7 @@ public class EditEventEvent extends MessageHandler { Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(id); - if (room == null || room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() || !this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room == null || room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() || !this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/PurchaseRoomAdEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/PurchaseRoomAdEvent.java index bb955317..e622e071 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/PurchaseRoomAdEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/PurchaseRoomAdEvent.java @@ -49,11 +49,11 @@ public class PurchaseRoomAdEvent extends MessageHandler { } if (room.isPromoted()) { - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_CREDITS)) { this.client.getHabbo().giveCredits(-item.getCredits()); } - if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_INFINITE_POINTS)) { this.client.getHabbo().givePoints(item.getPointsType(), -item.getPoints()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/AssignRightsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/AssignRightsEvent.java index 96d9376b..c905c207 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/AssignRightsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/AssignRightsEvent.java @@ -18,7 +18,7 @@ public class AssignRightsEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { Habbo target = room.getHabbo(userId); if (target != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RemoveRightsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RemoveRightsEvent.java index c53a97ec..3399e52e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RemoveRightsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RemoveRightsEvent.java @@ -14,7 +14,7 @@ public class RemoveRightsEvent extends MessageHandler { if (room == null) return; - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) { for (int i = 0; i < amount; i++) { int userId = this.packet.readInt(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java index b5b5a6a2..4dac9cb0 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java @@ -26,7 +26,7 @@ public class RoomUserKickEvent extends MessageHandler { if (target == null) return; - if (target.hasPermission(Permission.ACC_UNKICKABLE)) { + if (target.hasRight(Permission.ACC_UNKICKABLE)) { this.client.sendResponse(new WhisperMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("commands.error.cmd_kick.unkickable").replace("%username%", target.getHabboInfo().getUsername()), this.client.getHabbo(), this.client.getHabbo(), RoomChatMessageBubbles.ALERT))); return; } @@ -41,8 +41,8 @@ public class RoomUserKickEvent extends MessageHandler { if (event.isCancelled()) return; - if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { - if (target.hasPermission(Permission.ACC_UNKICKABLE)) return; + if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) { + if (target.hasRight(Permission.ACC_UNKICKABLE)) return; room.kickHabbo(target, true); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModKickSeen")); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java index f2e5cc2c..3b737e69 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java @@ -18,7 +18,7 @@ public class RoomUserMuteEvent extends MessageHandler { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission("cmd_mute") || this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { + if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasCommand("cmd_mute") || this.client.getHabbo().hasRight(Permission.ACC_AMBASSADOR)) { Habbo habbo = room.getHabbo(userId); if (habbo != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/trading/OpenTradingEvent.java b/src/main/java/com/eu/habbo/messages/incoming/trading/OpenTradingEvent.java index 7962d056..b0661bdc 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/trading/OpenTradingEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/trading/OpenTradingEvent.java @@ -21,7 +21,7 @@ public class OpenTradingEvent extends MessageHandler { if (userId >= 0 && userId != this.client.getHabbo().getRoomUnit().getId()) { Habbo targetUser = room.getHabboByRoomUnitId(userId); - boolean tradeAnywhere = this.client.getHabbo().hasPermission(Permission.ACC_TRADE_ANYWHERE); + boolean tradeAnywhere = this.client.getHabbo().hasRight(Permission.ACC_TRADE_ANYWHERE); if (!RoomTrade.TRADING_ENABLED && !tradeAnywhere) { this.client.sendResponse(new TradingOpenFailedComposer(TradingOpenFailedComposer.HOTEL_TRADING_NOT_ALLOWED)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/SetChatStylePreferenceEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/SetChatStylePreferenceEvent.java index 9c7fb4f3..ed7add4e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/SetChatStylePreferenceEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/SetChatStylePreferenceEvent.java @@ -10,7 +10,7 @@ public class SetChatStylePreferenceEvent extends MessageHandler { public void handle() { int chatBubble = this.packet.readInt(); - if (!this.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) { + if (!this.client.getHabbo().hasRight(Permission.ACC_ANYCHATCOLOR)) { for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) { if (Integer.parseInt(s) == chatBubble) { return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java index 16a1a31c..ba66ade6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java @@ -18,7 +18,7 @@ public class UpdateActionEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_MOVEROTATE)) { + if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) { InteractionWiredEffect effect = room.getRoomSpecialTypes().getEffect(itemId); try { diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java index 7bc5279d..47aa0d8a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java @@ -18,7 +18,7 @@ public class UpdateConditionEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_MOVEROTATE)) { + if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) { InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId); if (condition != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java index 56e6f69e..57859f62 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java @@ -18,7 +18,7 @@ public class UpdateTriggerEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_MOVEROTATE)) { + if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasRight(Permission.ACC_MOVEROTATE)) { InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId); if (trigger != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java index 6a50d752..ed282c32 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java @@ -21,7 +21,7 @@ public class CatalogPagesListComposer extends MessageComposer { public CatalogPagesListComposer(Habbo habbo, String mode) { this.habbo = habbo; this.mode = mode; - this.hasPermission = this.habbo.hasPermission(Permission.ACC_CATALOG_IDS); + this.hasPermission = this.habbo.hasRight(Permission.ACC_CATALOG_IDS); } @Override diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java index e64c758f..2830fcd5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java @@ -18,7 +18,7 @@ public class MessengerInitComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.messengerInitComposer); - if (this.habbo.hasPermission("acc_infinite_friends")) { + if (this.habbo.hasRight("acc_infinite_friends")) { this.response.appendInt(Integer.MAX_VALUE); this.response.appendInt(1337); this.response.appendInt(Integer.MAX_VALUE); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/HabboGroupDetailsMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/HabboGroupDetailsMessageComposer.java index 8313e588..84fb7bbe 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/HabboGroupDetailsMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/HabboGroupDetailsMessageComposer.java @@ -23,7 +23,7 @@ public class HabboGroupDetailsMessageComposer extends MessageComposer { private final GuildMember member; @Override protected ServerMessage composeInternal() { - boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN) || Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).get(this.client.getHabbo().getHabboInfo().getId()) != null; + boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasRight(Permission.ACC_GUILD_ADMIN) || Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).get(this.client.getHabbo().getHabboInfo().getId()) != null; this.response.init(Outgoing.habboGroupDetailsMessageComposer); this.response.appendInt(this.guild.getId()); this.response.appendBoolean(true); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ForumDataMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ForumDataMessageComposer.java index b97ebdde..840a9e1b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ForumDataMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ForumDataMessageComposer.java @@ -107,7 +107,7 @@ public class ForumDataMessageComposer extends MessageComposer { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo); boolean isAdmin = member != null && (member.getRank().getType() < GuildRank.MEMBER.getType() || guild.getOwnerId() == this.habbo.getHabboInfo().getId()); - boolean isStaff = this.habbo.hasPermission(Permission.ACC_MODTOOL_TICKET_Q); + boolean isStaff = this.habbo.hasRight(Permission.ACC_MODTOOL_TICKET_Q); String errorRead = ""; String errorPost = ""; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModeratorInitMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModeratorInitMessageComposer.java index e376cacf..5ae705f4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModeratorInitMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModeratorInitMessageComposer.java @@ -24,7 +24,7 @@ public class ModeratorInitMessageComposer extends MessageComposer implements TOb protected ServerMessage composeInternal() { this.response.init(Outgoing.moderatorInitMessageComposer); - if (this.habbo.hasPermission(Permission.ACC_MODTOOL_TICKET_Q)) { + if (this.habbo.hasRight(Permission.ACC_MODTOOL_TICKET_Q)) { THashSet openTickets = new THashSet<>(); THashMap tickets = Emulator.getGameEnvironment().getModToolManager().getTickets(); @@ -62,13 +62,13 @@ public class ModeratorInitMessageComposer extends MessageComposer implements TOb Emulator.getGameEnvironment().getModToolManager().getCategory().forEachValue(this); - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_TICKET_Q)); //ticketQueueueuhuehuehuehue - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_LOGS)); //user chatlogs - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_ALERT)); //can send caution - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_KICK)); //can send kick - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_BAN)); //can send ban - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_ROOM_INFO)); //room info ??Not sure - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_ROOM_LOGS)); //room chatlogs ??Not sure + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_TICKET_Q)); //ticketQueueueuhuehuehuehue + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_USER_LOGS)); //user chatlogs + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_USER_ALERT)); //can send caution + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_USER_KICK)); //can send kick + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_USER_BAN)); //can send ban + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_ROOM_INFO)); //room info ??Not sure + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_MODTOOL_ROOM_LOGS)); //room chatlogs ??Not sure synchronized (Emulator.getGameEnvironment().getModToolManager().getPresets()) { this.response.appendInt(Emulator.getGameEnvironment().getModToolManager().getPresets().get("room").size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserNameChangedMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserNameChangedMessageComposer.java index 21278e18..80d4a998 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserNameChangedMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserNameChangedMessageComposer.java @@ -21,7 +21,7 @@ public class UserNameChangedMessageComposer extends MessageComposer { public UserNameChangedMessageComposer(Habbo habbo, boolean includePrefix) { this.userId = habbo.getHabboInfo().getId(); this.roomId = habbo.getRoomUnit().getId(); - this.name = (includePrefix ? Room.PREFIX_FORMAT.replace("%color%", habbo.getHabboInfo().getRank().getPrefixColor()).replace("%prefix%", habbo.getHabboInfo().getRank().getPrefix()) : "") + habbo.getHabboInfo().getUsername(); + this.name = (includePrefix ? Room.PREFIX_FORMAT.replace("%color%", habbo.getHabboInfo().getPermissionGroup().getPrefixColor()).replace("%prefix%", habbo.getHabboInfo().getPermissionGroup().getPrefix()) : "") + habbo.getHabboInfo().getUsername(); } @Override diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java index 7681b354..e6f88c7e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.outgoing.users; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; @@ -18,15 +17,16 @@ public class UserPerksComposer extends MessageComposer { this.response.appendString("USE_GUIDE_TOOL"); this.response.appendString("requirement.unfulfilled.helper_level_4"); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, Permission.ACC_HELPER_USE_GUIDE_TOOL)); + this.response.appendBoolean(this.habbo.getHabboInfo().getPermissionGroup().hasRight(Permission.ACC_HELPER_USE_GUIDE_TOOL, false)); + this.response.appendString("GIVE_GUIDE_TOURS"); this.response.appendString(""); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, "acc_helper_give_guide_tours")); + this.response.appendBoolean(this.habbo.getHabboInfo().getPermissionGroup().hasRight(Permission.ACC_HELPER_GIVE_GUIDE_TOURS, false)); this.response.appendString("JUDGE_CHAT_REVIEWS"); this.response.appendString("requirement.unfulfilled.helper_level_6"); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, "acc_helper_judge_chat_reviews")); + this.response.appendBoolean(this.habbo.getHabboInfo().getPermissionGroup().hasRight(Permission.ACC_HELPER_JUDGE_CHAT_REVIEWS, false)); this.response.appendString("VOTE_IN_COMPETITIONS"); this.response.appendString("requirement.unfulfilled.helper_level_2"); @@ -46,7 +46,7 @@ public class UserPerksComposer extends MessageComposer { this.response.appendString("HEIGHTMAP_EDITOR_BETA"); this.response.appendString("requirement.unfulfilled.feature_disabled"); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, Permission.ACC_FLOORPLAN_EDITOR)); + this.response.appendBoolean(this.habbo.getHabboInfo().getPermissionGroup().hasRight(Permission.ACC_FLOORPLAN_EDITOR, false)); this.response.appendString("BUILDER_AT_WORK"); this.response.appendString(""); @@ -58,7 +58,7 @@ public class UserPerksComposer extends MessageComposer { this.response.appendString("CAMERA"); this.response.appendString(""); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, "acc_camera")); + this.response.appendBoolean(this.habbo.getHabboInfo().getPermissionGroup().hasRight(Permission.ACC_CAMERA, false)); this.response.appendString("NAVIGATOR_PHASE_TWO_2014"); this.response.appendString(""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserRightsMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserRightsMessageComposer.java index ca926e87..087f293f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserRightsMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserRightsMessageComposer.java @@ -20,8 +20,8 @@ public class UserRightsMessageComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.userRightsMessageComposer); this.response.appendInt(this.clubLevel); - this.response.appendInt(this.habbo.getHabboInfo().getRank().getLevel()); - this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_AMBASSADOR)); + this.response.appendInt(this.habbo.getHabboInfo().getPermissionGroup().getLevel()); + this.response.appendBoolean(this.habbo.hasRight(Permission.ACC_AMBASSADOR)); return this.response; } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java b/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java index 3e2dbecf..abe1a882 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java @@ -1,7 +1,7 @@ package com.eu.habbo.messages.rcon; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.CommandHandler; +import com.eu.habbo.habbohotel.commands.CommandsManager; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; @@ -25,7 +25,7 @@ public class ExecuteCommand extends RCONMessage