{"id":29341496,"url":"https://github.com/josscoder/redisbridge","last_synced_at":"2025-09-03T07:34:28.365Z","repository":{"id":303234283,"uuid":"1012212871","full_name":"Josscoder/RedisBridge","owner":"Josscoder","description":"RedisBridge is a Nukkit/WaterdogPE plugin for auto server registration and communication","archived":false,"fork":false,"pushed_at":"2025-07-21T16:47:33.000Z","size":1011,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-21T18:51:12.700Z","etag":null,"topics":["bedrock","minecraft","network","nukkit","redis","redisbungee","waterdogpe"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Josscoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-02T02:04:40.000Z","updated_at":"2025-07-21T02:47:32.000Z","dependencies_parsed_at":"2025-07-06T14:29:35.307Z","dependency_job_id":"bd4d34be-8b67-4257-99b2-22bb52654f81","html_url":"https://github.com/Josscoder/RedisBridge","commit_stats":null,"previous_names":["josscoder/redisbridge"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Josscoder/RedisBridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josscoder%2FRedisBridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josscoder%2FRedisBridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josscoder%2FRedisBridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josscoder%2FRedisBridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Josscoder","download_url":"https://codeload.github.com/Josscoder/RedisBridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josscoder%2FRedisBridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273409426,"owners_count":25100444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bedrock","minecraft","network","nukkit","redis","redisbungee","waterdogpe"],"created_at":"2025-07-08T09:09:16.889Z","updated_at":"2025-09-03T07:34:28.346Z","avatar_url":"https://github.com/Josscoder.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/assets/logo.png\" alt=\"fsmgo logo\" width=\"300\"/\u003e\n\u003c/p\u003e\n\n**RedisBridge** is a complete rewrite of my previous plugin [JBridge](https://github.com/JossArchived/JBridge), developed for Nukkit and WaterdogPE. It provides automatic server registration, player management, and seamless communication between backend servers and the proxy.\n\n# ⚙️ Available Commands\nRedisBridge includes ready-to-use commands for your WaterdogPE proxy or Nukkit backend servers:\n\n- `/lobby`\nTeleports the player to an available lobby instance using the `LOWEST_PLAYERS` strategy to avoid overloading a single lobby while keeping activity balanced.\n\n- `/transfer \u003cserver\u003e`\nTransfers the player to a specific instance if available. Useful for networks with multiple game modes.\n\n- `/whereami`\nDisplays information to the player showing which instance and proxy they are currently in.\n\n# 📡 Instance Management Usage\nRedisBridge includes a **distributed instance discovery and selection system** for minigame servers, lobbies, or backend servers using Redis and a low-latency distributed cache.\n\nEach server instance sends **automatic heartbeats** via `InstanceHeartbeatMessage` containing:\n\n- `id` (unique identifier)\n\n- `group` (e.g., `lobby`, `solo_skywars`, `duels`)\n\n- `players` (current online players)\n\n- `maxPlayers` (maximum capacity)\n\n- `host` and `port`\n\nThis allows other servers and the proxy to know in real time which instances are available, their capacity, and their status.\n\nThe `InstanceManager`:\n\n- Uses a local cache with a 10-second expiration to keep instance state updated efficiently.\n\n- Allows you to:\n\n  - Retrieve instances by ID (`getInstanceById`)\n\n  - Retrieve all instances in a group (`getGroupInstances`)\n\n  - Get total player counts or per group (`getTotalPlayerCount`, `getGroupPlayerCount`)\n\n  - Get total maximum player capacity or per group (`getTotalMaxPlayers`, `getGroupMaxPlayers`)\n\nProvides **automatic available instance selection** using different strategies:\n\n- `RANDOM`: Selects a random instance in the group.\n\n- `LOWEST_PLAYERS`: Selects the instance with the fewest players.\n\n- `MOST_PLAYERS_AVAILABLE`: Selects the instance with the most players while still having available slots.\n\nExample:\n\n```java\nInstanceInfo instance = InstanceManager.getInstance().selectAvailableInstance(\"lobby\", InstanceManager.SelectionStrategy.LOWEST_PLAYERS);\n\nif (instance != null) {\n    // Connect player to this instance\n}\n```\n\nThis system enables your network to distribute players dynamically without relying on a heavy centralized matchmaking server.\n\n# 🚀 Communication Usage\nRedisBridge simplifies inter-server communication over Redis, enabling you to publish and subscribe to messages seamlessly between your proxy and backend servers.\n\n## How it works?\n- Uses Redis Pub/Sub on a single channel (redis-bridge-channel) for all message transmission.\n\n- Messages are serialized in JSON and identified using their type field.\n\n- Each message type can have:\n\n    - A registered class (MessageRegistry) for deserialization.\n\n    - An optional handler (MessageHandlerRegistry) for automatic processing when received.\n\n- Includes default messages for instance heartbeat and shutdown announcements to enable automatic instance tracking.\n\n## Publishing Messages\nTo send a message to all connected instances:\n```java\nYourCustomMessage message = new YourCustomMessage();\n// fill your message data here\n\nredisBridge.publish(message, \"sender-id\");\n```\n\n## Handling Incoming Messages\n- Register your message type:\n    ```java\n    MessageRegistry.register(\"your-message-type\", YourCustomMessage.class);\n    ```\n- Register your message handler:\n    ```java\n    MessageHandlerRegistry.register(\"your-message-type\", new MessageHandler\u003cYourCustomMessage\u003e() {\n        @Override\n        public void handle(YourCustomMessage message) {\n            // handle your message here\n        }\n    });\n    ```\n\n## License\n**RedisBridge** is licensed under the [MIT License](./LICENSE). Feel free to use, modify, and distribute it in your projects.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosscoder%2Fredisbridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosscoder%2Fredisbridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosscoder%2Fredisbridge/lists"}