1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Requested changes

This commit is contained in:
Daniel Walsh 2021-03-28 13:26:57 +01:00
parent 488ffd951b
commit ec37fb142a
No known key found for this signature in database
GPG Key ID: 91C6D8D7C4011D82
3 changed files with 6 additions and 4 deletions

View File

@ -41,7 +41,7 @@ public class SoulboundListener implements Listener {
for (int slot = 0; slot < p.getInventory().getSize(); slot++) {
ItemStack item = p.getInventory().getItem(slot);
// Store soulbound items for later rtrieval
// Store soulbound items for later retrieval
if (SlimefunUtils.isSoulbound(item, p.getWorld())) {
items.put(slot, item);
}

View File

@ -113,7 +113,7 @@ public final class SlimefunUtils {
if (sfItem instanceof Soulbound) {
if (world != null) {
return !sfItem.isDisabled() && !sfItem.isDisabledIn(world);
return !sfItem.isDisabledIn(world);
} else {
return !sfItem.isDisabled();
}

View File

@ -1,17 +1,16 @@
package io.github.thebusybiscuit.slimefun4.testing.tests.listeners;
import be.seeseemelk.mockbukkit.WorldMock;
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.SoulboundItem;
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@ -42,6 +41,7 @@ class TestSoulboundListener {
@ParameterizedTest
@ValueSource(booleans = { true, false })
@DisplayName("Test if the soulbound item is dropped or not")
void testItemDrop(boolean soulbound) {
PlayerMock player = server.addPlayer();
ItemStack item = new CustomItem(Material.DIAMOND_SWORD, "&4Cool Sword");
@ -56,6 +56,7 @@ class TestSoulboundListener {
@ParameterizedTest
@ValueSource(booleans = { true, false })
@DisplayName("Test if soulbound item is dropped if disabled")
void testItemDropIfItemDisabled(boolean enabled) {
PlayerMock player = server.addPlayer();
@ -79,6 +80,7 @@ class TestSoulboundListener {
@ParameterizedTest
@ValueSource(booleans = { true, false })
@DisplayName("Test if soulbound item is returned to player")
void testItemRecover(boolean soulbound) {
PlayerMock player = server.addPlayer();
ItemStack item = new CustomItem(Material.DIAMOND_SWORD, "&4Cool Sword");