mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
Fix merge
This commit is contained in:
parent
4e405647e8
commit
b2c390af23
4 changed files with 40 additions and 32 deletions
|
@ -5,6 +5,7 @@ import com.google.common.collect.Multimap;
|
|||
import java.util.function.Consumer;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockType;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.CreativeCategory;
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.bukkit.block.data.Snowable;
|
|||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.AmethystCluster;
|
||||
import org.bukkit.block.data.type.Bamboo;
|
||||
import org.bukkit.block.data.type.Barrel;
|
||||
import org.bukkit.block.data.type.Bed;
|
||||
import org.bukkit.block.data.type.Beehive;
|
||||
import org.bukkit.block.data.type.Bell;
|
||||
|
@ -72,6 +73,7 @@ import org.bukkit.block.data.type.RespawnAnchor;
|
|||
import org.bukkit.block.data.type.Sapling;
|
||||
import org.bukkit.block.data.type.Scaffolding;
|
||||
import org.bukkit.block.data.type.SculkSensor;
|
||||
import org.bukkit.block.data.type.SculkVein;
|
||||
import org.bukkit.block.data.type.SeaPickle;
|
||||
import org.bukkit.block.data.type.Sign;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
|
@ -872,9 +874,9 @@ public interface BlockType<B extends BlockData> extends Material {
|
|||
BlockType<Stairs> NETHER_BRICK_STAIRS = asBlockType(Material.NETHER_BRICK_STAIRS);
|
||||
BlockType<BlockData> SCULK = asBlockType(Material.SCULK);
|
||||
/**
|
||||
* BlockData: {@link Waterlogged}
|
||||
* BlockData: {@link SculkVein}
|
||||
*/
|
||||
BlockType<Waterlogged> SCULK_VEIN = asBlockType(Material.SCULK_VEIN);
|
||||
BlockType<SculkVein> SCULK_VEIN = asBlockType(Material.SCULK_VEIN);
|
||||
BlockType<BlockData> SCULK_CATALYST = asBlockType(Material.SCULK_CATALYST);
|
||||
BlockType<BlockData> SCULK_SHRIEKER = asBlockType(Material.SCULK_SHRIEKER);
|
||||
BlockType<BlockData> ENCHANTING_TABLE = asBlockType(Material.ENCHANTING_TABLE);
|
||||
|
@ -2176,9 +2178,9 @@ public interface BlockType<B extends BlockData> extends Material {
|
|||
*/
|
||||
BlockType<Levelled> COMPOSTER = asBlockType(Material.COMPOSTER);
|
||||
/**
|
||||
* BlockData: {@link Directional}
|
||||
* BlockData: {@link Barrel}
|
||||
*/
|
||||
BlockType<Directional> BARREL = asBlockType(Material.BARREL);
|
||||
BlockType<Barrel> BARREL = asBlockType(Material.BARREL);
|
||||
/**
|
||||
* BlockData: {@link Furnace}
|
||||
*/
|
||||
|
@ -2819,9 +2821,22 @@ public interface BlockType<B extends BlockData> extends Material {
|
|||
boolean isBurnable();
|
||||
|
||||
/**
|
||||
* Check if the material is a block and completely blocks vision
|
||||
* Check if the material is a block and occludes light in the lighting engine.
|
||||
* <p>
|
||||
* Generally speaking, most full blocks will occlude light. Non-full blocks are
|
||||
* not occluding (e.g. anvils, chests, tall grass, stairs, etc.), nor are specific
|
||||
* full blocks such as barriers or spawners which block light despite their texture.
|
||||
* <p>
|
||||
* An occluding block will have the following effects:
|
||||
* <ul>
|
||||
* <li>Chests cannot be opened if an occluding block is above it.
|
||||
* <li>Mobs cannot spawn inside of occluding blocks.
|
||||
* <li>Only occluding blocks can be "powered" ({@link Block#isBlockPowered()}).
|
||||
* </ul>
|
||||
* This list may be inconclusive. For a full list of the side effects of an occluding
|
||||
* block, see the <a href="https://minecraft.fandom.com/wiki/Opacity">Minecraft Wiki</a>.
|
||||
*
|
||||
* @return True if this material is a block and completely blocks vision
|
||||
* @return True if this material is a block and occludes light
|
||||
*/
|
||||
boolean isOccluding();
|
||||
|
||||
|
|
|
@ -256,26 +256,20 @@ public interface Criteria {
|
|||
|
||||
// Good use case for a switch expression
|
||||
if (type == Type.BLOCK) {
|
||||
switch (statistic) {
|
||||
case MINE_BLOCK:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.mined:minecraft." + material.getKey().getKey());
|
||||
default:
|
||||
break;
|
||||
if (statistic == Statistic.MINE_BLOCK) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.mined:minecraft." + material.getKey().getKey());
|
||||
}
|
||||
} else if (type == Type.ITEM) {
|
||||
switch (statistic) {
|
||||
case BREAK_ITEM:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.broken:minecraft." + material.getKey().getKey());
|
||||
case CRAFT_ITEM:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.crafted:minecraft." + material.getKey().getKey());
|
||||
case USE_ITEM:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.used:minecraft." + material.getKey().getKey());
|
||||
case PICKUP:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.picked_up:minecraft." + material.getKey().getKey());
|
||||
case DROP:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.dropped:minecraft." + material.getKey().getKey());
|
||||
default:
|
||||
break;
|
||||
if (statistic == Statistic.BREAK_ITEM) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.broken:minecraft." + material.getKey().getKey());
|
||||
} else if (statistic == Statistic.CRAFT_ITEM) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.crafted:minecraft." + material.getKey().getKey());
|
||||
} else if (statistic == Statistic.USE_ITEM) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.used:minecraft." + material.getKey().getKey());
|
||||
} else if (statistic == Statistic.PICKUP) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.picked_up:minecraft." + material.getKey().getKey());
|
||||
} else if (statistic == Statistic.DROP) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.dropped:minecraft." + material.getKey().getKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,13 +303,10 @@ public interface Criteria {
|
|||
Preconditions.checkArgument(entityType != null, "entityType must not be null");
|
||||
Preconditions.checkArgument(statistic.getType() == Type.ENTITY, "statistic type must be ENTITY, given %s", statistic.getType());
|
||||
|
||||
switch (statistic) {
|
||||
case KILL_ENTITY:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.killed:minecraft." + entityType.getKey().getKey());
|
||||
case ENTITY_KILLED_BY:
|
||||
return Bukkit.getScoreboardCriteria("minecraft.killed_by:minecraft." + entityType.getKey().getKey());
|
||||
default:
|
||||
break;
|
||||
if (statistic == Statistic.KILL_ENTITY) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.killed:minecraft." + entityType.getKey().getKey());
|
||||
} else if (statistic == Statistic.ENTITY_KILLED_BY) {
|
||||
return Bukkit.getScoreboardCriteria("minecraft.killed_by:minecraft." + entityType.getKey().getKey());
|
||||
}
|
||||
|
||||
return statistic(statistic); // Fallback to a regular statistic
|
||||
|
|
|
@ -2,9 +2,10 @@ package org.bukkit;
|
|||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MaterialTest {
|
||||
public class MaterialTest extends AbstractTestingBase {
|
||||
|
||||
@Test
|
||||
public void getByNameNull() {
|
||||
|
|
Loading…
Add table
Reference in a new issue