Skip to content

Commit 559cc2e

Browse files
committed
- Attempt to bump to PaperMC 26.1.2 with Java 25
- Fix potential dupe - Allows items to be returned at any stage of the tree - Gives only the items back that they invested - Move to MiniMessage - Move to 26.1.2 - Better use of materials names - Moved /xmas to legacy alias command - Default modern command: /xmastree - Changed prefix and a few other phrases - Bunch of other fixes
1 parent 47eb383 commit 559cc2e

26 files changed

Lines changed: 1810 additions & 394 deletions

.gitignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ release.properties
88
dependency-reduced-pom.xml
99
buildNumber.properties
1010
.mvn/timing.properties
11+
.gradle/
12+
build/
1113

1214
# IntelliJ project files
1315
.idea
@@ -17,4 +19,14 @@ gen
1719
.project
1820
.classpath
1921
.settings
20-
bin
22+
bin
23+
24+
# Local editors and OS files
25+
.DS_Store
26+
Thumbs.db
27+
.vscode/
28+
*.swp
29+
*.swo
30+
31+
# Local test servers and generated Paper data
32+
servers/

README.md

Lines changed: 248 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,254 @@
1-
# X-Mas
1+
# 1MB X-Mas Tree
22

3-
![Image](http://puu.sh/dKlK1/85c3dad454.jpg)
3+
Upgradeable Christmas trees for Paper servers. Players plant a magic spruce sapling, feed it resources, grow it through several tree levels, and collect presents that appear under the finished tree.
44

5-
With this plugin you can plant your Christmas tree and upgrade it. Look for some gifts under it!
5+
This fork keeps the old X-Mas event data usable for winter 2026 while moving the plugin forward for modern Paper and Java runtimes.
66

7-
[SpigotMC plugin page](https://www.spigotmc.org/resources/x-mas-upgradeable-christmas-tree-event.2672/)
7+
![X-Mas tree preview](http://puu.sh/dKlK1/85c3dad454.jpg)
88

9-
## Authors
9+
## Current targets
1010

11-
* **MelonCode** - *Original dev* - [MelonCode](https://github.com/MelonCode)
12-
* **Ghost_chu** - *NMS fixes* - [Ghost_chu](https://github.com/Ghost-chu)
13-
* **LoneDev6** - *Optimization patches* - [LoneDev6](https://github.com/LoneDev6)
14-
* **montlikadani** - *Translation (hu)* - [montlikadani](https://github.com/montlikadani)
11+
The Gradle build creates the legacy reference jar and the current Paper 26.1.2 target jar in `build/libs`:
1512

16-
See also the list of [contributors](https://github.com/MelonCode/X-Mas/graphs/contributors) who participated in this project.
13+
| Jar | Purpose |
14+
| --- | --- |
15+
| `1MB-XMas-2026-v2.0.0-004-v21-1.21.8.jar` | Legacy reference jar copied from the deployed 2025 server jar. |
16+
| `1MB-XMas-2026-v2.0.1-010-v25-26.1.2.jar` | Modern Paper 26.1.2 build, Java 25 bytecode. |
17+
18+
The checked-in source targets Paper 26.1.2. The legacy jar is preserved so the deployed working 2025 behavior can be compared or rolled back during testing.
19+
20+
## Features
21+
22+
- Magic Christmas Crystal item for planting event trees.
23+
- Upgradeable spruce tree levels with configurable material requirements.
24+
- Random present spawning under grown trees.
25+
- Configurable present head skins using Mojang texture URLs.
26+
- Configurable gift table using modern material names or saved exact items.
27+
- MiniMessage support for locale strings, crystal display text, and plugin messages.
28+
- Existing `plugins/X-Mas/trees.yml` data remains the event data source.
29+
- Optional resource refunds when a tree is destroyed or cleaned up after the event.
30+
- Configurable per-stage particles using Paper 26.1.2 particle names.
31+
- `/xmastree debug` pages for status, commands, permissions, placeholders, and global boolean toggles.
32+
- Primary `/xmastree` command with an optional legacy `/xmas` alias.
33+
- Optional PlaceholderAPI placeholders for CMI holograms, ajLeaderboards, scoreboards, and menus.
34+
- Legacy `trees.yml` world-name alias support for renamed destination worlds.
35+
36+
## Installation
37+
38+
1. Stop the Paper server.
39+
2. Back up the existing `plugins/X-Mas` folder and the world folders.
40+
3. Remove the old X-Mas jar from `plugins` so Paper does not load two copies of the same plugin.
41+
4. Copy the jar for your server target into the server `plugins` folder.
42+
5. Start the server with Java 25.
43+
6. Check the console for XMas Tree startup messages, then run `/xmastree` in game or console.
44+
45+
For the 2026 target, use the modern Paper 26.1.2 jar:
46+
47+
- Paper 26.1.2: `1MB-XMas-2026-v2.0.1-010-v25-26.1.2.jar`
48+
49+
## Building
50+
51+
Requirements:
52+
53+
- JDK 25
54+
- Gradle
55+
- The local Paper server folder in `servers/Server-Two-Paper-26.1.2`
56+
- The local PlaceholderAPI jar in `servers/Server-Two-Paper-26.1.2/plugins`
57+
- The deployed legacy jar in `servers/Server-One-Paper-1.21.11/plugins` if you want `legacyJar`
58+
59+
Build the current Paper 26.1.2 jar and the legacy reference jar:
60+
61+
```bash
62+
gradle clean buildAllJars
63+
```
64+
65+
Build only the Paper 26.1.2 jar:
66+
67+
```bash
68+
gradle jar
69+
```
70+
71+
The `paper2612Jar` task is kept as an alias:
72+
73+
```bash
74+
gradle paper2612Jar
75+
```
76+
77+
Copy the deployed legacy jar into the requested legacy filename:
78+
79+
```bash
80+
gradle legacyJar
81+
```
82+
83+
The build compiles against the Paper 26.1.2 API jars found in `servers/Server-Two-Paper-26.1.2`. If that folder is missing or has not been started far enough for Paper to download its libraries, Gradle will not have the Paper API classpath it needs.
84+
85+
## Commands
86+
87+
The primary command is `/xmastree`.
88+
89+
If `core.commands.legacy-command-enabled` is `true`, the legacy `/xmas` alias is also registered.
90+
91+
| Command | Description |
92+
| --- | --- |
93+
| `/xmastree` | Shows plugin version, event status, auto-end status, resource-back status, tree count, and owner count. |
94+
| `/xmastree help` | Shows the command list. |
95+
| `/xmastree give <player>` | Gives an online player a Christmas Crystal. |
96+
| `/xmastree gifts` | Spawns a small batch of presents under every loaded Christmas tree. |
97+
| `/xmastree addhand` | Adds the item in your main hand to the gift list and saves it to `config.yml`. |
98+
| `/xmastree reload` | Reloads config, locale, present heads, gifts, luck settings, command alias settings, and tree level requirements. |
99+
| `/xmastree debug [page]` | Shows paginated status, commands, permissions, placeholders, and toggleable global config keys. |
100+
| `/xmastree debug toggle <key> true\|false` | Toggles supported global boolean config keys and reloads the plugin config. |
101+
| `/xmastree end` | Ends the event and sets `core.plugin-enabled` to `false`. |
102+
103+
## Permissions
104+
105+
| Permission | Default | Description |
106+
| --- | --- | --- |
107+
| `xmas.admin` | `op` | Allows use of the `/xmastree` command and all XMas Tree admin subcommands. |
108+
109+
## Player flow
110+
111+
Players can receive a Christmas Crystal from an admin, or craft one with diamonds around an emerald in a cross shape. Right-click a spruce sapling with the crystal to create a magic tree.
112+
113+
After planting, players right-click the tree with the configured level-up materials. The requirement header is short in chat and includes a hover hint that explains the ingredients must be fed into the tree by right-clicking while holding them. When all requirements for a level are complete, right-click the tree again to grow it. Presents spawn around grown trees while the event is enabled.
114+
115+
If `core.holiday-ends.resource-back` is enabled, confirmed tree destruction returns the upgrade materials that were actually spent on the tree. The plugin tries to place a chest first, then a barrel, then the player's inventory, and finally drops any overflow at the tree location.
116+
117+
Ingredient accept sounds can be tuned live in `config.yml` under `core.sounds.grow`. Use `0.0` for silent, `0.1` for quiet, `0.5` for half volume, and `1.0` for full volume. `/xmastree reload` applies the new values without a server restart.
118+
119+
## Configuration
120+
121+
The plugin writes its files to `plugins/X-Mas`:
122+
123+
- `config.yml` controls event timing, locale, tree limits, gift cooldowns, present skins, gift items, and level-up requirements.
124+
- `trees.yml` stores placed tree data and should be kept when upgrading an existing event.
125+
- `locales/*.yml` controls player-facing messages and crystal display text.
126+
127+
Use modern Paper/Bukkit material names such as `GOLD_INGOT`, `SPRUCE_LOG`, and `PLAYER_HEAD`. Legacy numeric IDs and old material names are skipped to avoid modern Paper exceptions.
128+
129+
Gift entries in `xmas.gifts` can be simple material names:
130+
131+
```yaml
132+
- DIAMOND
133+
- EMERALD:3
134+
```
135+
136+
Admins can also hold an item and run `/xmastree addhand`. This saves the exact item as Base64 so custom names, lore, enchantments, and metadata can be used as gifts.
137+
138+
Legacy world-name remapping lives under `migration.world-aliases`. This is useful when an old `trees.yml` was saved in worlds like `general`, `wild`, or `santa`, but the new Paper 26.1.2 server uses different world names:
139+
140+
```yaml
141+
migration:
142+
world-aliases:
143+
general: world
144+
wild: world
145+
santa: santa_event
146+
```
147+
148+
The saved coordinates are preserved. If the destination world terrain or world border changed, some legacy tree locations may still need manual cleanup.
149+
150+
Present head entries in `xmas.presents` should use `textures.minecraft.net` URLs. Old player-name entries are still accepted for compatibility.
151+
152+
Per-stage particles live under `xmas.tree-lvl.<stage>.particles`. Particle names should come from the Paper 26.1.2 `Particle` enum:
153+
154+
[jd.papermc.io/paper/26.1.2/org/bukkit/Particle.html](https://jd.papermc.io/paper/26.1.2/org/bukkit/Particle.html)
155+
156+
The config currently supports simple particles and `DUST`.
157+
158+
## MiniMessage
159+
160+
Locale messages, crystal names, crystal lore, and command messages support MiniMessage:
161+
162+
```yaml
163+
crystal:
164+
name: <green>Christmas Crystal</green>
165+
lore:
166+
- <gold>Concentrated Christmas Spirit</gold>
167+
- <gray>Use it on a spruce sapling to fill it with magic!</gray>
168+
```
169+
170+
Legacy `&` color codes are still parsed for compatibility when a message does not contain MiniMessage tags.
171+
172+
## Placeholders
173+
174+
PlaceholderAPI is optional. If PlaceholderAPI is installed, X-Mas registers the `onembxmastree` expansion.
175+
176+
PlaceholderAPI requires an underscore after the expansion identifier, so use:
177+
178+
```text
179+
%onembxmastree_event.active%
180+
```
181+
182+
The dotted key after `onembxmastree_` is supported to keep the placeholders readable and namespaced. Underscore variants also work, for example `%onembxmastree_event_active%`.
183+
184+
| Placeholder | Example output | Description |
185+
| --- | --- | --- |
186+
| `%onembxmastree_event.active%` | `true` | Whether the event is currently active. |
187+
| `%onembxmastree_event.active_text%` | `Active` | Human-readable active/inactive state. |
188+
| `%onembxmastree_event.status%` | `In Progress` | Current event status text. |
189+
| `%onembxmastree_event.starts_at%` | `manual` | Start mode. The plugin currently starts from `core.plugin-enabled`, not a scheduled start date. |
190+
| `%onembxmastree_event.ends_at%` | `10-01-2027 03-33-33` | Configured event end date. |
191+
| `%onembxmastree_event.ends_in%` | `263d 7h` | Approximate time until the configured end date, or `disabled` when auto-end is off. |
192+
| `%onembxmastree_event.ends_timestamp%` | `1799552013000` | Event end timestamp in milliseconds. |
193+
| `%onembxmastree_event.auto_end%` | `true` | Whether automatic event ending is enabled. |
194+
| `%onembxmastree_resource.back%` | `true` | Whether resource refunds are enabled. |
195+
| `%onembxmastree_resource.back_text%` | `Yes` | Human-readable refund state. |
196+
| `%onembxmastree_particles.enabled%` | `true` | Whether X-Mas particles are globally enabled. |
197+
| `%onembxmastree_luck.enabled%` | `false` | Whether gift luck chance is enabled. |
198+
| `%onembxmastree_luck.chance%` | `75` | Gift luck chance as a percent. |
199+
| `%onembxmastree_trees.total%` | `14` | Total loaded X-Mas trees. |
200+
| `%onembxmastree_trees.owners%` | `6` | Number of unique loaded tree owners. |
201+
| `%onembxmastree_player.trees%` | `2` | Number of loaded trees owned by the placeholder player. |
202+
| `%onembxmastree_version%` | `2.0.1-010` | Loaded plugin version. |
203+
204+
CMI hologram example:
205+
206+
```text
207+
&aX-Mas Event: &f%onembxmastree_event.active_text%
208+
&aEnds in: &f%onembxmastree_event.ends_in%
209+
&aResource back: &f%onembxmastree_resource.back_text%
210+
&aTrees planted: &f%onembxmastree_trees.total%
211+
```
212+
213+
ajLeaderboards placeholder examples:
214+
215+
```text
216+
%onembxmastree_trees.total%
217+
%onembxmastree_trees.owners%
218+
%onembxmastree_player.trees%
219+
```
220+
221+
## Compatibility notes
222+
223+
- Back up `plugins/X-Mas/trees.yml` before upgrading a live server.
224+
- Existing tree records are loaded from the same `trees.yml` format.
225+
- When saved world names no longer match the current server world names, `migration.world-aliases` can remap them without rewriting `trees.yml`.
226+
- Existing present head player-name entries are still accepted, but new configs should prefer Mojang texture URLs.
227+
- The modern jars are compiled with Java 25 bytecode and should be run on Java 25.
228+
- The Paper 26.1.2 jar is the intended winter 2026 target. Paper 1.21.11 compatibility is no longer part of the active test path.
229+
230+
## Security notes
231+
232+
- Admin commands are gated by `xmas.admin`.
233+
- Present texture URLs are restricted to `textures.minecraft.net`.
234+
- Gift item Base64 entries are capped before deserialization.
235+
- Config material names are resolved with modern `Material.matchMaterial` and invalid or legacy values are skipped.
236+
- Treat `config.yml` and locale files as trusted admin-controlled files, especially when using MiniMessage click or hover tags.
237+
238+
## Support
239+
240+
Please report bugs, compatibility problems, and upgrade questions in the GitHub issues section:
241+
242+
[github.com/mrfdev/XMasTree/issues](https://github.com/mrfdev/XMasTree/issues)
243+
244+
## Credits
245+
246+
- **MelonCode** - Original developer - [MelonCode](https://github.com/MelonCode)
247+
- **Ghost_chu** - NMS fixes - [Ghost-chu](https://github.com/Ghost-chu)
248+
- **LoneDev6** - Optimization patches - [LoneDev6](https://github.com/LoneDev6)
249+
- **montlikadani** - Hungarian translation - [montlikadani](https://github.com/montlikadani)
250+
- **1MB / mrfdev** - 2026 Paper modernization, Java 25 builds, and XMasTree maintenance
251+
252+
Original SpigotMC listing:
253+
254+
[spigotmc.org/resources/x-mas-upgradeable-christmas-tree-event.2672](https://www.spigotmc.org/resources/x-mas-upgradeable-christmas-tree-event.2672/)

build.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group = 'com.onemb.xmas'
6+
version = '2.0.1-010'
7+
8+
def legacyArchiveName = '1MB-XMas-2026-v2.0.0-004-v21-1.21.8.jar'
9+
def paper2612ArchiveName = '1MB-XMas-2026-v2.0.1-010-v25-26.1.2.jar'
10+
11+
def serverOne = layout.projectDirectory.dir('servers/Server-One-Paper-1.21.11')
12+
def serverTwo = layout.projectDirectory.dir('servers/Server-Two-Paper-26.1.2')
13+
def legacyServerJar = serverOne.file('plugins/1MB-X-Mas_2025-1.21.8.jar')
14+
def placeholderApiJar = serverTwo.file('plugins/PlaceholderAPI-2.12.3-DEV-265.jar')
15+
16+
def paper2612Api = serverTwo.file('libraries/io/papermc/paper/paper-api/26.1.2.build.18-alpha/paper-api-26.1.2.build.18-alpha.jar')
17+
18+
def paper2612Classpath = files(paper2612Api) + fileTree(dir: serverTwo.dir('libraries').asFile, include: '**/*.jar')
19+
20+
java {
21+
toolchain {
22+
languageVersion = JavaLanguageVersion.of(25)
23+
}
24+
}
25+
26+
dependencies {
27+
compileOnly paper2612Classpath
28+
compileOnly files(placeholderApiJar)
29+
}
30+
31+
tasks.withType(JavaCompile).configureEach {
32+
options.encoding = 'UTF-8'
33+
options.release = 25
34+
}
35+
36+
tasks.named('processResources') {
37+
filteringCharset = 'UTF-8'
38+
filesMatching('plugin.yml') {
39+
expand(version: project.version)
40+
}
41+
}
42+
43+
tasks.named('jar') {
44+
archiveFileName = paper2612ArchiveName
45+
}
46+
47+
tasks.register('paper2612Jar') {
48+
description = 'Assembles the Paper 26.1.2 Java 25 plugin jar.'
49+
group = 'build'
50+
dependsOn tasks.named('jar')
51+
}
52+
53+
tasks.register('legacyJar', Copy) {
54+
description = 'Copies the deployed legacy jar into the requested 2026 legacy filename.'
55+
group = 'build'
56+
from(legacyServerJar)
57+
into(layout.buildDirectory.dir('libs'))
58+
rename { legacyArchiveName }
59+
}
60+
61+
tasks.register('buildAllJars') {
62+
description = 'Builds the legacy reference jar plus the modern Paper 26.1.2 target jar.'
63+
group = 'build'
64+
dependsOn tasks.named('legacyJar'), tasks.named('jar')
65+
}
66+
67+
tasks.named('assemble') {
68+
dependsOn tasks.named('legacyJar'), tasks.named('paper2612Jar')
69+
}

0 commit comments

Comments
 (0)