Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmitch215/socketmc
🖥️ Communicate directly with Minecraft Clients from the Server
https://github.com/gmitch215/socketmc
client-to-server fabric forge minecraft paper paper-api spigot spigot-api
Last synced: 2 months ago
JSON representation
🖥️ Communicate directly with Minecraft Clients from the Server
- Host: GitHub
- URL: https://github.com/gmitch215/socketmc
- Owner: gmitch215
- License: gpl-3.0
- Created: 2024-03-26T04:01:24.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-10-29T12:31:31.000Z (2 months ago)
- Last Synced: 2024-10-29T14:56:45.394Z (2 months ago)
- Topics: client-to-server, fabric, forge, minecraft, paper, paper-api, spigot, spigot-api
- Language: Java
- Homepage: http://socketmc.gmitch215.xyz/
- Size: 11 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔌 SocketMC
> Minecraft Server-to-Client Direct Communication Library
[Notice](./NOTICE.md) | [License](./LICENSE)
## Background
"Client-side only" is a term widely used when advancing in plugin development, where you're limited in interacting with player's own client. The goal of this library
is to solve this issue: create a mod that can communicate with your plugin. That is exactly what SocketMC does! Send your own instructions to clients using our
simple and efficient API.## ❓ Why?
- **Extensive**: SocketMC provides thorough documentation and examples to help you get started.
- **Robust**: SocketMC is built with performance and reliability in mind, especially since it is version-dependent.
- **Transparent**: SocketMC is open-source, meaning you can see how it works and contribute to its development.# 🚚 Features
- Client Instructions
- Draw Shapes
- Draw Text
- Play Audio
- And More!
- Client Events
- Player Type and Click Events## 📥 Installation
[![GitHub branch checks state](https://github.com/gmitch215/SocketMC/actions/workflows/build.yml/badge.svg)](https://github.com/gmitch215/SocketMC/actions/workflows/build.yml)
![GitHub](https://img.shields.io/github/license/gmitch215/SocketMC)
![GitHub issues](https://img.shields.io/github/issues/gmitch215/SocketMC)### Prerequisites
All players on your server must have the SocketMC mod installed.
You can download them from the following locations:- [Modrinth](https://modrinth.com/mod/socketmc)
- [Jenkins CI](https://ci.codemc.io/job/gmitch215/job/SocketMC/)
- [GitHub Releases](https://github.com/gmitch215/SocketMC/releases/latest)### In your Plugin
![GitHub release (latest by date)](https://img.shields.io/github/v/release/gmitch215/SocketMC)
[![Static Badge](https://img.shields.io/badge/documentation-javadoc-yellow)](https://socketmc.gmitch215.xyz/)
[![Static Badge](https://img.shields.io/badge/wiki-github-dgreen)](https://github.com/gmitch215/SocketMC/wiki)
[![Static Badge](https://img.shields.io/badge/detailed_wiki-gitbook-dgreen)](https://docs.gmitch215.xyz/socketmc/)Maven
```xml
codemc-releases
https://repo.codemc.io/repository/maven-releases/
xyz.gmitch215.socketmc
socketmc-core
[VERSION]
xyz.gmitch215.socketmc
socketmc-spigot
[VERSION]
xyz.gmitch215.socketmc
socketmc-paper
[VERSION]
```
Gradle (Groovy)
```gradle
repositories {
maven { url 'https://repo.codemc.io/repository/maven-releases/' }
}dependencies {
// Include Core Module
implementation 'xyz.gmitch215.socketmc:socketmc-core:[VERSION]'
implementation 'xyz.gmitch215.socketmc:socketmc-spigot:[VERSION]'
// Alternatively, use the Paper Build
implementation 'xyz.gmitch215.socketmc:socketmc-paper:[VERSION]'
}
```Gradle (Kotlin DSL)
```kotlin
repositories {
maven(url = "https://repo.codemc.io/repository/maven-releases/")
}dependencies {
// Include Core Module
implementation("xyz.gmitch215.socketmc:socketmc-core:[VERSION]")
implementation("xyz.gmitch215.socketmc:socketmc-spigot:[VERSION]")
// Alternatively, use the Paper Build
implementation("xyz.gmitch215.socketmc:socketmc-paper:[VERSION]")
}
```## 📺 Example
**Java**
```java
import xyz.gmitch215.socketmc.spigot.SocketPlayer;
import xyz.gmitch215.socketmc.instruction.Instruction;import org.bukkit.Bukkit;
import org.bukkit.entity.Player;import java.time.Duration;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
sendInstructions();
}public void sendInstructions() {
Player player = Bukkit.getPlayer("gmitch215");
SocketPlayer sp = new SocketPlayer(player);// Specify X and Y, Text, and Duration
// Pass the plugin instance to the sendInstruction method
sp.sendInstruction(Instruction.drawText(100, 100, "Hello World", Duration.ofSeconds(5)), this);
}
}
```**Kotlin**
```kotlin
import xyz.gmitch215.socketmc.spigot.SocketPlayer
import xyz.gmitch215.socketmc.instruction.Instructionimport org.bukkit.Bukkit
import org.bukkit.entity.Playerimport java.time.Duration
class MyPlugin : JavaPlugin() {
override fun onEnable() {
sendInstructions()
}fun sendInstructions() {
val player: Player = Bukkit.getPlayer("gmitch215")
val sp = SocketPlayer(player)// Specify X and Y, Text, and Duration
// Pass the plugin instance to the sendInstruction method
sp.sendInstruction(Instruction.drawText(100, 100, "Hello World", Duration.ofSeconds(5)), this)
}
}
```Output:
![Example](.github/demo.gif)