Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prismarine-realms

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prismarine-realms

Library to manage and interact with Minecraft Realms for Java/Bedrock edition

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.9K
increased by4.63%
Maintainers
1
Weekly downloads
 
Created
Source

prismarine-realms

NPM version Build Status Discord Try it on gitpod

Minecraft Realm interface for Minecraft Java and Bedrock editions, providing a stable API to start/stop Realms, and obtain Realm information such as connection addresses.

Minecraft Realms is a subscription based service provided by Mojang where users can host, create and manage their own private Minecraft servers.

Installation

npm install prismarine-realms

Usage

RealmAPI

.from(authflow: Authflow, platform: 'bedrock' | 'java')

Takes an Authflow instance from prismarine-auth, you can see the documentation for this here.

API

Definitions

ParamTypeDescription
realmIdstringThe ID of the Realm
realmInviteCodestringThe invite code for the Realm. This can be used an unlimited amount of times and allows anyone with the code to join the Realm (Only on Bedrock)
invitationIdstringThe ID of the invitation. This can only be used by the player it is sent to and expires after use (Only on Bedrock)
usernamestringThe username of player
uuidstringThe unique ID of the player, without hyphens
xuidstringThe Xbox User ID of the targeted player

const { Authflow } = require('prismarine-auth') 
const { RealmAPI } = require('prismarine-realms')

const authflow = new Authflow()

const api = RealmAPI.from(authflow, 'bedrock')
getRealms(): Promise<Realm[]>

Returns a list of Realms the authenticating account has joined or owns.

await api.getRealms()
getRealm(realmId: string): Promise

Gets detailed information about a Realm if owned

await api.getRealm('1234567')
getRealmFromInvite(realmInviteCode: string, invite: boolean): Promise

(Bedrock Edition Only) Gets detailed information about a Realm from the invite code and adds it to the authenticating accounts Realms list if not present. If invite is false, the Realm will not be added to the authenticating accounts Realms list.

await api.getRealmFromInvite('AB1CD2EFA3B') // https://realms.gg/AB1CD2EFA3B will work as well
getRealmInvite(realmId: string): Promise

(Bedrock Edition Only) Gets the invite code for a Realm

await api.getRealmInvite('1234567')
refreshRealmInvite(realmId: string): Promise

(Bedrock Edition Only) Refreshes the invite code for a Realm (Note: This will invalidate the previous invite code)

await api.refreshRealmInvite('1234567')
getPendingInviteCount(): Promise

(Bedrock Edition Only) Gets the number of pending invites for the authenticating account

await api.getPendingInviteCount()
getPendingInvites(): Promise<RealmPlayerInvite[]>

(Bedrock Edition Only) Gets a list of pending invites for the authenticating account

await api.getPendingInvites()
acceptRealmInvitation(invitationId: string): Promise

(Bedrock Edition Only) Accepts a pending invite for the authenticating account

await api.acceptRealmInvitation('1234567')
rejectRealmInvitation(invitationId: string): Promise

(Bedrock Edition Only) Rejects a pending invite for the authenticating account

await api.rejectRealmInvitation('1234567')
getAddress(): Promise<{ host, port }>

Gets the address for the Realm.

const realm = await api.getRealm('1234567')

await realm.getAddress()
invitePlayer(uuid: string, name: string): Promise

Invites a player to the Realm

const realm = await api.getRealm('1234567')

await realm.invitePlayer('a8005260a332457097a50bdbe48a9a21', 'Steve')
open(): Promise

Opens a Realm. Allows players to join

const realm = await api.getRealm('1234567')

await realm.open()
close(): Promise

Closes a Realm. Removes all current players and restricts joining

const realm = await api.getRealm('1234567')

await realm.close()

Keywords

FAQs

Package last updated on 21 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc