From 2f725becf236b566daf76fb488f46f0e80362cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9meth=20Noel?= Date: Sun, 28 Feb 2021 22:39:38 +0100 Subject: [PATCH] canPlaceOn and canDestroy getters no longer return an unmodifiable list, methods for additions and removals are therefore removed --- .../net/minestom/server/item/ItemStack.java | 42 ++----------------- .../net/minestom/server/utils/NBTUtils.java | 4 +- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/src/main/java/net/minestom/server/item/ItemStack.java b/src/main/java/net/minestom/server/item/ItemStack.java index 67d7f6667..ef1ee8d99 100644 --- a/src/main/java/net/minestom/server/item/ItemStack.java +++ b/src/main/java/net/minestom/server/item/ItemStack.java @@ -213,30 +213,12 @@ public class ItemStack implements DataContainer, PublicCloneable { return canPlaceOn.contains(block); } - /** - * Adds the block to the list of blocks that - * this item can be placed on. - * @param block the block's namespaceID - */ - public void addCanPlaceOn(String block) { - canPlaceOn.add(block); - } - - /** - * Removes the block from the set of blocks that - * this item can be placed on. - * @param block the block's namespaceID - */ - public void removeCanPlaceOn(String block) { - canPlaceOn.remove(block); - } - /** * Gets the blocks that this item can be placed on - * @return an unmodifiable {@link Set} of blocks + * @return the {@link Set} of blocks */ public Set getCanPlaceOn() { - return Collections.unmodifiableSet(canPlaceOn); + return canPlaceOn; } /** @@ -249,28 +231,12 @@ public class ItemStack implements DataContainer, PublicCloneable { return canDestroy.contains(block); } - /** - * Adds the block to the set of blocks that can be destroyed by this item. - * @param block the block's namespaceID - */ - public void addCanDestroy(String block) { - canDestroy.add(block); - } - - /** - * Removes the block from the set of blocks that can be destroyed by this item. - * @param block the block's namespaceID - */ - public void removeCanDestroy(String block) { - canDestroy.remove(block); - } - /** * Gets the blocks that this item can destroy - * @return an unmodifiable {@link Set} of blocks + * @return the {@link Set} of blocks */ public Set getCanDestroy() { - return Collections.unmodifiableSet(canDestroy); + return canDestroy; } /** diff --git a/src/main/java/net/minestom/server/utils/NBTUtils.java b/src/main/java/net/minestom/server/utils/NBTUtils.java index 7af0c8231..e63446a67 100644 --- a/src/main/java/net/minestom/server/utils/NBTUtils.java +++ b/src/main/java/net/minestom/server/utils/NBTUtils.java @@ -225,14 +225,14 @@ public final class NBTUtils { { if (nbt.containsKey("CanPlaceOn")) { NBTList canPlaceOn = nbt.getList("CanPlaceOn"); - canPlaceOn.forEach(x -> item.addCanPlaceOn(x.getValue())); + canPlaceOn.forEach(x -> item.getCanPlaceOn().add(x.getValue())); } } //CanDestroy { if (nbt.containsKey("CanDestroy")) { NBTList canPlaceOn = nbt.getList("CanDestroy"); - canPlaceOn.forEach(x -> item.addCanDestroy(x.getValue())); + canPlaceOn.forEach(x -> item.getCanDestroy().add(x.getValue())); } } }