src/main | ||
.gitignore | ||
pom.xml | ||
README.md |
BukkitstrPlugin
BukkitstrPlugin is a Minecraft plugin that integrates with the Nostr relay to authenticate players. Players must authenticate by signing a valid Nostr event before they can move in the game.
Demo
Features
- WebSocket Integration: Connects to a Nostr relay using WebSockets.
- Player Authentication: Players must authenticate with their Minecraft username via a Nostr event.
- Movement Lock: Prevents players from moving until they are authenticated.
- Real-time Messaging: Sends and receives messages from the Nostr relay in real-time.
Prerequisites
- Java 8 or higher
- Maven (for building the plugin)
- Spigot/Paper server (Minecraft 1.20 or higher)
Installation
-
Clone the repository:
git clone https://git.vanderwarker.family/nostr/bukkitstr.git cd bukkitstr
-
Build the plugin:
mvn clean package
-
Copy the plugin JAR: Copy the generated
bukkitstr-plugin-1.0-SNAPSHOT.jar
file from thetarget
directory to your Minecraft server'splugins
directory. -
Configure the plugin: Make sure to replace
wss://your-nostr-relay-url
in theBukkitstrPlugin.java
file with your actual Nostr relay WebSocket URL. -
Start your server: Start your Minecraft server and check the console for any errors. The plugin should initialize and connect to the Nostr relay.
Usage
Authentication Command
Players need to use the /auth
command to start the authentication process. The plugin will wait for a Nostr event containing the player's Minecraft username in the d
tag content.
/auth
Sign Event
Next, you need to sign a event kind "13378008" and the "d" tag to be your Minecraft username.
Using nostril is quite easy.
nostril --kind 13378008 --tag "d" "MinecraftUsername"
Then send to the relay you've specified in src/../BukkitstrPlugin.java
Player Authentication Process
- Connect to the Nostr relay: The plugin connects to the specified Nostr relay when the server starts.
- Send Authentication Request: The plugin sends an initial request to the Nostr relay to listen for authentication events.
- Wait for Nostr Event: When a player uses the
/auth
command, the plugin waits for a Nostr event containing the player's username in thed
tag. - Authenticate Player: If the received Nostr event's
d
tag content matches the player's username, the player is authenticated and can move freely. Otherwise, they will receive an authentication failure message.
Developer Information
Source Code
The main source code is located in the src/main/java/family/vanderwarker/bukkitstr/BukkitstrPlugin.java
file.
Dependencies
Ensure the following dependencies are added to your pom.xml
:
<dependencies>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
</dependency>
</dependencies>
Acknowledgments
- Thanks to the SpigotMC community for their documentation and support.
- Thanks to the Nostr community for their innovative protocol.
- Thanks to npub1826v365he5ty69lk3xgvzqrwy8587vdfrxnsz0k09khzustf8r7s6j7t95
- Thanks to ChatGPT 4.o