common

package
v0.0.0-...-8b17de3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maintenance means maintenance mode is on.
	Maintenance = "maintenance"

	// MCAuth Version
	Version = "3.0.0"
)
View Source
const (
	// The player is an admin.
	IsAdmin = "admin"
	// AuthCode means the player has a pending authentication code.
	AuthCode = "auth_code"
	// NoLink means the player isn't linked with an account.
	NoLink = "no_link"
	// NotWhitelisted means the player's Discord account
	// has missing required roles.
	NotWhitelisted = "no_role"
	// The player is an alt of an admin account.
	IsAlt = "alt_acc"
	// The player is verified.
	Whitelisted = "whitelisted"
)

States of a player

Variables

This section is empty.

Functions

func GetPlayerID

func GetPlayerID(playerName string) string

GetPlayerID will get the UUID of a given Minecraft player name. An empty string will be returned if nothing was found.

func GetPlayerName

func GetPlayerName(playerID string) string

GetPlayerName gets a Minecraft player name of a player UUID. It will return an empty string if nothing was found.

Types

type AllAltsResponse

type AllAltsResponse struct {
	Accounts []db.AltAcc `json:"alt_accs"`
}

AllAltsResponse unlike AltsOfResponse this will show all the alts in the database.

type AltsOfResponse

type AltsOfResponse struct {
	Accounts []db.AltAcc `json:"alt_accs"`
	// The owner's Minecraft player name.
	Owner string `json:"owner"`
}

AltsOfResponse has the owner of the alts and an slice of alt accounts.

type Config

type Config struct {
	DB        db.Config       `yaml:"database"`
	Discord   DiscordConfig   `yaml:"discord_bot"`
	WebServer WebServerConfig `yaml:"webserver"`
}

Config is all the configurations below combined.

func GetConfig

func GetConfig(configPath string) (config Config)

GetConfig reads and returns the config.yml. A new one will be created if the current one can't be found in the CWD.

type DelAltResponse

type DelAltResponse struct {
	// whether or not it was successfully removed
	IsRemoved bool `json:"is_deleted"`
}

DelAltResponse represents whether or not an alt given was removed.

type DiscordConfig

type DiscordConfig struct {
	Help       string   `yaml:"help_message"`
	Token      string   `yaml:"token"`
	Prefix     string   `yaml:"prefix"`
	Guild      string   `yaml:"guild"`
	Whitelist  []string `yaml:"whitelisted_roles"`
	AdminRoles []string `yaml:"admin_roles"`
}

DiscordConfig is the Discord bot config.

type ErrorResponse

type ErrorResponse struct {
	ErrorCode string `json:"errcode"`
	// a human readable reason why an issue occurred
	Message string `json:"message"`
}

ErrorResponse represents a generic error

type InvalidPlayer

type InvalidPlayer struct {
	Verified bool   `json:"valid"`
	Reason   string `json:"reason"`
}

InvalidPlayer describes why a player isn't valid

type InvalidPlayerAuth

type InvalidPlayerAuth struct {
	Reason   string `json:"reason"`
	Verified bool   `json:"valid"`
	AuthCode string `json:"auth_code"`
}

InvalidPlayerAuth gives the minecraft server the provided player's pending authentication code.

type NewAltResponse

type NewAltResponse struct {
	// The name of the alt account being claimed
	PlayerName string `json:"player_name"`
	// The owner of the alt account
	Owner string `json:"owner"`
}

NewAltResponse is what the client gives us when a new alt is being claimed.

type PlayerDetailsRes

type PlayerDetailsRes struct {
	Id       string   `json:"id"`
	Roles    []string `json:"roles"`
	State    string   `json:"state"`
	AuthCode string   `json:"auth_code"`
}

type ResolveIDResponse

type ResolveIDResponse struct {
	Resolved string `json:"resolved_id"`
}

ResolveIDResponse comes from the /api/resolve/{id} endpoint

type ValidPlayer

type ValidPlayer struct {
	Verified bool `json:"valid"`
}

ValidPlayer says that the provided player is valid and ready to join the Minecraft server.

type WebServerConfig

type WebServerConfig struct {
	Port  int    `yaml:"port"`
	Token string `yaml:"token"`
}

WebServerConfig is the configuration attributes for the webserver talking to the plugin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL