GameVoting

插件

· 作者 Alex_Tang

一个 Minecraft 插件,用于通过投票启动游戏服务器,并与 CloudNet 集成。

0 本站下载 0 关注 更新于 8 个月前

需要前置:DecentHolograms

最新 1.1.4 · 1.21.11 · Paper / Purpur

一键开服(送7天)

GameVoting

中文文档 | User Guide | 使用文档

一款功能强大且特性丰富的 Paper 服务器 Minecraft 投票系统插件,专为 CloudNet v4 网络环境设计。支持自动游戏选择、玩家就绪系统、全息显示和多数据库持久化。

✨ Features

? Voting System

  • Multi-phase Voting Flow

    • Automatic item distribution based on player count (≥6 players)
    • Pre-voting ready phase with emerald trigger items
    • Voting phase with compass menu interface
    • Post-voting ready phase with dye-based ready indicators
  • Smart Player Ready System

    • Players receive emerald items when ≥6 players online
    • Right-click to mark ready/unready status
    • Automatic voting start when all players are ready
    • Real-time hologram updates showing ready count
  • Flexible Voting Modes

    • Manual start: /vote start [duration] - Always starts voting immediately
    • Automatic start: Emerald ready system triggers voting when all players ready
    • Custom voting duration (default 60 seconds)

? Holographic Displays

  • Dynamic Display States

    • Idle: Historical top 10 winning games with vote counts
    • Pre-voting Ready: Shows ready player count and progress
    • Voting Active: Current available games with live vote counts
    • Vote Ended: Top 10 voted games from current session
    • Post-teleport: Returns to historical top 10
  • Multi-location Support

    • Create holograms at any location with /vote holograms create
    • Automatic synchronization across all hologram locations
    • List and remove holograms with simple commands

?️ Database Integration

  • Multi-database Support

    • PostgreSQL (recommended for production)
    • MySQL/MariaDB
    • MongoDB
    • Optional: Can run without database
  • Vote History Tracking

    • Records winning game, total votes, player count
    • Stores detailed vote breakdown per game
    • Timestamp-based historical analytics
    • Automatic top 10 winner statistics

? CloudNet Integration

  • Seamless Service Management

    • Automatic CloudNet service detection
    • Service status-based game filtering
    • Player teleportation via proxy commands
    • Only teleports players who actually voted
  • Service Configuration

    • Game-to-service mapping via games.yml
    • Configurable service name patterns
    • Support for multiple services per game type

? Internationalization

  • Multi-language Support

    • English (en-US, en-UK)
    • Simplified Chinese (zh-CN)
    • Easy to add custom languages
  • Complete Translation Coverage

    • All commands, messages, and UI elements
    • Item names and lore
    • Hologram displays
    • Error messages and feedback

? Advanced Features

  • Smart Item Management

    • Automatic item distribution in slot 9
    • Different items for different server states
    • Undropable vote items with persistent data
    • Color-coded ready status indicators
  • Party System Integration

    • Create and manage player parties
    • Party-based game teleportation
    • Party member management
  • Robust Permission System

    • Fine-grained permission control
    • Admin vs player command separation
    • Configurable access levels

? Requirements

  • Server

    • Paper 1.16 or higher (Spigot/Bukkit not supported)
    • Java 17 or higher
    • CloudNet v4 (4.0.0-RC10 or higher)
  • Dependencies

    • DecentHolograms 2.8.6+ (for hologram displays)
    • CloudNet Driver & Bridge modules
  • Optional

    • PostgreSQL 12+ / MySQL 8.0+ / MongoDB 5.0+ (for vote history)

? Installation

  1. Download the plugin

    # Build from source
    git clone https://github.com/yourusername/GameVoting.git
    cd GameVoting
    mvn clean package
    
  2. Install dependencies

    • Download and install DecentHolograms
    • Ensure CloudNet v4 is properly configured
  3. Deploy the plugin

    # Copy the compiled JAR to your plugins folder
    cp target/GameVoting-1.1.0.jar /path/to/server/plugins/
    
  4. Configure the plugin

    • Start the server to generate default configuration files
    • Edit plugins/GameVoting/config.yml
    • Configure plugins/GameVoting/games.yml
    • Restart the server

⚙️ Configuration

config.yml

# Debug mode for detailed logging
debug: false

# Language: en-US, en-UK, zh-CN
language: "en-US"

# CloudNet proxy service name
proxy-service-name: "Proxy-1"

# Database configuration
database:
  enabled: true
  type: "postgresql"  # postgresql, mysql, mongodb
  host: "localhost"
  port: 5432
  database: "gamevoting"
  username: "postgres"
  password: "password"

# Hologram locations (managed via commands)
holograms:
  locations: []

games.yml

games:
  - id: "skywars"
    name: "SkyWars"
    service-name: "SkyWars-{number}"
    icon: "GOLDEN_SWORD"
    description: "Fight in the sky!"
    
  - id: "bedwars"
    name: "BedWars"
    service-name: "BedWars-{number}"
    icon: "RED_BED"
    description: "Protect your bed!"

? Usage

For Players

  1. Automatic Voting (≥6 players)

    - Wait for emerald item in slot 9
    - Right-click to mark ready
    - Voting starts when all players ready
    
  2. 手动投票

    - 管理员启动:/vote start
    - 在 9 号槽位获得指南针
    - 右键打开投票菜单
    - 选择你偏好的游戏
    
  3. 投票后准备就绪

    - 投票结束后获得灰色染料
    - 右键标记为准备就绪
    - 准备就绪时变为青绿色染料
    - 所有玩家准备就绪后游戏开始
    

管理员使用

# 手动启动投票
/vote start [duration]

# 强制开始游戏(跳过准备阶段)
/vote forcestart

# 取消当前活动投票
/vote cancel

# 重载配置
/vote reload

# 全息图管理
/vote holograms create        # 在当前位置创建
/vote holograms list          # 列出所有全息图
/vote holograms remove <id>   # 移除指定全息图

# 加入游戏服务
/vote join <service>

# 队伍命令
/party create              # 创建队伍
/party invite <player>     # 邀请玩家
/party join <player>       # 加入队伍
/party leave              # 离开当前队伍
/party disband            # 解散你的队伍

? API 使用

开发者使用

// 获取投票会话
VotingSession session = VotingSession.getInstance();

// 检查投票状态
boolean isVoting = session.isVotingInProgress();
boolean isReady = session.isReadyPhaseActive();

// 获取票数
Map<String, Integer> votes = session.getVoteCounts();

// 访问数据库
VoteHistoryRepository repo = DatabaseManager.getInstance()
    .getVoteHistoryRepository();
List<VoteHistory> history = repo.getTopWinningGames(10);

// 全息图管理
HologramManager manager = plugin.getHologramManager();
manager.updateAllDisplays(DisplayState.VOTING_ACTIVE);

?️ 项目结构

GameVoting/
├── src/main/java/com/talexck/gameVoting/
│   ├── GameVoting.java              # 主插件类
│   ├── commands/                     # 命令处理器
│   │   ├── VoteCommand.java         # 投票命令
│   │   └── PartyCommand.java        # 队伍命令
│   ├── config/                       # 配置管理
│   │   ├── GameConfig.java          # 游戏配置
│   │   └── ConfigLoader.java        # 配置加载器
│   ├── voting/                       # 投票系统
│   │   └── VotingSession.java       # 投票会话管理器
│   ├── database/                     # 数据库层
│   │   ├── DatabaseManager.java     # 数据库连接
│   │   ├── models/                  # 数据模型
│   │   └── repositories/            # 数据仓库
│   ├── hologram/                     # 全息图显示
│   │   ├── HologramManager.java     # 全息图管理器
│   │   └── HologramDisplayManager.java
│   ├── listeners/                    # 事件监听器
│   │   ├── VoteItemListener.java    # 投票物品交互
│   │   ├── PlayerJoinListener.java  # 玩家加入事件
│   │   └── VotingPlayerQuitListener.java
│   ├── cloudnet/                     # CloudNet 集成
│   │   └── CloudNetAPI.java         # CloudNet API 封装
│   ├── party/                        # 队伍系统
│   │   └── PartyManager.java        # 队伍管理
│   └── utils/                        # 工具类
│       ├── item/VoteItem.java       # 投票物品管理
│       ├── MessageUtil.java         # 消息工具
│       └── ActionBarUtil.java       # Actionbar 工具
├── src/main/resources/
│   ├── plugin.yml                    # 插件元数据
│   ├── config.yml                    # 默认配置
│   ├── games.yml                     # 游戏定义
│   └── lang/                         # 语言文件
│       ├── en-US.yml
│       ├── en-UK.yml
│       └── zh-CN.yml
└── pom.xml                           # Maven 配置

? 贡献

欢迎贡献!请遵循以下准则:

  1. Fork 本仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 提交 Pull Request

? 许可证

本项目采用 MIT 许可证授权 - 详情请参阅 LICENSE 文件。

? 致谢

? 支持

  • 问题反馈: GitHub Issues
  • 文档: 用户指南
  • 中文文档: 使用文档

? 版本历史

v1.1.0

  • 添加了基于绿宝石触发的前置投票准备系统
  • 实现了基于染料指示器的投票后准备阶段
  • 添加了基于玩家数量的物品分配
  • 增强了全息图显示状态
  • 改进了 CloudNet 集成
  • 添加了投票历史数据库追踪
  • 仅对已投票玩家进行传送过滤

v1.0.0

  • 初始发布
  • 基础投票系统
  • CloudNet 服务集成
  • 全息图显示
  • 多语言支持

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源