1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge branch 'master' into fix/hologram-dupes

This commit is contained in:
svr333 2021-05-01 01:46:58 +02:00 committed by GitHub
commit e7557ca680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 129 additions and 50 deletions

View File

@ -1,73 +1,119 @@
name: Bug Report (Beta)
about: Report a Bug or an Issue with Slimefun 4.
labels: ['\U0001F3AF Needs testing', '\U0001F41E Bug Report']
description: Report a Bug or an Issue with Slimefun 4.
labels: ['🎯 Needs testing', '🐞 Bug Report']
body:
- type: markdown
attributes:
value: '## Thanks for reporting a bug!'
- type: textarea
- id: description
type: textarea
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.
- type: textarea
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.
- id: reproduction-steps
type: textarea
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!
value: |
1.
2.
3.
- type: textarea
placeholder: |
(example)
1. Craft [...]
2. Right click with that item on a workbench
3. The workbench explodes
- id: expected-behaviour
type: textarea
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?
- type: textarea
placeholder: |
I expected [...] to happen.
- id: media
type: textarea
attributes:
label: ':scroll: Server Log'
label: '📷 Screenshots / Videos'
description: |
Take a look at your Server Log and post any errors you can find via https://pastebin.com/
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 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
- type: textarea
placeholder: https://pastebin.com/...
- id: error-reports
type: input
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/
- type: dropdown
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
validations:
required: true
attributes:
label: ':video_game: Minecraft Version'
label: '💻 Server Software'
description: 'Please select the software your Server is running on'
options:
- Spigot
- Paper
- Tuinity
- Purpur
- Other
- id: minecraft-version
type: dropdown
validations:
required: true
attributes:
label: '🎮 Minecraft Version'
description: 'Please select the Minecraft version of the server'
options:
#- 1.17.x
- 1.16.x
- 1.15.x
- 1.14.x
- Older
- type: textarea
- (Older versions are not supported)
- id: slimefun-version
type: textarea
validations:
required: true
attributes:
label: ':compass: Environment'
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 [...]
- type: markdown
attributes:
value: |
- Server software:
- Slimefun version:
## ❤️ 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!

View File

@ -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<T> {
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 <strong>current</strong> value of this {@link ItemSetting}.
*
@ -188,4 +199,19 @@ public class ItemSetting<T> {
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;
}
}
}

View File

@ -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,9 +50,14 @@ public class MagicianTalisman extends Talisman {
}
}
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());
}
}
/**