π
pasted-code-1788876218629.txt
txt
1547 lines
βΆ
Create a complete, production-ready Minecraft Paper plugin named **ZHelp**, developed under the **ZPlugins** plugin family.
The plugin must be designed for a real production survival/economy server running **Paper 1.21.11**.
---
# 1. PROJECT IDENTITY
### Plugin
* Plugin name: **ZHelp**
* Plugin ID: `zhelp`
* Developer/brand: **ZPlugins**
* Package: `com.zplugins.zhelp`
* Main class: `com.zplugins.zhelp.ZHelp`
* Minecraft version: **1.21.11**
* Server software: **Paper**
* Language: **Java**
* Build system: **Gradle or Maven**
* Use modern Paper/Bukkit APIs.
* Avoid NMS unless absolutely necessary.
### NAMING REQUIREMENT
The final project must exclusively use:
```text
ZPlugins
ZHelp
zhelp
com.zplugins.zhelp
```
Do not use any previous or alternative project names anywhere in the final project.
This applies to:
* Java packages
* Class names
* Variables
* Plugin metadata
* `plugin.yml`
* Gradle/Maven configuration
* Configuration files
* Database tables
* Commands
* Permissions
* Documentation
* Comments
* Messages
* File names
* Internal identifiers
---
# 2. PURPOSE
ZHelp is a lightweight player support/help-request system.
Players can type:
```text
/help
```
A GUI opens allowing them to select a help category.
Categories:
```text
β Questions
π‘ Grief
π¨ Abuse
β Other
```
After selecting a category, the player is asked to type their issue in chat.
Example:
```text
Player:
/help
```
GUI:
```text
π HELP CENTER
β Questions
π‘ Grief
π¨ Abuse
β Other
```
Player selects:
```text
π‘ Grief
```
ZHelp says:
```text
Please describe your problem in chat.
Type "cancel" to cancel.
```
Player types:
```text
Someone destroyed my house and stole my items.
```
ZHelp then creates a support request.
---
# 3. HELP REQUEST DATA
Every request must have a unique ID.
Example:
```text
Request #1024
```
Store:
* Request ID
* Player UUID
* Player name
* Category
* Message
* World
* X coordinate
* Y coordinate
* Z coordinate
* Creation timestamp
* Current status
* Staff member who answered
* Staff UUID
* Answer timestamp
* Staff member who closed it
* Close timestamp
Possible statuses:
```text
OPEN
ANSWERED
CLOSED
```
---
# 4. ONLINE STAFF NOTIFICATION
When a player creates a help request, notify every online staff member with:
```text
zhelp.staff
```
Example:
```text
ββββββββββββββββββββββββββββββ
π NEW HELP REQUEST
ββββββββββββββββββββββββββββββ
Player: Steve
Category: π‘ Grief
Message:
Someone destroyed my house and stole my items.
Location:
survival
X: 125
Y: 72
Z: -438
Use:
/helptp Steve
to teleport to the player.
Use:
/helpanswer Steve
to mark the request as answered.
Use:
/helpclose Steve
to close the request.
ββββββββββββββββββββββββββββββ
```
Make the notification configurable.
Use modern Adventure/MiniMessage formatting where appropriate.
---
# 5. STAFF COMMANDS
## `/helprequests`
Permission:
```text
zhelp.staff
```
Display all currently OPEN requests.
Example:
```text
ββββββββββββββββββββββββββββββ
π ACTIVE REQUESTS
ββββββββββββββββββββββββββββββ
#1024
Steve
π‘ Grief
"Someone destroyed my house."
survival 125 72 -438
Status: OPEN
#1025
Alex
β Questions
"How do I claim land?"
survival 300 70 -100
Status: OPEN
ββββββββββββββββββββββββββββββ
```
If there are many requests, implement pagination.
Example:
```text
/helprequests
/helprequests 2
/helprequests 3
```
Only show active/open requests by default.
---
# 6. `/helptp `
Permission:
```text
zhelp.staff
```
This command allows staff to teleport directly to the player who requested help.
Example:
```text
/helptp Steve
```
Before teleporting:
1. Check that the target has an active request.
2. Check that the target is online.
3. Check that the staff member has permission.
4. Teleport the staff member to the player.
Success:
```text
β Teleported to Steve.
```
The player should receive:
```text
ModeratorName is handling your help request.
```
If the player is offline:
```text
Steve is currently offline.
```
---
# 7. `/helpanswer `
Permission:
```text
zhelp.staff
```
Marks the player's active request as ANSWERED.
Store:
* Staff UUID
* Staff name
* Answer timestamp
Player receives:
```text
ββββββββββββββββββββββββββββββ
β HELP REQUEST ANSWERED
ββββββββββββββββββββββββββββββ
Staff member:
ModeratorName
Thank you for contacting our staff team.
ββββββββββββββββββββββββββββββ
```
Online staff receive:
```text
ModeratorName answered Steve's Grief help request.
```
The request must remain in the database as historical data.
Do NOT permanently delete it.
---
# 8. `/helpclose `
Permission:
```text
zhelp.staff
```
Closes the request.
Store:
* Closing staff UUID
* Closing staff name
* Close timestamp
Player receives:
```text
Your help request has been closed by ModeratorName.
```
The request remains in the database.
Status becomes:
```text
CLOSED
```
---
# 9. `/helpstatus`
Players can use:
```text
/helpstatus
```
to view their active request.
Example:
```text
ββββββββββββββββββββββββββββββ
π YOUR REQUEST
ββββββββββββββββββββββββββββββ
Category: π‘ Grief
Status: OPEN
Message:
Someone destroyed my house.
Created:
2 minutes ago
ββββββββββββββββββββββββββββββ
```
If there is no active request:
```text
You do not have an active help request.
```
---
# 10. `/help`
The `/help` command must open the help GUI.
Suggested 3-row layout:
```text
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]
[ ] [β] [ ] [π‘] [ ] [π¨] [ ] [β] [ ]
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]
```
Suggested items:
```text
Questions β BOOK
Grief β CHEST
Abuse β REDSTONE TORCH
Other β PAPER
```
Prevent players from taking items.
Cancel inventory clicks appropriately.
Make the GUI title and item names configurable.
---
# 11. CHAT INPUT
After the player selects a category, enter an input state.
Example:
```text
You selected: π‘ Grief
Please describe your problem in chat.
Type "cancel" to cancel.
```
Only capture the next chat message from that player.
After:
* Submission
* Cancellation
* Timeout
normal chat must immediately work again.
Do NOT accidentally intercept future messages.
Maximum message length should be configurable.
Default:
```yaml
max-message-length: 500
```
If the message exceeds the limit:
```text
Your message is too long. Please keep it under 500 characters.
```
---
# 12. CANCEL
If the player types:
```text
cancel
```
while entering a request:
```text
Your help request has been cancelled.
```
Remove the input state.
Normal chat resumes immediately.
---
# 13. INPUT TIMEOUT
Input sessions must automatically expire.
Default:
```yaml
input-timeout: 60
```
After timeout:
```text
Your help request timed out.
Please use /help again if you still need assistance.
```
Do NOT create one repeating task per player.
Use an efficient centralized cleanup system or timestamp-based expiration.
---
# 14. ONE ACTIVE REQUEST PER PLAYER
A player may only have **one active request**.
If they already have an OPEN request:
```text
You already have an active help request.
Use /helpstatus to view it.
```
Do not create another request.
Once the request becomes ANSWERED or CLOSED, they may create another after the cooldown.
---
# 15. COOLDOWN
Add a configurable cooldown.
Default:
```yaml
cooldown: 60
```
Players cannot spam help requests.
Staff should bypass the cooldown.
Permission:
```text
zhelp.bypass.cooldown
```
Do NOT create a repeating task for every player's cooldown.
Store timestamps and calculate the remaining cooldown when `/help` is executed.
---
# 16. PLAYER DISCONNECT
If a player disconnects while their request is OPEN:
**Do NOT delete the request.**
Keep it persistent.
Staff should see:
```text
Steve (OFFLINE)
```
If the player reconnects, their request remains active.
Temporary input state should be cleaned up when the player disconnects.
---
# 17. DISCORD INTEGRATION
Integrate with **DiscordSRV** if installed.
Do NOT require a second Discord bot if DiscordSRV can provide the required functionality.
Discord integration must be optional.
If DiscordSRV is not installed:
* ZHelp must continue working.
* Do not crash.
* Log a warning.
* Disable only Discord functionality.
Configuration:
```yaml
discord:
enabled: true
integration: discordsrv
channel: "staff-help"
```
---
# 18. DISCORD NEW REQUEST
When a request is created, send it to the configured Discord staff channel.
Example:
```text
π NEW HELP REQUEST
Player:
Steve
Category:
π‘ Grief
Message:
Someone destroyed my house and stole my items.
Location:
World: survival
X: 125
Y: 72
Z: -438
Request:
#1024
Status:
π‘ OPEN
```
Make the Discord formatting configurable where practical.
---
# 19. DISCORD ANSWER NOTIFICATION
When a staff member answers:
```text
β
HELP REQUEST ANSWERED
Request:
#1024
Player:
Steve
Category:
π‘ Grief
Answered by:
ModeratorName
Status:
ANSWERED
```
---
# 20. DISCORD CLOSE NOTIFICATION
When closed:
```text
π΄ HELP REQUEST CLOSED
Request:
#1024
Player:
Steve
Category:
π‘ Grief
Closed by:
ModeratorName
Status:
CLOSED
```
The Discord system should not spam messages.
Normally send only:
1. New request
2. Answer
3. Close
---
# 21. DISCORD ASYNC PERFORMANCE
Discord communication must never block the Minecraft main server thread.
Use asynchronous processing where appropriate.
Do NOT poll Discord.
Do NOT create repeating Discord tasks.
Handle Discord failures gracefully.
Do not repeatedly retry failed requests in a tight loop.
Respect Discord API rate limits.
---
# 22. SQLITE DATABASE
Use SQLite for persistent storage.
Database location:
```text
plugins/ZHelp/data.db
```
Store all requests.
The database must preserve:
* OPEN requests
* ANSWERED requests
* CLOSED requests
* Player information
* Staff information
* Timestamps
* Location
* Category
* Message
Open requests must survive server restarts.
---
# 23. DATABASE PERFORMANCE
Use prepared statements.
Create appropriate indexes.
For example:
```sql
CREATE INDEX IF NOT EXISTS idx_requests_player
ON help_requests(player_uuid);
CREATE INDEX IF NOT EXISTS idx_requests_status
ON help_requests(status);
CREATE INDEX IF NOT EXISTS idx_requests_created
ON help_requests(created_at);
```
Do not query SQLite unnecessarily.
Active requests should be held in memory.
Use an efficient structure such as:
```text
Map
```
SQLite should primarily be used for:
* Persistence
* History
* Startup recovery
* Historical queries
---
# 24. ASYNCHRONOUS DATABASE OPERATIONS
Do not perform slow database operations on the Minecraft main thread.
Use asynchronous operations for:
* INSERT
* UPDATE
* SELECT
* History queries
* Startup loading where appropriate
* Cleanup
Never access Bukkit/Paper API objects from an asynchronous database thread.
Do not access:
```text
Player
World
Location
Bukkit API
```
from asynchronous database code.
Collect required data on the main thread first.
---
# 25. ACTIVE REQUEST MEMORY
Only keep active requests in memory.
Example:
```text
Map activeRequests
```
Do not permanently keep historical requests in RAM.
When a request becomes ANSWERED or CLOSED:
* Remove it from active memory.
* Save it to SQLite.
* Keep the historical record in the database.
---
# 26. DATABASE HISTORY RETENTION
Add configurable history retention.
Example:
```yaml
database:
history-retention-days: 30
```
Requests older than this may be automatically deleted.
Cleanup should happen:
* On startup
* Or through a low-frequency maintenance task
Never perform database cleanup every tick.
Perform maintenance asynchronously.
---
# 27. OPTIMIZATION
ZHelp must be a **very lightweight, high-performance plugin**.
It is intended for a busy survival/economy server.
The plugin should have minimal impact on:
* TPS
* CPU
* RAM
* Disk I/O
* Network traffic
The plugin should be almost completely idle when nobody is using `/help`.
---
# 28. EVENT-DRIVEN ARCHITECTURE
Use an event-driven architecture.
Preferred flow:
```text
Player executes /help
β
GUI opens
β
Player selects category
β
Chat event captures ONE message
β
Request created
β
Request saved
β
Online staff notified
β
Discord notified
β
Plugin becomes idle
```
Do NOT use constant polling.
---
# 29. CHAT EVENT OPTIMIZATION
The chat listener must be extremely lightweight.
Maintain a collection such as:
```text
Set awaitingInput
```
When a chat event occurs:
1. Check whether the player's UUID is in the input set.
2. If not, immediately return.
3. Only process the message if they are actually entering a help request.
Do NOT process expensive logic for every chat message.
Do NOT scan all players.
---
# 30. STAFF NOTIFICATION OPTIMIZATION
When a request is created:
* Iterate online players once.
* Check `zhelp.staff`.
* Send the notification.
Do not constantly scan for staff.
Do not create repeating tasks.
---
# 31. COOLDOWN OPTIMIZATION
Do NOT do:
```text
every second:
loop all players
```
Instead use timestamps.
Example:
```text
Map cooldowns
```
When `/help` is executed:
```text
currentTime - lastRequestTime
```
Calculate the remaining cooldown.
---
# 32. INPUT TIMEOUT OPTIMIZATION
Do not create a repeating task for every player.
Use timestamps.
If cleanup is required, use **one centralized low-frequency cleanup task**.
For example, a cleanup task every 5β10 seconds.
It should only inspect temporary input sessions.
---
# 33. GUI OPTIMIZATION
Only create the GUI when `/help` is executed.
Do not constantly update inventories.
Do not use packet manipulation.
Do not run GUI update tasks.
---
# 34. CONFIGURATION OPTIMIZATION
Load configuration values into memory.
Do not repeatedly read the configuration file during:
* Chat events
* Inventory events
* Commands
Reload configuration only when:
```text
/zhelp reload
```
is executed.
---
# 35. RELOAD SAFETY
`/zhelp reload` must not:
* Duplicate listeners
* Duplicate tasks
* Duplicate database connections
* Duplicate Discord integrations
Reload configuration safely.
---
# 36. THREAD SAFETY
Handle concurrency correctly.
Use thread-safe structures where necessary, such as:
```text
ConcurrentHashMap
```
or ensure state changes occur on the appropriate thread.
Prevent race conditions if two staff members try to answer the same request simultaneously.
Example:
Staff A:
```text
/helpanswer Steve
```
Staff B:
```text
/helpanswer Steve
```
Only one should successfully change:
```text
OPEN
```
to:
```text
ANSWERED
```
The second staff member should receive:
```text
That help request has already been handled by ModeratorName.
```
The database update should protect against race conditions.
---
# 37. SECURITY
Players must NOT be able to:
* Execute staff commands
* Teleport themselves through staff commands
* Close other requests
* Answer other requests
* Modify requests
* Exploit the GUI
* Inject commands
* Execute arbitrary commands through help messages
Sanitize user-generated text before sending it to Discord.
Never execute player input as a Minecraft command.
---
# 38. COMMAND TAB COMPLETION
Implement useful tab completion.
For example:
```text
/helptp
/helpanswer
/helpclose
```
Only suggest online players or players with active requests where appropriate.
Staff commands should not expose unnecessary information to normal players.
---
# 39. PERMISSIONS
Implement:
```text
zhelp.staff
zhelp.admin
zhelp.bypass.cooldown
```
Permissions should be documented.
Default behavior should be configurable through `plugin.yml`.
---
# 40. CONFIGURATION
Create a clean `config.yml`.
Example:
```yaml
debug: false
settings:
cooldown: 60
input-timeout: 60
max-message-length: 500
staff:
permission: "zhelp.staff"
database:
history-retention-days: 30
discord:
enabled: true
integration: "discordsrv"
channel: "staff-help"
categories:
questions:
enabled: true
name: "β Questions"
grief:
enabled: true
name: "π‘ Grief"
abuse:
enabled: true
name: "π¨ Abuse"
other:
enabled: true
name: "β Other"
messages:
prefix: "[ZHelp ] "
request-created: "β Your help request has been sent to the staff team. "
already-active: "You already have an active help request. "
cancelled: "Your help request has been cancelled. "
no-request: "You do not have an active help request. "
player-offline: "That player is offline. "
no-permission: "You don't have permission to do that. "
staff-notified: "The staff team has been notified. "
```
Make reasonable additional options configurable.
---
# 41. DEBUG MODE
Add:
```yaml
debug: false
```
When false:
Do not spam console logs.
When true:
Allow useful diagnostic information such as:
* Request creation
* Database operations
* Discord operations
* Request state changes
* Cleanup operations
Do not log sensitive information unnecessarily.
---
# 42. LOGGING
Normal startup should only log important information.
Example:
```text
[ZHelp] ZHelp enabled.
[ZHelp] SQLite database initialized.
[ZHelp] DiscordSRV integration enabled.
```
If DiscordSRV isn't installed:
```text
[ZHelp] DiscordSRV not found. Discord integration disabled.
```
Do not log every player chat message.
Do not log every `/help` command unless debug mode is enabled.
---
# 43. SHUTDOWN
When the server shuts down:
* Save required active state.
* Complete important pending database operations.
* Close SQLite safely.
* Cancel scheduled tasks.
* Clean temporary memory.
* Disconnect/clean integrations safely.
Do not unnecessarily delay server shutdown.
---
# 44. PROJECT ARCHITECTURE
Use clean object-oriented architecture.
Suggested structure:
```text
src/main/java/com/zplugins/zhelp/
ZHelp.java
command/
HelpCommand.java
HelpTpCommand.java
HelpAnswerCommand.java
HelpCloseCommand.java
HelpStatusCommand.java
HelpRequestsCommand.java
ZHelpCommand.java
gui/
HelpMenu.java
listener/
HelpChatListener.java
HelpInventoryListener.java
PlayerConnectionListener.java
manager/
HelpRequestManager.java
CooldownManager.java
StaffNotificationManager.java
model/
HelpRequest.java
HelpCategory.java
HelpStatus.java
storage/
DatabaseManager.java
HelpRequestRepository.java
discord/
DiscordManager.java
DiscordSRVHook.java
config/
ConfigManager.java
util/
MessageUtil.java
LocationUtil.java
```
You may improve the architecture if there is a cleaner solution.
---
# 45. PLUGIN.YML
Create a correct `plugin.yml`.
Example:
```yaml
name: ZHelp
version: ${version}
main: com.zplugins.zhelp.ZHelp
api-version: '1.21'
author: ZPlugins
description: Lightweight player help and staff support system.
commands:
help:
description: Open the ZHelp menu
usage: /help
helptp:
description: Teleport to a help request player
usage: /helptp
permission: zhelp.staff
helpanswer:
description: Mark a help request as answered
usage: /helpanswer
permission: zhelp.staff
helpclose:
description: Close a help request
usage: /helpclose
permission: zhelp.staff
helpstatus:
description: View your active help request
usage: /helpstatus
helprequests:
description: View active help requests
usage: /helprequests [page]
permission: zhelp.staff
zhelp:
description: ZHelp administration command
usage: /zhelp reload
permission: zhelp.admin
permissions:
zhelp.staff:
description: Allows staff to manage help requests
default: op
zhelp.admin:
description: Allows administration of ZHelp
default: op
zhelp.bypass.cooldown:
description: Bypass the help request cooldown
default: op
```
If `/help` conflicts with another plugin, design the command registration so the conflict is handled gracefully and document the solution.
---
# 46. README
Include a complete README containing:
* Plugin description
* Requirements
* Installation
* Commands
* Permissions
* Configuration
* DiscordSRV setup
* Database information
* Troubleshooting
* Performance information
* Reload instructions
---
# 47. COMPATIBILITY
Target:
**Paper 1.21.11**
Use modern APIs.
Do not rely on deprecated APIs unless absolutely necessary.
Avoid NMS.
The plugin must compile against the correct Paper API for 1.21.11.
---
# 48. FINAL QUALITY REQUIREMENT
This must be a **complete, compilable, production-ready plugin**.
Do NOT provide:
```text
TODO
FIXME
implement this
placeholder code
pseudo-code
unfinished methods
```
Every required class and method must be implemented.
The final project must compile successfully.
---
# 49. FINAL TEST CHECKLIST
Before delivering the project, verify all of the following:
### Player
* `/help` works.
* GUI opens.
* Questions category works.
* Grief category works.
* Abuse category works.
* Other category works.
* Chat input works.
* Cancel works.
* Input timeout works.
* Message length limit works.
* Duplicate request protection works.
* Cooldown works.
* `/helpstatus` works.
### Staff
* Staff notifications work.
* `/helprequests` works.
* Pagination works.
* `/helptp ` works.
* `/helpanswer ` works.
* `/helpclose ` works.
* Staff permissions work.
* Tab completion works.
* Two staff members cannot simultaneously answer the same request incorrectly.
### Database
* SQLite initializes.
* Requests are saved.
* Requests survive restart.
* Open requests are restored.
* Answered requests are stored.
* Closed requests are stored.
* History retention works.
### Discord
* DiscordSRV integration works when installed.
* New requests are forwarded.
* Answer notifications are forwarded.
* Close notifications are forwarded.
* Discord failure does not break the plugin.
* Plugin works normally when DiscordSRV is missing.
* Discord operations do not block the main server thread.
### Performance
* No unnecessary repeating tasks.
* No per-player repeating tasks.
* No constant player scanning.
* No constant database polling.
* No Discord polling.
* No unnecessary NMS.
* No main-thread database operations.
* Minimal memory usage.
* Minimal CPU usage.
* Event-driven architecture.
### Naming
Search the entire project and confirm that the project uses only:
```text
ZPlugins
ZHelp
zhelp
com.zplugins.zhelp
```
The final project must be branded consistently as **ZPlugins β ZHelp**.
---
# 50. FINAL BRANDING
The final result should look like a professional plugin from the ZPlugins ecosystem:
```text
ZPlugins
βββ ZHelp
βββ Player Help System
βββ Staff Management
βββ DiscordSRV Integration
βββ SQLite Persistence
```
The plugin should be lightweight, clean, modern, secure, optimized, and suitable for a production Minecraft 1.21.11 Paper server.
Create the Gradle project and plugin metadata for ZHelp.
Implement configuration, SQLite persistence, request models, and DiscordSRV reflection integration.
Implement the GUI, chat-input lifecycle, request manager, listeners, and commands.
Add production configuration and README documentation.
Created the complete ZHelp Paper 1.21.11 plugin under the com.zplugins.zhelp package.
Included:
Gradle project configuration with Java 21 and SQLite persistence
/helpGUI with configurable categories and iconsChat-based request submission, cancellation, limits, and timeout handling
One active request per player and cooldown protection
Staff commands:
/helprequests/helptp/helpanswer/helpclose/helpstatus/zhelp reload
SQLite request history with startup recovery and retention cleanup
Thread-safe request state transitions
Staff notifications and pagination
Optional asynchronous DiscordSRV integration
Configurable MiniMessage messages
Player disconnect handling
Command tab completion
Permissions and
plugin.ymlProduction-focused README documentation
package com.zplugins.zhelp;
import com.zplugins.zhelp.command.ZHelpCommandHandler;
import com.zplugins.zhelp.config.ConfigManager;
import com.zplugins.zhelp.discord.DiscordManager;
import com.zplugins.zhelp.input.InputManager;
import com.zplugins.zhelp.listener.HelpListener;
import com.zplugins.zhelp.manager.HelpRequestManager;
import com.zplugins.zhelp.storage.DatabaseManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class ZHelp extends JavaPlugin {
private ConfigManager configManager;
private DatabaseManager databaseManager;
private HelpRequestManager requestManager;
private InputManager inputManager;
@Override
public void onEnable() {
configManager = new ConfigManager(this);
databaseManager = new DatabaseManager(this, configManager.retentionDays());
DiscordManager discordManager = new DiscordManager(this, configManager);
requestManager = new HelpRequestManager(this, configManager, databaseManager, discordManager);
inputManager = new InputManager(configManager);
Bukkit.getPluginManager().registerEvents(new HelpListener(this, configManager, requestManager, inputManager), this);
ZHelpCommandHandler commandHandler = new ZHelpCommandHandler(this, configManager, requestManager, inputManager);
registerCommand("help", commandHandler);
registerCommand("helptp", commandHandler);
registerCommand("helpanswer", commandHandler);
registerCommand("helpclose", commandHandler);
registerCommand("helpstatus", commandHandler);
registerCommand("helprequests", commandHandler);
registerCommand("zhelp", commandHandler);
Bukkit.getScheduler().runTaskTimer(this, inputManager::cleanup, 200L, 200L);
databaseManager.start().whenComplete((requests, error) -> Bukkit.getScheduler().runTask(this, () -> {
if (error != null) {
getLogger().severe("ZHelp could not initialize SQLite: " + error.getMessage());
return;
}
requestManager.restore(requests);
}));
getLogger().info("ZHelp enabled.");
}
private void registerCommand(String name, ZHelpCommandHandler handler) {
if (getCommand(name) != null) {
getCommand(name).setExecutor(handler);
getCommand(name).setTabCompleter(handler);
}
}
@Override
public void onDisable() {
if (inputManager != null) {
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) {
inputManager.cancel(player.getUniqueId());
}
}
if (databaseManager != null) {
databaseManager.shutdown();
}
}
public ConfigManager config() {
return configManager;
}
public InputManager input() {
return inputManager;
}
}