Fixed ItemTypeListFlag issue

This commit is contained in:
MattBDev 2019-11-18 13:43:16 -05:00
parent d7aa4a0e1f
commit 612e96201c

View File

@ -1,14 +1,9 @@
package com.github.intellectualsites.plotsquared.plot.flag;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil;
import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import java.util.Arrays;
import java.util.Objects;
@ -22,18 +17,15 @@ public class ItemTypeListFlag extends ListFlag<Set<ItemType>> {
}
@Override public String valueToString(Object value) {
return StringMan.join((Set<BlockType>) value, ",");
return StringMan.join((Set<ItemType>) value, ",");
}
@Override public Set<ItemType> parseValue(final String value) {
return Arrays.stream(ItemUtil.parse(value)).filter(Objects::nonNull).collect(Collectors.toSet());
return Arrays.stream(ItemUtil.parse(value)).filter(Objects::nonNull)
.collect(Collectors.toSet());
}
@Override public String getValueDescription() {
return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated();
}
public boolean contains(Plot plot, BlockState value) {
return contains(plot, value.getBlockType().getItemType());
}
}