mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Requested changes
This commit is contained in:
parent
488ffd951b
commit
ec37fb142a
@ -41,7 +41,7 @@ public class SoulboundListener implements Listener {
|
|||||||
for (int slot = 0; slot < p.getInventory().getSize(); slot++) {
|
for (int slot = 0; slot < p.getInventory().getSize(); slot++) {
|
||||||
ItemStack item = p.getInventory().getItem(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())) {
|
if (SlimefunUtils.isSoulbound(item, p.getWorld())) {
|
||||||
items.put(slot, item);
|
items.put(slot, item);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public final class SlimefunUtils {
|
|||||||
|
|
||||||
if (sfItem instanceof Soulbound) {
|
if (sfItem instanceof Soulbound) {
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
return !sfItem.isDisabled() && !sfItem.isDisabledIn(world);
|
return !sfItem.isDisabledIn(world);
|
||||||
} else {
|
} else {
|
||||||
return !sfItem.isDisabled();
|
return !sfItem.isDisabled();
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.testing.tests.listeners;
|
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.implementation.items.magical.SoulboundItem;
|
||||||
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
|
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
|
||||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
@ -42,6 +41,7 @@ class TestSoulboundListener {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = { true, false })
|
@ValueSource(booleans = { true, false })
|
||||||
|
@DisplayName("Test if the soulbound item is dropped or not")
|
||||||
void testItemDrop(boolean soulbound) {
|
void testItemDrop(boolean soulbound) {
|
||||||
PlayerMock player = server.addPlayer();
|
PlayerMock player = server.addPlayer();
|
||||||
ItemStack item = new CustomItem(Material.DIAMOND_SWORD, "&4Cool Sword");
|
ItemStack item = new CustomItem(Material.DIAMOND_SWORD, "&4Cool Sword");
|
||||||
@ -56,6 +56,7 @@ class TestSoulboundListener {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = { true, false })
|
@ValueSource(booleans = { true, false })
|
||||||
|
@DisplayName("Test if soulbound item is dropped if disabled")
|
||||||
void testItemDropIfItemDisabled(boolean enabled) {
|
void testItemDropIfItemDisabled(boolean enabled) {
|
||||||
PlayerMock player = server.addPlayer();
|
PlayerMock player = server.addPlayer();
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ class TestSoulboundListener {
|
|||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource(booleans = { true, false })
|
@ValueSource(booleans = { true, false })
|
||||||
|
@DisplayName("Test if soulbound item is returned to player")
|
||||||
void testItemRecover(boolean soulbound) {
|
void testItemRecover(boolean soulbound) {
|
||||||
PlayerMock player = server.addPlayer();
|
PlayerMock player = server.addPlayer();
|
||||||
ItemStack item = new CustomItem(Material.DIAMOND_SWORD, "&4Cool Sword");
|
ItemStack item = new CustomItem(Material.DIAMOND_SWORD, "&4Cool Sword");
|
||||||
|
Loading…
Reference in New Issue
Block a user