From 33ee417bdf3c81767de4c74363e761fca83850b3 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 16:33:33 +0200 Subject: [PATCH 1/8] [CI skip] Updated issue beta template --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 29 +++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index 1f896992a..836bfb1a2 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -1,10 +1,12 @@ name: Bug Report (Beta) -about: Report a Bug or an Issue with Slimefun 4. +description: Report a Bug or an Issue with Slimefun 4. labels: ['\U0001F3AF Needs testing', '\U0001F41E Bug Report'] + body: - type: markdown attributes: value: '## Thanks for reporting a bug!' + - type: textarea validations: required: true @@ -13,6 +15,7 @@ body: description: | A clear and detailed description of what went wrong. The more information you can provide, the easier we can handle this problem. + - type: textarea validations: required: true @@ -25,6 +28,7 @@ body: 1. 2. 3. + - type: textarea validations: required: true @@ -33,18 +37,34 @@ body: description: | What were you expecting to happen? What do you think would have been the correct behaviour? + - type: textarea attributes: label: ':scroll: Server Log' description: | Take a look at your Server Log and post any errors you can find via https://pastebin.com/ If you are unsure about it, post your full log, you can find it under /logs/latest.log + - type: textarea attributes: label: ':open_file_folder: /error-reports/ Folder' description: | Check the folder /plugins/Slimefun/error-reports/ and upload any files inside that folder. You can also post these files via https://pastebin.com/ + +- type: dropdown + validations: + required: true + attributes: + label: ':desktop_computer: Server Software' + description: 'Please select the software your Server is running on' + options: + - Spigot + - Paper + - Tuinity + - Purpur + - Other + - type: dropdown validations: required: true @@ -57,17 +77,16 @@ body: - 1.15.x - 1.14.x - Older + - type: textarea validations: required: true attributes: - label: ':compass: Environment' + label: ':compass: Your Slimefun version' description: | Any issue without the exact version numbers will be closed! "latest" IS NOT A VERSION NUMBER. We recommend running "/sf versions" and showing us a screenshot of that. Make sure that the screenshot covers the entire output of that command. If your issue is related to other plugins, make sure to include the versions of these plugins too! - value: | - - Server software: - - Slimefun version: + placeholder: Slimefun version From fc0b141dda006ba2c5a49e0f71f33f2dd1ea2809 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 16:47:41 +0200 Subject: [PATCH 2/8] [CI skip] Updated issues template (beta) --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 53 ++++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index 836bfb1a2..7e0238ce1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -3,11 +3,8 @@ description: Report a Bug or an Issue with Slimefun 4. labels: ['\U0001F3AF Needs testing', '\U0001F41E Bug Report'] body: -- type: markdown - attributes: - value: '## Thanks for reporting a bug!' - -- type: textarea +- id: description + type: textarea validations: required: true attributes: @@ -15,8 +12,13 @@ body: description: | A clear and detailed description of what went wrong. The more information you can provide, the easier we can handle this problem. + placeholder: | + example: + When trying to do [...], I expected [...] to happen but [...] happened instead. + I am pretty sure this is not intended and should be fixed. -- type: textarea +- id: reproduction-steps + type: textarea validations: required: true attributes: @@ -24,12 +26,14 @@ body: description: | Tell us the exact steps to reproduce this issue, the more detailed the easier we can reproduce it. Youtube Videos and Screenshots are recommended! - value: | - 1. - 2. - 3. + placeholder: | + example: + 1. Craft [...] + 2. Right click with that item on a workbench + 3. The workbench explodes -- type: textarea +- id: expected-behaviour + type: textarea validations: required: true attributes: @@ -37,22 +41,27 @@ body: description: | What were you expecting to happen? What do you think would have been the correct behaviour? + placeholder: | + I expected [...] to happen. -- type: textarea +- id: server-log + type: textarea attributes: label: ':scroll: Server Log' description: | Take a look at your Server Log and post any errors you can find via https://pastebin.com/ If you are unsure about it, post your full log, you can find it under /logs/latest.log -- type: textarea +- id: error-reports + type: textarea attributes: label: ':open_file_folder: /error-reports/ Folder' description: | Check the folder /plugins/Slimefun/error-reports/ and upload any files inside that folder. You can also post these files via https://pastebin.com/ -- type: dropdown +- id: server-software + type: dropdown validations: required: true attributes: @@ -65,7 +74,8 @@ body: - Purpur - Other -- type: dropdown +- id: minecraft-version + type: dropdown validations: required: true attributes: @@ -76,13 +86,14 @@ body: - 1.16.x - 1.15.x - 1.14.x - - Older + - (Older versions are not supported) -- type: textarea +- id: slimefun-version + type: input validations: required: true attributes: - label: ':compass: Your Slimefun version' + label: ':compass: Slimefun version' description: | Any issue without the exact version numbers will be closed! "latest" IS NOT A VERSION NUMBER. @@ -90,3 +101,9 @@ body: Make sure that the screenshot covers the entire output of that command. If your issue is related to other plugins, make sure to include the versions of these plugins too! placeholder: Slimefun version + +- type: markdown + value: | + Thank you for submitting a bug report! If anyone who sees this has some additional info which + can help reproduce or track down this issue, please comment down below. + Any help is appreciated! :heart: From f8bb18d1930b007035c79ab7995c091bf1572879 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 16:48:09 +0200 Subject: [PATCH 3/8] [CI skip] Fixed issue template (beta) --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index 7e0238ce1..c7025f85f 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -103,7 +103,8 @@ body: placeholder: Slimefun version - type: markdown - value: | - Thank you for submitting a bug report! If anyone who sees this has some additional info which - can help reproduce or track down this issue, please comment down below. - Any help is appreciated! :heart: + attributes: + value: | + Thank you for submitting a bug report! If anyone who sees this has some additional info which + can help reproduce or track down this issue, please comment down below. + Any help is appreciated! :heart: From 2d55c7be1f78cfd72bb712fff7e34138a359fb0e Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 16:52:05 +0200 Subject: [PATCH 4/8] [CI skip] Fixed emojis in beta template? --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index c7025f85f..3a3f67487 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -1,6 +1,6 @@ name: Bug Report (Beta) description: Report a Bug or an Issue with Slimefun 4. -labels: ['\U0001F3AF Needs testing', '\U0001F41E Bug Report'] +labels: ['🎯 Needs testing', '🐞 Bug Report'] body: - id: description @@ -8,7 +8,7 @@ body: validations: required: true attributes: - label: ':round_pushpin: Description' + label: '📍 Description' description: | A clear and detailed description of what went wrong. The more information you can provide, the easier we can handle this problem. @@ -22,7 +22,7 @@ body: validations: required: true attributes: - label: ':bookmark_tabs: Reproduction Steps' + label: '📑 Reproduction Steps' description: | Tell us the exact steps to reproduce this issue, the more detailed the easier we can reproduce it. Youtube Videos and Screenshots are recommended! @@ -37,7 +37,7 @@ body: validations: required: true attributes: - label: ':bulb: Expected Behavior' + label: '💡 Expected Behavior' description: | What were you expecting to happen? What do you think would have been the correct behaviour? @@ -47,7 +47,7 @@ body: - id: server-log type: textarea attributes: - label: ':scroll: Server Log' + label: '📜 Server Log' description: | Take a look at your Server Log and post any errors you can find via https://pastebin.com/ If you are unsure about it, post your full log, you can find it under /logs/latest.log @@ -55,7 +55,7 @@ body: - id: error-reports type: textarea attributes: - label: ':open_file_folder: /error-reports/ Folder' + label: '📂 `/error-reports/` folder' description: | Check the folder /plugins/Slimefun/error-reports/ and upload any files inside that folder. You can also post these files via https://pastebin.com/ @@ -65,7 +65,7 @@ body: validations: required: true attributes: - label: ':desktop_computer: Server Software' + label: '💻 Server Software' description: 'Please select the software your Server is running on' options: - Spigot @@ -79,7 +79,7 @@ body: validations: required: true attributes: - label: ':video_game: Minecraft Version' + label: '🎮 Minecraft Version' description: 'Please select the Minecraft version of the server' options: #- 1.17.x @@ -93,7 +93,7 @@ body: validations: required: true attributes: - label: ':compass: Slimefun version' + label: '⭐ Slimefun version' description: | Any issue without the exact version numbers will be closed! "latest" IS NOT A VERSION NUMBER. @@ -105,6 +105,6 @@ body: - type: markdown attributes: value: | - Thank you for submitting a bug report! If anyone who sees this has some additional info which - can help reproduce or track down this issue, please comment down below. - Any help is appreciated! :heart: + ## ❤️ Thank you for submitting a bug report! + If anyone who sees this has some additional info which can help reproduce or track down this issue, + please comment down below. Any help is appreciated! From b96ffb55293b57a8f737dbe1d5ec22e7528354f4 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 16:58:28 +0200 Subject: [PATCH 5/8] [CI skip] Updated issues template (beta) --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 41 +++++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index 3a3f67487..9cd932b45 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -13,8 +13,8 @@ body: A clear and detailed description of what went wrong. The more information you can provide, the easier we can handle this problem. placeholder: | - example: - When trying to do [...], I expected [...] to happen but [...] happened instead. + (example)
+ When trying to do [...], I expected [...] to happen but [...] happened instead.
I am pretty sure this is not intended and should be fixed. - id: reproduction-steps @@ -25,11 +25,10 @@ body: label: '📑 Reproduction Steps' description: | Tell us the exact steps to reproduce this issue, the more detailed the easier we can reproduce it. - Youtube Videos and Screenshots are recommended! placeholder: | - example: - 1. Craft [...] - 2. Right click with that item on a workbench + (example)
+ 1. Craft [...]
+ 2. Right click with that item on a workbench
3. The workbench explodes - id: expected-behaviour @@ -44,21 +43,32 @@ body: placeholder: | I expected [...] to happen. -- id: server-log +- id: media type: textarea + attributes: + label: '📷 Screenshots / Videos' + description: | + Videos and Screenshots help illustrate issues the best. + If you can capture any footage of the bug happening, it would help us out a lot! + +- id: server-log + type: input attributes: label: '📜 Server Log' description: | - Take a look at your Server Log and post any errors you can find via https://pastebin.com/ + Take a look at your Server Log and upload any error messages from Slimefun + to a pasting site (e.g. https://pastebin.com/) If you are unsure about it, post your full log, you can find it under /logs/latest.log + placeholder: https://pastebin.com/... - id: error-reports - type: textarea + type: input attributes: label: '📂 `/error-reports/` folder' description: | - Check the folder /plugins/Slimefun/error-reports/ and upload any files inside that folder. - You can also post these files via https://pastebin.com/ + Check the folder `/plugins/Slimefun/error-reports/` and upload any files inside that folder + to a pasting site (e.g. https://pastebin.com/) + placeholder: https://pastebin.com/... - id: server-software type: dropdown @@ -89,18 +99,17 @@ body: - (Older versions are not supported) - id: slimefun-version - type: input + type: textarea validations: required: true attributes: label: '⭐ Slimefun version' description: | - Any issue without the exact version numbers will be closed! - "latest" IS NOT A VERSION NUMBER. - We recommend running "/sf versions" and showing us a screenshot of that. + **"latest" is not a version number, we need the exact version.** + We recommend running "/sf versions" and uploading a screenshot of that. Make sure that the screenshot covers the entire output of that command. If your issue is related to other plugins, make sure to include the versions of these plugins too! - placeholder: Slimefun version + placeholder: Slimefun version: [...] - type: markdown attributes: From b3dd5041fd4aa0a803b5458c314bab0568441a5d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 16:59:03 +0200 Subject: [PATCH 6/8] [CI skip] Fixed yaml for issue template (beta) --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index 9cd932b45..20354cdc0 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -109,7 +109,7 @@ body: We recommend running "/sf versions" and uploading a screenshot of that. Make sure that the screenshot covers the entire output of that command. If your issue is related to other plugins, make sure to include the versions of these plugins too! - placeholder: Slimefun version: [...] + placeholder: Slimefun version [...] - type: markdown attributes: From 08a4cd75560cc5cefb6f808beb0141c1407b6725 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 30 Apr 2021 17:00:38 +0200 Subject: [PATCH 7/8] [CI skip] Removed line breaks from beta template --- .github/ISSUE_TEMPLATE/bug-report-beta.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml index 20354cdc0..36ae2dd74 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-beta.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report-beta.yaml @@ -13,8 +13,8 @@ body: A clear and detailed description of what went wrong. The more information you can provide, the easier we can handle this problem. placeholder: | - (example)
- When trying to do [...], I expected [...] to happen but [...] happened instead.
+ (example) + When trying to do [...], I expected [...] to happen but [...] happened instead. I am pretty sure this is not intended and should be fixed. - id: reproduction-steps @@ -26,9 +26,9 @@ body: description: | Tell us the exact steps to reproduce this issue, the more detailed the easier we can reproduce it. placeholder: | - (example)
- 1. Craft [...]
- 2. Right click with that item on a workbench
+ (example) + 1. Craft [...] + 2. Right click with that item on a workbench 3. The workbench explodes - id: expected-behaviour From df7b262d14e4d3d54e09c2050f97285f619f9b31 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 1 May 2021 00:09:38 +0200 Subject: [PATCH 8/8] Fixed #3007 --- CHANGELOG.md | 1 + .../slimefun4/api/items/ItemSetting.java | 30 ++++++++++++++- .../magical/talismans/MagicianTalisman.java | 37 +++++++++++-------- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf0c9fd3..eb17f3978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ * Fixed #2999 * Fixed #2593 * Fixed #2937 +* Fixed #3007 ## Release Candidate 22 (18 Apr 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#22 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java index b753f9c1e..417199e91 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java @@ -1,5 +1,8 @@ package io.github.thebusybiscuit.slimefun4.api.items; +import java.util.List; +import java.util.Objects; + import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; @@ -9,8 +12,6 @@ import io.github.thebusybiscuit.cscorelib2.config.Config; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import java.util.List; - /** * This class represents a Setting for a {@link SlimefunItem} that can be modified via * the {@code Items.yml} {@link Config} file. @@ -91,6 +92,16 @@ public class ItemSetting { return key; } + /** + * This returns the associated {@link SlimefunItem} for this {@link ItemSetting}. + * + * @return The associated {@link SlimefunItem} + */ + @Nonnull + protected SlimefunItem getItem() { + return item; + } + /** * This returns the current value of this {@link ItemSetting}. * @@ -188,4 +199,19 @@ public class ItemSetting { return getClass().getSimpleName() + " {" + getKey() + " = " + currentValue + " (default: " + getDefaultValue() + ")"; } + @Override + public final int hashCode() { + return Objects.hash(item, key); + } + + @Override + public final boolean equals(Object obj) { + if (obj instanceof ItemSetting) { + ItemSetting setting = (ItemSetting) obj; + return Objects.equals(getKey(), setting.getKey()) && Objects.equals(getItem(), setting.getItem()); + } else { + return false; + } + } + } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java index ea305bf32..446cb0b8c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java @@ -1,18 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans; -import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; -import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; -import org.apache.commons.lang.Validate; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -20,6 +7,21 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.logging.Level; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +import org.apache.commons.lang.Validate; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; +import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; + /** * The {@link MagicianTalisman} is a special kind of {@link Talisman} which awards a {@link Player} * with an extra {@link Enchantment} when they enchant their {@link ItemStack}. @@ -48,8 +50,13 @@ public class MagicianTalisman extends Talisman { } } - if (!enchantments.isEmpty()) { - addItemSetting(enchantments.toArray(new ItemSetting[0])); + try { + if (!enchantments.isEmpty()) { + // Fixes #3007 - This is a Set, so every Enchantment should only be contained in here once. + addItemSetting(enchantments.toArray(new ItemSetting[0])); + } + } catch (Exception x) { + SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "The following Exception was thrown when initializing the settings for " + toString()); } }