Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/main/java/com/cryptomorin/xseries/XBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public final class XBlock {
XMaterial.MAGMA_BLOCK, XMaterial.LAVA, XMaterial.CAMPFIRE, XMaterial.FIRE, XMaterial.SOUL_FIRE
));
public static final byte CAKE_SLICES = 6;
private static final boolean ISFLAT = XMaterial.supports(13);
private static final boolean ISFLAT = XMaterial.supports(1, 13);
private static final Map<XMaterial, XMaterial> ITEM_TO_BLOCK = new EnumMap<>(XMaterial.class);

static {
Expand Down Expand Up @@ -407,7 +407,7 @@ public static XMaterial getType(Block block) {
break;
case BED:
case BED_BLOCK:
if (!XMaterial.supports(12)) return XMaterial.RED_BED;
if (!XMaterial.supports(1, 12)) return XMaterial.RED_BED;
// This doesn't work, the returned data value is incorrect.
// data = (byte) (data & 0x7); // Mask to ignore head/foot, facing, occupied bits

Expand Down Expand Up @@ -1060,7 +1060,7 @@ public static boolean isSimilar(Block block, XMaterial material) {

Material mat = block.getType();

if (material.name().endsWith("_BED") && !XMaterial.supports(12))
if (material.name().endsWith("_BED") && !XMaterial.supports(1, 12))
return mat == LegacyBlockMaterial.BED_BLOCK.material || mat == LegacyBlockMaterial.BED.material;

switch (material) {
Expand Down
34 changes: 17 additions & 17 deletions core/src/main/java/com/cryptomorin/xseries/XItemStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ private static <T> Object singleOrList(List<T> list) {

@SuppressWarnings("deprecation")
private void legacySpawnEgg() {
if (!supports(11)) {
if (!supports(1, 11)) {
MaterialData data = item.getData();
if (data instanceof SpawnEgg) {
SpawnEgg spawnEgg = (SpawnEgg) data;
Expand Down Expand Up @@ -727,15 +727,15 @@ private void handleMapMeta(MapMeta map) {
ConfigurationSection mapSection = config.createSection("map");

mapSection.set("scaling", map.isScaling());
if (supports(11)) {
if (supports(1, 11)) {
if (map.hasLocationName()) mapSection.set("location", map.getLocationName());
if (map.hasColor()) {
Color color = map.getColor();
mapSection.set("color", colorString(color));
}
}

if (supports(14)) {
if (supports(1, 14)) {
if (map.hasMapView()) {
MapView mapView = map.getMapView();
ConfigurationSection view = mapSection.createSection("view");
Expand All @@ -757,7 +757,7 @@ private void handleBookMeta(BookMeta book) {

if (book.getTitle() != null) bookInfo.set("title", book.getTitle());
if (book.getAuthor() != null) bookInfo.set("author", book.getAuthor());
if (supports(9)) {
if (supports(1, 9)) {
BookMeta.Generation generation = book.getGeneration();
if (generation != null) {
bookInfo.set("generation", book.getGeneration().toString());
Expand Down Expand Up @@ -811,7 +811,7 @@ private void handleFireworkMeta(FireworkMeta firework) {

@SuppressWarnings({"deprecation", "StatementWithEmptyBody"})
private void handlePotionMeta(PotionMeta meta) {
if (supports(9)) {
if (supports(1, 9)) {
if (SUPPORTS_PotionMeta_getBasePotionType) {
PotionType basePotionType = meta.getBasePotionType();
if (basePotionType != null)
Expand Down Expand Up @@ -880,7 +880,7 @@ private void handleEnchantmentStorageMeta(EnchantmentStorageMeta meta) {
private void handleBlockStateMeta(BlockStateMeta meta) {
BlockState state = safeBlockState(meta);

if (supports(11) && state instanceof ShulkerBox) {
if (supports(1, 11) && state instanceof ShulkerBox) {
ShulkerBox box = (ShulkerBox) state;
ConfigurationSection shulker = config.createSection("contents");
int i = 0;
Expand All @@ -901,7 +901,7 @@ private void handleBlockStateMeta(BlockStateMeta meta) {

@SuppressWarnings("deprecation")
private void handleAttributes(ItemMeta meta) {
if (supports(13)) {
if (supports(1, 13)) {
Multimap<Attribute, AttributeModifier> attributes = meta.getAttributeModifiers();
if (attributes != null) {
for (Map.Entry<Attribute, AttributeModifier> attribute : attributes.entries()) {
Expand Down Expand Up @@ -936,7 +936,7 @@ private void handleEnchants() {

@SuppressWarnings("deprecation")
private void handleDurability(ItemMeta meta) {
if (supports(13)) {
if (supports(1, 13)) {
if (meta instanceof Damageable) {
Damageable damageable = (Damageable) meta;
if (damageable.hasDamage()) config.set("damage", damageable.getDamage());
Expand Down Expand Up @@ -1070,7 +1070,7 @@ public ItemStack deserialize() {

private void attributes() {
// Atrributes - https://minecraft.wiki/w/Attribute
if (!supports(13)) return;
if (!supports(1, 13)) return;

ConfigurationSection attributes = config.getConfigurationSection("attributes");
if (attributes != null) {
Expand Down Expand Up @@ -1119,7 +1119,7 @@ private void attributes() {

@SuppressWarnings("deprecation")
private void legacySpawnEgg() {
if (!supports(11)) {
if (!supports(1, 11)) {
MaterialData data = item.getData();
if (data instanceof SpawnEgg) {
String creatureName = config.getString("creature");
Expand Down Expand Up @@ -1416,14 +1416,14 @@ private void handleMapMeta(MapMeta map) {
if (mapSection == null) return;

map.setScaling(mapSection.getBoolean("scaling"));
if (supports(11)) {
if (supports(1, 11)) {
if (mapSection.isSet("location")) map.setLocationName(mapSection.getString("location"));
if (mapSection.isSet("color")) {
parseColor(mapSection.getString("color")).ifPresent(map::setColor);
}
}

if (supports(14)) {
if (supports(1, 14)) {
ConfigurationSection view = mapSection.getConfigurationSection("view");
if (view != null) {
World world = Bukkit.getWorld(view.getString("world"));
Expand Down Expand Up @@ -1455,7 +1455,7 @@ private void handleBookMeta(BookMeta book) {
book.setAuthor(bookInfo.getString("author"));
book.setPages(bookInfo.getStringList("pages"));

if (supports(9)) {
if (supports(1, 9)) {
String generationValue = bookInfo.getString("generation");
if (generationValue != null) {
BookMeta.Generation generation = Enums.getIfPresent(BookMeta.Generation.class, generationValue).orNull();
Expand Down Expand Up @@ -1515,7 +1515,7 @@ private void handleBlockStateMeta(BlockStateMeta bsm) {
spawner.update(true);
bsm.setBlockState(spawner);
}
} else if (supports(11) && state instanceof ShulkerBox) {
} else if (supports(1, 11) && state instanceof ShulkerBox) {
ConfigurationSection shulkerSection = config.getConfigurationSection("contents");
if (shulkerSection != null) {
ShulkerBox box = (ShulkerBox) state;
Expand All @@ -1532,7 +1532,7 @@ private void handleBlockStateMeta(BlockStateMeta bsm) {
} else if (state instanceof Banner) {
Banner banner = (Banner) state;
ConfigurationSection patterns = config.getConfigurationSection("patterns");
if (!supports(14)) {
if (!supports(1, 14)) {
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/diff/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java?until=b3dc236663a55450c69356e660c0c84f0abbb3aa
banner.setBaseColor(DyeColor.WHITE);
}
Expand Down Expand Up @@ -1563,7 +1563,7 @@ private void handleBlockStateMeta(BlockStateMeta bsm) {

@SuppressWarnings("StatementWithEmptyBody")
private void handlePotionMeta(ItemMeta meta) {
if (supports(9)) {
if (supports(1, 9)) {
PotionMeta potion = (PotionMeta) meta;

for (String effects : config.getStringList("effects")) {
Expand Down Expand Up @@ -1694,7 +1694,7 @@ private void handleSkullMeta(SkullMeta meta) {

@SuppressWarnings("deprecation")
private void handleDurability() {
if (supports(13)) {
if (supports(1, 13)) {
if (meta instanceof Damageable) {
int damage = config.getInt("damage");
if (damage > 0) ((Damageable) meta).setDamage(damage);
Expand Down
Loading