Documentation
¶
Index ¶
- Constants
- Variables
- func GroupRule(ctx *zero.Ctx) bool
- func InitPlugin()
- type APIResponse
- type AchievementModel
- type BaseEvent
- type ClickAction
- type ClickEvent
- type Color
- type Component
- type Config
- type DeathModel
- type DisplayModel
- type FlexibleTranslateText
- type GroupConfig
- type HoverAction
- type HoverEvent
- type HoverShowEntity
- type HoverShowItem
- type Player
- type PlayerAchievementEvent
- type PlayerChatEvent
- type PlayerCommandEvent
- type PlayerDeathEvent
- type PlayerNoticeEvent
- type ScoreComponent
- type ServerConfig
- type TranslateModel
- type WebsocketClientConfig
- type WebsocketData
- type WebsocketServerConfig
Constants ¶
View Source
const ( APIBroadcast = "broadcast" APISendPrivateMsg = "send_private_msg" APISendTitle = "send_title" APISendActionBar = "send_actionbar" APISendRconCommand = "send_rcon_command" APIGetStatus = "get_status" )
Variables ¶
View Source
var GroupMemberNameMap = map[int64]map[int64]string{}
View Source
var GroupNameMap = map[int64]string{}
GroupNameMap 群聊名称缓存,key为群号,value为群名
View Source
var PluginConfig = Config{}
Functions ¶
func InitPlugin ¶ added in v0.0.3
func InitPlugin()
Types ¶
type APIResponse ¶ added in v0.0.7
type AchievementModel ¶ added in v0.0.6
type AchievementModel struct {
Key string `json:"key"`
Display DisplayModel `json:"display"`
Text string `json:"text"`
Translate TranslateModel `json:"translate"`
}
type ClickAction ¶ added in v0.0.3
type ClickAction string
ClickAction 点击事件类型
const ( OpenURL ClickAction = "open_url" OpenFile ClickAction = "open_file" RunCommand ClickAction = "run_command" SuggestCommand ClickAction = "suggest_command" ChangePage ClickAction = "change_page" CopyToClipboard ClickAction = "copy_to_clipboard" )
type ClickEvent ¶
type ClickEvent struct {
Action ClickAction `json:"action"` // 点击事件类型
Value string `json:"value"` // 参数值(命令、URL或页码)
}
ClickEvent 点击事件定义,当玩家点击文本时触发的操作。
type Color ¶
type Color string
Color 文本颜色枚举
const ( Black Color = "black" DarkBlue Color = "dark_blue" DarkGreen Color = "dark_green" DarkAqua Color = "dark_aqua" DarkRed Color = "dark_red" DarkPurple Color = "dark_purple" Gold Color = "gold" Gray Color = "gray" DarkGray Color = "dark_gray" Blue Color = "blue" Green Color = "green" Aqua Color = "aqua" Red Color = "red" LightPurple Color = "light_purple" Yellow Color = "yellow" White Color = "white" )
type Component ¶ added in v0.0.3
type Component struct {
// === 内容字段 ===
Text *string `json:"text,omitempty"` // 纯文本内容
Translate *string `json:"translate,omitempty"` // 翻译键 (如 "chat.type.text")
Fallback *string `json:"fallback,omitempty"` // 翻译失败时的备用文本
With []interface{} `json:"with,omitempty"` // 翻译参数,可为字符串或子组件
Score *ScoreComponent `json:"score,omitempty"` // 计分板组件
Selector *string `json:"selector,omitempty"` // 实体选择器 (如 "@p")
Separator *Component `json:"separator,omitempty"` // 多实体分隔符文本
Keybind *string `json:"keybind,omitempty"` // 键位绑定名 (如 "key.jump")
NBT *string `json:"nbt,omitempty"` // NBT路径表达式
Block *string `json:"block,omitempty"` // NBT来源:方块坐标
Entity *string `json:"entity,omitempty"` // NBT来源:实体选择器
Storage *string `json:"storage,omitempty"` // NBT来源:存储命名空间
// === 样式属性 ===
Color *Color `json:"color,omitempty"` // 文本颜色
Font *string `json:"font,omitempty"` // 字体资源路径
Bold *bool `json:"bold,omitempty"` // 是否加粗
Italic *bool `json:"italic,omitempty"` // 是否斜体
Underlined *bool `json:"underlined,omitempty"` // 是否带下划线
Strikethrough *bool `json:"strikethrough,omitempty"` // 是否带删除线
Obfuscated *bool `json:"obfuscated,omitempty"` // 是否混淆显示
// === 行为属性 ===
Insertion *string `json:"insertion,omitempty"` // Shift+点击插入到聊天栏
ClickEvent *ClickEvent `json:"clickEvent,omitempty"` // 点击事件定义
HoverEvent *HoverEvent `json:"hoverEvent,omitempty"` // 悬停事件定义
// === 递归结构 ===
Extra []*Component `json:"extra,omitempty"` // 附加子文本组件
}
Component Minecraft 聊天文本组件 (Chat Component)
type Config ¶
type Config struct {
WebsocketServer WebsocketServerConfig `yaml:"websocket_server"`
WebsocketClient []WebsocketClientConfig `yaml:"websocket_client"`
ServerMap map[string]ServerConfig `yaml:"server_map"`
CommandPriority int `yaml:"command_priority"`
ChatImage bool `yaml:"chat_image"`
AccessToken string `yaml:"access_token"`
}
type DeathModel ¶ added in v0.0.6
type DisplayModel ¶ added in v0.0.6
type DisplayModel struct {
Title FlexibleTranslateText `json:"title"`
Description FlexibleTranslateText `json:"description"`
Frame string `json:"frame"`
}
type FlexibleTranslateText ¶ added in v0.0.7
type FlexibleTranslateText struct {
Text string
Translate TranslateModel
}
func (FlexibleTranslateText) String ¶ added in v0.0.7
func (f FlexibleTranslateText) String() string
func (*FlexibleTranslateText) UnmarshalJSON ¶ added in v0.0.7
func (f *FlexibleTranslateText) UnmarshalJSON(data []byte) error
type GroupConfig ¶ added in v0.0.3
type HoverAction ¶ added in v0.0.3
type HoverAction string
HoverAction 悬停事件类型
const ( ShowText HoverAction = "show_text" ShowItem HoverAction = "show_item" ShowEntity HoverAction = "show_entity" )
type HoverEvent ¶
type HoverEvent struct {
Action HoverAction `json:"action"` // 悬停事件类型
Contents interface{} `json:"contents,omitempty"` // 显示内容,可为文本、物品或实体信息
}
HoverEvent 悬停事件定义,当鼠标悬停时显示额外信息。
type HoverShowEntity ¶ added in v0.0.3
type HoverShowEntity struct {
Name *Component `json:"name,omitempty"` // 实体显示名称,可为文本组件
Type *string `json:"type,omitempty"` // 实体类型ID (例: "minecraft:zombie")
ID *string `json:"id,omitempty"` // 实体UUID字符串
}
HoverShowEntity 鼠标悬停显示实体信息。
type HoverShowItem ¶ added in v0.0.3
type HoverShowItem struct {
ID string `json:"id"` // 物品ID (例: "minecraft:diamond_sword")
Count *int `json:"count,omitempty"` // 物品数量
Tag interface{} `json:"tag,omitempty"` // 物品NBT数据
}
HoverShowItem 鼠标悬停显示物品信息。
type Player ¶ added in v0.0.6
type Player struct {
Nickname string `json:"nickname"`
UUID string `json:"uuid"`
IsOP bool `json:"is_op"`
Address string `json:"address"`
Health float64 `json:"health"`
MaxHealth float64 `json:"max_health"`
ExperienceLevel int `json:"experience_level"`
ExperienceProgress float64 `json:"experience_progress"`
TotalExperience int `json:"total_experience"`
WalkSpeed float64 `json:"walk_speed"`
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
}
Player 玩家信息
type PlayerAchievementEvent ¶ added in v0.0.6
type PlayerAchievementEvent struct {
Timestamp int `json:"timestamp"`
PostType string `json:"post_type"`
EventName string `json:"event_name"`
ServerName string `json:"server_name"`
ServerVersion string `json:"server_version"`
ServerType string `json:"server_type"`
SubType string `json:"sub_type"`
Player Player `json:"player"`
Achievement AchievementModel `json:"achievement"`
}
type PlayerChatEvent ¶ added in v0.0.6
type PlayerChatEvent struct {
Timestamp int `json:"timestamp"`
PostType string `json:"post_type"`
EventName string `json:"event_name"`
ServerName string `json:"server_name"`
ServerVersion string `json:"server_version"`
ServerType string `json:"server_type"`
SubType string `json:"sub_type"`
MessageID string `json:"message_id"`
RawMessage string `json:"raw_message"`
Player Player `json:"player"`
Message string `json:"message"`
}
PlayerChatEvent 玩家聊天事件
type PlayerCommandEvent ¶ added in v0.0.6
type PlayerCommandEvent struct {
Timestamp int `json:"timestamp"`
PostType string `json:"post_type"`
EventName string `json:"event_name"`
ServerName string `json:"server_name"`
ServerVersion string `json:"server_version"`
ServerType string `json:"server_type"`
SubType string `json:"sub_type"`
MessageID string `json:"message_id"`
RawMessage string `json:"raw_message"`
Player Player `json:"player"`
Command string `json:"command"`
}
PlayerCommandEvent 玩家命令事件
type PlayerDeathEvent ¶ added in v0.0.6
type PlayerDeathEvent struct {
Timestamp int `json:"timestamp"`
PostType string `json:"post_type"`
EventName string `json:"event_name"`
ServerName string `json:"server_name"`
ServerVersion string `json:"server_version"`
ServerType string `json:"server_type"`
SubType string `json:"sub_type"`
Player Player `json:"player"`
Death DeathModel `json:"death"`
}
type PlayerNoticeEvent ¶ added in v0.0.6
type PlayerNoticeEvent struct {
Timestamp int `json:"timestamp"`
PostType string `json:"post_type"`
EventName string `json:"event_name"`
ServerName string `json:"server_name"`
ServerVersion string `json:"server_version"`
ServerType string `json:"server_type"`
SubType string `json:"sub_type"`
Player Player `json:"player"`
}
type ScoreComponent ¶ added in v0.0.3
type ScoreComponent struct {
Name string `json:"name"` // 计分板条目的名称(通常为玩家名或选择器)
Objective string `json:"objective"` // 计分板目标名称
Value *string `json:"value,omitempty"` // 可选:直接指定显示值(通常仅用于客户端显示)
}
ScoreComponent 表示计分板文本组件,显示玩家或实体的计分板数值。
type ServerConfig ¶ added in v0.0.3
type ServerConfig struct {
GroupList []GroupConfig `yaml:"group_list"`
RconMsg bool `yaml:"rcon_msg"`
}
type TranslateModel ¶ added in v0.0.7
type WebsocketClientConfig ¶ added in v0.0.3
type WebsocketData ¶
type WebsocketServerConfig ¶ added in v0.0.3
Click to show internal directories.
Click to hide internal directories.