Skip to content

Commit

Permalink
Deprecate patterns in favor of displaypattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Jul 23, 2024
1 parent 29cc151 commit 54e8af9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,21 @@ Items:

### Changes:
- No longer add the contents of `DisplayData` to the `Items` section on `/crazycrates reload`
- Lowercase shield pattern types and colors which also fixed a display issue, so previous shield pattern/color configs work. They no longer need to be typed like GRADIENT_UP:LIGHT_GRAY, you can simply type gradient_up:light_gray
- Lowercase shield pattern types and colors which also fixed a display issue, so previous shield pattern/color configs work. They no longer need to be typed like GRADIENT_UP:LIGHT_GRAY, you can simply type gradient_up:light_gray
- Deprecated `Patterns` in favor of `DisplayPatterns`, it will be removed in the next major version of Minecraft.
```yml
'6':
# The name of the item to display in the gui.
DisplayName: "<green>Fancy Shield"
# The enchants to display in the gui.
DisplayItem: "shield"
# A list of patterns: https://jd.papermc.io/paper/1.21/org/bukkit/block/banner/PatternType.html
# The patterns don't need to be uppercased. you can type them lowercased along with the colors.
# Patterns have to be laid out in a specific order, otherwise it won't look right.
# This also applies to the Items section.
DisplayPatterns:
- "base:white"
- "gradient_up:light_gray"
- "straight_cross:light_blue"
- "flower:light_blue"
```
20 changes: 17 additions & 3 deletions src/main/java/com/badbones69/crazycrates/api/objects/Prize.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ public final boolean hasPermission(@NotNull final Player player) {
if (this.section.contains("Lore")) {
if (MiscUtils.isLogging()) {
List.of(
"Detected deprecated usage of Lore in Prize " + this.sectionName + " in " + this.crateName + ".yml, please change Lore to DisplayLore",
"Lore will be removed in the next major version of Minecraft in favor of DisplayLore.",
"This does not apply to ANYWHERE outside of the Prizes, It also does not apply to the Items section in prizes."
"Deprecated usage of Patterns in your Prize " + this.sectionName + " in " + this.crateName + ".yml, please change Lore to DisplayLore",
"Lore will be removed in the next major version of Minecraft in favor of DisplayLore",
"You can turn my nagging off in config.yml, verbose_logging: true -> false"
).forEach(this.plugin.getComponentLogger()::warn);
}

Expand All @@ -254,11 +254,25 @@ public final boolean hasPermission(@NotNull final Player player) {
builder.setDamage(this.section.getInt("DisplayDamage", 0));

if (this.section.contains("Patterns")) {
if (MiscUtils.isLogging()) {
List.of(
"Deprecated usage of Patterns in your Prize " + this.sectionName + " in " + this.crateName + ".yml, please change Patterns to DisplayPatterns",
"Patterns will be removed in the next major version of Minecraft in favor of DisplayPattern",
"You can turn my nagging off in config.yml, verbose_logging: true -> false"
).forEach(this.plugin.getComponentLogger()::warn);
}

for (final String pattern : this.section.getStringList("Patterns")) {
builder.addPattern(pattern.toLowerCase());
}
}

if (this.section.contains("DisplayPatterns")) {
for (final String pattern : this.section.getStringList("DisplayPatterns")) {
builder.addPattern(pattern.toLowerCase());
}
}

builder.setItemFlags(this.section.getStringList("Flags"));

builder.setHidingItemFlags(this.section.getBoolean("HideItemFlags", false));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/crates/CrateExample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Crate:
# The patterns don't need to be uppercased. you can type them lowercased along with the colors.
# Patterns have to be laid out in a specific order, otherwise it won't look right.
# This also applies to the Items section.
Patterns:
DisplayPatterns:
- "base:white"
- "gradient_up:light_gray"
- "straight_cross:light_blue"
Expand Down

0 comments on commit 54e8af9

Please sign in to comment.