diff --git a/Assets/bundled/generic/avatar_additions.nitro b/Assets/bundled/generic/avatar_additions.nitro deleted file mode 100644 index 0fb3ebff..00000000 Binary files a/Assets/bundled/generic/avatar_additions.nitro and /dev/null differ diff --git a/Assets/bundled/generic/floor_editor.nitro b/Assets/bundled/generic/floor_editor.nitro deleted file mode 100644 index 7c6674ab..00000000 Binary files a/Assets/bundled/generic/floor_editor.nitro and /dev/null differ diff --git a/Assets/bundled/generic/group_badge.nitro b/Assets/bundled/generic/group_badge.nitro deleted file mode 100644 index 9fb546dc..00000000 Binary files a/Assets/bundled/generic/group_badge.nitro and /dev/null differ diff --git a/Assets/bundled/generic/place_holder.nitro b/Assets/bundled/generic/place_holder.nitro deleted file mode 100644 index 78a97fca..00000000 Binary files a/Assets/bundled/generic/place_holder.nitro and /dev/null differ diff --git a/Assets/bundled/generic/place_holder_pet.nitro b/Assets/bundled/generic/place_holder_pet.nitro deleted file mode 100644 index c89aee1e..00000000 Binary files a/Assets/bundled/generic/place_holder_pet.nitro and /dev/null differ diff --git a/Assets/bundled/generic/place_holder_wall.nitro b/Assets/bundled/generic/place_holder_wall.nitro deleted file mode 100644 index 591c950f..00000000 Binary files a/Assets/bundled/generic/place_holder_wall.nitro and /dev/null differ diff --git a/Assets/bundled/generic/room.nitro b/Assets/bundled/generic/room.nitro deleted file mode 100644 index f4eafff0..00000000 Binary files a/Assets/bundled/generic/room.nitro and /dev/null differ diff --git a/Assets/bundled/generic/room_camwijs.nitro b/Assets/bundled/generic/room_camwijs.nitro deleted file mode 100644 index f4eafff0..00000000 Binary files a/Assets/bundled/generic/room_camwijs.nitro and /dev/null differ diff --git a/Assets/bundled/generic/selection_arrow.nitro b/Assets/bundled/generic/selection_arrow.nitro deleted file mode 100644 index 1a924d72..00000000 Binary files a/Assets/bundled/generic/selection_arrow.nitro and /dev/null differ diff --git a/Assets/bundled/generic/tile_cursor.nitro b/Assets/bundled/generic/tile_cursor.nitro deleted file mode 100644 index eb81ad2e..00000000 Binary files a/Assets/bundled/generic/tile_cursor.nitro and /dev/null differ diff --git a/Emulator/.idea/misc.xml b/Emulator/.idea/misc.xml index 6568344f..5ddb3b31 100644 --- a/Emulator/.idea/misc.xml +++ b/Emulator/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/Emulator/NitroWebsockets-3.1.jar b/Emulator/NitroWebsockets-3.1.jar deleted file mode 100644 index 32f73ce5..00000000 Binary files a/Emulator/NitroWebsockets-3.1.jar and /dev/null differ diff --git a/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar b/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar index a1fb2c2c..ce921ac0 100644 Binary files a/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar and b/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar differ diff --git a/Plugins/Camera/.gitattributes b/Plugins/Camera/.gitattributes deleted file mode 100644 index dfe07704..00000000 --- a/Plugins/Camera/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto diff --git a/Plugins/Camera/.gitignore b/Plugins/Camera/.gitignore deleted file mode 100644 index 27b37624..00000000 --- a/Plugins/Camera/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar -.mvn/wrapper/maven-wrapper.jar - -# Eclipse m2e generated files -# Eclipse Core -.project -# JDT-specific (Eclipse Java Development Tools) -.classpath - -.idea diff --git a/Plugins/Camera/Compiled/Camera-1.3.jar b/Plugins/Camera/Compiled/Camera-1.3.jar deleted file mode 100644 index 65c5e7f2..00000000 Binary files a/Plugins/Camera/Compiled/Camera-1.3.jar and /dev/null differ diff --git a/Plugins/Camera/Compiled/Camera-1.4.jar b/Plugins/Camera/Compiled/Camera-1.4.jar deleted file mode 100644 index af4edf16..00000000 Binary files a/Plugins/Camera/Compiled/Camera-1.4.jar and /dev/null differ diff --git a/Plugins/Camera/Compiled/Camera-1.6.jar b/Plugins/Camera/Compiled/Camera-1.6.jar deleted file mode 100644 index 2c3c32a2..00000000 Binary files a/Plugins/Camera/Compiled/Camera-1.6.jar and /dev/null differ diff --git a/Plugins/Camera/LICENSE b/Plugins/Camera/LICENSE deleted file mode 100644 index 113d1a33..00000000 --- a/Plugins/Camera/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 ThisAccountHasBeenSuspended, EntenKoeniq, habbo.sx - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Plugins/Camera/README.md b/Plugins/Camera/README.md deleted file mode 100644 index 75afa562..00000000 --- a/Plugins/Camera/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# 📷 Camera - -**New features compared to Apollyon** -- [x] Small and more efficient than Apollyon. -- [x] `*_small.png` are really small (original / 2) and not just copied. -- [x] Creates a folder structure if it doesn't exist. -- [x] Report failures to Habbo. -- [x] Added a cooldown time for taking photos to prevent your hard drive from filling up. -- [x] Prevent exploits on thumbnails, not just photos. -- [x] No more FTP (no one used that). - -[Download the latest compiled version here!](https://github.com/duckietm/Arcturus-Morningstar-Extended/blob/main/Plugins/Camera/Compiled/Camera-1.6.jar) - -## Informations -All missing settings in the database will be created with this plugin after the first launch of your emulator. -### emulator_settings -- `camera.url` -- - The URL from which you can access the image (default: http://localhost/camera/) -- `imager.location.output.camera` -- - The location where to save the photo (default: C:/inetpub/wwwroot/public/camera/) -- `imager.location.output.thumbnail` -- - The location to save the thumbnail (default: C:/inetpub/wwwroot/public/camera/thumbnails/) -- `camera.price.points.publish` -- - The price of points for publishing this photo (default: 1) -- `camera.price.points.publish.type` -- - The type of points to publish (default: 5 = diamonds) -- `camera.publish.delay` -- - The time, in seconds, how long the user should wait to post a new photo (default: 180) -- `camera.price.credits` -- - The credits required to purchase this photo (default: 2) -- `camera.price.points` -- - The price of points to purchase this photo (default: 0 = no points required) -- `camera.price.points.type` -- - The type of points to buy this photo (default: 5 = diamonds) -- `camera.render.delay` -- - The time, in seconds, how long the user should wait to take a new photo (default: 5) -### emulator_texts -- `camera.permission` -- - default: "You don't have permission to use the camera!" -- `camera.wait` -- - default: "Please wait %seconds% seconds before making another picture." -- `camera.error.creation` -- - default: "Failed to create your picture. \*sadpanda\*" - -Since this plugin doesn't use FTP like “Apollyon”, you can delete these values ​​in your database under `emulator_settings` if necessary. - -## Comparison -Apollyon doesn't show you any errors like you don't have enough currency. - -# Credits - -- EntenKoeniq for releaseing the fixes and rewritten the plugin. (This camera plugin was written for https://habbo.sx/ and is now available to the community for free.) -- John -- Beny (Packet Hijacking) -- Ovflowd (Original Implimentation) -- Alejandro (Error Handling Help) diff --git a/Plugins/Camera/pom.xml b/Plugins/Camera/pom.xml deleted file mode 100644 index 0690ec1b..00000000 --- a/Plugins/Camera/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - com.eu.camera - Camera - 1.6 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - - - - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - - com.eu.habbo - Habbo - 3.5.2 - - - \ No newline at end of file diff --git a/Plugins/Camera/src/main/java/com/eu/camera/Main.java b/Plugins/Camera/src/main/java/com/eu/camera/Main.java deleted file mode 100644 index 778abd8e..00000000 --- a/Plugins/Camera/src/main/java/com/eu/camera/Main.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.eu.camera; - -import com.eu.camera.handlers.PublishPhotoEvent; -import com.eu.camera.handlers.PurchasePhotoEvent; -import com.eu.camera.handlers.RenderRoomEvent; -import com.eu.camera.handlers.RenderRoomThumbnailEvent; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.PacketManager; -import com.eu.habbo.messages.incoming.Incoming; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.plugin.EventHandler; -import com.eu.habbo.plugin.EventListener; -import com.eu.habbo.plugin.HabboPlugin; -import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent; - -import gnu.trove.map.hash.THashMap; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.lang.reflect.Field; - -public class Main extends HabboPlugin implements EventListener { - private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class); - - @Override - public void onEnable() throws Exception { - Emulator.getPluginManager().registerEvents(this, this); - - if (Emulator.isReady && !Emulator.isShuttingDown) { - this.onEmulatorLoadedEvent(null); - } - } - - @Override - public void onDisable() throws Exception { - PacketManager packetManager = Emulator.getGameServer().getPacketManager(); - Field incomingField = PacketManager.class.getDeclaredField("incoming"); - incomingField.setAccessible(true); - @SuppressWarnings("unchecked") - THashMap> incoming = (THashMap>)incomingField.get(packetManager); - - // Removes the custom handlers for these packets. - incoming.remove(Incoming.CameraPublishToWebEvent, PublishPhotoEvent.class); - incoming.remove(Incoming.CameraPurchaseEvent, PurchasePhotoEvent.class); - incoming.remove(Incoming.CameraRoomPictureEvent, RenderRoomEvent.class); - incoming.remove(Incoming.CameraRoomThumbnailEvent, RenderRoomThumbnailEvent.class); - } - - @Override - public boolean hasPermission(Habbo habbo, String string) { - return false; - } - - @EventHandler - public void onEmulatorLoadedEvent(EmulatorLoadedEvent event) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, Exception { - // Adds missing SQLs if they are not found. - Emulator.getConfig().register("camera.url", "http://localhost/camera/"); - Emulator.getConfig().register("imager.location.output.camera", "C:/inetpub/wwwroot/public/camera/"); - Emulator.getConfig().register("imager.location.output.thumbnail", "C:/inetpub/wwwroot/camera/thumbnails/"); - Emulator.getConfig().register("camera.price.points.publish", "1"); - Emulator.getConfig().register("camera.price.points.publish.type", "5"); - Emulator.getConfig().register("camera.publish.delay", "180"); - Emulator.getConfig().register("camera.price.credits", "2"); - Emulator.getConfig().register("camera.price.points", "0"); - Emulator.getConfig().register("camera.price.points.type", "5"); - Emulator.getConfig().register("camera.render.delay", "5"); - Emulator.getTexts().register("camera.permission", "You don't have permission to use the camera!"); - Emulator.getTexts().register("camera.wait", "Please wait %seconds% seconds before making another picture."); - Emulator.getTexts().register("camera.error.creation", "Failed to create your picture. *sadpanda*"); - - PacketManager packetManager = Emulator.getGameServer().getPacketManager(); - Field incomingField = PacketManager.class.getDeclaredField("incoming"); - incomingField.setAccessible(true); - @SuppressWarnings("unchecked") - THashMap> incoming = (THashMap>)incomingField.get(packetManager); - - // Removes the current handlers for these packets. - incoming.remove(Incoming.CameraPublishToWebEvent); - incoming.remove(Incoming.CameraPurchaseEvent); - incoming.remove(Incoming.CameraRoomPictureEvent); - incoming.remove(Incoming.CameraRoomThumbnailEvent); - - // Adds the new handlers for these packets. - packetManager.registerHandler(Incoming.CameraPublishToWebEvent, PublishPhotoEvent.class); - packetManager.registerHandler(Incoming.CameraPurchaseEvent, PurchasePhotoEvent.class); - packetManager.registerHandler(Incoming.CameraRoomPictureEvent, RenderRoomEvent.class); - packetManager.registerHandler(Incoming.CameraRoomThumbnailEvent, RenderRoomThumbnailEvent.class); - - // Create the output directories if they don't exist. - File outputDir = new File(Emulator.getConfig().getValue("imager.location.output.thumbnail")); - if (!outputDir.exists()) { - outputDir.mkdirs(); - } - - LOGGER.info("[Camera] Plugin has loaded!"); - } -} diff --git a/Plugins/Camera/src/main/java/com/eu/camera/handlers/PublishPhotoEvent.java b/Plugins/Camera/src/main/java/com/eu/camera/handlers/PublishPhotoEvent.java deleted file mode 100644 index e54565a1..00000000 --- a/Plugins/Camera/src/main/java/com/eu/camera/handlers/PublishPhotoEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.eu.camera.handlers; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.camera.CameraPublishWaitMessageComposer; -import com.eu.habbo.messages.outgoing.catalog.NotEnoughPointsTypeComposer; -import com.eu.habbo.plugin.events.users.UserPublishPictureEvent; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class PublishPhotoEvent extends MessageHandler { - public static final int CAMERA_PUBLISH_POINTS = Emulator.getConfig().getInt("camera.price.points.publish", 1); - public static final int CAMERA_PUBLISH_POINTS_TYPE = Emulator.getConfig().getInt("camera.price.points.publish.type", 5); - public static final int CAMERA_PUBLISH_DELAY = Emulator.getConfig().getInt("camera.publish.delay", 180); - - @Override - public void handle() { - Habbo habbo = this.client.getHabbo(); - HabboInfo habboInfo = habbo.getHabboInfo(); - - int points = habboInfo.getCurrencyAmount(CAMERA_PUBLISH_POINTS_TYPE); - - if (points < CAMERA_PUBLISH_POINTS) { - String currencyName = Emulator.getTexts().getValue("seasonal.name." + Integer.toString(CAMERA_PUBLISH_POINTS_TYPE), "currency"); - String alertMessage = "You don't have enough " + currencyName + "!"; - habbo.alert(alertMessage); - this.client.sendResponse(new NotEnoughPointsTypeComposer(false, true, CAMERA_PUBLISH_POINTS_TYPE)); - return; - } - - int photoTimestamp = habboInfo.getPhotoTimestamp(); - String photoJSON = habboInfo.getPhotoJSON(); - - if (photoTimestamp == 0 || photoJSON.isEmpty() || !photoJSON.contains(Integer.toString(photoTimestamp))) { - return; - } - - int currentTimestamp = Emulator.getIntUnixTimestamp(); - int timeSinceLastPublish = currentTimestamp - habboInfo.getWebPublishTimestamp(); - - if (timeSinceLastPublish < CAMERA_PUBLISH_DELAY) { - int wait = CAMERA_PUBLISH_DELAY - timeSinceLastPublish; - this.client.sendResponse(new CameraPublishWaitMessageComposer(false, wait, habboInfo.getPhotoURL())); - } else { - UserPublishPictureEvent publishPictureEvent = new UserPublishPictureEvent(habbo, habboInfo.getPhotoURL(), currentTimestamp, habboInfo.getPhotoRoomId()); - - if (!Emulator.getPluginManager().fireEvent(publishPictureEvent).isCancelled()) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - PreparedStatement statement = connection.prepareStatement("INSERT INTO camera_web (user_id, room_id, timestamp, url) VALUES (?, ?, ?, ?)")) { - statement.setInt(1, habboInfo.getId()); - statement.setInt(2, publishPictureEvent.roomId); - statement.setInt(3, publishPictureEvent.timestamp); - statement.setString(4, publishPictureEvent.URL); - statement.execute(); - - habboInfo.setWebPublishTimestamp(currentTimestamp); - - habbo.givePoints(CAMERA_PUBLISH_POINTS_TYPE, -CAMERA_PUBLISH_POINTS); - } catch (SQLException throwable) { - throwable.printStackTrace(); - } - } - - this.client.sendResponse(new CameraPublishWaitMessageComposer(true, 0, "")); - } - } -} diff --git a/Plugins/Camera/src/main/java/com/eu/camera/handlers/PurchasePhotoEvent.java b/Plugins/Camera/src/main/java/com/eu/camera/handlers/PurchasePhotoEvent.java deleted file mode 100644 index 4bc2b6cb..00000000 --- a/Plugins/Camera/src/main/java/com/eu/camera/handlers/PurchasePhotoEvent.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.eu.camera.handlers; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.achievements.AchievementManager; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.camera.CameraPurchaseSuccesfullComposer; -import com.eu.habbo.messages.outgoing.catalog.NotEnoughPointsTypeComposer; -import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; -import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; -import com.eu.habbo.plugin.events.users.UserPurchasePictureEvent; - -public class PurchasePhotoEvent extends MessageHandler { - public static final int CAMERA_PURCHASE_CREDITS = Emulator.getConfig().getInt("camera.price.credits", 2); - public static final int CAMERA_PURCHASE_POINTS = Emulator.getConfig().getInt("camera.price.points", 0); - public static final int CAMERA_PURCHASE_POINTS_TYPE = Emulator.getConfig().getInt("camera.price.points.type", 5); - public static final int CAMERA_ITEM_ID = Emulator.getConfig().getInt("camera.item_id"); - public static final String EXTERNAL_IMAGE_INTERACTION = "external_image"; - - @Override - public void handle() { - Habbo habbo = this.client.getHabbo(); - HabboInfo habboInfo = habbo.getHabboInfo(); - - if (habboInfo.getCredits() < CAMERA_PURCHASE_CREDITS) { - handleInsufficientCredits(habbo); - return; - } - - if (habboInfo.getCurrencyAmount(CAMERA_PURCHASE_POINTS_TYPE) < CAMERA_PURCHASE_POINTS) { - handleInsufficientPoints(habbo); - return; - } - - if (!isValidPhoto(habboInfo)) { - return; - } - - if (Emulator.getPluginManager().fireEvent(new UserPurchasePictureEvent(habbo, habboInfo.getPhotoURL(), habboInfo.getCurrentRoom().getId(), habboInfo.getPhotoTimestamp())).isCancelled()) { - return; - } - - Item item = Emulator.getGameEnvironment().getItemManager().getItem(CAMERA_ITEM_ID); - if (item == null || !item.getInteractionType().getName().equals(EXTERNAL_IMAGE_INTERACTION)) { - return; - } - - handlePurchasedPhoto(habbo, habboInfo, item); - } - - private void handleInsufficientCredits(Habbo habbo) { - habbo.alert("You don't have enough credits!"); - this.client.sendResponse(new NotEnoughPointsTypeComposer(true, false, 0)); - } - - private void handleInsufficientPoints(Habbo habbo) { - String alertMessage = "You don't have enough " + Emulator.getTexts().getValue("seasonal.name." + Integer.toString(CAMERA_PURCHASE_POINTS_TYPE), "currency") + "!"; - habbo.alert(alertMessage); - this.client.sendResponse(new NotEnoughPointsTypeComposer(false, true, CAMERA_PURCHASE_POINTS_TYPE)); - } - - private boolean isValidPhoto(HabboInfo habboInfo) { - return habboInfo.getPhotoTimestamp() != 0 && !habboInfo.getPhotoJSON().isEmpty() && habboInfo.getPhotoJSON().contains(Integer.toString(habboInfo.getPhotoTimestamp())); - } - - private void handlePurchasedPhoto(Habbo habbo, HabboInfo habboInfo, Item item) { - HabboItem photoItem = Emulator.getGameEnvironment().getItemManager().createItem(habboInfo.getId(), item, 0, 0, habboInfo.getPhotoJSON()); - - if (photoItem != null) { - photoItem.setExtradata(photoItem.getExtradata().replace("%id%", Integer.toString(photoItem.getId()))); - photoItem.needsUpdate(true); - - habbo.getInventory().getItemsComponent().addItem(photoItem); - - this.client.sendResponse(new CameraPurchaseSuccesfullComposer()); - this.client.sendResponse(new AddHabboItemComposer(photoItem)); - this.client.sendResponse(new InventoryRefreshComposer()); - - habbo.giveCredits(-CAMERA_PURCHASE_CREDITS); - habbo.givePoints(CAMERA_PURCHASE_POINTS_TYPE, -CAMERA_PURCHASE_POINTS); - AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("CameraPhotoCount")); - } - } -} diff --git a/Plugins/Camera/src/main/java/com/eu/camera/handlers/RenderRoomEvent.java b/Plugins/Camera/src/main/java/com/eu/camera/handlers/RenderRoomEvent.java deleted file mode 100644 index 38ec10ce..00000000 --- a/Plugins/Camera/src/main/java/com/eu/camera/handlers/RenderRoomEvent.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.eu.camera.handlers; - -import com.eu.habbo.Emulator; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboStats; -import com.eu.habbo.messages.outgoing.camera.CameraURLComposer; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.buffer.ByteBufUtil; - -import javax.imageio.ImageIO; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; - -public class RenderRoomEvent extends MessageHandler { - public static final int CAMERA_RENDER_DELAY = Emulator.getConfig().getInt("camera.render.delay", 5); - - private ByteBuf image = null; - - @Override - public void handle() { - try { - make(); - } finally { - if (this.image != null) { - this.image.release(); - } - } - } - - private void make() { - Habbo habbo = this.client.getHabbo(); - if (!habbo.hasPermission("acc_camera")) { - habbo.alert(Emulator.getTexts().getValue("camera.permission")); - return; - } - - HabboInfo habboInfo = habbo.getHabboInfo(); - HabboStats habboStats = habbo.getHabboStats(); - - int timestamp = Emulator.getIntUnixTimestamp(); - - if (habboStats.cache.containsKey("camera_render_cooldown")) { - int cameraTimestamp = (int) habboStats.cache.get("camera_render_cooldown"); - if (timestamp - cameraTimestamp < CAMERA_RENDER_DELAY) { - String alertMessage = Emulator.getTexts().getValue("camera.wait") - .replace("%seconds%", Integer.toString(timestamp - cameraTimestamp)); - habbo.alert(alertMessage); - - // Show the correct last photo. - String[] splittedPhotoURL = habboInfo.getPhotoURL().split("/"); - if (splittedPhotoURL.length > 0) { - this.client.sendResponse(new CameraURLComposer(splittedPhotoURL[splittedPhotoURL.length - 1])); - } - - return; - } - } - habboStats.cache.put("camera_render_cooldown", (Object) timestamp); - - Room room = habboInfo.getCurrentRoom(); - if (room == null) { - return; - } - - final int count = this.packet.readInt(); - this.image = this.packet.getBuffer().readBytes(count); - if (this.image == null) { - return; - } - - // Prevent possible exploits. - byte[] imageBytes = ByteBufUtil.getBytes(this.image, 0, 4, true); - if (imageBytes == null || imageBytes.length < 4 || !isPNG(imageBytes)) { - return; - } - - BufferedImage theImage; - try (ByteBufInputStream in = new ByteBufInputStream(this.image)) { - theImage = ImageIO.read(in); - } catch (IOException e) { - handleImageProcessingError(habbo); - return; - } - - String fileName = habboInfo.getId() + "_" + timestamp; - String URL = fileName + ".png"; - String URLsmall = fileName + "_small.png"; - String base = Emulator.getConfig().getValue("camera.url"); - - String json = Emulator.getConfig().getValue("camera.extradata") - .replace("%timestamp%", Integer.toString(timestamp)) - .replace("%room_id%", Integer.toString(room.getId())) - .replace("%url%", base + URL); - - habboInfo.setPhotoURL(base + URL); - habboInfo.setPhotoTimestamp(timestamp); - habboInfo.setPhotoRoomId(room.getId()); - habboInfo.setPhotoJSON(json); - - File imageFile = new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL); - File smallImageFile = new File(Emulator.getConfig().getValue("imager.location.output.camera") + URLsmall); - - try { - ImageIO.write(theImage, "png", imageFile); - - Image smallImage = theImage.getScaledInstance(theImage.getWidth(null) / 2, theImage.getHeight(null) / 2, Image.SCALE_SMOOTH); - - BufferedImage bi = new BufferedImage(smallImage.getWidth(null), smallImage.getHeight(null), BufferedImage.TYPE_INT_ARGB); - Graphics2D graphics2D = bi.createGraphics(); - graphics2D.drawImage(smallImage, 0, 0, null); - graphics2D.dispose(); - - ImageIO.write(bi, "png", smallImageFile); - } catch (IOException e) { - handleImageProcessingError(habbo); - return; - } - - this.client.sendResponse(new CameraURLComposer(URL)); - } - - private boolean isPNG(byte[] bytes) { - return bytes[0] == -119 && bytes[1] == 80 && bytes[2] == 78 && bytes[3] == 71; - } - - private void handleImageProcessingError(Habbo habbo) { - habbo.alert(Emulator.getTexts().getValue("camera.error.creation")); - } -} diff --git a/Plugins/Camera/src/main/java/com/eu/camera/handlers/RenderRoomThumbnailEvent.java b/Plugins/Camera/src/main/java/com/eu/camera/handlers/RenderRoomThumbnailEvent.java deleted file mode 100644 index 787a445c..00000000 --- a/Plugins/Camera/src/main/java/com/eu/camera/handlers/RenderRoomThumbnailEvent.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.eu.camera.handlers; - -import com.eu.habbo.Emulator; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboStats; -import com.eu.habbo.messages.outgoing.camera.CameraRoomThumbnailSavedComposer; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.buffer.ByteBufUtil; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; - -public class RenderRoomThumbnailEvent extends MessageHandler { - public static final int CAMERA_RENDER_DELAY = Emulator.getConfig().getInt("camera.render.delay", 5); - - private ByteBuf image = null; - - @Override - public void handle() { - try { - make(); - } finally { - if (this.image != null) { - this.image.release(); - } - } - } - - private void make() { - Habbo habbo = this.client.getHabbo(); - if (!habbo.hasPermission("acc_camera")) { - habbo.alert(Emulator.getTexts().getValue("camera.permission")); - return; - } - - HabboStats habboStats = habbo.getHabboStats(); - - int timestamp = Emulator.getIntUnixTimestamp(); - - if (habboStats.cache.containsKey("camera_render_cooldown")) { - int cameraTimestamp = (int) habboStats.cache.get("camera_render_cooldown"); - if (timestamp - cameraTimestamp < CAMERA_RENDER_DELAY) { - String alertMessage = Emulator.getTexts().getValue("camera.wait") - .replace("%seconds%", Integer.toString(timestamp - cameraTimestamp)); - habbo.alert(alertMessage); - return; - } - } - habboStats.cache.put("camera_render_cooldown", (Object) timestamp); - - HabboInfo habboInfo = habbo.getHabboInfo(); - - Room room = habboInfo.getCurrentRoom(); - if (room == null || !room.isOwner(habbo)) { - return; - } - - final int count = this.packet.readInt(); - this.image = this.packet.getBuffer().readBytes(count); - if (this.image == null || !isValidImage(this.image)) { - return; - } - - BufferedImage theImage = null; - try (ByteBufInputStream in = new ByteBufInputStream(this.image)) { - theImage = ImageIO.read(in); - } catch (IOException e) { - e.printStackTrace(); - habbo.alert(Emulator.getTexts().getValue("camera.error.creation")); - return; - } - - File imageFile = new File(Emulator.getConfig().getValue("imager.location.output.thumbnail") + room.getId() + ".png"); - - try { - ImageIO.write(theImage, "png", imageFile); - } catch (IOException e) { - e.printStackTrace(); - habbo.alert(Emulator.getTexts().getValue("camera.error.creation")); - return; - } - - this.client.sendResponse(new CameraRoomThumbnailSavedComposer()); - } - - private boolean isValidImage(ByteBuf imageBuffer) { - byte[] imageBytes = ByteBufUtil.getBytes(imageBuffer, 0, 4, true); - return (imageBytes != null && imageBytes.length >= 4 && - imageBytes[0] == -119 && imageBytes[1] == 80 && imageBytes[2] == 78 && imageBytes[3] == 71); - } -} diff --git a/Plugins/Camera/src/main/resources/plugin.json b/Plugins/Camera/src/main/resources/plugin.json deleted file mode 100644 index c5b257ed..00000000 --- a/Plugins/Camera/src/main/resources/plugin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main" : "com.eu.camera.Main", - "name" : "Camera", - "author" : "EntenKoeniq and habbo.sx" -} - \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/.idea/compiler.xml b/Plugins/Javascript-Plugin/.idea/compiler.xml deleted file mode 100644 index 4ce00136..00000000 --- a/Plugins/Javascript-Plugin/.idea/compiler.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/.idea/jarRepositories.xml b/Plugins/Javascript-Plugin/.idea/jarRepositories.xml deleted file mode 100644 index 712ab9d9..00000000 --- a/Plugins/Javascript-Plugin/.idea/jarRepositories.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/.idea/misc.xml b/Plugins/Javascript-Plugin/.idea/misc.xml deleted file mode 100644 index 44185bb9..00000000 --- a/Plugins/Javascript-Plugin/.idea/misc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/.idea/workspace.xml b/Plugins/Javascript-Plugin/.idea/workspace.xml deleted file mode 100644 index b1aedd92..00000000 --- a/Plugins/Javascript-Plugin/.idea/workspace.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 1712556687432 - - - - \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/README.md b/Plugins/Javascript-Plugin/README.md deleted file mode 100644 index 25fdcd7e..00000000 --- a/Plugins/Javascript-Plugin/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# javascript-plugin -Allows 2-way communication between some javascript running in your client and your emulator using the FlashExternalInterface - -## How do I use it? -You can use the following Vue application which will work out of the box with this plugin: https://github.com/dank074/youtube-overlay -Just include the scripts and add a div with id=app, and you are set to go - -## I don't wanna use that Vue trash, how do I use it with my own javascript? - -Receiving a message: -```js -FlashExternalInterface.openHabblet = function(a,b){console.log("recieved " + a)} -``` - -Sending a message: -```js -document.querySelector('object, embed').openroom(JSON.stringify({"header": "test", "data": {"name": "Efrain"}})) -``` -## Built in features -- [x] Arrowkey walking -- [x] Youtube jukebox (use interaction `yt_jukebox` on any furniture) -- [x] Slots Machine (use interaction `slots_machine` on any furniture) -- [x] :youtube command ```ALTER TABLE permissions - ADD COLUMN cmd_youtube enum('0','1') DEFAULT '1';``` diff --git a/Plugins/Javascript-Plugin/compiled/Javascript-Plugin-1.1-SNAPSHOT.jar b/Plugins/Javascript-Plugin/compiled/Javascript-Plugin-1.1-SNAPSHOT.jar deleted file mode 100644 index 9e5595df..00000000 Binary files a/Plugins/Javascript-Plugin/compiled/Javascript-Plugin-1.1-SNAPSHOT.jar and /dev/null differ diff --git a/Plugins/Javascript-Plugin/pom.xml b/Plugins/Javascript-Plugin/pom.xml deleted file mode 100644 index 2fd7c0e0..00000000 --- a/Plugins/Javascript-Plugin/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - com.skeletor - Javascript-Plugin - 1.1-SNAPSHOT - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - - - - com.eu.habbo - Habbo - 3.5.1 - - - - com.googlecode.owasp-java-html-sanitizer - owasp-java-html-sanitizer - 20240325.1 - compile - - - - - \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/audio/RoomAudioManager.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/audio/RoomAudioManager.java deleted file mode 100644 index 6714f3bd..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/audio/RoomAudioManager.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.skeletor.plugin.javascript.audio; - -import java.util.concurrent.ConcurrentHashMap; - -public class RoomAudioManager { - private static RoomAudioManager _instance; - - private ConcurrentHashMap roomAudio = new ConcurrentHashMap<>(); - - public RoomPlaylist getPlaylistForRoom(int roomId) { - if (this.roomAudio.containsKey(Integer.valueOf(roomId))) - return this.roomAudio.get(Integer.valueOf(roomId)); - RoomPlaylist newPlaylist = new RoomPlaylist(); - this.roomAudio.put(Integer.valueOf(roomId), newPlaylist); - return newPlaylist; - } - - public void dispose(int roomId) { - this.roomAudio.remove(Integer.valueOf(roomId)); - } - - public static void Init() { - _instance = new RoomAudioManager(); - } - - public void Dispose() { - this.roomAudio.clear(); - _instance = null; - } - - public static RoomAudioManager getInstance() { - if (_instance == null) - _instance = new RoomAudioManager(); - return _instance; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/audio/RoomPlaylist.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/audio/RoomPlaylist.java deleted file mode 100644 index 07561066..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/audio/RoomPlaylist.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.skeletor.plugin.javascript.audio; - -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; -import gnu.trove.map.hash.THashMap; -import java.util.ArrayList; - -import static com.skeletor.plugin.javascript.utils.RegexUtility.sanitize; - -public class RoomPlaylist { - private ArrayList playlist = new ArrayList<>(); - - private int current = 0; - - private boolean playing = false; - - public YoutubeVideo nextSong() { - if (this.current < this.playlist.size() - 1) { - this.current++; - } else { - this.current = 0; - } - return this.playlist.get(this.current); - } - - public YoutubeVideo prevSong() { - if (this.current > 0) - this.current--; - return this.playlist.get(this.current); - } - - public boolean isPlaying() { - return this.playing; - } - - public void setPlaying(boolean playing) { - this.playing = playing; - } - - public void addSong(YoutubeVideo song) { - this.playlist.add(song); - } - - public YoutubeVideo removeSong(int index) { - YoutubeVideo res = null; - if(playlist.size() - 1 >= index) - res = this.playlist.remove(index); - if(playlist.isEmpty()) this.setPlaying(false); - if(index == this.getCurrentIndex()) { - if(index > this.playlist.size() - 1 && !this.playlist.isEmpty()) { - this.current = this.playlist.size() - 1; - } - } - else if(index < this.getCurrentIndex() && this.getCurrentIndex() > 0) { - this.current--; - } - return res; - } - - public YoutubeVideo getCurrentSong() { - return this.playlist.get(this.current); - } - - public int getCurrentIndex() { - return this.current; - } - - public ArrayList getPlaylist() { - return this.playlist; - } - - public static class YoutubeVideo { - public String name; - - public String videoId; - - public String channel; - - public YoutubeVideo(String name, String videoId, String channel) { - this.name = name; - this.videoId = videoId; - this.channel = channel; - } - } - - public MessageComposer getNowPlayingBubbleAlert() { - final THashMap keys = new THashMap<>(); - keys.put("display", "BUBBLE"); - keys.put("image", ("${image.library.url}notifications/music.png")); - keys.put("message", "Now playing " + sanitize(this.getCurrentSong().name)); - return new BubbleAlertComposer("", keys); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/categories/Category.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/categories/Category.java deleted file mode 100644 index 0629cf5b..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/categories/Category.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.skeletor.plugin.javascript.categories; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class Category { - private int id; - - private String name; - - private List permissions; - - public Category(ResultSet set) throws SQLException { - this.id = set.getInt("id"); - this.name = set.getString("name"); - this.permissions = new ArrayList<>(); - } - - public void addPermission(String permission) { - if (!this.permissions.contains(permission)) - this.permissions.add(permission); - } - - public int getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public List getPermissions() { - return this.permissions; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/categories/CommandManager.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/categories/CommandManager.java deleted file mode 100644 index e45ecf93..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/categories/CommandManager.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.skeletor.plugin.javascript.categories; - -import com.eu.habbo.Emulator; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CommandManager { - private static final Logger LOGGER = LoggerFactory.getLogger(CommandManager.class); - - private final List commandCategories; - - public CommandManager() { - this.commandCategories = new ArrayList<>(); - reload(); - } - - public void reload() { - dispose(); - try(Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - PreparedStatement statement = connection.prepareStatement("SELECT * FROM `command_categories` ORDER BY `order`"); - ResultSet set = statement.executeQuery()) { - while (set.next()) { - Category category = new Category(set); - this.commandCategories.add(category); - } - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } - try(Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - PreparedStatement statement = connection.prepareStatement("SELECT * FROM `command_category_permissions` ORDER BY `order`"); - ResultSet set = statement.executeQuery()) { - while (set.next()) { - if (hasCommandCategory(Integer.valueOf(set.getInt("category_id")))) { - Category category = getCommandCategory(Integer.valueOf(set.getInt("category_id"))); - ((Category)this.commandCategories.get(this.commandCategories.indexOf(category))).addPermission(set.getString("permission")); - } - } - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } - } - - public void dispose() { - this.commandCategories.clear(); - } - - public boolean hasCommandCategory(Integer id) { - return - - (((List)this.commandCategories.stream().filter(p -> (p.getId() == id.intValue())).collect(Collectors.toList())).size() > 0); - } - - public Category getCommandCategory(Integer id) { - if (hasCommandCategory(id)) - return ((List)this.commandCategories - .stream() - .filter(p -> (p.getId() == id.intValue())) - .collect(Collectors.toList())).get(0); - return null; - } - - public List getCommandCategories() { - return this.commandCategories; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/CmdCommand.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/CmdCommand.java deleted file mode 100644 index 21e29688..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/CmdCommand.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.skeletor.plugin.javascript.commands; - -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.MessageComposer; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.CommandsComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import java.util.List; - -public class CmdCommand extends Command { - public CmdCommand() { - super("cmd_commands", Emulator.getTexts().getValue("jscommands.keys.cmd_commands").split(";")); - } - - public boolean handle(GameClient gameClient, String[] strings) throws Exception { - List commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId()); - CommandsComposer commandsComposer = new CommandsComposer(commands); - gameClient.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)commandsComposer)); - return true; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/TwitchCommand.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/TwitchCommand.java deleted file mode 100644 index 0cdd2096..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/TwitchCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.skeletor.plugin.javascript.commands; - -import com.eu.habbo.habbohotel.commands.Command; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.TwitchVideoComposer; -import com.skeletor.plugin.javascript.main; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class TwitchCommand extends Command { - public TwitchCommand() { - super("cmd_twitch", new String[] { "twitch" }); - } - - public boolean handle(GameClient gameClient, String[] strings) throws Exception { - Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); - if ((room.hasRights(gameClient.getHabbo()) || gameClient.getHabbo().getHabboInfo().getRank().getName().equals("VIP")) && - strings.length > 1) { - String videoId = strings[1]; - if (videoId.isEmpty()) { - gameClient.getHabbo().whisper("You must supply the twitch channel/video"); - return true; - } - main.addTwitchRoom(room.getId(), videoId); - TwitchVideoComposer twitchVideoComposer = new TwitchVideoComposer(videoId); - room.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)twitchVideoComposer)).compose()); - return true; - } - gameClient.getHabbo().whisper("You do not have permission to use this command in this room"); - return true; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/UpdateCategoriesCommand.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/UpdateCategoriesCommand.java deleted file mode 100644 index f44bf3a2..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/UpdateCategoriesCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.skeletor.plugin.javascript.commands; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.plugin.EventListener; -import com.skeletor.plugin.javascript.main; - -public class UpdateCategoriesCommand extends Command implements EventListener { - public UpdateCategoriesCommand(String permission, String[] keys) { - super(permission, keys); - } - - public boolean handle(GameClient gameClient, String[] strings) throws Exception { - main.getCommandManager().reload(); - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("categories.cmd_update_categories.success")); - return true; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/YoutubeCommand.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/YoutubeCommand.java deleted file mode 100644 index d509ab57..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/commands/YoutubeCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.skeletor.plugin.javascript.commands; - -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.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.YoutubeTVComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import com.skeletor.plugin.javascript.utils.RegexUtility; - -public class YoutubeCommand extends Command { - public YoutubeCommand() { - super("cmd_youtube", new String[] { "youtube" }); - } - - public boolean handle(GameClient gameClient, String[] strings) throws Exception { - Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); - if (strings.length > 1) { - String videoId = RegexUtility.getYouTubeId(strings[1]); - int time = 0; - if (videoId.isEmpty()) { - gameClient.getHabbo().whisper("Invalid youtube url", RoomChatMessageBubbles.ALERT); - return true; - } - if (strings[1].contains("t=")) - try { - String[] realParams = strings[1].split("\\?"); - if (realParams.length > 1) { - String[] params = realParams[1].split("&"); - for (String param : params) { - String[] split = param.split("="); - if (split.length > 1 && - split[0].equals("t")) - time = Integer.parseInt(split[1].replace("s", "")); - } - } - } catch (Exception exception) {} - YoutubeTVComposer youtubeTVComposer = new YoutubeTVComposer(videoId, Integer.valueOf(time)); - room.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)youtubeTVComposer)).compose()); - return true; - } - return true; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/CommunicationManager.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/CommunicationManager.java deleted file mode 100644 index 77772c62..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/CommunicationManager.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.skeletor.plugin.javascript.communication; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.incoming.audio.AddSongEvent; -import com.skeletor.plugin.javascript.communication.incoming.audio.NextSongEvent; -import com.skeletor.plugin.javascript.communication.incoming.audio.PlayStopEvent; -import com.skeletor.plugin.javascript.communication.incoming.audio.PreviousSongEvent; -import com.skeletor.plugin.javascript.communication.incoming.audio.RemoveSongEvent; -import com.skeletor.plugin.javascript.communication.incoming.audio.SongEndedEvent; -import com.skeletor.plugin.javascript.communication.incoming.common.MoveAvatarEvent; -import com.skeletor.plugin.javascript.communication.incoming.common.RequestCommandsEvent; -import com.skeletor.plugin.javascript.communication.incoming.common.RequestCreditsEvent; -import com.skeletor.plugin.javascript.communication.incoming.common.RequestSpinSlotMachineEvent; -import com.skeletor.plugin.javascript.communication.incoming.loaded.LoadedEvent; -import com.skeletor.plugin.javascript.utils.JsonFactory; -import gnu.trove.map.hash.THashMap; - -public class CommunicationManager { - private static CommunicationManager instance; - - private final THashMap> _incomingMessages; - - static { - try { - instance = new CommunicationManager(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public CommunicationManager() { - this._incomingMessages = new THashMap(); - initializeMessages(); - } - - public void initializeMessages() { - registerMessage("move_avatar", (Class)MoveAvatarEvent.class); - registerMessage("request_credits", (Class)RequestCreditsEvent.class); - registerMessage("spin_slot_machine", (Class)RequestSpinSlotMachineEvent.class); - registerMessage("add_song", (Class)AddSongEvent.class); - registerMessage("next_song", (Class)NextSongEvent.class); - registerMessage("prev_song", (Class)PreviousSongEvent.class); - registerMessage("play_stop", (Class)PlayStopEvent.class); - registerMessage("remove_song", (Class)RemoveSongEvent.class); - registerMessage("song_ended", (Class)SongEndedEvent.class); - registerMessage("request_commands", (Class)RequestCommandsEvent.class); - registerMessage("js_loaded", (Class)LoadedEvent.class); - } - - public void registerMessage(String key, Class message) { - this._incomingMessages.put(key, message); - } - - public THashMap> getIncomingMessages() { - return this._incomingMessages; - } - - public static CommunicationManager getInstance() { - if (instance == null) - try { - instance = new CommunicationManager(); - } catch (Exception e) { - Emulator.getLogging().logErrorLine(e.getMessage()); - } - return instance; - } - - public void OnMessage(String jsonPayload, GameClient sender) { - try { - IncomingWebMessage.JSONIncomingEvent heading = (IncomingWebMessage.JSONIncomingEvent)JsonFactory.getInstance().fromJson(jsonPayload, IncomingWebMessage.JSONIncomingEvent.class); - Class message = (Class)getInstance().getIncomingMessages().get(heading.header); - IncomingWebMessage webEvent = message.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]); - webEvent.handle(sender, JsonFactory.getInstance().fromJson(heading.data.toString(), webEvent.type)); - } catch (Exception e) { - Emulator.getLogging().logUndefinedPacketLine("unknown message: " + jsonPayload); - } - } - - public void Dispose() { - this._incomingMessages.clear(); - instance = null; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/IncomingWebMessage.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/IncomingWebMessage.java deleted file mode 100644 index add0095d..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/IncomingWebMessage.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.google.gson.JsonObject; - -public abstract class IncomingWebMessage { - public final Class type; - - public IncomingWebMessage(Class type) { - this.type = type; - } - - public abstract void handle(GameClient paramGameClient, T paramT); - - public static class JSONIncomingEvent { - public String header; - - public JsonObject data; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/AddSongEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/AddSongEvent.java deleted file mode 100644 index 0890434b..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/AddSongEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.audio; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.AddSongComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class AddSongEvent extends IncomingWebMessage { - public AddSongEvent() { - super(JSONAddSong.class); - } - - public void handle(GameClient client, JSONAddSong message) { - Room currentRoom = client.getHabbo().getHabboInfo().getCurrentRoom(); - if (currentRoom == null) - return; - if (currentRoom.hasRights(client.getHabbo())) { - RoomPlaylist playlist = RoomAudioManager.getInstance().getPlaylistForRoom(currentRoom.getId()); - RoomPlaylist.YoutubeVideo song = new RoomPlaylist.YoutubeVideo(message.name, message.videoId, message.channel); - playlist.addSong(song); - AddSongComposer addSongComposer = new AddSongComposer(song); - currentRoom.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)addSongComposer)).compose()); - } - } - - public static class JSONAddSong { - public String name; - - public String videoId; - - public String channel; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/NextSongEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/NextSongEvent.java deleted file mode 100644 index c6b5c416..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/NextSongEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.audio; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlaySongComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class NextSongEvent extends IncomingWebMessage { - public NextSongEvent() { - super(JSONNextSongEvent.class); - } - - public void handle(GameClient client, JSONNextSongEvent message) { - Room currentRoom = client.getHabbo().getHabboInfo().getCurrentRoom(); - if (currentRoom == null) - return; - if (currentRoom.hasRights(client.getHabbo())) { - RoomPlaylist playlist = RoomAudioManager.getInstance().getPlaylistForRoom(currentRoom.getId()); - playlist.nextSong(); - playlist.setPlaying(true); - PlaySongComposer playSongComposer = new PlaySongComposer(playlist.getCurrentIndex()); - currentRoom.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)playSongComposer)).compose()); - currentRoom.sendComposer(playlist.getNowPlayingBubbleAlert().compose()); - } - } - - public static class JSONNextSongEvent { - public int currentIndex; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/PlayStopEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/PlayStopEvent.java deleted file mode 100644 index 646a7492..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/PlayStopEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.audio; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlayStopComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class PlayStopEvent extends IncomingWebMessage { - public PlayStopEvent() { - super(JSONPlayStopEvent.class); - } - - public void handle(GameClient client, JSONPlayStopEvent message) { - Room room = client.getHabbo().getHabboInfo().getCurrentRoom(); - if (room == null) - return; - if (room.hasRights(client.getHabbo())) { - RoomPlaylist roomPlaylist = RoomAudioManager.getInstance().getPlaylistForRoom(room.getId()); - roomPlaylist.setPlaying(message.play); - room.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)new PlayStopComposer(message.play))).compose()); - if (message.play) - room.sendComposer(roomPlaylist.getNowPlayingBubbleAlert().compose()); - } - } - - public static class JSONPlayStopEvent { - public boolean play; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/PreviousSongEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/PreviousSongEvent.java deleted file mode 100644 index b443c473..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/PreviousSongEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.audio; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlaySongComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class PreviousSongEvent extends IncomingWebMessage { - public PreviousSongEvent() { - super(JSONPreviousSongEvent.class); - } - - public void handle(GameClient client, JSONPreviousSongEvent message) { - Room currentRoom = client.getHabbo().getHabboInfo().getCurrentRoom(); - if (currentRoom == null) - return; - if (currentRoom.hasRights(client.getHabbo())) { - RoomPlaylist playlist = RoomAudioManager.getInstance().getPlaylistForRoom(currentRoom.getId()); - playlist.prevSong(); - playlist.setPlaying(true); - PlaySongComposer playSongComposer = new PlaySongComposer(playlist.getCurrentIndex()); - currentRoom.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)playSongComposer)).compose()); - currentRoom.sendComposer(playlist.getNowPlayingBubbleAlert().compose()); - } - } - - public static class JSONPreviousSongEvent { - public int currentIndex; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/RemoveSongEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/RemoveSongEvent.java deleted file mode 100644 index 4dde4ee6..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/RemoveSongEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.audio; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.RemoveSongComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class RemoveSongEvent extends IncomingWebMessage { - public RemoveSongEvent() { - super(JSONRemoveSongEvent.class); - } - - public void handle(GameClient client, JSONRemoveSongEvent message) { - Room room = client.getHabbo().getHabboInfo().getCurrentRoom(); - if (room == null) - return; - if (room.hasRights(client.getHabbo())) { - RoomPlaylist roomPlaylist = RoomAudioManager.getInstance().getPlaylistForRoom(room.getId()); - roomPlaylist.removeSong(message.index); - room.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)new RemoveSongComposer(message.index))).compose()); - } - } - - public static class JSONRemoveSongEvent { - public int index; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/SongEndedEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/SongEndedEvent.java deleted file mode 100644 index 499e1def..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/audio/SongEndedEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.audio; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlaySongComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class SongEndedEvent extends IncomingWebMessage { - public SongEndedEvent() { - super(JSONSongEndedEvent.class); - } - - public void handle(GameClient client, JSONSongEndedEvent message) { - Room room = client.getHabbo().getHabboInfo().getCurrentRoom(); - if (room == null) - return; - if (room.hasRights(client.getHabbo())) { - RoomPlaylist playlist = RoomAudioManager.getInstance().getPlaylistForRoom(room.getId()); - if (playlist.getCurrentIndex() == message.currentIndex) { - playlist.nextSong(); - playlist.setPlaying(true); - PlaySongComposer playSongComposer = new PlaySongComposer(playlist.getCurrentIndex()); - room.sendComposer((new JavascriptCallbackComposer((OutgoingWebMessage)playSongComposer)).compose()); - room.sendComposer(playlist.getNowPlayingBubbleAlert().compose()); - } - } - } - - class JSONSongEndedEvent { - public int currentIndex; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/MoveAvatarEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/MoveAvatarEvent.java deleted file mode 100644 index 8db59e41..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/MoveAvatarEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.common; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomTile; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; - -public class MoveAvatarEvent extends IncomingWebMessage { - private static final short DEFAULT_WALK_AMOUNT = 1; - - public MoveAvatarEvent() { - super(JSONMoveAvatarEvent.class); - } - - public void handle(GameClient client, JSONMoveAvatarEvent message) { - Room room = client.getHabbo().getRoomUnit().getRoom(); - if (room == null) - return; - short x = (client.getHabbo().getRoomUnit().getGoal()).x; - short y = (client.getHabbo().getRoomUnit().getGoal()).y; - switch (message.direction) { - case "stop": - return; - case "left": - y = (short)(y + 1); - break; - case "right": - y = (short)(y - 1); - break; - case "up": - x = (short)(x - 1); - break; - case "down": - x = (short)(x + 1); - break; - default: - return; - } - try { - RoomTile goal = room.getLayout().getTile(x, y); - if (goal == null) - return; - if (goal.isWalkable() || client.getHabbo().getHabboInfo().getCurrentRoom().canSitOrLayAt(goal.x, goal.y)) { - if (client.getHabbo().getRoomUnit().getMoveBlockingTask() != null) - client.getHabbo().getRoomUnit().getMoveBlockingTask().get(); - client.getHabbo().getRoomUnit().setGoalLocation(goal); - } - } catch (Exception exception) {} - } - - static class JSONMoveAvatarEvent { - String direction; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestCommandsEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestCommandsEvent.java deleted file mode 100644 index c67ea48a..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestCommandsEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.common; - -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.MessageComposer; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.CommandsComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import java.util.List; - -public class RequestCommandsEvent extends IncomingWebMessage { - public RequestCommandsEvent() { - super(JSONRequestCommandsEvent.class); - } - - public void handle(GameClient client, JSONRequestCommandsEvent message) { - List commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(client.getHabbo().getHabboInfo().getRank().getId()); - CommandsComposer commandsComposer = new CommandsComposer(commands); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)commandsComposer)); - } - - static class JSONRequestCommandsEvent { - boolean idk; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestCreditsEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestCreditsEvent.java deleted file mode 100644 index 9c8452ae..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestCreditsEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.common; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.users.UserCreditsComposer; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.UpdateCreditsComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class RequestCreditsEvent extends IncomingWebMessage { - public RequestCreditsEvent() { - super(JSONRequestCreditsEvent.class); - } - - public void handle(GameClient client, JSONRequestCreditsEvent message) { - client.sendResponse((MessageComposer)new UserCreditsComposer(client.getHabbo())); - UpdateCreditsComposer creditsComposer = new UpdateCreditsComposer(client.getHabbo().getHabboInfo().getCredits()); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)creditsComposer)); - } - - static class JSONRequestCreditsEvent { - boolean idk; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestSpinSlotMachineEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestSpinSlotMachineEvent.java deleted file mode 100644 index 58ea5a86..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/common/RequestSpinSlotMachineEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.common; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.users.UserCreditsComposer; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.UpdateCreditsComposer; -import com.skeletor.plugin.javascript.communication.outgoing.slotmachine.SpinResultComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class RequestSpinSlotMachineEvent extends IncomingWebMessage { - private static final int maxNumber = 5; - - private static final int LEMON = 0; - - private static final int MELON = 1; - - private static final int GRAPES = 2; - - private static final int CHERRY = 3; - - private static final int BAR = 4; - - public RequestSpinSlotMachineEvent() { - super(JSONRequestSpinSlotMachineEvent.class); - } - - public void handle(GameClient client, JSONRequestSpinSlotMachineEvent message) { - HabboItem item = client.getHabbo().getRoomUnit().getRoom().getHabboItem(message.itemId); - if (item == null) - return; - if (message.bet <= 0 || message.bet > client.getHabbo().getHabboInfo().getCredits()) - return; - client.getHabbo().getHabboInfo().addCredits(-message.bet); - client.sendResponse((MessageComposer)new UserCreditsComposer(client.getHabbo())); - client.getHabbo().talk(Emulator.getTexts().getValue("slot.machines.spin", "* Bets %amount% on Slots Machine *").replace("%amount%", message.bet + ""), RoomChatMessageBubbles.ALERT); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new UpdateCreditsComposer(client.getHabbo().getHabboInfo().getCredits()))); - int result1 = Emulator.getRandom().nextInt(5); - int result2 = Emulator.getRandom().nextInt(5); - int result3 = Emulator.getRandom().nextInt(5); - int amountWon = 0; - boolean won = false; - if (result1 == result2 && result2 == result3) { - won = true; - switch (result1) { - case 0: - amountWon = 5 * message.bet; - break; - case 1: - amountWon = 6 * message.bet; - break; - case 2: - amountWon = 10 * message.bet; - break; - case 3: - amountWon = 15 * message.bet; - break; - case 4: - amountWon = 20 * message.bet; - break; - } - client.getHabbo().getHabboInfo().addCredits(amountWon); - } else if (result1 == 4 && result2 == 4) { - won = true; - amountWon = 4 * message.bet; - client.getHabbo().getHabboInfo().addCredits(amountWon); - } else if (result1 == 3 && result2 == 3) { - won = true; - amountWon = 3 * message.bet; - client.getHabbo().getHabboInfo().addCredits(amountWon); - } else if (result1 == 3) { - won = true; - amountWon = 2 * message.bet; - client.getHabbo().getHabboInfo().addCredits(amountWon); - } - SpinResultComposer resultComposer = new SpinResultComposer(result1, result2, result3, won, amountWon); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)resultComposer)); - int finalAmount = amountWon; - Emulator.getThreading().run(() -> client.getHabbo().talk(Emulator.getTexts().getValue("slot.machines.won", "* Won %amount% in Slots Machine *").replace("%amount%", finalAmount + ""), RoomChatMessageBubbles.ALERT), 5000L); - } - - static class JSONRequestSpinSlotMachineEvent { - int itemId; - - int bet; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/loaded/LoadedEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/loaded/LoadedEvent.java deleted file mode 100644 index ffb47688..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/incoming/loaded/LoadedEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.skeletor.plugin.javascript.communication.incoming.loaded; - -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.MessageComposer; -import com.skeletor.plugin.javascript.communication.incoming.IncomingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.commands.CommandsPopUpComposer; -import com.skeletor.plugin.javascript.main; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import java.util.List; - -public class LoadedEvent extends IncomingWebMessage { - public LoadedEvent() { - super(JSONLoadedEvent.class); - } - - public void handle(GameClient client, JSONLoadedEvent message) { - Habbo habbo = client.getHabbo(); - if (habbo == null) - return; - (habbo.getHabboStats()).cache.put(main.USER_LOADED_EVENT, Boolean.valueOf(true)); - List commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(client.getHabbo().getHabboInfo().getRank().getId()); - CommandsPopUpComposer commandsPopUpComposer = new CommandsPopUpComposer(commands, (habbo.getHabboInfo().getRank().getLevel() >= 5)); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)commandsPopUpComposer)); - } - - static class JSONLoadedEvent { - boolean idk; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/OutgoingWebMessage.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/OutgoingWebMessage.java deleted file mode 100644 index ce70c591..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/OutgoingWebMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing; - -import com.google.gson.JsonObject; - -public abstract class OutgoingWebMessage { - public String header; - - public JsonObject data; - - public OutgoingWebMessage(String name) { - this.header = name; - this.data = new JsonObject(); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/AddSongComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/AddSongComposer.java deleted file mode 100644 index 7da77f81..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/AddSongComposer.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class AddSongComposer extends OutgoingWebMessage { - public AddSongComposer(RoomPlaylist.YoutubeVideo video) { - super("add_song"); - JsonObject song = new JsonObject(); - song.add("name", (JsonElement)new JsonPrimitive(video.name)); - song.add("videoId", (JsonElement)new JsonPrimitive(video.videoId)); - song.add("channel", (JsonElement)new JsonPrimitive(video.channel)); - this.data.add("song", (JsonElement)song); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/ChangeVolumeComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/ChangeVolumeComposer.java deleted file mode 100644 index a2080ec0..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/ChangeVolumeComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class ChangeVolumeComposer extends OutgoingWebMessage { - public ChangeVolumeComposer(int volume) { - super("change_volume"); - this.data.add("volume", (JsonElement)new JsonPrimitive(Integer.valueOf(volume))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/DisposePlaylistComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/DisposePlaylistComposer.java deleted file mode 100644 index 3b1b7eaa..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/DisposePlaylistComposer.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class DisposePlaylistComposer extends OutgoingWebMessage { - public DisposePlaylistComposer() { - super("dispose_playlist"); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/JukeboxComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/JukeboxComposer.java deleted file mode 100644 index 15f7fbfb..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/JukeboxComposer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class JukeboxComposer extends OutgoingWebMessage { - public JukeboxComposer(RoomPlaylist playlist) { - super("jukebox_player"); - JsonArray playlistJson = new JsonArray(); - for (RoomPlaylist.YoutubeVideo video : playlist.getPlaylist()) { - JsonObject song = new JsonObject(); - song.add("name", (JsonElement)new JsonPrimitive(video.name)); - song.add("videoId", (JsonElement)new JsonPrimitive(video.videoId)); - song.add("channel", (JsonElement)new JsonPrimitive(video.channel)); - playlistJson.add((JsonElement)song); - } - this.data.add("playlist", (JsonElement)playlistJson); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlaySongComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlaySongComposer.java deleted file mode 100644 index 85ab1dbd..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlaySongComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class PlaySongComposer extends OutgoingWebMessage { - public PlaySongComposer(int index) { - super("play_song"); - this.data.add("index", (JsonElement)new JsonPrimitive(Integer.valueOf(index))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlayStopComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlayStopComposer.java deleted file mode 100644 index bfce7e0d..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlayStopComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class PlayStopComposer extends OutgoingWebMessage { - public PlayStopComposer(boolean isPlaying) { - super("play_stop"); - this.data.add("playing", (JsonElement)new JsonPrimitive(Boolean.valueOf(isPlaying))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlaylistComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlaylistComposer.java deleted file mode 100644 index 31692553..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/PlaylistComposer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class PlaylistComposer extends OutgoingWebMessage { - public PlaylistComposer(RoomPlaylist playlist) { - super("playlist"); - JsonArray playlistJson = new JsonArray(); - for (RoomPlaylist.YoutubeVideo video : playlist.getPlaylist()) { - JsonObject song = new JsonObject(); - song.add("name", (JsonElement)new JsonPrimitive(video.name)); - song.add("videoId", (JsonElement)new JsonPrimitive(video.videoId)); - song.add("channel", (JsonElement)new JsonPrimitive(video.channel)); - playlistJson.add((JsonElement)song); - } - this.data.add("playlist", (JsonElement)playlistJson); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/RemoveSongComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/RemoveSongComposer.java deleted file mode 100644 index 28db2426..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/audio/RemoveSongComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.audio; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class RemoveSongComposer extends OutgoingWebMessage { - public RemoveSongComposer(int index) { - super("remove_song"); - this.data.add("index", (JsonElement)new JsonPrimitive(Integer.valueOf(index))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/commands/CommandsPopUpComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/commands/CommandsPopUpComposer.java deleted file mode 100644 index 7a5ac1b2..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/commands/CommandsPopUpComposer.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.commands; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -public class CommandsPopUpComposer extends OutgoingWebMessage { - public CommandsPopUpComposer(List commands, boolean mod) { - super("commands_pop_up"); - JsonArray json_cmd = new JsonArray(); - Collections.sort(commands, new Comparator() { - public int compare(Command command2, Command command1) { - return Emulator.getTexts().getValue("commands.description." + command2.permission, "commands.description." + command2.permission).compareTo(Emulator.getTexts().getValue("commands.description." + command1.permission, "commands.description." + command1.permission)); - } - }); - for (Command c : commands) - json_cmd.add(Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission)); - this.data.add("commands", (JsonElement)json_cmd); - this.data.add("mod", (JsonElement)new JsonPrimitive(Boolean.valueOf(mod))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/CommandsComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/CommandsComposer.java deleted file mode 100644 index eb48958b..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/CommandsComposer.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.common; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.skeletor.plugin.javascript.categories.Category; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.main; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -public class CommandsComposer extends OutgoingWebMessage { - public CommandsComposer(List commands) { - super("commands"); - JsonArray json_cmd = new JsonArray(); - Collections.sort(commands, new Comparator() { - public int compare(Command command2, Command command1) { - return Emulator.getTexts().getValue("commands.description." + command2.permission, "commands.description." + command2.permission).compareTo(Emulator.getTexts().getValue("commands.description." + command1.permission, "commands.description." + command1.permission)); - } - }); - List duplicateCommands = new ArrayList<>(commands); - List tempList = new ArrayList<>(); - boolean hasPermission = false; - for (Category category : main.getCommandManager().getCommandCategories()) { - tempList = new ArrayList<>(); - hasPermission = false; - if (category.getPermissions().size() > 0) { - for (String permission : category.getPermissions()) { - for (Command command : commands) { - if (command.permission.equals(permission)) { - duplicateCommands.remove(command); - String keys = ""; - if (Emulator.getConfig().getBoolean("categories.cmd_commandsc.show_keys")) { - for (String key : command.keys) { - if (keys.equals("")) { - keys = "(" + key; - } else { - keys = keys + " " + key; - } - } - keys = keys + ")"; - } - tempList.add(Emulator.getTexts().getValue("commands.description." + command.permission, "commands.description." + command.permission + " " + keys)); - hasPermission = true; - } - } - } - if (hasPermission) { - json_cmd.add(category.getName()); - for (String temp : tempList) - json_cmd.add(temp); - } - } - } - if (duplicateCommands.size() > 0 && Emulator.getConfig().getBoolean("categories.cmd_commandsc.show_others")) { - json_cmd.add(Emulator.getTexts().getValue("commands.generic.cmd_commandsc.others")); - for (Command command : duplicateCommands) { - String keys = ""; - if (Emulator.getConfig().getBoolean("categories.cmd_commandsc.show_keys")) { - for (String key : command.keys) { - if (keys.equals("")) { - keys = "(" + key; - } else { - keys = keys + " " + key; - } - } - keys = keys + ")"; - } - json_cmd.add(Emulator.getTexts().getValue("commands.description." + command.permission, "commands.description." + command.permission) + " " + keys); - } - } - this.data.add("commands", (JsonElement)json_cmd); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/OnlineCountComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/OnlineCountComposer.java deleted file mode 100644 index 82528641..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/OnlineCountComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.common; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class OnlineCountComposer extends OutgoingWebMessage { - public OnlineCountComposer(int count) { - super("online_count"); - this.data.add("count", (JsonElement)new JsonPrimitive(Integer.valueOf(count))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/SessionDataComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/SessionDataComposer.java deleted file mode 100644 index 43ed4ec9..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/SessionDataComposer.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.common; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class SessionDataComposer extends OutgoingWebMessage { - public SessionDataComposer(int id, String username, String look, int credits) { - super("session_data"); - this.data.add("id", (JsonElement)new JsonPrimitive(Integer.valueOf(id))); - this.data.add("username", (JsonElement)new JsonPrimitive(username)); - this.data.add("look", (JsonElement)new JsonPrimitive(look)); - this.data.add("credits", (JsonElement)new JsonPrimitive(Integer.valueOf(credits))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/TwitchVideoComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/TwitchVideoComposer.java deleted file mode 100644 index a596c05a..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/TwitchVideoComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.common; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class TwitchVideoComposer extends OutgoingWebMessage { - public TwitchVideoComposer(String videoId) { - super("twitch"); - this.data.add("videoId", (JsonElement)new JsonPrimitive(videoId)); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/UpdateCreditsComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/UpdateCreditsComposer.java deleted file mode 100644 index f79bfa3a..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/UpdateCreditsComposer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.common; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class UpdateCreditsComposer extends OutgoingWebMessage { - public UpdateCreditsComposer(int credits) { - super("update_credits"); - this.data.add("credits", (JsonElement)new JsonPrimitive(Integer.valueOf(credits))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/YoutubeTVComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/YoutubeTVComposer.java deleted file mode 100644 index 69f4e82d..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/common/YoutubeTVComposer.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.common; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class YoutubeTVComposer extends OutgoingWebMessage { - public YoutubeTVComposer(String videoId, Integer time) { - super("youtube_tv"); - this.data.add("videoId", (JsonElement)new JsonPrimitive(videoId)); - this.data.add("time", (JsonElement)new JsonPrimitive(time)); - this.data.add("itemId", (JsonElement)new JsonPrimitive(Integer.valueOf(0))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/slotmachine/SlotMachineComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/slotmachine/SlotMachineComposer.java deleted file mode 100644 index c24da4c3..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/slotmachine/SlotMachineComposer.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.slotmachine; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class SlotMachineComposer extends OutgoingWebMessage { - public SlotMachineComposer(int itemId, int credits) { - super("slot_machine"); - this.data.add("itemId", (JsonElement)new JsonPrimitive(Integer.valueOf(itemId))); - this.data.add("credits", (JsonElement)new JsonPrimitive(Integer.valueOf(credits))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/slotmachine/SpinResultComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/slotmachine/SpinResultComposer.java deleted file mode 100644 index 54cbc9a4..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/communication/outgoing/slotmachine/SpinResultComposer.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.skeletor.plugin.javascript.communication.outgoing.slotmachine; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; - -public class SpinResultComposer extends OutgoingWebMessage { - public SpinResultComposer(int result1, int result2, int result3, boolean won, int payout) { - super("slot_result"); - this.data.add("result1", (JsonElement)new JsonPrimitive(Integer.valueOf(result1))); - this.data.add("result2", (JsonElement)new JsonPrimitive(Integer.valueOf(result2))); - this.data.add("result3", (JsonElement)new JsonPrimitive(Integer.valueOf(result3))); - this.data.add("won", (JsonElement)new JsonPrimitive(Boolean.valueOf(won))); - this.data.add("payout", (JsonElement)new JsonPrimitive(Integer.valueOf(payout))); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/interactions/InteractionSlotMachine.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/interactions/InteractionSlotMachine.java deleted file mode 100644 index 37321b56..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/interactions/InteractionSlotMachine.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.skeletor.plugin.javascript.interactions; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.slotmachine.SlotMachineComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import java.sql.ResultSet; -import java.sql.SQLException; - -public class InteractionSlotMachine extends InteractionDefault { - public InteractionSlotMachine(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public InteractionSlotMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { - return false; - } - - public boolean isWalkable() { - return false; - } - - public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {} - - public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - super.onClick(client, room, objects); - SlotMachineComposer webComposer = new SlotMachineComposer(getId(), client.getHabbo().getHabboInfo().getCredits()); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)webComposer)); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/interactions/InteractionYoutubeJukebox.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/interactions/InteractionYoutubeJukebox.java deleted file mode 100644 index c28706b1..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/interactions/InteractionYoutubeJukebox.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.skeletor.plugin.javascript.interactions; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.JukeboxComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import java.sql.ResultSet; -import java.sql.SQLException; - -public class InteractionYoutubeJukebox extends InteractionDefault { - public InteractionYoutubeJukebox(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public InteractionYoutubeJukebox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { - return false; - } - - public boolean isWalkable() { - return false; - } - - public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {} - - public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - super.onClick(client, room, objects); - if (room.hasRights(client.getHabbo())) { - RoomPlaylist roomPlaylist = RoomAudioManager.getInstance().getPlaylistForRoom(room.getId()); - JukeboxComposer webComposer = new JukeboxComposer(roomPlaylist); - client.sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)webComposer)); - } - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/main.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/main.java deleted file mode 100644 index 53a101ab..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/main.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.skeletor.plugin.javascript; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.commands.Command; -import com.eu.habbo.habbohotel.commands.CommandHandler; -import com.eu.habbo.habbohotel.items.ItemInteraction; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.plugin.EventHandler; -import com.eu.habbo.plugin.EventListener; -import com.eu.habbo.plugin.HabboPlugin; -import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent; -import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent; -import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent; -import com.eu.habbo.plugin.events.users.UserCreditsEvent; -import com.eu.habbo.plugin.events.users.UserEnterRoomEvent; -import com.eu.habbo.plugin.events.users.UserExitRoomEvent; -import com.eu.habbo.plugin.events.users.UserLoginEvent; -import com.eu.habbo.plugin.events.users.UserSavedSettingsEvent; -import com.skeletor.plugin.javascript.audio.RoomAudioManager; -import com.skeletor.plugin.javascript.audio.RoomPlaylist; -import com.skeletor.plugin.javascript.categories.CommandManager; -import com.skeletor.plugin.javascript.commands.CmdCommand; -import com.skeletor.plugin.javascript.commands.TwitchCommand; -import com.skeletor.plugin.javascript.commands.UpdateCategoriesCommand; -import com.skeletor.plugin.javascript.commands.YoutubeCommand; -import com.skeletor.plugin.javascript.communication.CommunicationManager; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.audio.ChangeVolumeComposer; -import com.skeletor.plugin.javascript.communication.outgoing.audio.DisposePlaylistComposer; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlaySongComposer; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlayStopComposer; -import com.skeletor.plugin.javascript.communication.outgoing.audio.PlaylistComposer; -import com.skeletor.plugin.javascript.communication.outgoing.common.OnlineCountComposer; -import com.skeletor.plugin.javascript.communication.outgoing.common.SessionDataComposer; -import com.skeletor.plugin.javascript.communication.outgoing.common.TwitchVideoComposer; -import com.skeletor.plugin.javascript.communication.outgoing.common.UpdateCreditsComposer; -import com.skeletor.plugin.javascript.interactions.InteractionSlotMachine; -import com.skeletor.plugin.javascript.interactions.InteractionYoutubeJukebox; -import com.skeletor.plugin.javascript.override_packets.incoming.JavascriptCallbackEvent; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import com.skeletor.plugin.javascript.runnables.OnlineCountRunnable; -import com.skeletor.plugin.javascript.scheduler.CheckLoadedScheduler; -import gnu.trove.map.hash.THashMap; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class main extends HabboPlugin implements EventListener { - public static final int JSCALLBACKEVENTHEADER = 314; - - private static CommandManager commandManager; - - private static THashMap twitchRooms; - - public static String USER_LOADED_EVENT = "user.loaded.event.key"; - - public static String STARTED_LOADING_EVENT = "user.loading.event.key"; - - public void onEnable() throws Exception { - Emulator.getPluginManager().registerEvents(this, this); - if (Emulator.isReady && !Emulator.isShuttingDown) - onEmulatorLoadedEvent(null); - } - - @EventHandler - public void onEmulatorLoadedEvent(EmulatorLoadedEvent e) throws Exception { - Emulator.getGameServer().getPacketManager().registerHandler(Integer.valueOf(314), JavascriptCallbackEvent.class); - Emulator.getTexts().register("jscommands.keys.cmd_commands", "commands"); - Emulator.getTexts().register("commands.description.cmd_commandsc", ":commandsc"); - Emulator.getTexts().register("categories.cmd_commandsc.keys", "commandsc"); - Emulator.getTexts().register("commands.generic.cmd_commandsc.text", "Your Commands"); - Emulator.getTexts().register("commands.generic.cmd_commandsc.others", "Others"); - Emulator.getTexts().register("commands.description.cmd_update_categories", ":update_categories"); - Emulator.getTexts().register("categories.cmd_update_categories.keys", "update_categories"); - Emulator.getTexts().register("categories.cmd_update_categories.success", "Successfully updated command categories"); - Emulator.getConfig().register("categories.cmd_commandsc.show_keys", "1"); - Emulator.getConfig().register("categories.cmd_commandsc.show_others", "1"); - boolean reloadPermissions = false; - reloadPermissions = registerPermission("cmd_commandsc", "'0', '1'", "1", reloadPermissions); - reloadPermissions = registerPermission("cmd_update_categories", "'0', '1'", "0", reloadPermissions); - if (reloadPermissions) - Emulator.getGameEnvironment().getPermissionsManager().reload(); - CommandHandler.addCommand((Command)new YoutubeCommand()); - CommandHandler.addCommand((Command)new CmdCommand()); - CommandHandler.addCommand((Command)new TwitchCommand()); - CommandHandler.addCommand((Command)new UpdateCategoriesCommand("cmd_update_categories", Emulator.getTexts().getValue("categories.cmd_update_categories.keys").split(";"))); - RoomAudioManager.Init(); - OnlineCountRunnable.getInstance().start(); - commandManager = new CommandManager(); - twitchRooms = new THashMap(); - new CheckLoadedScheduler(); - } - - private boolean registerPermission(String name, String options, String defaultValue, boolean defaultReturn) { - try(Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - - PreparedStatement statement = connection.prepareStatement("ALTER TABLE `permissions` ADD `" + name + "` ENUM( " + options + " ) NOT NULL DEFAULT '" + defaultValue + "'")) { - statement.execute(); - return true; - } catch (SQLException sQLException) { - return defaultReturn; - } - } - - @EventHandler - public void onLoadItemsManager(EmulatorLoadItemsManagerEvent e) { - Emulator.getGameEnvironment().getItemManager().addItemInteraction(new ItemInteraction("slots_machine", InteractionSlotMachine.class)); - Emulator.getGameEnvironment().getItemManager().addItemInteraction(new ItemInteraction("yt_jukebox", InteractionYoutubeJukebox.class)); - } - - @EventHandler - public void onUserEnterRoomEvent(UserEnterRoomEvent e) { - RoomPlaylist playlist = RoomAudioManager.getInstance().getPlaylistForRoom(e.room.getId()); - if (playlist.getPlaylist().size() > 0) { - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new PlaylistComposer(playlist))); - if (playlist.isPlaying()) { - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new PlaySongComposer(playlist.getCurrentIndex()))); - e.habbo.getClient().sendResponse(playlist.getNowPlayingBubbleAlert()); - } - } - if (e.room.getHabbos() == null || e.room.getHabbos().size() == 0) - twitchRooms.remove(Integer.valueOf(e.room.getId())); - if (twitchRooms.containsKey(Integer.valueOf(e.room.getId()))) { - TwitchVideoComposer twitchVideoComposer = new TwitchVideoComposer((String)twitchRooms.get(Integer.valueOf(e.room.getId()))); - e.habbo.getClient().sendResponse((new JavascriptCallbackComposer((OutgoingWebMessage)twitchVideoComposer)).compose()); - } - } - - @EventHandler - public void onUserExitRoomEvent(UserExitRoomEvent e) { - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new PlayStopComposer(false))); - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new DisposePlaylistComposer())); - } - - @EventHandler - public void onRoomUncachedEvent(RoomUncachedEvent e) { - RoomAudioManager.getInstance().dispose(e.room.getId()); - } - - @EventHandler - public void onUserLoginEvent(UserLoginEvent e) { - if (e.habbo == null || e.habbo.getClient() == null) - return; - Habbo habbo = e.habbo; - (e.habbo.getHabboStats()).cache.put(USER_LOADED_EVENT, Boolean.valueOf(false)); - (e.habbo.getHabboStats()).cache.put(STARTED_LOADING_EVENT, Integer.valueOf(Emulator.getIntUnixTimestamp())); - SessionDataComposer sessionDataComposer = new SessionDataComposer(e.habbo.getHabboInfo().getId(), e.habbo.getHabboInfo().getUsername(), e.habbo.getHabboInfo().getLook(), e.habbo.getHabboInfo().getCredits()); - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)sessionDataComposer)); - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new ChangeVolumeComposer((e.habbo.getHabboStats()).volumeTrax))); - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new OnlineCountComposer(Emulator.getGameEnvironment().getHabboManager().getOnlineCount()))); - Emulator.getThreading().run(() -> userCheckLoaded(habbo), 500L); - } - - public void userCheckLoaded(Habbo habbo) { - if (habbo == null || habbo.getClient() == null || !habbo.isOnline()) - return; - if (((Boolean)(habbo.getHabboStats()).cache.get(USER_LOADED_EVENT)).booleanValue()) - return; - if (Emulator.getIntUnixTimestamp() - ((Integer)(habbo.getHabboStats()).cache.get(STARTED_LOADING_EVENT)).intValue() > 15) - return; - SessionDataComposer sessionDataComposer = new SessionDataComposer(habbo.getHabboInfo().getId(), habbo.getHabboInfo().getUsername(), habbo.getHabboInfo().getLook(), habbo.getHabboInfo().getCredits()); - habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)sessionDataComposer)); - habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new ChangeVolumeComposer((habbo.getHabboStats()).volumeTrax))); - habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new OnlineCountComposer(Emulator.getGameEnvironment().getHabboManager().getOnlineCount()))); - Emulator.getThreading().run(() -> userCheckLoaded(habbo), 500L); - } - - @EventHandler - public void onUserCreditsEvent(UserCreditsEvent e) { - UpdateCreditsComposer creditsComposer = new UpdateCreditsComposer(e.habbo.getHabboInfo().getCredits()); - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)creditsComposer)); - } - - @EventHandler - public void onUserSavedSettingsEvent(UserSavedSettingsEvent e) { - e.habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new ChangeVolumeComposer((e.habbo.getHabboStats()).volumeTrax))); - } - - public void onDisable() throws Exception { - CommunicationManager.getInstance().Dispose(); - RoomAudioManager.getInstance().Dispose(); - OnlineCountRunnable.getInstance().stop(); - } - - public static CommandManager getCommandManager() { - return commandManager; - } - - public static void addTwitchRoom(int roomId, String twitch) { - twitchRooms.put(Integer.valueOf(roomId), twitch); - } - - public boolean hasPermission(Habbo habbo, String s) { - return false; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/override_packets/incoming/JavascriptCallbackEvent.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/override_packets/incoming/JavascriptCallbackEvent.java deleted file mode 100644 index ddda6429..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/override_packets/incoming/JavascriptCallbackEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.skeletor.plugin.javascript.override_packets.incoming; - -import com.eu.habbo.messages.incoming.MessageHandler; -import com.skeletor.plugin.javascript.communication.CommunicationManager; - -public class JavascriptCallbackEvent extends MessageHandler { - public void handle() { - String payload = this.packet.readString(); - CommunicationManager.getInstance().OnMessage(payload, this.client); - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/override_packets/outgoing/JavascriptCallbackComposer.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/override_packets/outgoing/JavascriptCallbackComposer.java deleted file mode 100644 index 61178ab6..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/override_packets/outgoing/JavascriptCallbackComposer.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.skeletor.plugin.javascript.override_packets.outgoing; - -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.utils.JsonFactory; - -public class JavascriptCallbackComposer extends MessageComposer { - private OutgoingWebMessage webMessage; - - public JavascriptCallbackComposer(OutgoingWebMessage message) { - this.webMessage = message; - } - - public ServerMessage composeInternal() { - this.response.init(2023); - String jsonMessage = JsonFactory.getInstance().toJson(this.webMessage).replace("/", "/"); - this.response.appendString("habblet/open/" + jsonMessage); - return this.response; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/runnables/OnlineCountRunnable.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/runnables/OnlineCountRunnable.java deleted file mode 100644 index 54558399..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/runnables/OnlineCountRunnable.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.skeletor.plugin.javascript.runnables; - -import com.eu.habbo.Emulator; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.OnlineCountComposer; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; - -public class OnlineCountRunnable implements Runnable { - private static final OnlineCountRunnable instance = new OnlineCountRunnable(); - - private volatile boolean running = false; - - public void run() { - if (this.running) { - int count = Emulator.getGameEnvironment().getHabboManager().getOnlineCount(); - Emulator.getGameServer().getGameClientManager().sendBroadcastResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)new OnlineCountComposer(count))); - Emulator.getThreading().run(this, 30000L); - } - } - - public static OnlineCountRunnable getInstance() { - return instance; - } - - public void start() { - if (!this.running) { - this.running = true; - Emulator.getThreading().run(this); - } - } - - public void stop() { - this.running = false; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/scheduler/CheckLoadedScheduler.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/scheduler/CheckLoadedScheduler.java deleted file mode 100644 index 030bca3d..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/scheduler/CheckLoadedScheduler.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.skeletor.plugin.javascript.scheduler; - -import com.eu.habbo.Emulator; -import com.eu.habbo.core.Scheduler; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.skeletor.plugin.javascript.communication.outgoing.OutgoingWebMessage; -import com.skeletor.plugin.javascript.communication.outgoing.common.SessionDataComposer; -import com.skeletor.plugin.javascript.main; -import com.skeletor.plugin.javascript.override_packets.outgoing.JavascriptCallbackComposer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CheckLoadedScheduler extends Scheduler { - private static final Logger LOGGER = LoggerFactory.getLogger(CheckLoadedScheduler.class); - - public CheckLoadedScheduler() { - super(60); - run(); - } - - public void run() { - super.run(); - if (Emulator.getConfig().getBoolean("pop.up.enabled", true)) - for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) { - if (!(habbo.getHabboStats()).cache.containsKey(main.USER_LOADED_EVENT)) - continue; - if (((Boolean)(habbo.getHabboStats()).cache.get(main.USER_LOADED_EVENT)).booleanValue()) - continue; - SessionDataComposer sessionDataComposer = new SessionDataComposer(habbo.getHabboInfo().getId(), habbo.getHabboInfo().getUsername(), habbo.getHabboInfo().getLook(), habbo.getHabboInfo().getCredits()); - habbo.getClient().sendResponse((MessageComposer)new JavascriptCallbackComposer((OutgoingWebMessage)sessionDataComposer)); - } - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/utils/JsonFactory.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/utils/JsonFactory.java deleted file mode 100644 index fa3e5abd..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/utils/JsonFactory.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.skeletor.plugin.javascript.utils; - -import com.google.gson.Gson; - -public class JsonFactory { - private static final Gson gson = new Gson(); - - public static Gson getInstance() { - return gson; - } -} diff --git a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/utils/RegexUtility.java b/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/utils/RegexUtility.java deleted file mode 100644 index 9fb748d6..00000000 --- a/Plugins/Javascript-Plugin/src/main/java/com/skeletor/plugin/javascript/utils/RegexUtility.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.skeletor.plugin.javascript.utils; -import org.owasp.html.HtmlPolicyBuilder; -import org.owasp.html.PolicyFactory; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class RegexUtility { - - public static String getYouTubeId (String youTubeUrl) { - String pattern = "(?<=youtu.be/|watch\\?v=|/videos/|embed\\/)[^#\\&\\?]*"; - Pattern compiledPattern = Pattern.compile(pattern); - Matcher matcher = compiledPattern.matcher(youTubeUrl); - if(matcher.find()){ - return matcher.group(); - } else { - return ""; - } - } - - /** - * Sanitizes a string by removing any potentially harmful HTML elements. - * - * @param str The string to be sanitized. - * @return The sanitized string. - */ - public static String sanitize(String str) { - PolicyFactory policy = new HtmlPolicyBuilder().toFactory(); - return policy.sanitize(str); - } -} \ No newline at end of file diff --git a/Plugins/Javascript-Plugin/src/main/resources/plugin.json b/Plugins/Javascript-Plugin/src/main/resources/plugin.json deleted file mode 100644 index 64adabf1..00000000 --- a/Plugins/Javascript-Plugin/src/main/resources/plugin.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "main" : "com.skeletor.plugin.javascript.main", - "name" : "Javascript Plugin", - "author" : "skeletor" -} \ No newline at end of file