Refactor snow bucket creation to return a list of snow buckets.
Updated `getPowderedSnow` to generate a list of 16 individual snow bucket items instead of modifying the amount of a single item. Adjusted `getTools` to handle the list returned by this method, ensuring proper item handling and consistency.
This commit is contained in:
parent
fe39cdf5a1
commit
a10607092b
|
|
@ -12,7 +12,9 @@ import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TrapperCreator {
|
public class TrapperCreator {
|
||||||
|
|
@ -32,17 +34,22 @@ public class TrapperCreator {
|
||||||
|
|
||||||
@Contract("_ -> new")
|
@Contract("_ -> new")
|
||||||
private static @NotNull @Unmodifiable List<ItemStack> getTools(TeamColor teamColor) {
|
private static @NotNull @Unmodifiable List<ItemStack> getTools(TeamColor teamColor) {
|
||||||
return (List.of(getShovel(teamColor), getPowderedSnow(teamColor)));
|
List<ItemStack> itemStacks = new ArrayList<>(List.of(getShovel(teamColor)));
|
||||||
|
itemStacks.addAll(getPowderedSnow(teamColor));
|
||||||
|
return itemStacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static @NotNull ItemStack getPowderedSnow(@NotNull TeamColor teamColor) {
|
private static @NotNull List<ItemStack> getPowderedSnow(@NotNull TeamColor teamColor) {
|
||||||
ItemStack powderedSnow = new ItemStack(Material.POWDER_SNOW_BUCKET);
|
ItemStack powderedSnow = new ItemStack(Material.POWDER_SNOW_BUCKET);
|
||||||
powderedSnow.setAmount(16);
|
|
||||||
ItemMeta itemMeta = powderedSnow.getItemMeta();
|
ItemMeta itemMeta = powderedSnow.getItemMeta();
|
||||||
itemMeta.itemName(MiniMessage.miniMessage().deserialize(
|
itemMeta.itemName(MiniMessage.miniMessage().deserialize(
|
||||||
String.format("<color:%s>Snow Trap</color>", teamColor.hex())));
|
String.format("<color:%s>Snow Trap</color>", teamColor.hex())));
|
||||||
powderedSnow.setItemMeta(itemMeta);
|
powderedSnow.setItemMeta(itemMeta);
|
||||||
return powderedSnow;
|
List<ItemStack> snowBuckets = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
snowBuckets.add(powderedSnow.clone());
|
||||||
|
}
|
||||||
|
return snowBuckets;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static @NotNull ItemStack getShovel(@NotNull TeamColor teamColor) {
|
private static @NotNull ItemStack getShovel(@NotNull TeamColor teamColor) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user