geforkt von Mirrors/Paper
SPIGOT-3936: Add isInteractable to Material
By: Christos Miniotis <chrismin1302@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
8654bfc80e
Commit
b4349f5a60
@ -26,7 +26,12 @@ import org.junit.runners.Parameterized.Parameters;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.minecraft.server.Block;
|
import net.minecraft.server.Block;
|
||||||
|
import net.minecraft.server.BlockPosition;
|
||||||
import net.minecraft.server.Blocks;
|
import net.minecraft.server.Blocks;
|
||||||
|
import net.minecraft.server.EntityHuman;
|
||||||
|
import net.minecraft.server.EnumDirection;
|
||||||
|
import net.minecraft.server.EnumHand;
|
||||||
|
import net.minecraft.server.IBlockData;
|
||||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||||
import org.bukkit.enchantments.EnchantmentTarget;
|
import org.bukkit.enchantments.EnchantmentTarget;
|
||||||
|
|
||||||
@ -198,4 +203,16 @@ public class PerMaterialTest extends AbstractTestingBase {
|
|||||||
assertThat(material.isItem(), is(equalTo(CraftMagicNumbers.getItem(material) != null)));
|
assertThat(material.isItem(), is(equalTo(CraftMagicNumbers.getItem(material) != null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInteractable() throws ReflectiveOperationException {
|
||||||
|
if (material.isBlock()) {
|
||||||
|
assertThat(material.isInteractable(),
|
||||||
|
is(!CraftMagicNumbers.getBlock(material).getClass()
|
||||||
|
.getMethod("interact", IBlockData.class, net.minecraft.server.World.class, BlockPosition.class, EntityHuman.class, EnumHand.class, EnumDirection.class, float.class, float.class, float.class)
|
||||||
|
.getDeclaringClass().equals(Block.class)));
|
||||||
|
} else {
|
||||||
|
assertFalse(material.isInteractable());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren