Authenticate to a Minecraft server using Nostr nostr:npub1826v365he5ty69lk3xgvzqrwy8587vdfrxnsz0k09khzustf8r7s6j7t95 made me do it...
Go to file
2024-07-08 20:06:25 -04:00
src/main Bukkitstr. Thanks ChatGPT... 2024-07-08 19:08:51 -04:00
.gitignore Bukkitstr. Thanks ChatGPT... 2024-07-08 19:08:51 -04:00
pom.xml Bukkitstr. Thanks ChatGPT... 2024-07-08 19:08:51 -04:00
README.md Adding demo video. 2024-07-08 20:06:25 -04:00

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

  1. Clone the repository:

    git clone https://git.vanderwarker.family/nostr/bukkitstr.git
    cd bukkitstr
    
  2. Build the plugin:

    mvn clean package
    
  3. Copy the plugin JAR: Copy the generated bukkitstr-plugin-1.0-SNAPSHOT.jar file from the target directory to your Minecraft server's plugins directory.

  4. Configure the plugin: Make sure to replace wss://your-nostr-relay-url in the BukkitstrPlugin.java file with your actual Nostr relay WebSocket URL.

  5. 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

  1. Connect to the Nostr relay: The plugin connects to the specified Nostr relay when the server starts.
  2. Send Authentication Request: The plugin sends an initial request to the Nostr relay to listen for authentication events.
  3. Wait for Nostr Event: When a player uses the /auth command, the plugin waits for a Nostr event containing the player's username in the d tag.
  4. 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