📄
pasted-code-1789300460433.txt
txt
42 lines
▶
Create a complete Minecraft plugin project for Spigot / Paper 1.20+ in Java. The plugin name is "ChatGames".
DO NOT include build.gradle, settings.gradle, or any setup instructions. Only output the Java source code and plugin.yml.
Requirements & Features:
1. Dependencies:
- Soft-depend on "Vault" (Vault 2.0 API) for economy integration.
- If Vault is enabled, support economy money distribution.
2. Game Types (Triggers automatically via a task every 5 to 10 minutes):
- Reverse Word: Displays a LITHUANIAN word in reverse order (e.g., "SVEIKAS" displayed as "SAKIEVS", "KOMPIUTERIS" displayed as "SIRETUIPMOK"), and players must type the correct Lithuanian word in chat.
- Math Problem: Simple arithmetic (e.g., "15 + 27 = ?").
- Speed Typing: Generates a short random Lithuanian phrase or word string (e.g., "Lietuvos Serveris", "Minecraft Zaidimai") that players must type as quickly as possible.
3. Lithuanian Word List for Games:
- All target words for the Reverse Word and Speed Typing games must be common LITHUANIAN words (e.g., lietuva, geltona, kalnas, zaidimas, pergalė, laimėjimas, draugas, kardas, miškas).
4. Reward System:
- When a player answers correctly first, reward them with ONE random option selected from the following weighted pool:
* Item: 1x Enchanted Golden Apple
* Item: 3x Golden Apple
* Item: 16x Iron Ingot
* Item: 8x Gold Ingot
* Item: 32x Experience Bottle
* Item: 1x Diamond
* Money (Vault): Give the player $1000 using Vault Economy API
* Money (Vault): Give the player $3000 using Vault Economy API
* Command Reward: Execute console command "crates key give {PLAYER} daily 1"
* Command Reward: Execute console command "crates key give {PLAYER} purvo 1"
5. Language & Messages:
- ALL in-game chat messages sent to players must be written in LITHUANIAN using legacy color codes (&a, &e, &c, &f, &b).
- Lithuanian Message Examples:
* Game Start: "&a[Pokalbių Žaidimai] &fPirmasis atspėjęs žodį &e{WORD}&f laimės prizą!"
* Math Start: "&a[Pokalbių Žaidimai] &fIšspręskite užduotį: &e{QUESTION}&f ir laimėkite prizą!"
* Winner Announcement: "&a[Pokalbių Žaidimai] &fŽaidėjas &e{PLAYER} &fteisingai atsakė ir gavo: &b{REWARD}&f!"
* No Winner (Timeout): "&c[Pokalbių Žaidimai] &fNiekas neatsakė teisingai per skirtą laiką."
6. Deliverables:
- Complete plugin.yml including softdepend: [Vault]
- Java classes (Main JavaPlugin class, Event Listener for AsyncPlayerChatEvent, Game Manager, and Reward Handler).
Create the JavaPlugin entry point and lifecycle wiring.
Add the asynchronous chat listener and synchronized game manager for reverse-word, math, and speed-typing rounds.
Add Vault-aware weighted reward handling and the complete Lithuanian
plugin.ymlmetadata.
Created the complete ChatGames plugin project with:
ChatGamesPlugin.javaChatGameListener.javaGameManager.javaRewardHandler.javaplugin.yml
Features include Lithuanian reverse-word, math, and speed-typing games; automatic 5–10 minute scheduling; 30-second timeouts; weighted rewards; Vault economy support; item rewards; and crate key commands.
📄
pasted-code-1789300894631.txt
txt
42 lines
▶
Create a complete Minecraft plugin project for Spigot / Paper 1.20+ in Java. The plugin name is "ChatGames".
DO NOT include build.gradle, settings.gradle, or any setup instructions. Only output the Java source code and plugin.yml.
Requirements & Features:
1. Dependencies:
- Soft-depend on "Vault" (Vault 2.0 API) for economy integration.
- If Vault is enabled, support economy money distribution.
2. Game Types (Triggers automatically via a task every 5 to 10 minutes):
- Reverse Word: Displays a LITHUANIAN word in reverse order (e.g., "SVEIKAS" displayed as "SAKIEVS", "KOMPIUTERIS" displayed as "SIRETUIPMOK"), and players must type the correct Lithuanian word in chat.
- Math Problem: Simple arithmetic (e.g., "15 + 27 = ?").
- Speed Typing: Generates a short random Lithuanian phrase or word string (e.g., "Lietuvos Serveris", "Minecraft Zaidimai") that players must type as quickly as possible.
3. Lithuanian Word List for Games:
- All target words for the Reverse Word and Speed Typing games must be common LITHUANIAN words (e.g., lietuva, geltona, kalnas, zaidimas, pergalė, laimėjimas, draugas, kardas, miškas).
4. Reward System:
- When a player answers correctly first, reward them with ONE random option selected from the following weighted pool:
* Item: 1x Enchanted Golden Apple
* Item: 3x Golden Apple
* Item: 16x Iron Ingot
* Item: 8x Gold Ingot
* Item: 32x Experience Bottle
* Item: 1x Diamond
* Money (Vault): Give the player $1000 using Vault Economy API
* Money (Vault): Give the player $3000 using Vault Economy API
* Command Reward: Execute console command "crates key give {PLAYER} daily 1"
* Command Reward: Execute console command "crates key give {PLAYER} purvo 1"
5. Language & Messages:
- ALL in-game chat messages sent to players must be written in LITHUANIAN using legacy color codes (&a, &e, &c, &f, &b).
- Lithuanian Message Examples:
* Game Start: "&a[Pokalbių Žaidimai] &fPirmasis atspėjęs žodį &e{WORD}&f laimės prizą!"
* Math Start: "&a[Pokalbių Žaidimai] &fIšspręskite užduotį: &e{QUESTION}&f ir laimėkite prizą!"
* Winner Announcement: "&a[Pokalbių Žaidimai] &fŽaidėjas &e{PLAYER} &fteisingai atsakė ir gavo: &b{REWARD}&f!"
* No Winner (Timeout): "&c[Pokalbių Žaidimai] &fNiekas neatsakė teisingai per skirtą laiką."
6. Deliverables:
- Complete plugin.yml including softdepend: [Vault]
- Java classes (Main JavaPlugin class, Event Listener for AsyncPlayerChatEvent, Game Manager, and Reward Handler).
Implemented the ChatGames plugin project:
Lithuanian reverse-word, math, and speed-typing games
Automatic rounds every 5–10 minutes
30-second answer timeout
First correct answer wins
Weighted reward pool with items, Vault money, and crate commands
Lithuanian chat messages with legacy color codes
Vault soft dependency
XSeries-compatible material handling for cross-version support
Updated files:
src/main/java/com/chatgames/ChatGamesPlugin.javasrc/main/java/com/chatgames/ChatGameListener.javasrc/main/java/com/chatgames/GameManager.javasrc/main/java/com/chatgames/RewardHandler.javasrc/main/resources/plugin.yml
package com.chatgames;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class ChatGamesPlugin extends JavaPlugin {
private GameManager gameManager;
@Override
public void onEnable() {
RewardHandler rewardHandler = new RewardHandler(this);
this.gameManager = new GameManager(this, rewardHandler);
Bukkit.getPluginManager().registerEvents(new ChatGameListener(gameManager), this);
gameManager.start();
}
@Override
public void onDisable() {
if (gameManager != null) {
gameManager.stop();
}
}
}