From fa439ed6d6ba4792e55e2722b1bb7658fbdf6c35 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 11 Aug 2024 17:03:24 -0700 Subject: [PATCH] Prevent non-items being put into chests. Update to 1.21.1 --- .../skygrid/generators/SkyGridPop.java | 24 ++++++++++++++----- src/main/resources/config.yml | 4 +++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/world/bentobox/skygrid/generators/SkyGridPop.java b/src/main/java/world/bentobox/skygrid/generators/SkyGridPop.java index 7f938f8..8a6cba7 100644 --- a/src/main/java/world/bentobox/skygrid/generators/SkyGridPop.java +++ b/src/main/java/world/bentobox/skygrid/generators/SkyGridPop.java @@ -59,16 +59,28 @@ public SkyGridPop(SkyGrid addon) { this.islandHeight = addon.getSettings().getIslandHeight(); // Load the chest items for (Entry en : addon.getSettings().getChestItemsOverworld().entrySet()) { - worldTotal += en.getValue(); - chestItemsWorld.put(worldTotal, en.getKey()); + if (en.getKey().isItem()) { + worldTotal += en.getValue(); + chestItemsWorld.put(worldTotal, en.getKey()); + } else { + addon.logWarning(en.getKey() + " is not an item so cannot go in a chest."); + } } for (Entry en : addon.getSettings().getChestItemsNether().entrySet()) { - netherTotal += en.getValue(); - chestItemsNether.put(netherTotal, en.getKey()); + if (en.getKey().isItem()) { + netherTotal += en.getValue(); + chestItemsNether.put(netherTotal, en.getKey()); + } else { + addon.logWarning(en.getKey() + " is not an item so cannot go in a chest."); + } } for (Entry en : addon.getSettings().getChestItemsEnd().entrySet()) { - endTotal += en.getValue(); - chestItemsEnd.put(endTotal, en.getKey()); + if (en.getKey().isItem()) { + endTotal += en.getValue(); + chestItemsEnd.put(endTotal, en.getKey()); + } else { + addon.logWarning(en.getKey() + " is not an item so cannot go in a chest."); + } } addon.log(LOADED + chestItemsWorld.size() + " chest items for world"); addon.log(LOADED + chestItemsNether.size() + " chest items for nether world"); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3fb0783..0a5096c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -294,7 +294,9 @@ world: SALMON_BUCKET: 10 SALMON_SPAWN_EGG: 10 SALMON: 10 - SCUTE: 100 + TURTLE_SCUTE: 100 + ARMADILLO_SCUTE: 100 + WOLF_ARMOR: 100 SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE: 10 SHEARS: 10 SHEEP_SPAWN_EGG: 10