π
pasted-code-1786168920953.txt
txt
1145 lines
βΆ
SMP Start β Final Production Development Prompt
1. Plugin Overview
Create a professional, production-ready Minecraft plugin named:
SMP Start
Plugin Information
Plugin Name: SMP Start
Author: Pyramid
Java: Java 21
Platform: Paper 1.21.11+
Build System: Gradle Kotlin DSL
API: Paper API
Formatting: Adventure API + MiniMessage
Primary Command: `/smp`
Help Command: `/smpstart help`
The plugin must be highly configurable, optimized for large SMP servers, modular, maintainable, and free of unnecessary dependencies.
Do not use deprecated APIs when modern Paper APIs are available.
---
2. Command System
The plugin must use `/smp` as the main command.
Main commands
```text
/smp start
/smp stop
/smp force stop
/smp reload
/smp grace end
/smp grace force
/smpstart help
```
There must be NO `/smp4` command.
---
3. `/smp start`
This starts the complete SMP launch sequence.
When executed:
```text
/smp start
```
the plugin must:
Validate the current SMP state.
Prevent duplicate starts.
Capture all eligible online players.
Begin the countdown.
Launch players.
Equip temporary Elytras.
Handle airborne state.
Detect landing.
Remove temporary Elytras safely.
Start the SMP.
Enable the configured grace period.
Display the grace timer.
Disable PvP while grace is active.
---
4. SMP State Machine
Use a proper state system.
```java
public enum SMPState {
IDLE,
COUNTDOWN,
LAUNCHING,
AIRBORNE,
STARTED,
GRACE,
STOPPED
}
```
The state must be centrally managed.
Do not allow individual managers to independently decide whether the SMP is running.
Recommended architecture:
```text
SMPManager
β
βββ SmpSession
βββ CountdownManager
βββ LaunchManager
βββ GraceManager
βββ ProtectionManager
βββ PlayerSessionManager
βββ ParticleManager
```
---
5. Countdown
After `/smp start`:
Display a configurable countdown.
Default:
```text
5
4
3
2
1
```
Each number should appear as a Minecraft title.
Example:
```text
TITLE:
5
SUBTITLE:
SMP Starting...
```
Every countdown step should have:
Title
Subtitle
Sound
Fade-in
Stay
Fade-out
All configurable.
Example:
```yaml
countdown:
enabled: true
seconds: 5
title: "%seconds% "
subtitle: "SMP Starting... "
fade-in: 0
stay: 20
fade-out: 5
sound:
enabled: true
type: "minecraft:block.note_block.pling"
volume: 1.0
pitch: 1.0
```
---
6. SMP Name
The SMP name must be configurable.
```yaml
smp:
name: "Dream SMP "
```
Support:
```text
%smp_name%
```
in all configurable messages.
The name may be used in:
Titles
Subtitles
Chat
Action bars
Grace announcements
Start announcements
---
7. Player Selection
When `/smp start` is executed, capture the eligible players.
Players joining after the sequence begins should not automatically be added to the launch.
Configurable:
```yaml
players:
join-during-start-participation: false
```
Allow configuration for:
```yaml
players:
include-survival: true
include-adventure: true
include-creative: false
include-spectator: false
include-vanished: false
```
---
8. Launch System
After the countdown reaches zero:
Launch eligible players approximately 18 blocks upward.
Default:
```yaml
launch:
height: 18
```
Preserve:
```text
X
Z
```
and modify the Y position.
The launch should feel smooth and controlled.
Do not simply teleport players 18 blocks upward unless necessary.
Use safe velocity/movement mechanics where appropriate.
---
9. Launch Particles
During the launch:
Display firework-style particles around players.
Example:
```yaml
launch:
particles:
enabled: true
type: "FIREWORK"
count: 20
radius: 0.8
```
The particles must:
Follow the player.
Stop when launch ends.
Be configurable.
Never create unlimited tasks.
---
10. Launch Sound
Play a configurable sound during launch.
```yaml
launch:
sound:
enabled: true
type: "minecraft:entity.firework_rocket.launch"
volume: 1.0
pitch: 1.0
```
Sounds must be validated.
Invalid sounds must log a warning rather than crash the plugin.
---
11. Elytra System
When the player reaches the configured airborne height:
Automatically equip an Elytra in the chestplate slot.
The player should be able to enter a controlled airborne/gliding state.
The Elytra is temporary and belongs to the plugin.
---
12. Elytra Inventory Protection
This is extremely important.
Before placing an Elytra:
```java
ItemStack originalChestItem;
```
must be stored.
Example:
```text
Diamond Chestplate
β
Temporary Elytra
β
Landing
β
Diamond Chestplate restored
```
If the chest slot was empty:
```text
Empty
β
Elytra
β
Empty
```
Never delete or duplicate player items.
The temporary Elytra should contain a unique PersistentDataContainer marker so the plugin can distinguish it from normal Elytras.
Never identify temporary Elytras only by:
```java
Material.ELYTRA
```
---
13. Airborne State
While players are airborne:
Track them individually.
Apply temporary fall-damage protection.
Display configured particles.
Maintain the airborne state.
Never globally disable fall damage.
Example:
```yaml
airborne:
particles:
enabled: true
type: "END_ROD"
count: 8
radius: 0.6
```
Use a centralized scheduler for all airborne players.
Do not create one repeating task per player.
---
14. Fall Damage Protection
Only players currently participating in the launch should receive fall-damage protection.
Use UUID/session tracking.
Example:
```java
Set airbornePlayers;
```
Protection must automatically disappear when:
Player lands.
Launch is cancelled.
Player dies.
Player disconnects.
Launch times out.
Force stop occurs.
Never globally cancel:
```java
EntityDamageEvent
```
for all players.
---
15. Landing Detection
The plugin must detect actual landing.
Do not use only a fixed timer.
Check:
`Player#isOnGround()`
Safe block underneath
Current player state
When landing occurs:
Stop airborne particles.
Remove temporary launch protection.
Restore original chest item.
Remove plugin Elytra.
Play landing sound.
Clear launch session.
Continue SMP lifecycle.
---
16. Safe Landing
Support:
```yaml
landing:
safe-check: true
```
The plugin should avoid treating dangerous situations as a successful landing.
Account for:
Lava
Fire
Void
Powder snow
Dangerous blocks
Invalid locations
---
17. Airborne Timeout
Prevent players from remaining permanently in the airborne state.
Example:
```yaml
launch:
timeout: "30s"
```
If the timeout is reached:
```text
Launch Session
β
Timeout
β
Safe Cleanup
β
Restore Inventory
β
Remove Elytra
β
Remove Protection
```
---
18. SMP Started
Once the launch sequence has completed:
Display:
```text
TITLE:
%smp_name%
SUBTITLE:
SMP Started!
```
Everything configurable.
Then activate the grace period if enabled.
---
19. Grace Period
Grace is enabled automatically after SMP starts.
Example:
```yaml
grace:
enabled: true
duration: "30m"
```
Supported formats:
```text
30s
5m
1h
```
---
20. PvP During Grace
PvP must be OFF while grace is active.
This should be enabled by default and should not depend on individual players.
Cancel player-vs-player damage during grace.
Support:
Melee
Arrows
Tridents
Projectiles
Other configurable PvP sources
Example:
```yaml
grace:
protection:
melee: true
projectile: true
trident: true
```
---
21. Grace Protection
Provide configurable protection categories.
```yaml
grace:
protection:
melee: true
projectile: true
trident: true
fire: false
lava: false
tnt: false
crystal: false
creeper: false
```
Only enabled protections should be cancelled.
---
22. Grace Action Bar
While grace is active, display:
```text
π‘ Grace Period: 29:59
```
Then:
```text
π‘ Grace Period: 29:58
```
etc.
Example:
```yaml
grace:
actionbar:
enabled: true
format: "π‘ Grace Period: %time% "
```
The displayed timer must be based on the actual grace end timestamp.
Never use the displayed action bar as the source of truth.
---
23. Grace Start Announcement
When grace starts:
```text
TITLE:
%smp_name%
SUBTITLE:
Grace Period is now ON!
```
Also optionally send:
```text
Chat:
Grace Period is now active for 30 minutes.
```
Everything configurable.
---
24. `/smp grace end`
This is the normal/manual way to end grace.
```text
/smp grace end
```
It must:
End grace.
Disable grace PvP protection.
Remove grace action bars.
Display configured title.
Play configured sound.
Send configured announcement.
Change the internal SMP state.
This should use the same centralized `endGrace()` method used by the automatic timer.
---
25. `/smp grace force`
Emergency grace termination:
```text
/smp grace force
```
This immediately disables grace.
It should prioritize state cleanup and correctness.
Configurable option:
```yaml
grace:
force-end:
show-title: false
play-sound: false
send-message: true
```
The force command must never leave protection active.
---
26. Automatic Grace End
When the grace timestamp reaches zero:
```text
00:00
```
automatically perform:
```text
endGrace()
```
Do not duplicate grace-ending logic.
Both:
```text
/smp grace end
```
and automatic expiration must use the same underlying method.
---
27. `/smp stop`
Normal SMP stop:
```text
/smp stop
```
This should safely stop the SMP.
It must clean up:
Countdown
Launch
Airborne state
Particles
Grace
Action bars
Temporary Elytras
Temporary protections
Runtime sessions
Then set:
```text
SMPState.IDLE
```
---
28. `/smp force stop`
Emergency complete reset:
```text
/smp force stop
```
This is the nuclear reset command.
Regardless of the current state:
```text
COUNTDOWN
LAUNCHING
AIRBORNE
STARTED
GRACE
```
everything must be terminated.
The plugin must:
Cancel all tasks.
Stop countdown.
Stop launch.
Stop grace.
Remove action bars.
Remove temporary particles.
Restore original chest items.
Remove temporary Elytras.
Remove launch protection.
Remove grace protection.
Clear player sessions.
Clear active SMP session.
Reset state to `IDLE`.
No residual state should remain.
---
29. `/smp reload`
```text
/smp reload
```
Reload only this plugin's configuration.
Do NOT perform a global Bukkit/Paper reload.
Reload:
Messages
Titles
Sounds
Particles
Countdown
Launch settings
Grace settings
Protection settings
Player policies
Runtime state must remain intact.
If grace is active, its timer must not reset.
---
30. `/smpstart help`
Add:
```text
/smpstart help
```
The help system must contain 27 entries.
Use numbered entries:
```text
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
```
The help content must explain the plugin's major commands/features.
Suggested help topics:
```text
1. /smp start
2. /smp stop
3. /smp force stop
4. /smp reload
5. /smp grace end
6. /smp grace force
7. Countdown system
8. SMP launch system
9. Launch height
10. Firework particles
11. Elytra system
12. Landing system
13. Fall-damage protection
14. Launch timeout
15. Grace period
16. Grace timer
17. PvP protection
18. Grace protection
19. Automatic grace ending
20. Player join behavior
21. Player disconnect handling
22. Player death handling
23. Inventory protection
24. Staff bypass/exclusions
25. Configuration system
26. Permission system
27. SMP lifecycle/state system
```
All help messages must be configurable.
---
31. Disconnect Handling
If a player leaves during:
Countdown
Launch
Airborne
Grace
clean their temporary runtime state safely.
Prevent:
Elytra duplication
Chestplate loss
Permanent fall protection
Permanent tracking
Particle leaks
---
32. Death Handling
If a player dies during launch:
Immediately clear:
Airborne state
Launch state
Fall protection
Particles
Temporary Elytra state
Prevent UUID/session leaks.
---
33. Teleport Handling
If another plugin or staff member teleports an airborne player:
Detect external teleportation.
Recommended behavior:
```text
External Teleport
β
Cancel launch
β
Safely restore player
β
Restore inventory
β
Remove protection
β
Clear session
```
Do not repeatedly teleport the player back.
---
34. World Change Handling
If an airborne player changes worlds:
Safely cancel the launch sequence for that player.
Prevent cross-world launch corruption.
Configurable:
```yaml
launch:
cancel-on-world-change: true
```
---
35. Server Restart Persistence
Grace must not be bypassable by restarting the server.
Persist:
```text
SMP state
SMP start timestamp
Grace end timestamp
```
Example:
```yaml
persistence:
enabled: true
```
After restart:
```text
Current time < grace end
β
Restore grace
```
If grace has already expired:
```text
Restore SMP started
Grace inactive
```
Do not restore an active launch sequence after a restart.
If the server restarts during launch:
```text
Cancel launch
Restore safe state
Continue SMP lifecycle
```
---
36. Permission System
Use granular permissions:
```text
smpstart.start
smpstart.stop
smpstart.force-stop
smpstart.reload
smpstart.grace
smpstart.grace.end
smpstart.grace.force
smpstart.help
smpstart.bypass
```
The permission names should be configurable where practical.
---
37. Tab Completion
Support:
```text
/smp
```
with:
```text
start
stop
force
reload
grace
```
and:
```text
/smp grace
```
with:
```text
end
force
```
Tab completion must respect permissions.
---
38. Player Bypass
Support:
```text
smpstart.bypass
```
Players with this permission may optionally bypass:
Launch
Grace protection
Other configurable mechanics
Example:
```yaml
bypass:
launch: false
grace: false
```
---
39. PVP Protection Loopholes
Do not only cancel:
```java
EntityDamageByEntityEvent
```
blindly.
Properly account for configured PvP sources.
Potential sources include:
Direct melee
Arrows
Tridents
Projectiles
TNT
End crystals
Fire
Lava
Other configured sources
Protection must be modular.
---
40. External Plugin API
Provide:
```java
SMPStartAPI
```
with methods such as:
```java
boolean isSMPStarted();
boolean isGraceActive();
Duration getGraceRemaining();
SMPState getState();
void startSMP();
void stopSMP();
void endGrace();
void forceGraceEnd();
```
This allows future plugins to integrate with SMP Start.
---
41. Configuration
Everything should be customizable.
This includes:
SMP name
Countdown
Titles
Subtitles
Action bars
Chat messages
Sounds
Sound volume
Sound pitch
Particles
Particle count
Particle radius
Launch height
Launch duration
Launch timeout
Elytra behavior
Landing behavior
Grace duration
Grace timer
PvP protection
Grace protection
Player inclusion
Bypass behavior
Persistence
Help messages
Permissions where practical
---
42. Placeholder System
Support at minimum:
```text
%smp_name%
%seconds%
%time%
%minutes%
%seconds_remaining%
%player%
%grace_time%
%state%
```
The placeholder system must be extensible.
---
43. Configuration Validation
Invalid configuration must never crash the server.
Examples:
Invalid particle:
```text
Log warning
Use fallback
Continue
```
Invalid sound:
```text
Log warning
Disable sound
Continue
```
Invalid grace duration:
```text
Log warning
Use safe default
Continue
```
---
44. Performance
The plugin must be optimized for large servers.
Requirements:
No per-player repeating schedulers.
Use centralized schedulers.
Cancel tasks when no longer needed.
Avoid excessive particle spawning.
Do not perform unnecessary calculations every tick.
Only process relevant players.
Clean UUID/session collections.
Avoid memory leaks.
Avoid blocking the main thread.
Use Paper-compatible scheduling.
Do not create unnecessary objects every tick.
---
45. Recommended Internal Player Session
Use a dedicated object:
```java
PlayerLaunchSession
```
Example fields:
```java
UUID playerId;
ItemStack originalChestItem;
ItemStack temporaryElytra;
boolean airborne;
boolean landed;
long launchStartTime;
long launchTimeout;
```
This prevents Elytra, inventory, and state bugs.
---
46. SMP Session
Use:
```java
SmpSession
```
containing:
```java
UUID sessionId;
SMPState state;
long startTime;
long graceEndTime;
Set participants;
Map playerSessions;
```
All managers should operate through the current session.
---
47. Runtime Safety
The plugin must safely handle:
Duplicate start
Stop during countdown
Force stop during launch
Reload during grace
Player disconnect
Player death
Player teleport
World change
Server restart
Invalid configuration
Invalid sounds
Invalid particles
Missing players
Empty server
Staff bypass
Concurrent command execution
The plugin must never leave itself in an inconsistent state.
---
48. Empty Server
If:
```text
/smp start
```
is executed with no eligible players online:
Do not start a useless launch sequence.
Send:
```text
No eligible players are currently online.
```
This must be configurable.
---
49. No Duplicate Items
This is a strict requirement.
The plugin must never:
Duplicate Elytras
Duplicate chestplates
Delete chestplates
Drop unintended items
Restore an item twice
Inventory restoration must be idempotent.
Calling cleanup twice must not duplicate anything.
Example:
```java
cleanupPlayer(player);
cleanupPlayer(player);
```
must still produce exactly one correct inventory state.
---
50. Plugin Structure
Use a clean modular architecture:
```text
me.pyramid.smpstart
β
βββ SMPStartPlugin.java
β
βββ command
β βββ SMPCommand.java
β βββ SMPStartHelpCommand.java
β
βββ manager
β βββ SMPManager.java
β βββ CountdownManager.java
β βββ LaunchManager.java
β βββ GraceManager.java
β βββ ProtectionManager.java
β βββ PlayerSessionManager.java
β βββ ParticleManager.java
β
βββ session
β βββ SmpSession.java
β βββ PlayerLaunchSession.java
β
βββ state
β βββ SMPState.java
β
βββ listener
β βββ PlayerDamageListener.java
β βββ PlayerMoveListener.java
β βββ PlayerTeleportListener.java
β βββ PlayerQuitListener.java
β βββ PlayerJoinListener.java
β βββ PlayerDeathListener.java
β βββ WorldChangeListener.java
β
βββ config
β βββ ConfigManager.java
β
βββ api
β βββ SMPStartAPI.java
β
βββ utility
β βββ MessageUtil.java
β βββ SoundUtil.java
β βββ ParticleUtil.java
β βββ TimeUtil.java
β βββ PlaceholderUtil.java
β
βββ SMPStartPlugin.java
```
The architecture can be adjusted if a cleaner production architecture is possible.
---
51. Build System
Use:
```text
Java 21
Gradle Kotlin DSL
Paper 1.21.11+
```
Files:
```text
build.gradle.kts
settings.gradle.kts
gradle.properties
```
Do not add unnecessary dependencies.
---
52. Plugin Metadata
Use:
```yaml
name: SMPStart
version: 1.0.0
main: me.pyramid.smpstart.SMPStartPlugin
api-version: '1.21'
author: Pyramid
description: Professional SMP startup, launch, Elytra and grace-period management plugin.
```
Register:
```text
/smp
/smpstart
```
`/smpstart` may be used specifically for the help command:
```text
/smpstart help
```
Do not register `/smp4`.
---
53. Final SMP Lifecycle
The complete lifecycle must be:
```text
IDLE
β
/smp start
β
COUNTDOWN
β
5
4
3
2
1
β
LAUNCHING
β
Players launched ~18 blocks
β
Firework particles
β
Temporary Elytra
β
AIRBORNE
β
Players descend/glide
β
LANDING
β
Restore chest item
β
Remove Elytra
β
SMP STARTED
β
GRACE
β
PvP OFF
β
Grace timer
β
Automatic /smp grace end
OR
/smp grace end
OR
/smp grace force
β
NORMAL SMP
```
At any point:
```text
/smp force stop
```
must safely return everything to:
```text
IDLE
```
---
54. Final Quality Requirements
The final project must:
Compile successfully.
Use Java 21.
Target Paper 1.21.11+.
Contain complete source code.
Contain all required imports.
Contain no pseudo-code.
Contain no TODO implementations.
Contain no fake APIs.
Avoid deprecated APIs.
Handle all edge cases listed above.
Be performance optimized.
Be modular.
Be maintainable.
Be fully configurable.
Be safe for production SMP use.
The final implementation must prioritize state consistency, inventory safety, performance, graceful recovery, and exploit prevention above visual effects.
The plugin should feel like a professional commercial-quality SMP management plugin rather than a simple countdown plugin.
Create the Gradle/Paper project metadata and complete configurable runtime configuration.
Implement the centralized SMP state/session lifecycle, countdown, launch, Elytra restoration, landing safety, and grace management.
Add commands, permissions, tab completion, listeners, protection handling, persistence, and the public API.
Add Adventure/MiniMessage utilities and plugin registration with no
/smp4command.
The project foundation and configuration are in place. Iβm adding the runtime managers and lifecycle wiring next, keeping launch/grace state centralized and cleanup idempotent.
Implemented the SMP Start plugin project from scratch with:
Gradle Kotlin DSL and Java 21 configuration
Paper API 1.21.11 target
/smpcommand system and/smpstart helpNo
/smp4commandCentralized SMP state machine and session management
Configurable countdown titles, sounds, and placeholders
Player eligibility filtering and permissions
Launch velocity, particles, sounds, timeout, and landing detection
Temporary Elytra tracking with PersistentDataContainer markers
Chestplate restoration and cleanup handling
Disconnect, death, teleport, and world-change handling
Grace period timer, action bar, expiration, and protection categories
Persistence of SMP and grace state
Public
SMPStartAPIConfigurable MiniMessage messages and 27 numbered help entries
where is the elytra after getting dash fix it
Fixed the Elytra disappearing after dash/landing.
The temporary Elytra is now removed from any inventory slot before the original chest item is restored, preventing it from being left behind or replacing the playerβs real Elytra.
now if i get dash i will be automatically weared an elytra?
Yes. During the dash, a temporary Elytra is automatically equipped once you reach the configured launch height, and gliding starts automatically.
After landing, timeout, teleport, or cancellation, the temporary Elytra is removed and your original chestplate is restored.
so now i can download it ?
Yesβthe updated project is ready to download. The Elytra dash fix has been applied to LaunchManager.java.
If you need a ready-to-use .jar, youβll still need to build the project first.
how can i download now the latest one which have been fixed
The latest fix is already applied in:
src/main/java/me/pyramid/smpstart/manager/LaunchManager.java
To download it:
Use the project/workspace Download or Export button.
Download the entire updated project, not an older individual file.
Build the plugin locally.
Copy the generated
.jarfrombuild/libs/ortarget/into your serverβspluginsfolder.
I can update the source project here, but I canβt directly attach a compiled .jar download unless the workspace provides an export/download option.
after getting dash on sky players cannot wear elytra and after landing they are gettings fall damage fix it
Plan:
Inspect the dash session lifecycle and landing handling.
Ensure temporary Elytra is equipped without blocking the playerβs own Elytra.
Prevent fall damage caused by the dash and restore equipment safely after landing.
Fixed:
Elytra is equipped immediately when the dash starts, so players can glide at launch height.
Fall distance is reset throughout the launch and glide to prevent fall damage.
Landing cleanup waits one extra tick before restoring the original chest item, preventing the Elytra from being removed too early.
Temporary Elytras are always removed and the playerβs original chest item is restored safely.
Fall-damage protection now runs at high priority.
package me.pyramid.smpstart;
import me.pyramid.smpstart.api.SMPStartAPI;
import me.pyramid.smpstart.command.SMPCommand;
import me.pyramid.smpstart.command.SMPStartHelpCommand;
import me.pyramid.smpstart.config.ConfigManager;
import me.pyramid.smpstart.listener.ProtectionListener;
import me.pyramid.smpstart.listener.SMPListener;
import me.pyramid.smpstart.manager.CountdownManager;
import me.pyramid.smpstart.manager.GraceManager;
import me.pyramid.smpstart.manager.LaunchManager;
import me.pyramid.smpstart.manager.ProtectionManager;
import me.pyramid.smpstart.manager.SMPManager;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class SMPStartPlugin extends JavaPlugin {
private SMPManager manager;
private SMPStartAPI api;
@Override
public void onEnable() {
saveDefaultConfig();
ConfigManager config = new ConfigManager(this);
CountdownManager countdown = new CountdownManager(this, config);
LaunchManager launch = new LaunchManager(this, config);
GraceManager grace = new GraceManager(this, config);
ProtectionManager protection = new ProtectionManager(config, launch);
manager = new SMPManager(config, countdown, launch, grace, protection);
api = new SMPStartAPI(manager);
SMPCommand command = new SMPCommand(manager, config);
PluginCommand smp = getCommand("smp");
if (smp != null) { smp.setExecutor(command); smp.setTabCompleter(command); }
PluginCommand help = getCommand("smpstart");
if (help != null) help.setExecutor(new SMPStartHelpCommand(manager, config));
Bukkit.getPluginManager().registerEvents(new SMPListener(manager), this);
Bukkit.getPluginManager().registerEvents(new ProtectionListener(manager), this);
manager.restore();
}
@Override
public void onDisable() { if (manager != null) manager.shutdown(); }
public SMPStartAPI getAPI() { return api; }
public SMPManager getSMPManager() { return manager; }
}