mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixed ItemTypeListFlag issue
This commit is contained in:
parent
d7aa4a0e1f
commit
612e96201c
@ -1,14 +1,9 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
package com.github.intellectualsites.plotsquared.plot.flag;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
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.StringMan;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil;
|
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.ItemType;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -22,18 +17,15 @@ public class ItemTypeListFlag extends ListFlag<Set<ItemType>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public String valueToString(Object value) {
|
@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) {
|
@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() {
|
@Override public String getValueDescription() {
|
||||||
return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated();
|
return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Plot plot, BlockState value) {
|
|
||||||
return contains(plot, value.getBlockType().getItemType());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user