From 8b1f31d41cf31554681d4ea385ee4c8070bf03b0 Mon Sep 17 00:00:00 2001 From: tastybento Date: Thu, 9 Feb 2023 23:42:06 -0800 Subject: [PATCH] Even less complexity! --- .../com/wasteofplastic/invswitcher/Store.java | 37 +++---------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/wasteofplastic/invswitcher/Store.java b/src/main/java/com/wasteofplastic/invswitcher/Store.java index 9088db3..6066277 100644 --- a/src/main/java/com/wasteofplastic/invswitcher/Store.java +++ b/src/main/java/com/wasteofplastic/invswitcher/Store.java @@ -367,38 +367,11 @@ private void resetAdv(Player player) { @SuppressWarnings("deprecation") private void resetStats(Player player, Statistic s) { - switch (s.getType()) - { - case BLOCK: - for (Material m : Material.values()) - { - if (m.isBlock() && !m.isLegacy()) - { - player.setStatistic(s, m, 0); - } - } - break; - case ITEM: - for (Material m : Material.values()) - { - if (m.isItem() && !m.isLegacy()) - { - player.setStatistic(s, m, 0); - } - } - break; - case ENTITY: - for (EntityType en : EntityType.values()) - { - if (en.isAlive()) - { - player.setStatistic(s, en, 0); - } - } - break; - case UNTYPED: - player.setStatistic(s, 0); - break; + switch (s.getType()) { + case BLOCK -> Arrays.stream(Material.values()).filter(Material::isBlock).filter(m -> !m.isLegacy()).forEach(m -> player.setStatistic(s, m, 0)); + case ITEM -> Arrays.stream(Material.values()).filter(Material::isItem).filter(m -> !m.isLegacy()).forEach(m -> player.setStatistic(s, m, 0)); + case ENTITY -> Arrays.stream(EntityType.values()).filter(EntityType::isAlive).forEach(en -> player.setStatistic(s, en, 0)); + case UNTYPED -> player.setStatistic(s, 0); } }