From 92696226e48e906ed09ad1fa4cf341feb1252c00 Mon Sep 17 00:00:00 2001 From: Moritz Kempe Date: Sat, 17 Oct 2020 11:58:56 +0200 Subject: [PATCH 001/144] fixes PR Explosive tools not working with silk touch Explosive Tools no longer ignore their SILK_TOUCH enchantment. Fixes PR #2460 --- .../items/tools/ExplosiveTool.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java index d452896f3..e96c4c0bb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java @@ -8,6 +8,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.inventory.ItemStack; @@ -135,12 +136,17 @@ class ExplosiveTool extends SimpleSlimefunItem implements NotPla } else if (b.getType() == Material.PLAYER_HEAD || b.getType() == Material.SHULKER_BOX || b.getType().name().endsWith("_SHULKER_BOX")) { b.breakNaturally(item); } else { - boolean applyFortune = b.getType().name().endsWith("_ORE") && b.getType() != Material.IRON_ORE && b.getType() != Material.GOLD_ORE; - - for (ItemStack drop : b.getDrops(getItem())) { - // For some reason this check is necessary with Paper - if (drop != null && drop.getType() != Material.AIR) { - b.getWorld().dropItemNaturally(b.getLocation(), applyFortune ? new CustomItem(drop, fortune) : drop); + // if mined whit silk_touch tool + if (item.getEnchantments().containsKey(Enchantment.SILK_TOUCH)) { + b.getWorld().dropItemNaturally(b.getLocation(), new ItemStack(b.getType())); + } else { + // else mined without silk_touch tool + boolean applyFortune = b.getType().name().endsWith("_ORE") && b.getType() != Material.IRON_ORE && b.getType() != Material.GOLD_ORE; + for (ItemStack drop : b.getDrops(getItem())) { + // For some reason this check is necessary with Paper + if (drop != null && drop.getType() != Material.AIR) { + b.getWorld().dropItemNaturally(b.getLocation(), applyFortune ? new CustomItem(drop, fortune) : drop); + } } } From 434d469a0d86de6e80be8f37727bb89960e8dd3b Mon Sep 17 00:00:00 2001 From: svr333 Date: Sun, 6 Dec 2020 02:01:39 +0100 Subject: [PATCH 002/144] Add t3 Electric Ore Grinder --- .../slimefun4/implementation/SlimefunItems.java | 1 + .../slimefun4/implementation/setup/ResearchSetup.java | 2 +- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 4bb3e82f5..4d5a8b2f8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -661,6 +661,7 @@ public final class SlimefunItems { public static final SlimefunItemStack ELECTRIC_ORE_GRINDER = new SlimefunItemStack("ELECTRIC_ORE_GRINDER", Material.FURNACE, "&cElectric Ore Grinder", "", "&fWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12)); public static final SlimefunItemStack ELECTRIC_ORE_GRINDER_2 = new SlimefunItemStack("ELECTRIC_ORE_GRINDER_2", Material.FURNACE, "&cElectric Ore Grinder &7(&eII&7)", "", "&fWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.speed(4), LoreBuilder.powerPerSecond(30)); + public static final SlimefunItemStack ELECTRIC_ORE_GRINDER_3 = new SlimefunItemStack("ELECTRIC_ORE_GRINDER_3", Material.FURNACE, "&cElectric Ore Grinder &7(&eIII&7)", "", "&fWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.speed(10), LoreBuilder.powerPerSecond(90)); public static final SlimefunItemStack ELECTRIC_INGOT_PULVERIZER = new SlimefunItemStack("ELECTRIC_INGOT_PULVERIZER", Material.FURNACE, "&cElectric Ingot Pulverizer", "", "&fPulverizes Ingots into Dust", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(14)); public static final SlimefunItemStack AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&6Auto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10)); public static final SlimefunItemStack AUTO_ENCHANTER = new SlimefunItemStack("AUTO_ENCHANTER", Material.ENCHANTING_TABLE, "&5Auto Enchanter", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(18)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java index 9e1aefef2..15bb40e8c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java @@ -217,7 +217,7 @@ public final class ResearchSetup { register("cargo_basics", 205, "Cargo Basics", 30, SlimefunItems.CARGO_MOTOR, SlimefunItems.CARGO_MANAGER, SlimefunItems.CARGO_CONNECTOR_NODE); register("cargo_nodes", 206, "Cargo Setup", 30, SlimefunItems.CARGO_INPUT_NODE, SlimefunItems.CARGO_OUTPUT_NODE); register("electric_ingot_machines", 207, "Electric Ingot Fabrication", 18, SlimefunItems.ELECTRIC_GOLD_PAN, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.ELECTRIC_INGOT_FACTORY); - register("high_tier_electric_ingot_machines", 209, "Super Fast Ingot Fabrication", 32, SlimefunItems.ELECTRIC_GOLD_PAN_3, SlimefunItems.ELECTRIC_DUST_WASHER_3, SlimefunItems.ELECTRIC_INGOT_FACTORY_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2); + register("high_tier_electric_ingot_machines", 209, "Super Fast Ingot Fabrication", 32, SlimefunItems.ELECTRIC_GOLD_PAN_3, SlimefunItems.ELECTRIC_DUST_WASHER_3, SlimefunItems.ELECTRIC_INGOT_FACTORY_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.ELECTRIC_ORE_GRINDER_3); register("automated_crafting_chamber", 210, "Automated Crafting", 20, SlimefunItems.AUTOMATED_CRAFTING_CHAMBER); register("better_food_fabricator", 211, "Upgraded Food Fabrication", 28, SlimefunItems.FOOD_FABRICATOR_2, SlimefunItems.FOOD_COMPOSTER_2); register("reactor_access_port", 212, "Reactor Interaction", 18, SlimefunItems.REACTOR_ACCESS_PORT); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 46be8024a..2477804f5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1658,6 +1658,13 @@ public final class SlimefunItemSetup { .setProcessingSpeed(4) .register(plugin); + new ElectricOreGrinder(categories.electricity, SlimefunItems.ELECTRIC_ORE_GRINDER_3, RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.HEATING_COIL, SlimefunItems.BLISTERING_INGOT_3}) + .setCapacity(1024) + .setEnergyConsumption(90) + .setProcessingSpeed(10) + .register(plugin); + new HeatedPressureChamber(categories.electricity, SlimefunItems.HEATED_PRESSURE_CHAMBER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, new ItemStack(Material.GLASS), SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.LEAD_INGOT}) .setCapacity(128) From d571fc5c18b3edc055c09f61ba43bf7485ff346c Mon Sep 17 00:00:00 2001 From: svr333 Date: Sun, 6 Dec 2020 13:19:02 +0100 Subject: [PATCH 003/144] Change speed to 45 instead of 90 --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 2477804f5..5dfa13c96 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1661,7 +1661,7 @@ public final class SlimefunItemSetup { new ElectricOreGrinder(categories.electricity, SlimefunItems.ELECTRIC_ORE_GRINDER_3, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.HEATING_COIL, SlimefunItems.BLISTERING_INGOT_3}) .setCapacity(1024) - .setEnergyConsumption(90) + .setEnergyConsumption(45) .setProcessingSpeed(10) .register(plugin); From ce3db297859298d5e4585394048f2d32aac8674b Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Sun, 13 Dec 2020 17:25:25 +0000 Subject: [PATCH 004/144] Added PR labels workflow file --- .github/workflows/pr-labels.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/pr-labels.yml diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml new file mode 100644 index 000000000..630bedcd5 --- /dev/null +++ b/.github/workflows/pr-labels.yml @@ -0,0 +1,18 @@ +name: PR Labeler +on: + pull_request: + types: [opened] + +jobs: + pr-labeler: + runs-on: ubuntu-latest + steps: + - uses: WalshyDev/pr-labels@v1 + with: + feature: 'New Feature' + fix: '🐞 Bug Fix' + chore: 'Chore' + perf: '🛠️ Performance Improvement' + performance: '🛠️ Performance Improvement' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 8baf55f454d5ac639c5ceb55dc6ec88835baf52c Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Sun, 13 Dec 2020 17:32:55 +0000 Subject: [PATCH 005/144] Fix --- .github/workflows/pr-labels.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 630bedcd5..b7d3f9c58 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -9,10 +9,9 @@ jobs: steps: - uses: WalshyDev/pr-labels@v1 with: + token: "${{ secrets.GITHUB_TOKEN }}" feature: 'New Feature' fix: '🐞 Bug Fix' chore: 'Chore' perf: '🛠️ Performance Improvement' performance: '🛠️ Performance Improvement' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 5aa34c7a6e012bf8fd1d2e76fe1eb7299b2dfd76 Mon Sep 17 00:00:00 2001 From: svr333 Date: Thu, 17 Dec 2020 21:05:12 +0100 Subject: [PATCH 006/144] Update recipe --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 5dfa13c96..1202a6827 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1659,7 +1659,7 @@ public final class SlimefunItemSetup { .register(plugin); new ElectricOreGrinder(categories.electricity, SlimefunItems.ELECTRIC_ORE_GRINDER_3, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.HEATING_COIL, SlimefunItems.BLISTERING_INGOT_3}) + new ItemStack[] {SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE}) .setCapacity(1024) .setEnergyConsumption(45) .setProcessingSpeed(10) From 65fc3cea4e2fe63746331e0bc6212f6ce8329c49 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 21 Dec 2020 12:27:16 +0100 Subject: [PATCH 007/144] Finalized the fix for #2636 --- CHANGELOG.md | 2 +- .../slimefun4/api/network/Network.java | 1 + .../items/electric/gadgets/MultiTool.java | 3 +-- .../implementation/listeners/BlockListener.java | 8 ++++---- .../implementation/tasks/TickerTask.java | 16 ++++++++++++++++ .../slimefun4/utils/tags/SlimefunTag.java | 2 +- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2d0d4418..c63bf3e53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ * Fixed a couple of compatibility issues with ItemsAdder * Fixed #2575 * Fixed ghost blocks to some extent (ghost blocks will now drop and be replaced) -* Fixed #2636 (hotfix) +* Fixed #2636 ## Release Candidate 18 (03 Dec 2020) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java index 9f026b2e5..21ef9b0a6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java @@ -72,6 +72,7 @@ public abstract class Network { * * @param l * The {@link Location} to classify + * * @return The assigned type of {@link NetworkComponent} for this {@link Location} */ @Nullable diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java index cba3f71cf..eae1b162b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java @@ -52,8 +52,7 @@ public class MultiTool extends SlimefunItem implements Rechargeable { if (index >= modes.size()) { index = 0; } - } - while (index != i && !modes.get(index).isEnabled()); + } while (index != i && !modes.get(index).isEnabled()); return index; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 4b401f1bc..ff3520a78 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -66,14 +66,14 @@ public class BlockListener implements Listener { if (e.getBlockReplacedState().getType().isAir()) { SlimefunItem sfItem = BlockStorage.check(block); - if (sfItem != null) { - /* Temp fix for #2636 + // Fixes #2636 + if (sfItem != null && !SlimefunPlugin.getTickerTask().isDeletedSoon(block.getLocation())) { for (ItemStack item : sfItem.getDrops()) { if (item != null && !item.getType().isAir()) { block.getWorld().dropItemNaturally(block.getLocation(), item); } } - */ + BlockStorage.clearBlockInfo(block); } } else if (BlockStorage.hasBlockInfo(e.getBlock())) { @@ -118,7 +118,7 @@ public class BlockListener implements Listener { int fortune = getBonusDropsWithFortune(item, e.getBlock()); List drops = new ArrayList<>(); - if (item.getType() != Material.AIR) { + if (!item.getType().isAir()) { callToolHandler(e, item, fortune, drops); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TickerTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TickerTask.java index 11fe81551..75b9ea9a9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TickerTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TickerTask.java @@ -254,9 +254,25 @@ public class TickerTask implements Runnable { * @return Whether this {@link Location} has been reserved and will be filled upon the next tick */ public boolean isReserved(@Nonnull Location l) { + Validate.notNull(l, "Null is not a valid Location!"); + return movingQueue.containsValue(l); } + /** + * This method checks if a given {@link Location} will be deleted on the next tick. + * + * @param l + * The {@link Location} to check + * + * @return Whether this {@link Location} will be deleted on the next tick + */ + public boolean isDeletedSoon(@Nonnull Location l) { + Validate.notNull(l, "Null is not a valid Location!"); + + return deletionQueue.containsKey(l); + } + /** * This returns the delay between ticks * diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java index 1a7869875..855485681 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java @@ -62,7 +62,7 @@ public enum SlimefunTag implements Tag { * All command block variants */ COMMAND_BLOCKS, - + /** * All variants of Spawn Eggs */ From b00afa4790223043c45908d587ea90d74b493e7b Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 22 Dec 2020 15:47:58 +0100 Subject: [PATCH 008/144] Refactoring --- CHANGELOG.md | 1 + .../slimefun4/api/player/PlayerProfile.java | 1 - .../core/categories/LockedCategory.java | 11 +-- .../core/multiblocks/MultiBlockMachine.java | 4 +- .../localization/SlimefunLocalization.java | 48 +++++----- .../guide/BookSlimefunGuide.java | 2 +- .../guide/ChestSlimefunGuide.java | 2 +- .../items/magical/runes/EnchantmentRune.java | 3 +- .../items/magical/runes/SoulboundRune.java | 7 +- .../items/magical/talismans/Talisman.java | 5 +- .../items/multiblocks/AbstractSmeltery.java | 3 +- .../items/multiblocks/ArmorForge.java | 3 +- .../multiblocks/EnhancedCraftingTable.java | 3 +- .../items/multiblocks/MagicWorkbench.java | 3 +- .../items/multiblocks/OreCrusher.java | 3 +- .../listeners/AncientAltarListener.java | 11 ++- .../listeners/BackpackListener.java | 28 +++++- .../listeners/BeeWingsListener.java | 3 +- .../listeners/BlockListener.java | 4 +- .../listeners/CoolerListener.java | 3 +- .../listeners/ElytraImpactListener.java | 3 +- .../listeners/GadgetsListener.java | 9 +- .../listeners/SlimefunBootsListener.java | 7 +- .../SlimefunItemConsumeListener.java | 3 +- .../SlimefunItemInteractListener.java | 13 ++- .../listeners/VampireBladeListener.java | 3 +- .../entity/EntityInteractionListener.java | 3 +- .../listeners/entity/MobDropListener.java | 17 ++-- .../implementation/tasks/ArmorTask.java | 4 +- .../slimefun4/utils/SlimefunUtils.java | 28 ++++++ .../Objects/SlimefunItem/SlimefunItem.java | 94 ++++++++++++++++++- .../mrCookieSlime/Slimefun/api/Slimefun.java | 53 +++-------- 32 files changed, 244 insertions(+), 141 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c63bf3e53..583e7c82d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ * Fixed #2575 * Fixed ghost blocks to some extent (ghost blocks will now drop and be replaced) * Fixed #2636 +* Fixed some backpack opening issues ## Release Candidate 18 (03 Dec 2020) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java index e6d745773..32671d0c8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java @@ -459,7 +459,6 @@ public final class PlayerProfile { int number = id.getAsInt(); fromUUID(UUID.fromString(uuid), profile -> { Optional backpack = profile.getBackpack(number); - backpack.ifPresent(callback); }); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java index 69b2434cd..f85b8b362 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java @@ -148,17 +148,16 @@ public class LockedCategory extends Category { * The {@link Player} to check * @param profile * The {@link PlayerProfile} that belongs to the given {@link Player} + * * @return Whether the {@link Player} has fully completed all parent categories, otherwise false */ public boolean hasUnlocked(@Nonnull Player p, @Nonnull PlayerProfile profile) { + Validate.notNull(p, "The player cannot be null!"); + Validate.notNull(profile, "The Profile cannot be null!"); + for (Category category : parents) { for (SlimefunItem item : category.getItems()) { - /** - * Should probably be replaced with Slimefun.hasUnlocked(...) - * However this will result in better performance because we don't - * request the PlayerProfile everytime - */ - if (Slimefun.isEnabled(p, item, false) && Slimefun.hasPermission(p, item, false) && !profile.hasUnlocked(item.getResearch())) { + if (item.canUse(p, false)) { return false; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java index a0f7f33e7..3be2cb608 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java @@ -31,7 +31,6 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.BlockStorage; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** @@ -114,10 +113,11 @@ public abstract class MultiBlockMachine extends SlimefunItem implements NotPlace } } + @Nonnull protected MultiBlockInteractionHandler getInteractionHandler() { return (p, mb, b) -> { if (mb.equals(getMultiBlock())) { - if (!isDisabled() && SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK) && Slimefun.hasUnlocked(p, this, true)) { + if (canUse(p, true) && SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK)) { onInteract(p, b); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java index 79523c45a..1ff34495f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java @@ -215,76 +215,76 @@ public abstract class SlimefunLocalization extends Localization implements Keyed } @Override - public void sendMessage(CommandSender sender, String key, boolean addPrefix) { + public void sendMessage(CommandSender recipient, String key, boolean addPrefix) { String prefix = addPrefix ? getPrefix() : ""; - if (sender instanceof Player) { - sender.sendMessage(ChatColors.color(prefix + getMessage((Player) sender, key))); + if (recipient instanceof Player) { + recipient.sendMessage(ChatColors.color(prefix + getMessage((Player) recipient, key))); } else { - sender.sendMessage(ChatColor.stripColor(ChatColors.color(prefix + getMessage(key)))); + recipient.sendMessage(ChatColor.stripColor(ChatColors.color(prefix + getMessage(key)))); } } @Override - public void sendMessage(CommandSender sender, String key) { - sendMessage(sender, key, true); + public void sendMessage(CommandSender recipient, String key) { + sendMessage(recipient, key, true); } - public void sendMessage(CommandSender sender, String key, UnaryOperator function) { - sendMessage(sender, key, true, function); + public void sendMessage(CommandSender recipient, String key, UnaryOperator function) { + sendMessage(recipient, key, true, function); } @Override - public void sendMessage(CommandSender sender, String key, boolean addPrefix, UnaryOperator function) { + public void sendMessage(CommandSender recipient, String key, boolean addPrefix, UnaryOperator function) { if (SlimefunPlugin.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) { return; } String prefix = addPrefix ? getPrefix() : ""; - if (sender instanceof Player) { - sender.sendMessage(ChatColors.color(prefix + function.apply(getMessage((Player) sender, key)))); + if (recipient instanceof Player) { + recipient.sendMessage(ChatColors.color(prefix + function.apply(getMessage((Player) recipient, key)))); } else { - sender.sendMessage(ChatColor.stripColor(ChatColors.color(prefix + function.apply(getMessage(key))))); + recipient.sendMessage(ChatColor.stripColor(ChatColors.color(prefix + function.apply(getMessage(key))))); } } @Override - public void sendMessages(CommandSender sender, String key) { + public void sendMessages(CommandSender recipient, String key) { String prefix = getPrefix(); - if (sender instanceof Player) { - for (String translation : getMessages((Player) sender, key)) { + if (recipient instanceof Player) { + for (String translation : getMessages((Player) recipient, key)) { String message = ChatColors.color(prefix + translation); - sender.sendMessage(message); + recipient.sendMessage(message); } } else { for (String translation : getMessages(key)) { String message = ChatColors.color(prefix + translation); - sender.sendMessage(ChatColor.stripColor(message)); + recipient.sendMessage(ChatColor.stripColor(message)); } } } @Override - public void sendMessages(CommandSender sender, String key, boolean addPrefix, UnaryOperator function) { + public void sendMessages(CommandSender recipient, String key, boolean addPrefix, UnaryOperator function) { String prefix = addPrefix ? getPrefix() : ""; - if (sender instanceof Player) { - for (String translation : getMessages((Player) sender, key)) { + if (recipient instanceof Player) { + for (String translation : getMessages((Player) recipient, key)) { String message = ChatColors.color(prefix + function.apply(translation)); - sender.sendMessage(message); + recipient.sendMessage(message); } } else { for (String translation : getMessages(key)) { String message = ChatColors.color(prefix + function.apply(translation)); - sender.sendMessage(ChatColor.stripColor(message)); + recipient.sendMessage(ChatColor.stripColor(message)); } } } - public void sendMessages(CommandSender sender, String key, UnaryOperator function) { - sendMessages(sender, key, true, function); + public void sendMessages(CommandSender recipient, String key, UnaryOperator function) { + sendMessages(recipient, key, true, function); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java index a5c7c1d29..14c1345b4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java @@ -210,7 +210,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation { private void addSlimefunItem(Category category, int page, Player p, PlayerProfile profile, SlimefunItem item, List items) { NamespacedKey key = new NamespacedKey(SlimefunPlugin.instance(), item.getId().toLowerCase(Locale.ROOT)); - if (!Slimefun.hasUnlocked(p, item, false) && item.getResearch() != null) { + if (!item.canUse(p, false) && item.hasResearch()) { Research research = item.getResearch(); ChatComponent component = new ChatComponent(ChatUtils.crop(ChatColor.RED, item.getItemName()) + "\n"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java index e140f2b7c..23b673c39 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java @@ -604,7 +604,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation { } String lore = Slimefun.hasPermission(p, slimefunItem, false) ? "&fNeeds to be unlocked elsewhere" : "&fNo Permission"; - return Slimefun.hasUnlocked(p, slimefunItem, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", lore); + return slimefunItem.canUse(p, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", lore); } else { return item; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java index 4ca91cec6..8a08067d4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java @@ -25,7 +25,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunIte import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** @@ -66,7 +65,7 @@ public class EnchantmentRune extends SimpleSlimefunItem { public ItemDropHandler getItemHandler() { return (e, p, item) -> { if (isItem(item.getItemStack())) { - if (Slimefun.hasUnlocked(p, this, true)) { + if (canUse(p, true)) { SlimefunPlugin.runSync(() -> { try { addRandomEnchantment(p, item); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/SoulboundRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/SoulboundRune.java index dfde7821e..997a08acc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/SoulboundRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/SoulboundRune.java @@ -3,6 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical.runes; import java.util.Collection; import java.util.Optional; +import javax.annotation.Nonnull; + import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Entity; @@ -19,7 +21,6 @@ import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** @@ -47,7 +48,7 @@ public class SoulboundRune extends SimpleSlimefunItem { return (e, p, item) -> { if (isItem(item.getItemStack())) { - if (!Slimefun.hasUnlocked(p, this, true)) { + if (!canUse(p, true)) { return true; } @@ -59,7 +60,7 @@ public class SoulboundRune extends SimpleSlimefunItem { }; } - private void activate(Player p, Item rune) { + private void activate(@Nonnull Player p, @Nonnull Item rune) { // Being sure the entity is still valid and not picked up or whatsoever. if (!rune.isValid()) { return; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java index 335f4d4e2..7f10fb813 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java @@ -33,7 +33,6 @@ import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; public class Talisman extends SlimefunItem { @@ -175,7 +174,7 @@ public class Talisman extends SlimefunItem { ItemStack talismanItem = talisman.getItem(); if (SlimefunUtils.containsSimilarItem(p.getInventory(), talismanItem, true)) { - if (Slimefun.hasUnlocked(p, talisman, true)) { + if (talisman.canUse(p, true)) { activateTalisman(e, p, p.getInventory(), talisman, talismanItem); return true; } else { @@ -185,7 +184,7 @@ public class Talisman extends SlimefunItem { ItemStack enderTalisman = talisman.getEnderVariant(); if (SlimefunUtils.containsSimilarItem(p.getEnderChest(), enderTalisman, true)) { - if (Slimefun.hasUnlocked(p, talisman, true)) { + if (talisman.canUse(p, true)) { activateTalisman(e, p, p.getEnderChest(), talisman, enderTalisman); return true; } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AbstractSmeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AbstractSmeltery.java index 632e95f0a..2dd1632a2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AbstractSmeltery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AbstractSmeltery.java @@ -19,7 +19,6 @@ import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import io.papermc.lib.PaperLib; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** @@ -48,7 +47,7 @@ abstract class AbstractSmeltery extends MultiBlockMachine { if (canCraft(inv, inputs, i)) { ItemStack output = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone(); - if (Slimefun.hasUnlocked(p, output, true)) { + if (SlimefunUtils.canPlayerUseItem(p, output, true)) { Inventory outputInv = findOutputInventory(output, dispBlock, inv); if (outputInv != null) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java index ff68a91e1..7d66099fc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java @@ -21,7 +21,6 @@ import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import io.papermc.lib.PaperLib; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; public class ArmorForge extends AbstractCraftingTable { @@ -44,7 +43,7 @@ public class ArmorForge extends AbstractCraftingTable { if (isCraftable(inv, inputs.get(i))) { ItemStack output = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone(); - if (Slimefun.hasUnlocked(p, output, true)) { + if (SlimefunUtils.canPlayerUseItem(p, output, true)) { craft(p, output, inv, dispenser); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java index a55a804c2..5aeab8fb5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java @@ -20,7 +20,6 @@ import io.papermc.lib.PaperLib; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; public class EnhancedCraftingTable extends AbstractCraftingTable { @@ -43,7 +42,7 @@ public class EnhancedCraftingTable extends AbstractCraftingTable { if (isCraftable(inv, inputs.get(i))) { ItemStack output = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone(); - if (Slimefun.hasUnlocked(p, output, true)) { + if (SlimefunUtils.canPlayerUseItem(p, output, true)) { craft(inv, dispenser, p, b, output); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java index fd0056e6a..d98935eb1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java @@ -21,7 +21,6 @@ import io.papermc.lib.PaperLib; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; public class MagicWorkbench extends AbstractCraftingTable { @@ -50,7 +49,7 @@ public class MagicWorkbench extends AbstractCraftingTable { if (isCraftable(inv, inputs.get(i))) { ItemStack output = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone(); - if (Slimefun.hasUnlocked(p, output, true)) { + if (SlimefunUtils.canPlayerUseItem(p, output, true)) { craft(inv, dispenser, p, b, output); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java index bb857f3d5..87df574ae 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java @@ -25,7 +25,6 @@ import io.papermc.lib.PaperLib; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** @@ -135,7 +134,7 @@ public class OreCrusher extends MultiBlockMachine { ItemStack adding = RecipeType.getRecipeOutput(this, convert); Inventory outputInv = findOutputInventory(adding, dispBlock, inv); - if (Slimefun.hasUnlocked(p, adding, true)) { + if (SlimefunUtils.canPlayerUseItem(p, adding, true)) { if (outputInv != null) { ItemStack removing = current.clone(); removing.setAmount(convert.getAmount()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 646ed0476..388ba6365 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -41,7 +41,6 @@ import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.BlockStorage; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for providing the core mechanics of the {@link AncientAltar} @@ -105,12 +104,13 @@ public class AncientAltarListener implements Listener { } String id = slimefunBlock.get().getId(); + Player p = e.getPlayer(); if (id.equals(pedestalItem.getId())) { e.cancel(); - usePedestal(b, e.getPlayer()); + usePedestal(b, p); } else if (id.equals(altarItem.getId())) { - if (!Slimefun.hasUnlocked(e.getPlayer(), altarItem, true) || altarsInUse.contains(b.getLocation())) { + if (!altarItem.canUse(p, true) || altarsInUse.contains(b.getLocation())) { e.cancel(); return; } @@ -119,7 +119,7 @@ public class AncientAltarListener implements Listener { altarsInUse.add(b.getLocation()); e.cancel(); - useAltar(b, e.getPlayer()); + useAltar(b, p); } } @@ -212,8 +212,9 @@ public class AncientAltarListener implements Listener { } Optional result = getRecipeOutput(catalyst, input); + if (result.isPresent()) { - if (Slimefun.hasUnlocked(p, result.get(), true)) { + if (SlimefunUtils.canPlayerUseItem(p, result.get(), true)) { List consumed = new ArrayList<>(); consumed.add(catalyst); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java index ddbcaa8fc..b291c2b80 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java @@ -7,6 +7,7 @@ import java.util.UUID; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; @@ -30,7 +31,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler; import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.SlimefunBackpack; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for all events centered around a {@link SlimefunBackpack}. @@ -57,12 +57,21 @@ public class BackpackListener implements Listener { @EventHandler public void onClose(InventoryCloseEvent e) { - Player p = ((Player) e.getPlayer()); + Player p = (Player) e.getPlayer(); + + if (markBackpackDirty(p)) { + p.playSound(p.getLocation(), Sound.ENTITY_HORSE_ARMOR, 1F, 1F); + } + } + + private boolean markBackpackDirty(@Nonnull Player p) { ItemStack backpack = backpacks.remove(p.getUniqueId()); if (backpack != null) { - p.playSound(p.getLocation(), Sound.ENTITY_HORSE_ARMOR, 1F, 1F); PlayerProfile.getBackpack(backpack, PlayerBackpack::markDirty); + return true; + } else { + return false; } } @@ -111,7 +120,7 @@ public class BackpackListener implements Listener { public void openBackpack(Player p, ItemStack item, SlimefunBackpack backpack) { if (item.getAmount() == 1) { - if (Slimefun.hasUnlocked(p, backpack, true) && !PlayerProfile.get(p, profile -> openBackpack(p, item, profile, backpack.getSize()))) { + if (backpack.canUse(p, true) && !PlayerProfile.get(p, profile -> openBackpack(p, item, profile, backpack.getSize()))) { SlimefunPlugin.getLocalization().sendMessage(p, "messages.opening-backpack"); } } else { @@ -119,8 +128,10 @@ public class BackpackListener implements Listener { } } + @ParametersAreNonnullByDefault private void openBackpack(Player p, ItemStack item, PlayerProfile profile, int size) { List lore = item.getItemMeta().getLore(); + for (int line = 0; line < lore.size(); line++) { if (lore.get(line).equals(ChatColor.GRAY + "ID: ")) { setBackpackId(p, item, line, profile.createBackpack(size).getId()); @@ -128,6 +139,15 @@ public class BackpackListener implements Listener { } } + /* + * If the current Player is already viewing a backpack (for whatever reason), + * terminate that view. + */ + if (markBackpackDirty(p)) { + p.closeInventory(); + } + + // Check if someone else is currently viewing this backpack if (!backpacks.containsValue(item)) { p.playSound(p.getLocation(), Sound.ENTITY_HORSE_ARMOR, 1F, 1F); backpacks.put(p.getUniqueId(), item); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BeeWingsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BeeWingsListener.java index 3ac4ec600..6fc179556 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BeeWingsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BeeWingsListener.java @@ -11,7 +11,6 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.BeeWings; import io.github.thebusybiscuit.slimefun4.implementation.tasks.BeeWingsTask; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for the slow falling effect given to the {@link Player} @@ -44,7 +43,7 @@ public class BeeWingsListener implements Listener { Player player = (Player) e.getEntity(); ItemStack chestplate = player.getInventory().getChestplate(); - if (wings.isItem(chestplate) && Slimefun.hasUnlocked(player, chestplate, true)) { + if (wings.isItem(chestplate) && wings.canUse(player, true)) { new BeeWingsTask(player).scheduleRepeating(3, 1); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index ff3520a78..b0741f11b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -87,7 +87,7 @@ public class BlockListener implements Listener { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null && !(sfItem instanceof NotPlaceable) && Slimefun.isEnabled(e.getPlayer(), sfItem, true)) { - if (!Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) { + if (!sfItem.canUse(e.getPlayer(), true)) { e.setCancelled(true); } else { if (SlimefunPlugin.getBlockDataService().isTileEntity(e.getBlock().getType())) { @@ -134,7 +134,7 @@ public class BlockListener implements Listener { SlimefunItem tool = SlimefunItem.getByItem(item); if (tool != null) { - if (Slimefun.hasUnlocked(e.getPlayer(), tool, true)) { + if (tool.canUse(e.getPlayer(), true)) { tool.callItemHandler(ToolUseHandler.class, handler -> handler.onToolUse(e, item, fortune, drops)); } else { e.setCancelled(true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java index 87a5a88a6..c2f836bdd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java @@ -21,7 +21,6 @@ import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler; import io.github.thebusybiscuit.slimefun4.implementation.items.food.Juice; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} listens for a {@link FoodLevelChangeEvent} or an {@link EntityDamageEvent} for starvation @@ -74,7 +73,7 @@ public class CoolerListener implements Listener { for (ItemStack item : p.getInventory().getContents()) { if (cooler.isItem(item)) { - if (Slimefun.hasUnlocked(p, cooler, true)) { + if (cooler.canUse(p, true)) { takeJuiceFromCooler(p, item); } else { return; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraImpactListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraImpactListener.java index 8b065acc6..9b40e0fc1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraImpactListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ElytraImpactListener.java @@ -18,7 +18,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * The {@link Listener} for the {@link ElytraCap}. @@ -57,7 +56,7 @@ public class ElytraImpactListener implements Listener { if (helmet.isPresent()) { SlimefunItem item = helmet.get(); - if (Slimefun.hasUnlocked(p, item, true) && profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { + if (item.canUse(p, true) && profile.hasFullProtectionAgainst(ProtectionType.FLYING_INTO_WALL)) { e.setDamage(0); p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 20, 1); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java index 2e2b0fecf..f3002e775 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java @@ -14,13 +14,12 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.armor.Parachute; import io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets.JetBoots; import io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets.Jetpack; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.InfusedMagnet; +import io.github.thebusybiscuit.slimefun4.implementation.tasks.InfusedMagnetTask; import io.github.thebusybiscuit.slimefun4.implementation.tasks.JetBootsTask; import io.github.thebusybiscuit.slimefun4.implementation.tasks.JetpackTask; -import io.github.thebusybiscuit.slimefun4.implementation.tasks.InfusedMagnetTask; import io.github.thebusybiscuit.slimefun4.implementation.tasks.ParachuteTask; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for listening to the {@link PlayerToggleSneakEvent} @@ -59,7 +58,7 @@ public class GadgetsListener implements Listener { if (SlimefunUtils.containsSimilarItem(p.getInventory(), SlimefunItems.INFUSED_MAGNET, true)) { InfusedMagnet magnet = (InfusedMagnet) SlimefunItems.INFUSED_MAGNET.getItem(); - if (Slimefun.hasUnlocked(p, magnet, true)) { + if (magnet.canUse(p, true)) { new InfusedMagnetTask(p, magnet.getRadius()).scheduleRepeating(0, 8); } } @@ -67,7 +66,7 @@ public class GadgetsListener implements Listener { } private void handleChestplate(@Nonnull Player p, @Nullable SlimefunItem chestplate) { - if (chestplate == null || !Slimefun.hasUnlocked(p, chestplate, true)) { + if (chestplate == null || !chestplate.canUse(p, true)) { return; } @@ -83,7 +82,7 @@ public class GadgetsListener implements Listener { } private void handleBoots(@Nonnull Player p, @Nullable SlimefunItem boots) { - if (boots instanceof JetBoots && Slimefun.hasUnlocked(p, boots, true)) { + if (boots instanceof JetBoots && boots.canUse(p, true)) { double speed = ((JetBoots) boots).getSpeed(); if (speed > 0.2) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java index 0db770f40..5c04c7e49 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java @@ -23,7 +23,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.armor.LongFallBoo import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece; import io.github.thebusybiscuit.slimefun4.implementation.items.armor.StomperBoots; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for handling all boots provided by @@ -53,7 +52,7 @@ public class SlimefunBootsListener implements Listener { Player p = (Player) e.getEntity(); SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots()); - if (boots instanceof EnderBoots && Slimefun.hasUnlocked(p, boots, true)) { + if (boots instanceof EnderBoots && boots.canUse(p, true)) { e.setCancelled(true); } } @@ -65,7 +64,7 @@ public class SlimefunBootsListener implements Listener { if (boots != null) { // Check if the boots were researched - if (!Slimefun.hasUnlocked(p, boots, true)) { + if (!boots.canUse(p, true)) { return; } @@ -91,7 +90,7 @@ public class SlimefunBootsListener implements Listener { Player p = e.getPlayer(); SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots()); - if (boots instanceof FarmerShoes && Slimefun.hasUnlocked(p, boots, true)) { + if (boots instanceof FarmerShoes && boots.canUse(p, true)) { e.setCancelled(true); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemConsumeListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemConsumeListener.java index bfd4d657a..fdbd271e2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemConsumeListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemConsumeListener.java @@ -11,7 +11,6 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.slimefun4.core.handlers.ItemConsumptionHandler; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for handling the {@link ItemConsumptionHandler} @@ -33,7 +32,7 @@ public class SlimefunItemConsumeListener implements Listener { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null) { - if (Slimefun.hasUnlocked(p, sfItem, true)) { + if (sfItem.canUse(p, true)) { sfItem.callItemHandler(ItemConsumptionHandler.class, handler -> handler.onConsume(e, p, item)); } else { e.setCancelled(true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java index ee276c3d3..0ac0e9f6a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java @@ -25,7 +25,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.api.BlockStorage; -import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu; @@ -94,8 +93,10 @@ public class SlimefunItemInteractListener implements Listener { Optional optional = event.getSlimefunItem(); if (optional.isPresent()) { - if (Slimefun.hasUnlocked(e.getPlayer(), optional.get(), true)) { - return optional.get().callItemHandler(ItemUseHandler.class, handler -> handler.onRightClick(event)); + SlimefunItem sfItem = optional.get(); + + if (sfItem.canUse(e.getPlayer(), true)) { + return sfItem.callItemHandler(ItemUseHandler.class, handler -> handler.onRightClick(event)); } else { event.setUseItem(Result.DENY); } @@ -109,12 +110,14 @@ public class SlimefunItemInteractListener implements Listener { Optional optional = event.getSlimefunBlock(); if (optional.isPresent()) { - if (!Slimefun.hasUnlocked(event.getPlayer(), optional.get(), true)) { + SlimefunItem sfItem = optional.get(); + + if (!sfItem.canUse(event.getPlayer(), true)) { event.getInteractEvent().setCancelled(true); return false; } - boolean interactable = optional.get().callItemHandler(BlockUseHandler.class, handler -> handler.onRightClick(event)); + boolean interactable = sfItem.callItemHandler(BlockUseHandler.class, handler -> handler.onRightClick(event)); if (!interactable) { String id = optional.get().getId(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VampireBladeListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VampireBladeListener.java index 31e7444ac..e91d2660f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VampireBladeListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VampireBladeListener.java @@ -13,7 +13,6 @@ import org.bukkit.potion.PotionEffect; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is exclusively used for the {@link VampireBlade}. @@ -44,7 +43,7 @@ public class VampireBladeListener implements Listener { Player p = (Player) e.getDamager(); if (blade.isItem(p.getInventory().getItemInMainHand())) { - if (Slimefun.hasUnlocked(p, blade, true)) { + if (blade.canUse(p, true)) { blade.heal(p); } else { e.setCancelled(true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/EntityInteractionListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/EntityInteractionListener.java index 47bf84f4f..f9aaa6abe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/EntityInteractionListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/EntityInteractionListener.java @@ -14,7 +14,6 @@ import io.github.thebusybiscuit.slimefun4.api.items.ItemState; import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * The {@link Listener} responsible for a {@link Player} interacting with an {@link Entity}. @@ -48,7 +47,7 @@ public class EntityInteractionListener implements Listener { SlimefunItem sfItem = SlimefunItem.getByItem(itemStack); if (sfItem != null) { - if (Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) { + if (sfItem.canUse(e.getPlayer(), true)) { sfItem.callItemHandler(EntityInteractHandler.class, handler -> handler.onInteract(e, itemStack, e.getHand() == EquipmentSlot.OFF_HAND)); } else if (sfItem.getState() != ItemState.VANILLA_FALLBACK) { /* diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java index 47579d295..b0f8b85b1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java @@ -18,7 +18,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.misc.BasicCircuitBoard; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * This {@link Listener} is responsible for handling any custom mob drops. @@ -55,7 +54,7 @@ public class MobDropListener implements Listener { if (item.getType() != Material.AIR) { SlimefunItem sfItem = SlimefunItem.getByItem(item); - if (sfItem != null && Slimefun.hasUnlocked(p, sfItem, true)) { + if (sfItem != null && sfItem.canUse(p, true)) { sfItem.callItemHandler(EntityKillHandler.class, handler -> handler.onKill(e, e.getEntity(), p, item)); } } @@ -63,21 +62,21 @@ public class MobDropListener implements Listener { } private boolean canDrop(@Nonnull Player p, @Nonnull ItemStack item) { - SlimefunItem sfi = SlimefunItem.getByItem(item); + SlimefunItem sfItem = SlimefunItem.getByItem(item); - if (sfi == null) { + if (sfItem == null) { return true; - } else if (Slimefun.hasUnlocked(p, sfi, true)) { - if (sfi instanceof RandomMobDrop) { + } else if (sfItem.canUse(p, true)) { + if (sfItem instanceof RandomMobDrop) { int random = ThreadLocalRandom.current().nextInt(100); - if (((RandomMobDrop) sfi).getMobDropChance() <= random) { + if (((RandomMobDrop) sfItem).getMobDropChance() <= random) { return false; } } - if (sfi instanceof BasicCircuitBoard) { - return ((BasicCircuitBoard) sfi).isDroppedFromGolems(); + if (sfItem instanceof BasicCircuitBoard) { + return ((BasicCircuitBoard) sfItem).isDroppedFromGolems(); } return true; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java index ed1c04fa3..510dfc07d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/ArmorTask.java @@ -117,7 +117,7 @@ public class ArmorTask implements Runnable { SlimefunPlugin.runSync(() -> { SlimefunArmorPiece slimefunArmor = armorpiece.getItem().get(); - if (Slimefun.hasUnlocked(p, slimefunArmor, true)) { + if (slimefunArmor.canUse(p, true)) { for (PotionEffect effect : slimefunArmor.getPotionEffects()) { p.removePotionEffect(effect.getType()); p.addPotionEffect(effect); @@ -138,7 +138,7 @@ public class ArmorTask implements Runnable { SlimefunItem item = SlimefunItem.getByItem(helmet); - if (item instanceof SolarHelmet && Slimefun.hasUnlocked(p, item, true)) { + if (item instanceof SolarHelmet && item.canUse(p, true)) { ((SolarHelmet) item).rechargeItems(p); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java index 2369a6898..1e7b76000 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java @@ -15,6 +15,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.entity.Item; +import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -358,4 +359,31 @@ public final class SlimefunUtils { SlimefunPlugin.runSync(new CapacitorTextureUpdateTask(l, charge, capacity)); } + /** + * This checks whether the {@link Player} is able to use the given {@link ItemStack}. + * It will always return true for non-Slimefun items. + *

+ * If you already have an instance of {@link SlimefunItem}, please use {@link SlimefunItem#canUse(Player, boolean)}. + * + * @param p + * The {@link Player} + * @param item + * The {@link ItemStack} to check + * @param sendMessage + * Whether to send a message response to the {@link Player} + * + * @return Whether the {@link Player} is able to use that item. + */ + public static boolean canPlayerUseItem(@Nonnull Player p, @Nullable ItemStack item, boolean sendMessage) { + Validate.notNull(p, "The player cannot be null"); + + SlimefunItem sfItem = SlimefunItem.getByItem(item); + + if (sfItem != null) { + return sfItem.canUse(p, sendMessage); + } else { + return true; + } + } + } diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java index 666f8dae4..7d3ea46bf 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java @@ -18,6 +18,9 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import org.bukkit.permissions.Permission; + +import com.sk89q.worldedit.world.World; import io.github.thebusybiscuit.cscorelib2.collections.OptionalMap; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; @@ -31,6 +34,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.UnregisteredItemExcepti import io.github.thebusybiscuit.slimefun4.api.exceptions.WrongItemStackException; import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; import io.github.thebusybiscuit.slimefun4.api.items.ItemState; +import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.core.attributes.NotConfigurable; import io.github.thebusybiscuit.slimefun4.core.attributes.Placeable; import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive; @@ -259,10 +263,14 @@ public class SlimefunItem implements Placeable { * @return The linked {@link Research} or null */ @Nullable - public Research getResearch() { + public final Research getResearch() { return research; } + public final boolean hasResearch() { + return research != null; + } + /** * This returns a {@link Set} containing all instances of {@link ItemSetting} for this {@link SlimefunItem}. * @@ -979,6 +987,90 @@ public class SlimefunItem implements Placeable { } } + /** + * This method checks if the given {@link Player} is able to use this {@link SlimefunItem}. + * A {@link Player} can use it if the following conditions apply: + * + *

+ *

    + *
  • The {@link SlimefunItem} is not disabled + *
  • The {@link SlimefunItem} was not disabled for that {@link Player}'s {@link World}. + *
  • The {@link Player} has the required {@link Permission} (if present) + *
  • The {@link Player} has unlocked the required {@link Research} (if present) + *
+ *

+ * + * If any of these conditions evaluate to false, then an optional message will be + * sent to the {@link Player}. + * + * @param p + * The {@link Player} to check + * @param sendMessage + * Whether to send that {@link Player} a message response. + * + * @return Whether this {@link Player} is able to use this {@link SlimefunItem}. + */ + public boolean canUse(@Nonnull Player p, boolean sendMessage) { + Validate.notNull(p, "The Player cannot be null!"); + + if (getState() == ItemState.VANILLA_FALLBACK) { + // Vanilla items (which fell back) can always be used. + return true; + } else if (isDisabled()) { + // The Item has been disabled in the config + if (sendMessage) { + SlimefunPlugin.getLocalization().sendMessage(p, "messages.disabled-item", true); + } + + return false; + } else if (!SlimefunPlugin.getWorldSettingsService().isEnabled(p.getWorld(), this)) { + // The Item was disabled in the current World + if (sendMessage) { + SlimefunPlugin.getLocalization().sendMessage(p, "messages.disabled-in-world", true); + } + + return false; + } else if (!SlimefunPlugin.getPermissionsService().hasPermission(p, this)) { + // The Player does not have the required permission node + if (sendMessage) { + SlimefunPlugin.getLocalization().sendMessage(p, "messages.no-permission", true); + } + + return false; + } else if (hasResearch()) { + Optional profile = PlayerProfile.find(p); + + if (!profile.isPresent()) { + /* + * We will return false since we cannot know the answer yet. + * But we will schedule the Profile for loading and not send + * any message. + */ + PlayerProfile.request(p); + return false; + } else if (!profile.get().hasUnlocked(getResearch())) { + /* + * The Profile is loaded but Player has not unlocked the + * required Research to use this SlimefunItem. + */ + if (sendMessage && !(this instanceof VanillaItem)) { + SlimefunPlugin.getLocalization().sendMessage(p, "messages.not-researched", true); + } + + return false; + } else { + /* + * The PlayerProfile is loaded and the Player has unlocked + * the required Research. + */ + return true; + } + } else { + // All checks have passed, the Player can use this item. + return true; + } + } + @Override public final boolean equals(Object obj) { if (obj instanceof SlimefunItem) { diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/Slimefun.java b/src/main/java/me/mrCookieSlime/Slimefun/api/Slimefun.java index 2507d50bb..d47c380c3 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/Slimefun.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/Slimefun.java @@ -1,6 +1,5 @@ package me.mrCookieSlime.Slimefun.api; -import java.util.Optional; import java.util.logging.Logger; import javax.annotation.Nonnull; @@ -8,14 +7,13 @@ import javax.annotation.Nonnull; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import io.github.thebusybiscuit.slimefun4.api.items.ItemState; -import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem; +import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; /** * Provides a few static convenience methods. + * This class is slowly getting stripped away in favour of a more object-oriented approach. * * @author TheBusyBiscuit * @author Walshy @@ -39,19 +37,17 @@ public final class Slimefun { * the item to check, not null * @param message * whether a message should be sent to the player or not + * + * @deprecated Moved to + * {@link SlimefunUtils#canPlayerUseItem(Player, ItemStack, boolean)} * * @return true if the item is a SlimefunItem, enabled, researched and if the player has the permission * to use it, * false otherwise. */ + @Deprecated public static boolean hasUnlocked(Player p, ItemStack item, boolean message) { - SlimefunItem sfItem = SlimefunItem.getByItem(item); - - if (sfItem != null) { - return hasUnlocked(p, sfItem, message); - } else { - return true; - } + return SlimefunUtils.canPlayerUseItem(p, item, message); } /** @@ -63,39 +59,15 @@ public final class Slimefun { * the item to check, not null * @param message * whether a message should be sent to the player or not + * + * @deprecated Please use {@link SlimefunItem#canUse(Player, boolean)} instead. * * @return true if the item is enabled, researched and the player has the permission to use it, * false otherwise. */ + @Deprecated public static boolean hasUnlocked(Player p, SlimefunItem sfItem, boolean message) { - if (sfItem.getState() == ItemState.VANILLA_FALLBACK) { - return true; - } - - if (isEnabled(p, sfItem, message) && hasPermission(p, sfItem, message)) { - if (sfItem.getResearch() == null) { - return true; - } else { - Optional profile = PlayerProfile.find(p); - - if (!profile.isPresent()) { - // We will return false since we cannot know the answer yet - // But we will schedule the Profile for loading. - PlayerProfile.request(p); - return false; - } else if (profile.get().hasUnlocked(sfItem.getResearch())) { - return true; - } else { - if (message && !(sfItem instanceof VanillaItem)) { - SlimefunPlugin.getLocalization().sendMessage(p, "messages.not-researched", true); - } - - return false; - } - } - } - - return false; + return sfItem.canUse(p, message); } /** @@ -134,10 +106,13 @@ public final class Slimefun { * the item to check, not null * @param message * whether a message should be sent to the player or not + * + * @deprecated This method will be removed. * * @return true if the item is a SlimefunItem and is enabled in the world the player is in, * false otherwise. */ + @Deprecated public static boolean isEnabled(Player p, ItemStack item, boolean message) { SlimefunItem sfItem = SlimefunItem.getByItem(item); From 2cd0378306666ef97c67938f2650f9418a8449db Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 22 Dec 2020 15:53:00 +0100 Subject: [PATCH 009/144] Thank god we have Unit Tests :monkaS: --- .../slimefun4/core/categories/LockedCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java index f85b8b362..abf17e55d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java @@ -157,7 +157,7 @@ public class LockedCategory extends Category { for (Category category : parents) { for (SlimefunItem item : category.getItems()) { - if (item.canUse(p, false)) { + if (!item.canUse(p, false)) { return false; } } From bd06d0daecda82b441857ddec7bb534b664bb3ea Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 22 Dec 2020 15:58:18 +0100 Subject: [PATCH 010/144] Wrong import --- .../Slimefun/Objects/SlimefunItem/SlimefunItem.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java index 7d3ea46bf..09afe8290 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java @@ -15,13 +15,12 @@ import javax.annotation.Nullable; import org.apache.commons.lang.Validate; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.permissions.Permission; -import com.sk89q.worldedit.world.World; - import io.github.thebusybiscuit.cscorelib2.collections.OptionalMap; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; From 452dc5c3c57b2f2245102bf472cb5bda9a09ca58 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 14 Jan 2021 12:26:21 +0100 Subject: [PATCH 011/144] Updated changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4013bee4b..101785a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ * Fixed #2511 * Fixed #2636 * Fixed a threading issue related to BlockStates and persistent data +* Fixed some backpack opening issues ## Release Candidate 19 (11 Jan 2021) @@ -55,8 +56,7 @@ * Fixed a couple of compatibility issues with ItemsAdder * Fixed #2575 * Fixed ghost blocks to some extent (ghost blocks will now drop and be replaced) -* Fixed #2636 -* Fixed some backpack opening issues +* Fixed #2636 (hotfix) * Fixed #2647 * Fixed #2664 * Fixed #2655 From 76a0ea1fdced34f8832d56b4af126a2d72b28d03 Mon Sep 17 00:00:00 2001 From: Keaton Date: Fri, 22 Jan 2021 13:40:01 -0600 Subject: [PATCH 012/144] Check inv maxStackSize As mentioned in CS-CoreLib2's #141 and #142 PR's, previous iterations of Slimefun AContainers would not consider the underlying Inventory's max stack size when determining sizing or pushing items. This commit changes DirtyChestMenus to act similarly by storing a variable defined as the lower of the Inventory's max stack size and the ItemStack's max stack size in a slot. --- .../api/inventory/DirtyChestMenu.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java index 5155fe76d..3c5412f66 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java @@ -105,15 +105,18 @@ public class DirtyChestMenu extends ChestMenu { if (stack == null) { replaceExistingItem(slot, item); return null; - } else if (stack.getAmount() < stack.getMaxStackSize()) { - if (wrapper == null) { - wrapper = new ItemStackWrapper(item); - } + } else { + int maxStackSize = Math.min(stack.getMaxStackSize(), toInventory().getMaxStackSize()); + if (stack.getAmount() < maxStackSize) { + if (wrapper == null) { + wrapper = new ItemStackWrapper(item); + } - if (ItemUtils.canStack(wrapper, stack)) { - amount -= (stack.getMaxStackSize() - stack.getAmount()); - stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), stack.getMaxStackSize())); - item.setAmount(amount); + if (ItemUtils.canStack(wrapper, stack)) { + amount -= (maxStackSize - stack.getAmount()); + stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), maxStackSize)); + item.setAmount(amount); + } } } } From a94567333a798f230032efb4acd4305bc8cac2b6 Mon Sep 17 00:00:00 2001 From: Name1ess Date: Sat, 23 Jan 2021 18:45:31 +0800 Subject: [PATCH 013/144] fix: add bypass for book --- .../implementation/listeners/TalismanListener.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index e895b9105..af2c8b561 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -239,7 +239,11 @@ public class TalismanListener implements Listener { TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet()); if (enchantment != null) { - enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); + if (e.getItem().getType() == Material.BOOK) { + e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); + } else { + enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); + } } } From 48165dd13838204433cd6ca6de6170f5b42b1d96 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Sat, 23 Jan 2021 18:49:42 +0800 Subject: [PATCH 014/144] fix: add enchant item check in filter --- .../items/magical/talismans/MagicianTalisman.java | 3 ++- .../slimefun4/implementation/listeners/TalismanListener.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java index 2d9959a11..906672b2f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java @@ -12,6 +12,7 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import org.apache.commons.lang.Validate; +import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -70,7 +71,7 @@ public class MagicianTalisman extends Talisman { // @formatter:off List enabled = enchantments.stream() - .filter(e -> e.getEnchantment().canEnchantItem(item)) + .filter(e -> item.getType() == Material.BOOK || e.getEnchantment().canEnchantItem(item)) .filter(e -> hasConflicts(existingEnchantments, e)) .filter(TalismanEnchantment::getValue) .collect(Collectors.toList()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index af2c8b561..7d9ca23d5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -239,6 +239,10 @@ public class TalismanListener implements Listener { TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet()); if (enchantment != null) { + /* + * Fix #2679 + * By default, Bukkit doesn't allow book enchant any type enchantment. + */ if (e.getItem().getType() == Material.BOOK) { e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); } else { From 9e490711618af71a0cc240aa61b18cfb42ca7c49 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Sun, 24 Jan 2021 10:59:55 +0800 Subject: [PATCH 015/144] feat: Add ItemSetting for magician talisman This setting can set whether books can be enchanted. --- .../items/magical/talismans/MagicianTalisman.java | 14 ++++++++++++++ .../implementation/listeners/TalismanListener.java | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java index 906672b2f..823bf9e74 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java @@ -31,12 +31,16 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; */ public class MagicianTalisman extends Talisman { + private final ItemSetting allowEnchantBook = new ItemSetting<>("allow-enchant-book", false); + private final Set enchantments = new HashSet<>(); @ParametersAreNonnullByDefault public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) { super(item, recipe, false, false, "magician", 80); + addItemSetting(allowEnchantBook); + for (Enchantment enchantment : Enchantment.values()) { try { for (int i = 1; i <= enchantment.getMaxLevel(); i++) { @@ -91,4 +95,14 @@ public class MagicianTalisman extends Talisman { return true; } + /** + * This method checks when enchanting book + * can it be applied a extra {@link Enchantment} or not. + * + * @return Whether the book can be apply extra {@link Enchantment} + */ + @Nonnull + public ItemSetting isAllowEnchantBook() { + return allowEnchantBook; + } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 7d9ca23d5..1fbf327b8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -243,7 +243,7 @@ public class TalismanListener implements Listener { * Fix #2679 * By default, Bukkit doesn't allow book enchant any type enchantment. */ - if (e.getItem().getType() == Material.BOOK) { + if (talisman.isAllowEnchantBook().getValue() && e.getItem().getType() == Material.BOOK) { e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); } else { enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); From 8302c0c932a916258ae1e1403603bff24f5b5c16 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Sun, 24 Jan 2021 11:01:42 +0800 Subject: [PATCH 016/144] fix: add missing judge in getRandomEnchantment --- .../items/magical/talismans/MagicianTalisman.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java index 823bf9e74..49b1871d1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java @@ -75,7 +75,7 @@ public class MagicianTalisman extends Talisman { // @formatter:off List enabled = enchantments.stream() - .filter(e -> item.getType() == Material.BOOK || e.getEnchantment().canEnchantItem(item)) + .filter(e -> (isAllowEnchantBook().getValue() && item.getType() == Material.BOOK) || e.getEnchantment().canEnchantItem(item)) .filter(e -> hasConflicts(existingEnchantments, e)) .filter(TalismanEnchantment::getValue) .collect(Collectors.toList()); From f958385f3d977d76f44d9e5f2850b9150884b175 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Jan 2021 19:21:44 +0000 Subject: [PATCH 017/144] Translate messages_es.yml via GitLocalize --- src/main/resources/languages/messages_es.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/languages/messages_es.yml b/src/main/resources/languages/messages_es.yml index 0e6716f8b..d219fca66 100644 --- a/src/main/resources/languages/messages_es.yml +++ b/src/main/resources/languages/messages_es.yml @@ -25,9 +25,9 @@ commands: not-rechargeable: Este ítem no puede ser cargado! timings: description: Timings para Slimefun y sus addon + please-wait: "&ePor favor, espere un segundo... ¡Los resultados están llegando!" verbose-player: "&4La flag verbose no puede ser usada por un jugador!" unknown-flag: "&4flag desconocida: &c%flag%" - please-wait: "&ePor favor, espere un segundo... ¡Los resultados están llegando!" guide: search: message: "&b¿Qué te gustaría buscar?" @@ -189,9 +189,9 @@ messages: invalid-item: "&c¡&4%item% &cno es un objeto válido!" invalid-amount: "&c¡&4%amount% &cno es un valor válido: tiene que ser mayor a 0!" invalid-research: "&c¡&4%research% &cno es un conocimiento válido!" - mode-change: 'El modo de &b%device% ha cambiado a: &9%mode%' bee-suit-slow-fall: "&eTus alas de Abeja te ayudarán a llegar seguro y lento al piso" + mode-change: 'El modo de &b%device% ha cambiado a: &9%mode%' machines: pattern-not-found: "&eLo siento, no puedo reconocer esta receta. Por favor coloca el objeto en el patrón correcto dentro del dispensador." @@ -335,6 +335,7 @@ languages: zh-CN: Chino (China) el: Griego he: Hebreo + pt: Portugués (Portugal) ar: Árabe af: Africano da: Danés @@ -346,7 +347,6 @@ languages: fa: Persa th: Tailandés ro: Rumano - pt: Portugués (Portugal) pt-BR: Portugués (Brasil) bg: Búlgaro ko: Coreano From cd643cabb5b1d891fe849f30fd56fd03f03b9144 Mon Sep 17 00:00:00 2001 From: dylan Date: Sun, 24 Jan 2021 19:21:45 +0000 Subject: [PATCH 018/144] Translate messages_es.yml via GitLocalize --- src/main/resources/languages/messages_es.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_es.yml b/src/main/resources/languages/messages_es.yml index d219fca66..e7f5f5534 100644 --- a/src/main/resources/languages/messages_es.yml +++ b/src/main/resources/languages/messages_es.yml @@ -314,6 +314,7 @@ android: own: "&4¡No puedes calificar tu propio script!" already: "&4¡Ya has calificado este script!" editor: Editor de Guión + too-long: "&cEl script es demasiado largo para editar!" languages: default: Predeterminado en: Inglés From 0da0468b23d557c23933c5d14fce1f0711320f67 Mon Sep 17 00:00:00 2001 From: Luu7 Date: Sun, 24 Jan 2021 19:21:46 +0000 Subject: [PATCH 019/144] Translate messages_es.yml via GitLocalize --- src/main/resources/languages/messages_es.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_es.yml b/src/main/resources/languages/messages_es.yml index e7f5f5534..769db6106 100644 --- a/src/main/resources/languages/messages_es.yml +++ b/src/main/resources/languages/messages_es.yml @@ -134,6 +134,7 @@ messages: wizard: "&a&oTu talismán te ha dado un mayor nivel de fortuna, pero pudo disminuír el nivel de otros encantamientos." caveman: "&a&oTu Talismán te ha dado Haste" + wise: "&a&oTu Talismán ha duplicado tu drop de experiencia" soulbound-rune: fail: "&cSolo puedes ligar un objeto a tu alma." success: "&a¡Has ligado este objeto a tu alma exitosamente! No lo perderás al From 794d184a41e73367762952ea1b75ddeec895c0b8 Mon Sep 17 00:00:00 2001 From: Luu7 Date: Sun, 24 Jan 2021 19:21:47 +0000 Subject: [PATCH 020/144] Translate researches_es.yml via GitLocalize --- src/main/resources/languages/researches_es.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_es.yml b/src/main/resources/languages/researches_es.yml index 4b04064a2..f816c31b2 100644 --- a/src/main/resources/languages/researches_es.yml +++ b/src/main/resources/languages/researches_es.yml @@ -248,3 +248,4 @@ slimefun: elytra_cap: Equipo de choque energy_connectors: Conexiones Instaladas bee_armor: Armadura de Abeja + wise_talisman: Talismán del Sabio From 352d1c082359be8807484bcbe42c256aabfa6c9c Mon Sep 17 00:00:00 2001 From: Vravinite Date: Sun, 24 Jan 2021 19:21:48 +0000 Subject: [PATCH 021/144] Translate recipes_es.yml via GitLocalize From a9c4df30a4dda6ae460ab7730f10b1da9c707f3c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Jan 2021 20:23:30 +0100 Subject: [PATCH 022/144] Update Translators.java --- .../core/services/localization/Translators.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java index 9d668b69c..f052ea340 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java @@ -47,6 +47,14 @@ public class Translators { addTranslator("dracrus", SupportedLanguage.ITALIAN, true); addTranslator("prolletto64", SupportedLanguage.ITALIAN, true); + // Translators - Spanish + addTranslator("Luu7", "_Luu", SupportedLanguage.SPANISH, true); + addTranslator("Vravinite", SupportedLanguage.SPANISH, true); + addTranslator("NotUmBr4", SupportedLanguage.SPANISH, true); + addTranslator("dbzjjoe", SupportedLanguage.SPANISH, true); + addTranslator("DaHolyCheese", SupportedLanguage.SPANISH, true); + addTranslator("d-l-n", SupportedLanguage.SPANISH, true); + // Translators - Latvian addTranslator("AgnisT", "NIKNAIZ", SupportedLanguage.LATVIAN, true); @@ -91,13 +99,6 @@ public class Translators { // Translators - Ukrainian addTranslator("SoSeDiK", SupportedLanguage.UKRAINIAN, false); - // Translators - Spanish - addTranslator("Luu7", "_Luu", SupportedLanguage.SPANISH, true); - addTranslator("Vravinite", SupportedLanguage.SPANISH, true); - addTranslator("NotUmBr4", SupportedLanguage.SPANISH, true); - addTranslator("dbzjjoe", SupportedLanguage.SPANISH, true); - addTranslator("DaHolyCheese", SupportedLanguage.SPANISH, true); - // Translators - Swedish addTranslator("NihilistBrew", "ma1yang2", SupportedLanguage.SWEDISH, false); addTranslator("Tra-sh", "TurretTrash", SupportedLanguage.SWEDISH, true); From e5d5b2950da5f6a971c7c528692e357a3f85fd73 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Jan 2021 19:27:23 +0000 Subject: [PATCH 023/144] Translate researches_de.yml via GitLocalize --- src/main/resources/languages/researches_de.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_de.yml b/src/main/resources/languages/researches_de.yml index d96160850..e934cddbb 100644 --- a/src/main/resources/languages/researches_de.yml +++ b/src/main/resources/languages/researches_de.yml @@ -248,3 +248,4 @@ slimefun: elytra_cap: Harter Aufprall energy_connectors: Kupferkabel bee_armor: Bienen-Rüstung + wise_talisman: Stein der Weisen From abf948e4ed48e23c503662aec87360d80a37a2f9 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Jan 2021 19:27:24 +0000 Subject: [PATCH 024/144] Translate messages_de.yml via GitLocalize --- src/main/resources/languages/messages_de.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/languages/messages_de.yml b/src/main/resources/languages/messages_de.yml index 369335a38..6853972c2 100644 --- a/src/main/resources/languages/messages_de.yml +++ b/src/main/resources/languages/messages_de.yml @@ -136,6 +136,7 @@ messages: wizard: "&a&oDein Talisman hat dein Glück-Level erhöht aber möglicherweise das Level einer anderen Verzauberung vermindert" caveman: "&a&oDein Talisman hat dir einen Abbau-Boost verschafft" + wise: "&a&oDein Talisman hat soeben deine Erfahrungspunkte verdoppelt" soulbound-rune: fail: "&cDu kannst nicht mehrere Items auf einmal an deine Seele binden" success: "&aDu hast dieses Item erfolgreich an deine Seele gebunden! Solltest @@ -319,6 +320,7 @@ android: own: "&4Du kannst nicht dein eigenes Skript bewerten!" already: "&4Du hast dieses Skript bereits bewertet!" editor: Skripteditor + too-long: "&cDieses Skript ist zu lang, um es zu bearbeiten!" languages: default: Server-Standard en: Englisch From 1c4c9caf2e6061ecb7aae7bd9b9b1944463386bb Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Jan 2021 19:27:26 +0000 Subject: [PATCH 025/144] Translate recipes_de.yml via GitLocalize From ce869b2acce66ad1b4e53e0760917c857acf9379 Mon Sep 17 00:00:00 2001 From: bito-blosh Date: Sun, 24 Jan 2021 21:21:58 +0000 Subject: [PATCH 026/144] Translate researches_ja.yml via GitLocalize --- src/main/resources/languages/researches_ja.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_ja.yml b/src/main/resources/languages/researches_ja.yml index e66c8498c..9bd65a1bc 100644 --- a/src/main/resources/languages/researches_ja.yml +++ b/src/main/resources/languages/researches_ja.yml @@ -248,3 +248,4 @@ slimefun: elytra_cap: 衝撃緩和装備 energy_connectors: 有線接続 bee_armor: 蜂アーマー + wise_talisman: 知恵のタリスマン From c9cdffdfac2247aedafd5fcb31fcb747c6cb4c1d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Jan 2021 21:22:00 +0000 Subject: [PATCH 027/144] Translate messages_ja.yml via GitLocalize --- src/main/resources/languages/messages_ja.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/languages/messages_ja.yml b/src/main/resources/languages/messages_ja.yml index d008529e0..6f1d4c065 100644 --- a/src/main/resources/languages/messages_ja.yml +++ b/src/main/resources/languages/messages_ja.yml @@ -318,7 +318,6 @@ languages: zh-CN: 中国語(中国) el: ギリシャ語 he: ヘブライ語 - pt: ポルトガル語(ポルトガル) pt-BR: ポルトガル語(ブラジル) ar: アラビア語 af: アフリカーンス語 @@ -331,6 +330,7 @@ languages: fa: ペルシア語 th: タイ語 ro: ルーマニア語 + pt: ポルトガル語(ポルトガル) bg: ブルガリア語 ko: 韓国語 tr: トルコ語 From 826e90ef8297472ba2f99b1507d44c6bf060fcd2 Mon Sep 17 00:00:00 2001 From: bito-blosh Date: Sun, 24 Jan 2021 21:22:01 +0000 Subject: [PATCH 028/144] Translate messages_ja.yml via GitLocalize --- src/main/resources/languages/messages_ja.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_ja.yml b/src/main/resources/languages/messages_ja.yml index 6f1d4c065..c97fa1104 100644 --- a/src/main/resources/languages/messages_ja.yml +++ b/src/main/resources/languages/messages_ja.yml @@ -133,6 +133,7 @@ messages: whirlwind: "&a&oタリスマンが飛び道具から身を護った" wizard: "&a&oタリスマンが高レベルの幸運を付与したが、他のエンチャントレベルは下がってしまった" caveman: "&a&oタリスマンが採掘速度を上昇させた" + wise: "&a&oタリスマンが経験値のドロップを倍にした" soulbound-rune: fail: "&c一度に複数アイテムとのバインディングはできません" success: "&aアイテムとのバインディングが確立した!リスポーン時に当該アイテムは手繰り寄せられます" From 3b564c04864068eb743b2fd2366c6720c9989c6c Mon Sep 17 00:00:00 2001 From: Nikolay Date: Sun, 24 Jan 2021 22:55:41 +0000 Subject: [PATCH 029/144] Translate messages_bg.yml via GitLocalize --- src/main/resources/languages/messages_bg.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_bg.yml b/src/main/resources/languages/messages_bg.yml index a400654de..699fa7f3c 100644 --- a/src/main/resources/languages/messages_bg.yml +++ b/src/main/resources/languages/messages_bg.yml @@ -134,6 +134,7 @@ messages: wizard: "&a&oВашия Талисман Ви даде по-добро Ниво Fortune, но може да е намалило Нивата на някои от другите Ви Enchantment-и" caveman: "&a&oВашия Талисман Ви дава haste или познато, като бързо чупене" + wise: "&a&oВашия Талисман удвой вашите XP дропове" soulbound-rune: fail: "& cМожете да свържете само един елемент с душата си наведнъж." success: "&aВие успешно свързахте този предмет с душата си! Когато умрете Вие From decf9bd08c765c392be55c7bdf218bf69c7c5bed Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Mon, 25 Jan 2021 11:59:53 +0800 Subject: [PATCH 030/144] fix: grammar issue --- .../magical/talismans/MagicianTalisman.java | 45 +++++++++---------- .../listeners/TalismanListener.java | 41 ++++++----------- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java index 49b1871d1..0b6758bbe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java @@ -1,26 +1,24 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ThreadLocalRandom; -import java.util.logging.Level; -import java.util.stream.Collectors; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - +import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; +import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; -import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; +import java.util.logging.Level; +import java.util.stream.Collectors; /** * The {@link MagicianTalisman} is a special kind of {@link Talisman} which awards a {@link Player} @@ -31,7 +29,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; */ public class MagicianTalisman extends Talisman { - private final ItemSetting allowEnchantBook = new ItemSetting<>("allow-enchant-book", false); + private final ItemSetting allowEnchantmentBooks = new ItemSetting<>("allow-enchantment-books", false); private final Set enchantments = new HashSet<>(); @@ -39,7 +37,7 @@ public class MagicianTalisman extends Talisman { public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) { super(item, recipe, false, false, "magician", 80); - addItemSetting(allowEnchantBook); + addItemSetting(allowEnchantmentBooks); for (Enchantment enchantment : Enchantment.values()) { try { @@ -75,7 +73,7 @@ public class MagicianTalisman extends Talisman { // @formatter:off List enabled = enchantments.stream() - .filter(e -> (isAllowEnchantBook().getValue() && item.getType() == Material.BOOK) || e.getEnchantment().canEnchantItem(item)) + .filter(e -> (isEnchantmentBookAllowed() && item.getType() == Material.BOOK) || e.getEnchantment().canEnchantItem(item)) .filter(e -> hasConflicts(existingEnchantments, e)) .filter(TalismanEnchantment::getValue) .collect(Collectors.toList()); @@ -96,13 +94,12 @@ public class MagicianTalisman extends Talisman { } /** - * This method checks when enchanting book - * can it be applied a extra {@link Enchantment} or not. + * This method checks whether enchantment books + * can be given an extra {@link Enchantment} or not. * - * @return Whether the book can be apply extra {@link Enchantment} + * @return Whether enchantment books can receive an extra {@link Enchantment} */ - @Nonnull - public ItemSetting isAllowEnchantBook() { - return allowEnchantBook; + public boolean isEnchantmentBookAllowed() { + return allowEnchantmentBooks.getValue(); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 1fbf327b8..66aa9ed25 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -1,26 +1,16 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.concurrent.ThreadLocalRandom; - -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; - +import io.github.thebusybiscuit.cscorelib2.item.CustomItem; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.MagicianTalisman; +import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; +import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; +import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.ChestedHorse; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Trident; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -40,13 +30,10 @@ import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.util.Vector; -import io.github.thebusybiscuit.cscorelib2.item.CustomItem; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.MagicianTalisman; -import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; -import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; -import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.*; +import java.util.concurrent.ThreadLocalRandom; public class TalismanListener implements Listener { @@ -241,9 +228,9 @@ public class TalismanListener implements Listener { if (enchantment != null) { /* * Fix #2679 - * By default, Bukkit doesn't allow book enchant any type enchantment. + * By default, the Bukkit API doesn't allow us to give enchantment books extra enchantments. */ - if (talisman.isAllowEnchantBook().getValue() && e.getItem().getType() == Material.BOOK) { + if (talisman.isEnchantmentBookAllowed() && e.getItem().getType() == Material.BOOK) { e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); } else { enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); From 89370d31f9739435af4e3567a840e19985536053 Mon Sep 17 00:00:00 2001 From: Nameless Date: Mon, 25 Jan 2021 04:05:59 +0000 Subject: [PATCH 031/144] Translate messages_zh-CN.yml via GitLocalize --- src/main/resources/languages/messages_zh-CN.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/languages/messages_zh-CN.yml b/src/main/resources/languages/messages_zh-CN.yml index 1e72adead..3d8453412 100644 --- a/src/main/resources/languages/messages_zh-CN.yml +++ b/src/main/resources/languages/messages_zh-CN.yml @@ -133,6 +133,7 @@ messages: whirlwind: "&a&o你的护身符反弹了所有射向你的投掷物" wizard: "&a&o你的护身符随机提高了一个附魔的等级, 但其他的附魔等级将会下降" caveman: "&a&o你的护身符给予了你急迫效果" + wise: "&a&o你的护身符让掉落的经验翻倍了" soulbound-rune: fail: "&c灵魂一次只能绑定一个物品." success: "&a物品绑定成功! 在你死亡后此物品将不会掉落." @@ -318,8 +319,6 @@ languages: zh-CN: 简体中文 (中国) el: 希腊语 he: 希伯来语 - pt: 葡萄牙语 (葡萄牙) - pt-BR: 葡萄牙语 (巴西) ar: 阿拉伯语 af: 南非语 da: 丹麦语 @@ -331,6 +330,8 @@ languages: fa: 波斯语 th: 泰语 ro: 罗马尼亚语 + pt: 葡萄牙语 (葡萄牙) + pt-BR: 葡萄牙语 (巴西) bg: 保加利亚语 ko: 韩语 tr: 土耳其语 From 76ebff105bcd4c09a3fcbd35ca1699e1c630b47e Mon Sep 17 00:00:00 2001 From: Nameless Date: Mon, 25 Jan 2021 04:06:01 +0000 Subject: [PATCH 032/144] Translate researches_zh-CN.yml via GitLocalize --- src/main/resources/languages/researches_zh-CN.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_zh-CN.yml b/src/main/resources/languages/researches_zh-CN.yml index e57e46707..12899cf16 100644 --- a/src/main/resources/languages/researches_zh-CN.yml +++ b/src/main/resources/languages/researches_zh-CN.yml @@ -248,3 +248,4 @@ slimefun: elytra_cap: 无伤落地 energy_connectors: 有线连接 bee_armor: 蜜蜂服 + wise_talisman: 智者的护身符 From 8d844254c20a2a080f352e8bd4443ba1b9b01b7a Mon Sep 17 00:00:00 2001 From: Name1ess Date: Mon, 25 Jan 2021 12:15:18 +0800 Subject: [PATCH 033/144] fix: register recipes when speed is not 0 --- .../Objects/SlimefunItem/abstractItems/AContainer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java index 2572751b1..e32edf19d 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java @@ -74,8 +74,6 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock, processing.remove(b); return true; }); - - registerDefaultRecipes(); } @ParametersAreNonnullByDefault @@ -238,6 +236,8 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock, warn("The processing speed has not been configured correctly. The Item was disabled."); warn("Make sure to call '" + getClass().getSimpleName() + "#setProcessingSpeed(...)' before registering!"); } + + registerDefaultRecipes(); if (getCapacity() > 0 && getEnergyConsumption() > 0 && getSpeed() > 0) { super.register(addon); From a6bcab266f167175b6dcb6d282debefd34f380c4 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Mon, 25 Jan 2021 12:18:24 +0800 Subject: [PATCH 034/144] chore: remove register call when initialize --- .../electric/machines/ElectricSmeltery.java | 27 +++++++++---------- .../machines/HeatedPressureChamber.java | 23 +++++++--------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java index a0ce3cd4d..aac0dc718 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java @@ -1,16 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedList; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; - import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.core.attributes.NotHopperable; @@ -22,13 +11,23 @@ import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenu import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; +import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu; import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow; -import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; + +import java.util.Collections; +import java.util.Comparator; +import java.util.LinkedList; +import java.util.List; /** * The {@link ElectricSmeltery} is an electric version of the standard {@link Smeltery}. @@ -112,12 +111,10 @@ public class ElectricSmeltery extends AContainer implements NotHopperable { processing.remove(b); return true; }); - - this.registerDefaultRecipes(); } private Comparator compareSlots(DirtyChestMenu menu) { - return (slot1, slot2) -> menu.getItemInSlot(slot1).getAmount() - menu.getItemInSlot(slot2).getAmount(); + return Comparator.comparingInt(slot -> menu.getItemInSlot(slot).getAmount()); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java index 95b62ac1f..5a5d16fc2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java @@ -1,15 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; @@ -22,6 +12,15 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu; import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; public class HeatedPressureChamber extends AContainer { @@ -73,12 +72,10 @@ public class HeatedPressureChamber extends AContainer { } } }; - - this.registerDefaultRecipes(); } private Comparator compareSlots(DirtyChestMenu menu) { - return (slot1, slot2) -> menu.getItemInSlot(slot1).getAmount() - menu.getItemInSlot(slot2).getAmount(); + return Comparator.comparingInt(slot -> menu.getItemInSlot(slot).getAmount()); } @Override From 28f0b44f3c344797332c39dbbc9a5a5717f31ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Marczink=C3=B3?= Date: Mon, 25 Jan 2021 08:04:20 +0000 Subject: [PATCH 035/144] Translate messages_hu.yml via GitLocalize From e47b89de4ea5e44c6fff2fade674616b90c19845 Mon Sep 17 00:00:00 2001 From: poma123 Date: Mon, 25 Jan 2021 08:04:21 +0000 Subject: [PATCH 036/144] Translate messages_hu.yml via GitLocalize --- src/main/resources/languages/messages_hu.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_hu.yml b/src/main/resources/languages/messages_hu.yml index 7a806b08e..d1e522f47 100644 --- a/src/main/resources/languages/messages_hu.yml +++ b/src/main/resources/languages/messages_hu.yml @@ -313,6 +313,7 @@ android: own: "&4Nem értékelheted a saját szkriptedet!" already: "&4Ezt a szkriptet már értékelted!" editor: Szkript szerkesztő + too-long: "&cA szkript túl hosszú a szerkesztéshez!" languages: default: Szerver-alapértelmezett en: Angol From 6792ee765ff5b36de44f526766e365483cce939d Mon Sep 17 00:00:00 2001 From: KingDead Date: Mon, 25 Jan 2021 08:04:22 +0000 Subject: [PATCH 037/144] Translate messages_hu.yml via GitLocalize --- src/main/resources/languages/messages_hu.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_hu.yml b/src/main/resources/languages/messages_hu.yml index d1e522f47..1f8132d3c 100644 --- a/src/main/resources/languages/messages_hu.yml +++ b/src/main/resources/languages/messages_hu.yml @@ -134,6 +134,7 @@ messages: wizard: "&a&oA talizmánod erősítette a Szerencse varázslatot, de néhány egyéb varázslatot gyengített" caveman: "&a&oA talizmánod adott Sietség effektet" + wise: "&a&oA talizmánod megduplázta a dobott tapasztalat pontokat" soulbound-rune: fail: "&cEgyszerre csak egy tárgyat köthetsz a lelkedhez." success: "&aSikeresen hozzákötötted ezt a tárgyat a lelkedhez! Megmarad, amikor From 290afb47462bf9274507c070fd3dc3b152824210 Mon Sep 17 00:00:00 2001 From: poma123 Date: Mon, 25 Jan 2021 08:04:24 +0000 Subject: [PATCH 038/144] Translate researches_hu.yml via GitLocalize --- src/main/resources/languages/researches_hu.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_hu.yml b/src/main/resources/languages/researches_hu.yml index 9f5e930ff..fbf7e0c03 100644 --- a/src/main/resources/languages/researches_hu.yml +++ b/src/main/resources/languages/researches_hu.yml @@ -248,3 +248,4 @@ slimefun: elytra_cap: Ütközésvédelem energy_connectors: Vezetékes csatlakozás bee_armor: Méhpáncél + wise_talisman: A Bölcs talizmánja From da6727195d6c7de900f2a86d7ed647a04f41c472 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 12:37:37 +0100 Subject: [PATCH 039/144] Update .github/workflows/pr-labels.yml --- .github/workflows/pr-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index b7d3f9c58..8c21901e6 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: WalshyDev/pr-labels@v1 with: - token: "${{ secrets.GITHUB_TOKEN }}" + token: "${{ secrets.ACCESS_TOKEN }}" feature: 'New Feature' fix: '🐞 Bug Fix' chore: 'Chore' From 95144e999facdf3dc24096408c3721ab5e4830a3 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 12:39:46 +0100 Subject: [PATCH 040/144] Update pr-labels.yml --- .github/workflows/pr-labels.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 8c21901e6..404d21641 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -1,17 +1,21 @@ -name: PR Labeler +name: Pull Request Labels + on: pull_request: types: [opened] jobs: pr-labeler: + + name: Pull Request Labels runs-on: ubuntu-latest + steps: - uses: WalshyDev/pr-labels@v1 + name: Apply labels based on branch with: token: "${{ secrets.ACCESS_TOKEN }}" - feature: 'New Feature' - fix: '🐞 Bug Fix' - chore: 'Chore' - perf: '🛠️ Performance Improvement' - performance: '🛠️ Performance Improvement' + feature: '🎈 Feature' + fix: '✨ Fix' + chore: '🧹 Chores' + performance: '💡 Performance Optimization' From f3fafabcff46c426e90ed883f74cbe2065f100b3 Mon Sep 17 00:00:00 2001 From: Name1ess Date: Mon, 25 Jan 2021 20:10:35 +0800 Subject: [PATCH 041/144] Update TalismanListener.java --- .../listeners/TalismanListener.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 66aa9ed25..af5a0bf50 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -221,21 +221,19 @@ public class TalismanListener implements Listener { Map enchantments = e.getEnchantsToAdd(); // Magician Talisman - if (Talisman.checkFor(e, SlimefunItems.TALISMAN_MAGICIAN)) { - MagicianTalisman talisman = (MagicianTalisman) SlimefunItems.TALISMAN_MAGICIAN.getItem(); - TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet()); + MagicianTalisman talisman = (MagicianTalisman) SlimefunItems.TALISMAN_MAGICIAN.getItem(); + TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet()); - if (enchantment != null) { - /* - * Fix #2679 - * By default, the Bukkit API doesn't allow us to give enchantment books extra enchantments. - */ - if (talisman.isEnchantmentBookAllowed() && e.getItem().getType() == Material.BOOK) { - e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); - } else { - enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); - } - } + if (enchantment != null && Talisman.checkFor(e, SlimefunItems.TALISMAN_MAGICIAN)) { + /* + * Fix #2679 + * By default, the Bukkit API doesn't allow us to give enchantment books extra enchantments. + */ + if (talisman.isEnchantmentBookAllowed() && e.getItem().getType() == Material.BOOK) { + e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); + } else { + enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); + } } // Wizard Talisman From 9f29901eb832ff36db51b63a6712bce3b2c5f307 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 15:46:35 +0100 Subject: [PATCH 042/144] [CI skip] Updated translators list --- .../slimefun4/core/services/localization/Translators.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java index f052ea340..1861c7ed8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java @@ -138,6 +138,7 @@ public class Translators { addTranslator("Eylonnn", SupportedLanguage.HEBREW, true); addTranslator("sarhatabaot", SupportedLanguage.HEBREW, false); addTranslator("Timotiyadeyhakesem", SupportedLanguage.HEBREW, true); + addTranslator("PaladinBear", SupportedLanguage.HEBREW, true); addTranslator("Molioron", SupportedLanguage.HEBREW, true); addTranslator("McAlmog", SupportedLanguage.HEBREW, true); From 3e5926c5c2a0ecc0ff877c6de7f6945e3691955c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 16:36:24 +0100 Subject: [PATCH 043/144] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1cd355b..881b65bad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ * Fixed Infused Hopper picking up items with a max pickup delay * Fixed duplication issues related to holograms/armorstands * Fixed #2754 +* Fixed machines not respecting max size from inventories +* Fixed #2761 ## Release Candidate 19 (11 Jan 2021) From 8d85ce27208272cc560574449aff49f0c2fc1629 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 16:46:52 +0100 Subject: [PATCH 044/144] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 881b65bad..71cd54554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ * Added a new language: Hebrew * (API) Added AsyncProfileLoadEvent * Added Talisman of the Wise +* Added Book Binder #### Changes * Massive performance improvements to holograms/armorstands From 423125a888a3eda239a7fc4d206c814984234ebc Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Mon, 25 Jan 2021 16:20:19 +0000 Subject: [PATCH 045/144] Updated pr-labels to 1.1 --- .github/workflows/pr-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 404d21641..504899091 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: WalshyDev/pr-labels@v1 + - uses: WalshyDev/pr-labels@v1.1 name: Apply labels based on branch with: token: "${{ secrets.ACCESS_TOKEN }}" From dd251fe29a3b981477efde35bccef891269573c5 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 18:30:47 +0100 Subject: [PATCH 046/144] [CI skip] Test out automatic responses --- .github/workflows/pr-labels.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 504899091..c50fe7bbc 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -12,6 +12,7 @@ jobs: steps: - uses: WalshyDev/pr-labels@v1.1 + id: labeller name: Apply labels based on branch with: token: "${{ secrets.ACCESS_TOKEN }}" @@ -19,3 +20,22 @@ jobs: fix: '✨ Fix' chore: '🧹 Chores' performance: '💡 Performance Optimization' + - uses: thollander/actions-comment-pull-request@1.0.1 + name: Comment the applied label + if: ${{ steps.labeller.outputs.applied != 0 }} + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + message: 'Your Pull Request was automatically labelled as: ${{ steps.labeller.outputs.applied }}' + - uses: thollander/actions-comment-pull-request@1.0.1 + name: Comment the applied label + if: ${{ steps.labeller.outputs.applied == 0 }} + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + message: | + **Pro Tip**: You can help us to label your Pull Request by using the following branch naming convention when you create a pull request the next time:
+ `feature/**` -> 🎈 Feature + `fix/**` -> ✨ Fix + `chore/**` -> 🧹 Chores + `performance/**` -> 💡 Performance Optimization + + If your changes do not fall into any of these categories, don't worry. You can ignore this message in that case! 👀 From 3994111a77a26ffdb86e175bc9eaa890ec419529 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 18:34:18 +0100 Subject: [PATCH 047/144] [CI skip] Updated workflow --- .github/workflows/pr-labels.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index c50fe7bbc..6a2273b83 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -2,7 +2,8 @@ name: Pull Request Labels on: pull_request: - types: [opened] + types: + - opened jobs: pr-labeler: @@ -37,5 +38,5 @@ jobs: `fix/**` -> ✨ Fix `chore/**` -> 🧹 Chores `performance/**` -> 💡 Performance Optimization - - If your changes do not fall into any of these categories, don't worry. You can ignore this message in that case! 👀 +
+ > If your changes do not fall into any of these categories, don't worry. You can ignore this message in that case! 👀 From 904cebeccbd6a6d198d56e2e58edf62c8f6b009f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 18:44:21 +0100 Subject: [PATCH 048/144] [CI skip] Exclude our other actions from this one --- .github/workflows/pr-labels.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 6a2273b83..5a874ec92 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -10,6 +10,7 @@ jobs: name: Pull Request Labels runs-on: ubuntu-latest + if: github.repository == 'Slimefun/Slimefun4' && github.actor != 'gitlocalize-app[bot]' && github.actor != 'renovate[bot]' steps: - uses: WalshyDev/pr-labels@v1.1 @@ -21,22 +22,30 @@ jobs: fix: '✨ Fix' chore: '🧹 Chores' performance: '💡 Performance Optimization' + - uses: thollander/actions-comment-pull-request@1.0.1 name: Comment the applied label if: ${{ steps.labeller.outputs.applied != 0 }} with: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - message: 'Your Pull Request was automatically labelled as: ${{ steps.labeller.outputs.applied }}' + message: | + Your Pull Request was automatically labelled as: ${{ steps.labeller.outputs.applied }} + Thank you for contributing to this project! ❤️ + - uses: thollander/actions-comment-pull-request@1.0.1 name: Comment the applied label if: ${{ steps.labeller.outputs.applied == 0 }} with: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} message: | - **Pro Tip**: You can help us to label your Pull Request by using the following branch naming convention when you create a pull request the next time:
- `feature/**` -> 🎈 Feature - `fix/**` -> ✨ Fix - `chore/**` -> 🧹 Chores - `performance/**` -> 💡 Performance Optimization -
- > If your changes do not fall into any of these categories, don't worry. You can ignore this message in that case! 👀 + **Pro Tip!** + You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️ + Branch naming convention | Label + ------------------------------ | ------ + `feature/**` | 🎈 Feature + `fix/**` | ✨ Fix + `chore/**` | 🧹 Chores + `performance/**` | 💡 Performance Optimization +


+ If your changes do not fall into any of these categories, don't worry. + You can just ignore this message in that case! 👀 From e150444c24df2ac9aebbac42771107a202a7fb16 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 18:44:52 +0100 Subject: [PATCH 049/144] [CI skip] Fixed alignment --- .github/workflows/pr-labels.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 5a874ec92..20b6429a7 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -41,11 +41,11 @@ jobs: **Pro Tip!** You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️ Branch naming convention | Label - ------------------------------ | ------ - `feature/**` | 🎈 Feature - `fix/**` | ✨ Fix - `chore/**` | 🧹 Chores - `performance/**` | 💡 Performance Optimization + ------------------------ | ------ + `feature/**` | 🎈 Feature + `fix/**` | ✨ Fix + `chore/**` | 🧹 Chores + `performance/**` | 💡 Performance Optimization
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 From d78e82cf051915ef9b531afb43c6e58ea00df43f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Jan 2021 18:47:15 +0100 Subject: [PATCH 050/144] [CI skip] Removed trailing spaces --- .github/workflows/pr-labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 20b6429a7..e392ae93e 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -39,12 +39,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} message: | **Pro Tip!** - You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️ + You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️ Branch naming convention | Label ------------------------ | ------ `feature/**` | 🎈 Feature `fix/**` | ✨ Fix - `chore/**` | 🧹 Chores + `chore/**` | 🧹 Chores `performance/**` | 💡 Performance Optimization
If your changes do not fall into any of these categories, don't worry. From 2085d9eebacd97faafec9826a33b6b55004c8ced Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 26 Jan 2021 00:56:03 +0100 Subject: [PATCH 051/144] [CI skip] Updated changelog --- CHANGELOG.md | 1 + .../slimefun4/api/player/PlayerProfile.java | 2 +- .../items/electric/machines/BookBinder.java | 47 +++++++++---------- .../listeners/TalismanListener.java | 2 +- .../abstractItems/AContainer.java | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71cd54554..318bcfb4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ * (API) Added AsyncProfileLoadEvent * Added Talisman of the Wise * Added Book Binder +* Added Tier 3 Electric Ore Grinder #### Changes * Massive performance improvements to holograms/armorstands diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java index 76ad95838..d867ac51a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java @@ -388,7 +388,7 @@ public class PlayerProfile { Bukkit.getScheduler().runTaskAsynchronously(SlimefunPlugin.instance(), () -> { AsyncProfileLoadEvent event = new AsyncProfileLoadEvent(new PlayerProfile(p)); Bukkit.getPluginManager().callEvent(event); - + SlimefunPlugin.getRegistry().getPlayerProfiles().put(uuid, event.getProfile()); callback.accept(event.getProfile()); }); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java index 82bb001ca..1052c3b57 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java @@ -23,10 +23,10 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; /** -* Represents Book Binder, a machine that binds multiple enchantments books into one. -* -* @author ProfElements -*/ + * Represents Book Binder, a machine that binds multiple enchantments books into one. + * + * @author ProfElements + */ public class BookBinder extends AContainer { private final ItemSetting bypassVanillaMaxLevel = new ItemSetting<>("bypass-vanilla-max-level", false); @@ -36,36 +36,36 @@ public class BookBinder extends AContainer { @ParametersAreNonnullByDefault public BookBinder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(category, item, recipeType, recipe); - - addItemSetting(bypassVanillaMaxLevel, hasCustomMaxLevel, customMaxLevel); + + addItemSetting(bypassVanillaMaxLevel, hasCustomMaxLevel, customMaxLevel); } @Override protected MachineRecipe findNextRecipe(BlockMenu menu) { for (int slot : getInputSlots()) { ItemStack target = menu.getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1] : getInputSlots()[0]); - ItemStack item = menu.getItemInSlot(slot); - if (isCompatible(item) && isCompatible(target)) { - + + if (isCompatible(item) && isCompatible(target)) { EnchantmentStorageMeta itemMeta = (EnchantmentStorageMeta) item.getItemMeta(); EnchantmentStorageMeta targetMeta = (EnchantmentStorageMeta) target.getItemMeta(); Map storedItemEnchantments = itemMeta.getStoredEnchants(); Map storedTargetEnchantments = targetMeta.getStoredEnchants(); Map enchantments = combineEnchantments(storedItemEnchantments, storedTargetEnchantments); - + if (enchantments.size() > 0) { ItemStack book = new ItemStack(Material.ENCHANTED_BOOK); EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) book.getItemMeta(); + for (Map.Entry entry : enchantments.entrySet()) { enchantMeta.addStoredEnchant(entry.getKey(), entry.getValue(), bypassVanillaMaxLevel.getValue()); } book.setItemMeta(enchantMeta); - - MachineRecipe recipe = new MachineRecipe(25 * (enchantments.size() / this.getSpeed()), new ItemStack[] {target, item}, new ItemStack[] {book}); + + MachineRecipe recipe = new MachineRecipe(25 * (enchantments.size() / this.getSpeed()), new ItemStack[] { target, item }, new ItemStack[] { book }); if (!InvUtils.fitAll(menu.toInventory(), recipe.getOutput(), getOutputSlots())) { return null; @@ -105,24 +105,23 @@ public class BookBinder extends AContainer { private Map combineEnchantments(Map ech1, Map ech2) { Map enchantments = new HashMap<>(); boolean conflicts = false; - enchantments.putAll(ech1); + for (Map.Entry entry : ech2.entrySet()) { for (Map.Entry conflictsWith : enchantments.entrySet()) { if (entry.getKey().conflictsWith(conflictsWith.getKey())) { - conflicts = true; + conflicts = true; } } - + if (!conflicts) { enchantments.merge(entry.getKey(), entry.getValue(), (a, b) -> { - if (a == b) { + if (a.intValue() == b.intValue()) { if (hasCustomMaxLevel.getValue()) { return a + 1 > customMaxLevel.getValue() ? customMaxLevel.getValue() : a + 1; } else { return a + 1; } - } else { int highestLevel = Math.max(a, b); @@ -131,13 +130,13 @@ public class BookBinder extends AContainer { } else { return highestLevel; } - - } - }); - } - } - return enchantments; - + } + }); + } + } + + return enchantments; + } } \ No newline at end of file diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 8cf2f71c3..5502e61b0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -256,7 +256,7 @@ public class TalismanListener implements Listener { enchantments.put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); } } - + @EventHandler(ignoreCancelled = true) public void onExperienceReceive(PlayerExpChangeEvent e) { if (e.getAmount() > 0 && Talisman.checkFor(e, SlimefunItems.TALISMAN_WISE)) { diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java index e32edf19d..077b26c8b 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java @@ -236,7 +236,7 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock, warn("The processing speed has not been configured correctly. The Item was disabled."); warn("Make sure to call '" + getClass().getSimpleName() + "#setProcessingSpeed(...)' before registering!"); } - + registerDefaultRecipes(); if (getCapacity() > 0 && getEnergyConsumption() > 0 && getSpeed() > 0) { From c2da6c5f53898711ec2d8a54e3d312d9e4a6bdbe Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 26 Jan 2021 00:57:49 +0100 Subject: [PATCH 052/144] Changed recipe for Tier 3 electric ore grinder --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 5d7e65731..0757c2931 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -1667,7 +1667,7 @@ public final class SlimefunItemSetup { .register(plugin); new ElectricOreGrinder(categories.electricity, SlimefunItems.ELECTRIC_ORE_GRINDER_3, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ELECTRIC_ORE_GRINDER_2, SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE}) + new ItemStack[] {SlimefunItems.REINFORCED_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_PLATE, null, SlimefunItems.ELECTRIC_ORE_GRINDER_2, null, SlimefunItems.REINFORCED_PLATE, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.REINFORCED_PLATE}) .setCapacity(1024) .setEnergyConsumption(45) .setProcessingSpeed(10) From 4ed7a401b903452ae71e2067949c0a7d579d0f29 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 26 Jan 2021 02:26:13 +0000 Subject: [PATCH 053/144] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.173 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 753cf0864..bb8068aea 100644 --- a/pom.xml +++ b/pom.xml @@ -387,7 +387,7 @@ com.gmail.nossr50.mcMMO mcMMO - 2.1.172 + 2.1.173 provided From 177c67d25cbef602a7114dbcbea5afd43fe2d9f7 Mon Sep 17 00:00:00 2001 From: bito-blosh Date: Tue, 26 Jan 2021 04:15:47 +0000 Subject: [PATCH 054/144] Translate researches_ja.yml via GitLocalize --- src/main/resources/languages/researches_ja.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_ja.yml b/src/main/resources/languages/researches_ja.yml index 9bd65a1bc..35c73be99 100644 --- a/src/main/resources/languages/researches_ja.yml +++ b/src/main/resources/languages/researches_ja.yml @@ -249,3 +249,4 @@ slimefun: energy_connectors: 有線接続 bee_armor: 蜂アーマー wise_talisman: 知恵のタリスマン + book_binder: エンチャントの本の製本 From 6c7b8fd9da247e4aa37f845edf44eb631c5d2e84 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 07:30:42 +0000 Subject: [PATCH 055/144] Add a way to retrieve the raw storage --- .../Slimefun/api/BlockStorage.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index 8870e9534..b5f223e41 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -360,6 +360,23 @@ public class BlockStorage { } } + @Nonnull + public Map getStorage() { + return this.storage; + } + + @Nullable + public static Map getStorage(@Nonnull World world) { + Validate.notNull(world, "World cannot be null!"); + + BlockStorage storage = getStorage(world); + if (storage != null) { + return storage.getStorage(); + } else { + return null; + } + } + public static void store(Block block, ItemStack item) { SlimefunItem sfitem = SlimefunItem.getByItem(item); From fd4073768249119c9d79c52362e83083406a522e Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 07:40:37 +0000 Subject: [PATCH 056/144] Oops --- .../java/me/mrCookieSlime/Slimefun/api/BlockStorage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index b5f223e41..6a8dfaa5a 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -27,6 +27,8 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.HumanEntity; import org.bukkit.inventory.ItemStack; +import org.apache.commons.lang.Validate; + import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -361,12 +363,12 @@ public class BlockStorage { } @Nonnull - public Map getStorage() { + public Map getStorage() { return this.storage; } @Nullable - public static Map getStorage(@Nonnull World world) { + public static Map getStorage(@Nonnull World world) { Validate.notNull(world, "World cannot be null!"); BlockStorage storage = getStorage(world); From d0e0aa3c657aeffe401813890644e3b02d7ccf5b Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 07:44:04 +0000 Subject: [PATCH 057/144] getStorage -> getRawStorage --- src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index 6a8dfaa5a..1a54e08b4 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -363,12 +363,12 @@ public class BlockStorage { } @Nonnull - public Map getStorage() { + public Map getRawStorage() { return this.storage; } @Nullable - public static Map getStorage(@Nonnull World world) { + public static Map getRawStorage(@Nonnull World world) { Validate.notNull(world, "World cannot be null!"); BlockStorage storage = getStorage(world); From 986eb38e814a8ce6b4baa3d3ef72ee65d67c7e5b Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 07:47:41 +0000 Subject: [PATCH 058/144] Whoops forgot to change this one --- src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index 1a54e08b4..20f9a04e4 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -373,7 +373,7 @@ public class BlockStorage { BlockStorage storage = getStorage(world); if (storage != null) { - return storage.getStorage(); + return storage.getRawStorage(); } else { return null; } From 1a9262983abda1b1ffa1224a7e61b5a566a4bd2f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 26 Jan 2021 09:38:15 +0100 Subject: [PATCH 059/144] [CI skip] Added API label. --- .github/workflows/pr-labels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index e392ae93e..343808518 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -22,6 +22,7 @@ jobs: fix: '✨ Fix' chore: '🧹 Chores' performance: '💡 Performance Optimization' + api: '🔧 API' - uses: thollander/actions-comment-pull-request@1.0.1 name: Comment the applied label @@ -45,6 +46,7 @@ jobs: `feature/**` | 🎈 Feature `fix/**` | ✨ Fix `chore/**` | 🧹 Chores + `api/**` | 🔧 API `performance/**` | 💡 Performance Optimization
If your changes do not fall into any of these categories, don't worry. From 9436ce451a0e77e72f275b453fd1f4928c2dd585 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 26 Jan 2021 10:07:12 +0100 Subject: [PATCH 060/144] Fixes #2460 --- CHANGELOG.md | 1 + .../items/electric/machines/BookBinder.java | 2 +- .../items/tools/ExplosiveTool.java | 35 ++++++------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 318bcfb4c..905e11673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ * Fixed #2754 * Fixed machines not respecting max size from inventories * Fixed #2761 +* Fixed #2460 ## Release Candidate 19 (11 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java index 1052c3b57..5f8355715 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/BookBinder.java @@ -106,7 +106,7 @@ public class BookBinder extends AContainer { Map enchantments = new HashMap<>(); boolean conflicts = false; enchantments.putAll(ech1); - + for (Map.Entry entry : ech2.entrySet()) { for (Map.Entry conflictsWith : enchantments.entrySet()) { if (entry.getKey().conflictsWith(conflictsWith.getKey())) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java index 9589ef7a5..da52e9750 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java @@ -3,17 +3,17 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.tools; import java.util.ArrayList; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.inventory.ItemStack; -import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem; @@ -44,6 +44,7 @@ class ExplosiveTool extends SimpleSlimefunItem implements NotPla private final ItemSetting damageOnUse = new ItemSetting<>("damage-on-use", true); private final ItemSetting callExplosionEvent = new ItemSetting<>("call-explosion-event", false); + @ParametersAreNonnullByDefault public ExplosiveTool(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(category, item, recipeType, recipe); @@ -60,11 +61,12 @@ class ExplosiveTool extends SimpleSlimefunItem implements NotPla b.getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.2F, 1F); List blocks = findBlocks(b); - breakBlocks(p, tool, b, blocks, fortune, drops); + breakBlocks(p, tool, b, blocks, drops); }; } - private void breakBlocks(Player p, ItemStack item, Block b, List blocks, int fortune, List drops) { + @ParametersAreNonnullByDefault + private void breakBlocks(Player p, ItemStack item, Block b, List blocks, List drops) { if (callExplosionEvent.getValue().booleanValue()) { BlockExplodeEvent blockExplodeEvent = new BlockExplodeEvent(b, blocks, 0); Bukkit.getServer().getPluginManager().callEvent(blockExplodeEvent); @@ -72,14 +74,14 @@ class ExplosiveTool extends SimpleSlimefunItem implements NotPla if (!blockExplodeEvent.isCancelled()) { for (Block block : blockExplodeEvent.blockList()) { if (canBreak(p, block)) { - breakBlock(p, item, block, fortune, drops); + breakBlock(p, item, block, drops); } } } } else { for (Block block : blocks) { if (canBreak(p, block)) { - breakBlock(p, item, block, fortune, drops); + breakBlock(p, item, block, drops); } } } @@ -123,7 +125,8 @@ class ExplosiveTool extends SimpleSlimefunItem implements NotPla } } - private void breakBlock(Player p, ItemStack item, Block b, int fortune, List drops) { + @ParametersAreNonnullByDefault + private void breakBlock(Player p, ItemStack item, Block b, List drops) { SlimefunPlugin.getProtectionManager().logAction(p, b, ProtectableAction.BREAK_BLOCK); Material material = b.getType(); @@ -136,24 +139,8 @@ class ExplosiveTool extends SimpleSlimefunItem implements NotPla if (handler != null && !handler.onBreak(p, b, sfItem, UnregisterReason.PLAYER_BREAK)) { drops.add(BlockStorage.retrieve(b)); } - } else if (material == Material.PLAYER_HEAD || SlimefunTag.SHULKER_BOXES.isTagged(material)) { - b.breakNaturally(item); } else { - // Check if the block was mined using Silk Touch - if (item.containsEnchantment(Enchantment.SILK_TOUCH)) { - b.getWorld().dropItemNaturally(b.getLocation(), new ItemStack(b.getType())); - } else { - boolean applyFortune = SlimefunTag.FORTUNE_COMPATIBLE_ORES.isTagged(material); - - for (ItemStack drop : b.getDrops(getItem())) { - // For some reason this check is necessary with Paper - if (drop != null && drop.getType() != Material.AIR) { - b.getWorld().dropItemNaturally(b.getLocation(), applyFortune ? new CustomItem(drop, fortune) : drop); - } - } - } - - b.setType(Material.AIR); + b.breakNaturally(item); } damageItem(p, item); From 7ffc8aff247cec96fba482eb6713fcc319a9a603 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 26 Jan 2021 10:35:47 +0100 Subject: [PATCH 061/144] Fixes #2760 --- CHANGELOG.md | 1 + .../implementation/listeners/TalismanListener.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 905e11673..a317ac00c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ * Fixed machines not respecting max size from inventories * Fixed #2761 * Fixed #2460 +* Fixed #2760 ## Release Candidate 19 (11 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 5502e61b0..445935569 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -246,13 +246,14 @@ public class TalismanListener implements Listener { // Wizard Talisman if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, SlimefunItems.TALISMAN_WIZARD)) { - - for (Enchantment enchantment : enchantments.keySet()) { - if (random.nextInt(100) < 40) { - e.getEnchantsToAdd().put(enchantment, random.nextInt(3) + 1); + // Randomly lower some enchantments + for (Map.Entry entry : enchantments.entrySet()) { + if (entry.getValue() > 1 && random.nextInt(100) < 40) { + enchantments.put(entry.getKey(), entry.getValue() - 1); } } + // Give an extra Fortune boost (Lvl 3 - 5) enchantments.put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); } } From 03cce6265dbc5afd13f2985e082d4a5bf6ea231e Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 12:55:03 +0000 Subject: [PATCH 062/144] Make it return an immutable map --- .../mrCookieSlime/Slimefun/api/BlockStorage.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index 20f9a04e4..067973cb1 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -18,6 +18,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import com.google.common.collect.ImmutableMap; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -362,18 +363,31 @@ public class BlockStorage { } } + /** + * This will return an {@link ImmutableMap} of the underline {@code Map} of + * this worlds {@link BlockStorage}. + * + * @return An {@link ImmutableMap} of the raw data. + */ @Nonnull public Map getRawStorage() { return this.storage; } + /** + * This will return an {@link ImmutableMap} of the underline {@code Map} of + * this worlds {@link BlockStorage}. If there is no registered world then this will return null. + * + * @param world The world of which to fetch the data from. + * @return An {@link ImmutableMap} of the raw data or null if the world isn't registered. + */ @Nullable public static Map getRawStorage(@Nonnull World world) { Validate.notNull(world, "World cannot be null!"); BlockStorage storage = getStorage(world); if (storage != null) { - return storage.getRawStorage(); + return ImmutableMap.copyOf(storage.getRawStorage()); } else { return null; } From f92361238838f0642a21055eca3ab8182f0f2d6c Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 12:58:14 +0000 Subject: [PATCH 063/144] oops --- src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index 067973cb1..a610736c4 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -371,7 +371,7 @@ public class BlockStorage { */ @Nonnull public Map getRawStorage() { - return this.storage; + return ImmutableMap.copyOf(this.storage); } /** @@ -387,7 +387,7 @@ public class BlockStorage { BlockStorage storage = getStorage(world); if (storage != null) { - return ImmutableMap.copyOf(storage.getRawStorage()); + return (storage.getRawStorage(); } else { return null; } From 23efc9b6f0fdf27e6e9a1986994f4ac684ab9a13 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 26 Jan 2021 13:01:07 +0000 Subject: [PATCH 064/144] REEE Im not having a good day --- src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index a610736c4..c04900fa7 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -387,7 +387,7 @@ public class BlockStorage { BlockStorage storage = getStorage(world); if (storage != null) { - return (storage.getRawStorage(); + return storage.getRawStorage(); } else { return null; } From 6df052e4cf76bb1305e03632a0aea7f66b05449e Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 12:37:13 +0100 Subject: [PATCH 065/144] Fixes #2771 --- CHANGELOG.md | 1 + .../listeners/BlockListener.java | 31 +++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a317ac00c..12c56aacb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ * Fixed #2761 * Fixed #2460 * Fixed #2760 +* Fixed #2771 ## Release Candidate 19 (11 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 82a322bee..a97cf123e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -10,7 +10,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -51,10 +50,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun; */ public class BlockListener implements Listener { - private final SlimefunPlugin plugin; - public BlockListener(@Nonnull SlimefunPlugin plugin) { - this.plugin = plugin; plugin.getServer().getPluginManager().registerEvents(this, plugin); } @@ -71,22 +67,14 @@ public class BlockListener implements Listener { if (e.getBlockReplacedState().getType().isAir()) { SlimefunItem sfItem = BlockStorage.check(block); - if (sfItem != null) { - /* - * We can move the TickerTask synchronization to an async task to - * avoid blocking the main Thread here. - */ - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - if (!SlimefunPlugin.getTickerTask().isDeletedSoon(block.getLocation())) { - for (ItemStack item : sfItem.getDrops()) { - if (item != null && !item.getType().isAir()) { - SlimefunPlugin.runSync(() -> block.getWorld().dropItemNaturally(block.getLocation(), item)); - } - } - - BlockStorage.clearBlockInfo(block); + if (sfItem != null && !SlimefunPlugin.getTickerTask().isDeletedSoon(block.getLocation())) { + for (ItemStack item : sfItem.getDrops()) { + if (item != null && !item.getType().isAir()) { + block.getWorld().dropItemNaturally(block.getLocation(), item); } - }); + } + + BlockStorage.clearBlockInfo(block); } } else if (BlockStorage.hasBlockInfo(e.getBlock())) { e.setCancelled(true); @@ -124,6 +112,11 @@ public class BlockListener implements Listener { return; } + // Ignore blocks which we have marked as deleted (Fixes #2771) + if (SlimefunPlugin.getTickerTask().isDeletedSoon(e.getBlock().getLocation())) { + return; + } + checkForSensitiveBlockAbove(e.getPlayer(), e.getBlock()); ItemStack item = e.getPlayer().getInventory().getItemInMainHand(); From 1d111772f227e090cada79daef415e1d8cbedc8c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 13:08:39 +0000 Subject: [PATCH 066/144] Translate messages_zh-TW.yml via GitLocalize --- src/main/resources/languages/messages_zh-TW.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/languages/messages_zh-TW.yml b/src/main/resources/languages/messages_zh-TW.yml index e8cf8f43d..58e8fa66c 100644 --- a/src/main/resources/languages/messages_zh-TW.yml +++ b/src/main/resources/languages/messages_zh-TW.yml @@ -318,7 +318,6 @@ languages: zh-CN: 中文(簡體) el: 希臘語 he: 希伯來語 - pt: 葡萄牙文(葡萄牙) pt-BR: 葡萄牙文(巴西) ar: 阿拉伯文 af: 南非語 @@ -331,6 +330,7 @@ languages: fa: 波斯語 th: 泰語 ro: 羅馬尼亞語 + pt: 葡萄牙文(葡萄牙) bg: 保加利亞語 ko: 韓語 tr: 土耳其 From 8399136bc1beb8957b9a370f6f553ee0017c738e Mon Sep 17 00:00:00 2001 From: HeroBrineKing Date: Thu, 28 Jan 2021 13:08:40 +0000 Subject: [PATCH 067/144] Translate messages_zh-TW.yml via GitLocalize --- src/main/resources/languages/messages_zh-TW.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_zh-TW.yml b/src/main/resources/languages/messages_zh-TW.yml index 58e8fa66c..bf5967959 100644 --- a/src/main/resources/languages/messages_zh-TW.yml +++ b/src/main/resources/languages/messages_zh-TW.yml @@ -133,6 +133,7 @@ messages: whirlwind: "&a&o你的護符反射了投射物" wizard: "&a&o你的護符為你升高了幸運等級,但也降低了其他附魔等級" caveman: "&a&o你的護符給了你挖掘加速效果" + wise: "&a&o你的護身符加倍了你得到的經驗值" soulbound-rune: fail: "&c你一次只能靈魂綁定一個物品。" success: "&a您已成功將此物品綁定靈魂!死後不會掉落。" From afb492fb3bd4eda6ccae9ceb5e9ecfb95f06e7cf Mon Sep 17 00:00:00 2001 From: HeroBrineKing Date: Thu, 28 Jan 2021 13:09:52 +0000 Subject: [PATCH 068/144] Translate researches_zh-TW.yml via GitLocalize --- src/main/resources/languages/researches_zh-TW.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/languages/researches_zh-TW.yml b/src/main/resources/languages/researches_zh-TW.yml index a1fbd7669..cb728bd43 100644 --- a/src/main/resources/languages/researches_zh-TW.yml +++ b/src/main/resources/languages/researches_zh-TW.yml @@ -248,3 +248,5 @@ slimefun: elytra_cap: 體驗動能 energy_connectors: 電線 bee_armor: 蜂裝 + wise_talisman: 智者護身符 + book_binder: 附魔書裝訂 From 2d244420a907af88b0a1a71a2f334296856af60f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 14:51:02 +0100 Subject: [PATCH 069/144] [CI skip] Added a release date --- CHANGELOG.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12c56aacb..589eaf27a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,5 @@ - - -**Table of contents** - +# Table of contents +- [Release Candidate 20 (30 Jan 2021)](#release-candidate-20-30-jan-2021) - [Release Candidate 19 (11 Jan 2021)](#release-candidate-19-11-jan-2021) - [Release Candidate 18 (03 Dec 2020)](#release-candidate-18-03-dec-2020) - [Release Candidate 17 (17 Oct 2020)](#release-candidate-17-17-oct-2020) @@ -22,9 +20,7 @@ - [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019) - [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019) - - -## Release Candidate 20 (TBD) +## Release Candidate 20 (30 Jan 2021) #### Additions * Added a new language: Bulgarian From 8cf0f61f3e4d0e1eb307045a4673be0c7bbee879 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 18:21:22 +0100 Subject: [PATCH 070/144] Added placeholder for unloaded profiles to PlaceholderAPI integration --- CHANGELOG.md | 1 + .../slimefun4/integrations/PlaceholderAPIIntegration.java | 8 ++++++++ src/main/resources/languages/messages_en.yml | 3 +++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 589eaf27a..1da11eed9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ * Fixed #2460 * Fixed #2760 * Fixed #2771 +* Fixed placeholders that did not get loaded yet not having a label ## Release Candidate 19 (11 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java index b6fa8a0cf..e5a4d9b04 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java @@ -76,6 +76,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion { if (profile.isPresent()) { Stream stream = profile.get().getResearches().stream(); return String.valueOf(stream.mapToInt(Research::getCost).sum()); + } else if (p instanceof Player) { + return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading"); } } @@ -85,6 +87,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion { if (profile.isPresent()) { Set set = profile.get().getResearches(); return String.valueOf(set.size()); + } else if (p instanceof Player) { + return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading"); } } @@ -98,6 +102,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion { if (profile.isPresent()) { Set set = profile.get().getResearches(); return String.valueOf(Math.round(((set.size() * 100.0F) / SlimefunPlugin.getRegistry().getResearches().size()) * 100.0F) / 100.0F); + } else if (p instanceof Player) { + return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading"); } } @@ -106,6 +112,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion { if (profile.isPresent()) { return profile.get().getTitle(); + } else if (p instanceof Player) { + return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading"); } } diff --git a/src/main/resources/languages/messages_en.yml b/src/main/resources/languages/messages_en.yml index fa811437a..1331bd69e 100644 --- a/src/main/resources/languages/messages_en.yml +++ b/src/main/resources/languages/messages_en.yml @@ -32,6 +32,9 @@ commands: verbose-player: '&4The verbose flag cannot be used by a Player!' unknown-flag: '&4Unknown flag: &c%flag%' +placeholderapi: + profile-loading: 'Loading...' + guide: locked: 'LOCKED' work-in-progress: 'This feature is not fully finished yet!' From 46de5a700a3543e992892aaa823d54648602f5ad Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 18:43:20 +0100 Subject: [PATCH 071/144] Little bit of refactoring --- .../core/guide/options/GuideModeOption.java | 15 ++- .../guide/options/SlimefunGuideSettings.java | 108 ++++++++++++++++-- 2 files changed, 103 insertions(+), 20 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java index 007a1d3cc..bd7506eeb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java @@ -32,7 +32,7 @@ class GuideModeOption implements SlimefunGuideOption { @Nonnull @Override public NamespacedKey getKey() { - return new NamespacedKey(SlimefunPlugin.instance(), "guide_layout"); + return new NamespacedKey(SlimefunPlugin.instance(), "guide_mode"); } @Nonnull @@ -46,25 +46,24 @@ class GuideModeOption implements SlimefunGuideOption { Optional current = getSelectedOption(p, guide); if (current.isPresent()) { - SlimefunGuideMode layout = current.get(); + SlimefunGuideMode selectedMode = current.get(); ItemStack item = new ItemStack(Material.AIR); - if (layout == SlimefunGuideMode.SURVIVAL_MODE) { + if (selectedMode == SlimefunGuideMode.SURVIVAL_MODE) { item.setType(Material.CHEST); } else { item.setType(Material.COMMAND_BLOCK); } ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(ChatColor.GRAY + "Slimefun Guide Design: " + ChatColor.YELLOW + ChatUtils.humanize(layout.name())); + meta.setDisplayName(ChatColor.GRAY + "Slimefun Guide Type: " + ChatColor.YELLOW + ChatUtils.humanize(selectedMode.name())); List lore = new ArrayList<>(); lore.add(""); - lore.add((layout == SlimefunGuideMode.SURVIVAL_MODE ? ChatColor.GREEN : ChatColor.GRAY) + "Chest"); - - lore.add((layout == SlimefunGuideMode.CHEAT_MODE ? ChatColor.GREEN : ChatColor.GRAY) + "Cheat Sheet"); + lore.add((selectedMode == SlimefunGuideMode.SURVIVAL_MODE ? ChatColor.GREEN : ChatColor.GRAY) + "Survival Mode"); + lore.add((selectedMode == SlimefunGuideMode.CHEAT_MODE ? ChatColor.GREEN : ChatColor.GRAY) + "Cheat Sheet"); lore.add(""); - lore.add(ChatColor.GRAY + "\u21E8 " + ChatColor.YELLOW + "Click to change your layout"); + lore.add(ChatColor.GRAY + "\u21E8 " + ChatColor.YELLOW + "Click to change the type"); meta.setLore(lore); item.setItemMeta(meta); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java index 250281097..6662fcb22 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java @@ -18,6 +18,8 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; import io.github.thebusybiscuit.slimefun4.core.researching.Research; +import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService; +import io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService; import io.github.thebusybiscuit.slimefun4.core.services.localization.Language; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; @@ -71,46 +73,127 @@ public final class SlimefunGuideSettings { @ParametersAreNonnullByDefault private static void addHeader(Player p, ChestMenu menu, ItemStack guide) { - menu.addItem(0, new CustomItem(SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE), "&e\u21E6 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.title"), "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide")), (pl, slot, item, action) -> { + LocalizationService locale = SlimefunPlugin.getLocalization(); + + // @formatter:off + menu.addItem(0, new CustomItem(SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE), + "&e\u21E6 " + locale.getMessage(p, "guide.back.title"), + "", + "&7" + locale.getMessage(p, "guide.back.guide") + )); + // @formatter:on + + menu.addMenuClickHandler(0, (pl, slot, item, action) -> { SlimefunGuide.openGuide(pl, guide); return false; }); + GitHubService github = SlimefunPlugin.getGitHubService(); + List contributorsLore = new ArrayList<>(); contributorsLore.add(""); - contributorsLore.addAll(SlimefunPlugin.getLocalization().getMessages(p, "guide.credits.description", msg -> msg.replace("%contributors%", String.valueOf(SlimefunPlugin.getGitHubService().getContributors().size())))); + contributorsLore.addAll(locale.getMessages(p, "guide.credits.description", msg -> msg.replace("%contributors%", String.valueOf(github.getContributors().size())))); contributorsLore.add(""); - contributorsLore.add("&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.open")); + contributorsLore.add("&7\u21E8 &e" + locale.getMessage(p, "guide.credits.open")); - menu.addItem(2, new CustomItem(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"), "&c" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.credits"), contributorsLore.toArray(new String[0])), (pl, slot, action, item) -> { + // @formatter:off + menu.addItem(2, new CustomItem(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"), + "&c" + locale.getMessage(p, "guide.title.credits"), + contributorsLore.toArray(new String[0]) + )); + // @formatter:on + + menu.addMenuClickHandler(2, (pl, slot, action, item) -> { ContributorsMenu.open(pl, 0); return false; }); - menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK, ChatColor.GREEN + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.versions"), "&7&o" + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.versions-notice"), "", "&fMinecraft: &a" + Bukkit.getBukkitVersion(), "&fSlimefun: &a" + SlimefunPlugin.getVersion()), ChestMenuUtils.getEmptyClickHandler()); + // @formatter:off + menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK, + ChatColor.GREEN + locale.getMessage(p, "guide.title.versions"), + "&7&o" + locale.getMessage(p, "guide.tooltips.versions-notice"), + "", + "&fMinecraft: &a" + Bukkit.getBukkitVersion(), + "&fSlimefun: &a" + SlimefunPlugin.getVersion()), + ChestMenuUtils.getEmptyClickHandler() + ); + // @formatter:on + + // @formatter:off + menu.addItem(6, new CustomItem(Material.COMPARATOR, + "&e" + locale.getMessage(p, "guide.title.source"), + "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(github.getLastUpdate()) + " ago", + "&7Forks: &e" + github.getForks(), + "&7Stars: &e" + github.getStars(), + "", + "&7&oSlimefun 4 is a community project,", + "&7&othe source code is available on GitHub", + "&7&oand if you want to keep this Plugin alive,", + "&7&othen please consider contributing to it", + "", + "&7\u21E8 &eClick to go to GitHub" + )); + // @formatter:on - menu.addItem(6, - new CustomItem(Material.COMPARATOR, "&e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.source"), "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(SlimefunPlugin.getGitHubService().getLastUpdate()) + " ago", "&7Forks: &e" + SlimefunPlugin.getGitHubService().getForks(), "&7Stars: &e" + SlimefunPlugin.getGitHubService().getStars(), "", "&7&oSlimefun 4 is a community project,", "&7&othe source code is available on GitHub", "&7&oand if you want to keep this Plugin alive,", "&7&othen please consider contributing to it", "", "&7\u21E8 &eClick to go to GitHub")); menu.addMenuClickHandler(6, (pl, slot, item, action) -> { pl.closeInventory(); ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4"); return false; }); - menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, "&3" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.wiki"), "", "&7Do you need help with an Item or machine?", "&7You cannot figure out what to do?", "&7Check out our community-maintained Wiki", "&7and become one of our Editors!", "", "&7\u21E8 &eClick to go to the official Slimefun Wiki"), (pl, slot, item, action) -> { + // @formatter:off + menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, + "&3" + locale.getMessage(p, "guide.title.wiki"), + "", "&7Do you need help with an Item or machine?", + "&7You cannot figure out what to do?", + "&7Check out our community-maintained Wiki", + "&7and become one of our Editors!", + "", + "&7\u21E8 &eClick to go to the official Slimefun Wiki" + )); + // @formatter:on + + menu.addMenuClickHandler(8, (pl, slot, item, action) -> { pl.closeInventory(); ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/wiki"); return false; }); - menu.addItem(47, new CustomItem(Material.BOOKSHELF, "&3" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.addons"), "", "&7Slimefun is huge. But its addons are what makes", "&7this plugin truly shine. Go check them out, some", "&7of them may be exactly what you were missing out on!", "", "&7Installed on this Server: &b" + SlimefunPlugin.getInstalledAddons().size(), "", "&7\u21E8 &eClick to see all available Addons for Slimefun4"), (pl, slot, item, action) -> { + // @formatter:off + menu.addItem(47, new CustomItem(Material.BOOKSHELF, + "&3" + locale.getMessage(p, "guide.title.addons"), + "", + "&7Slimefun is huge. But its addons are what makes", + "&7this plugin truly shine. Go check them out, some", + "&7of them may be exactly what you were missing out on!", + "", + "&7Installed on this Server: &b" + SlimefunPlugin.getInstalledAddons().size(), + "", + "&7\u21E8 &eClick to see all available addons for Slimefun4" + )); + // @formatter:on + + menu.addMenuClickHandler(47, (pl, slot, item, action) -> { pl.closeInventory(); ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/wiki/Addons"); return false; }); if (SlimefunPlugin.getUpdater().getBranch().isOfficial()) { - menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH, "&4" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.bugs"), "", "&7&oBug reports have to be made in English!", "", "&7Open Issues: &a" + SlimefunPlugin.getGitHubService().getOpenIssues(), "&7Pending Pull Requests: &a" + SlimefunPlugin.getGitHubService().getPendingPullRequests(), "", "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker"), (pl, slot, item, action) -> { + // @formatter:off + menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH, + "&4" + locale.getMessage(p, "guide.title.bugs"), + "", + "&7&oBug reports have to be made in English!", + "", + "&7Open Issues: &a" + github.getOpenIssues(), + "&7Pending Pull Requests: &a" + github.getPendingPullRequests(), + "", + "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker" + )); + // @formatter:on + + menu.addMenuClickHandler(49, (pl, slot, item, action) -> { pl.closeInventory(); ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/issues"); return false; @@ -119,7 +202,7 @@ public final class SlimefunGuideSettings { menu.addItem(49, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler()); } - menu.addItem(51, new CustomItem(Material.TOTEM_OF_UNDYING, ChatColor.RED + SlimefunPlugin.getLocalization().getMessage(p, "guide.work-in-progress")), (pl, slot, item, action) -> { + menu.addItem(51, new CustomItem(Material.TOTEM_OF_UNDYING, ChatColor.RED + locale.getMessage(p, "guide.work-in-progress")), (pl, slot, item, action) -> { // Add something here return false; }); @@ -158,7 +241,8 @@ public final class SlimefunGuideSettings { for (SlimefunGuideOption option : options) { if (option instanceof FireworksOption) { FireworksOption fireworks = (FireworksOption) option; - return fireworks.getSelectedOption(p, SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE)).orElse(true); + ItemStack guide = SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE); + return fireworks.getSelectedOption(p, guide).orElse(true); } } From 835e8fa3848544841b1e1b4a383148b8f1fa9e19 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 17:55:09 +0000 Subject: [PATCH 072/144] Translate messages_ja.yml via GitLocalize --- src/main/resources/languages/messages_ja.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/languages/messages_ja.yml b/src/main/resources/languages/messages_ja.yml index c97fa1104..dcb0c61dc 100644 --- a/src/main/resources/languages/messages_ja.yml +++ b/src/main/resources/languages/messages_ja.yml @@ -319,7 +319,7 @@ languages: zh-CN: 中国語(中国) el: ギリシャ語 he: ヘブライ語 - pt-BR: ポルトガル語(ブラジル) + pt: ポルトガル語(ポルトガル) ar: アラビア語 af: アフリカーンス語 da: デンマーク語 @@ -331,7 +331,7 @@ languages: fa: ペルシア語 th: タイ語 ro: ルーマニア語 - pt: ポルトガル語(ポルトガル) + pt-BR: ポルトガル語(ブラジル) bg: ブルガリア語 ko: 韓国語 tr: トルコ語 From 1c404d7f6623cdc1cad906514d2cc27ebffca781 Mon Sep 17 00:00:00 2001 From: bito-blosh Date: Thu, 28 Jan 2021 17:55:10 +0000 Subject: [PATCH 073/144] Translate messages_ja.yml via GitLocalize --- src/main/resources/languages/messages_ja.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/languages/messages_ja.yml b/src/main/resources/languages/messages_ja.yml index dcb0c61dc..f01c7711e 100644 --- a/src/main/resources/languages/messages_ja.yml +++ b/src/main/resources/languages/messages_ja.yml @@ -350,3 +350,5 @@ cauldron: no-discoloring: "&4Slimefunアイテムの脱色はできません" miner: no-ores: "&e周辺には鉱石が見つかりませんでした!" +placeholderapi: + profile-loading: ロード中… From 6505b1c6247e26a5a8bca5573ed048812eb73a61 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Thu, 28 Jan 2021 21:28:58 +0000 Subject: [PATCH 074/144] Translate messages_bg.yml via GitLocalize --- src/main/resources/languages/messages_bg.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/languages/messages_bg.yml b/src/main/resources/languages/messages_bg.yml index 699fa7f3c..7da9bb3b5 100644 --- a/src/main/resources/languages/messages_bg.yml +++ b/src/main/resources/languages/messages_bg.yml @@ -370,3 +370,5 @@ cartography_table: not-working: "&4Не може да използвате Slimefun предмети в картографска маса!" cauldron: no-discoloring: "&4Не можете да обезцветявате Slimefun брони" +placeholderapi: + profile-loading: Зареждане... From 5aeffb3dd68569a64861a620c4ce6da23a0e7056 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 28 Jan 2021 21:39:41 +0000 Subject: [PATCH 075/144] Update dependency com.github.seeseemelk:MockBukkit-v1.16 to v0.22.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bb8068aea..8bd654cfd 100644 --- a/pom.xml +++ b/pom.xml @@ -321,7 +321,7 @@ com.github.seeseemelk MockBukkit-v1.16 - 0.21.0 + 0.22.1 test From a827df19a7890cd03b9817c5dad845e481d376be Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 28 Jan 2021 23:17:56 +0100 Subject: [PATCH 076/144] [CI skip] Small style change --- .github/workflows/pr-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 343808518..43608e463 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -30,7 +30,7 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} message: | - Your Pull Request was automatically labelled as: ${{ steps.labeller.outputs.applied }} + Your Pull Request was automatically labelled as: "${{ steps.labeller.outputs.applied }}" Thank you for contributing to this project! ❤️ - uses: thollander/actions-comment-pull-request@1.0.1 From 3c0afeb943b073646746623ced390af8577865f4 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 02:47:20 +0100 Subject: [PATCH 077/144] Small fix --- .../slimefun4/integrations/PlaceholderAPIIntegration.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java index e5a4d9b04..354902c4e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java @@ -62,7 +62,12 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion { private boolean isPlaceholder(@Nullable OfflinePlayer p, boolean requiresProfile, @Nonnull String params, @Nonnull String placeholder) { if (requiresProfile) { - return p != null && placeholder.equals(params) && PlayerProfile.request(p); + if (p != null && placeholder.equals(params)) { + PlayerProfile.request(p); + return true; + } else { + return false; + } } else { return placeholder.equals(params); } From ee7786b8e4122ca4e897750d1027b6607fd7fee4 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 03:02:50 +0100 Subject: [PATCH 078/144] Allow Talismans to use the Actionbar --- CHANGELOG.md | 1 + .../slimefun4/core/SlimefunRegistry.java | 7 ++ .../localization/SlimefunLocalization.java | 11 ++++ .../implementation/SlimefunPlugin.java | 11 +--- .../items/magical/talismans/Talisman.java | 66 ++++++++++++------- src/main/resources/config.yml | 5 +- 6 files changed, 64 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da11eed9..324d58f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ * Added Talisman of the Wise * Added Book Binder * Added Tier 3 Electric Ore Grinder +* Added an option to allow Talismans to send their notifications via the Actionbar #### Changes * Massive performance improvements to holograms/armorstands diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java index e282c31af..a12e4b00c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java @@ -64,12 +64,14 @@ public final class SlimefunRegistry { private final List researchRanks = new ArrayList<>(); private final Set researchingPlayers = Collections.synchronizedSet(new HashSet<>()); + // TODO: Move this all into a proper "config cache" class private boolean backwardsCompatibility; private boolean automaticallyLoadItems; private boolean enableResearches; private boolean freeCreativeResearches; private boolean researchFireworks; private boolean logDuplicateBlockEntries; + private boolean talismanActionBarMessages; private final Set tickers = new HashSet<>(); private final Set radioactive = new HashSet<>(); @@ -110,6 +112,7 @@ public final class SlimefunRegistry { freeCreativeResearches = cfg.getBoolean("researches.free-in-creative-mode"); researchFireworks = cfg.getBoolean("researches.enable-fireworks"); logDuplicateBlockEntries = cfg.getBoolean("options.log-duplicate-block-entries"); + talismanActionBarMessages = cfg.getBoolean("talismans.use-actionbar"); } /** @@ -353,6 +356,10 @@ public final class SlimefunRegistry { public boolean logDuplicateBlockEntries() { return logDuplicateBlockEntries; } + + public boolean useActionbarForTalismans() { + return talismanActionBarMessages; + } @Nonnull public NamespacedKey getSoulboundDataKey() { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java index 79523c45a..86fce5529 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java @@ -26,6 +26,9 @@ import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch; import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Lists.RecipeType; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.TextComponent; /** * This is an abstract parent class of {@link LocalizationService}. @@ -225,6 +228,14 @@ public abstract class SlimefunLocalization extends Localization implements Keyed } } + public void sendActionbarMessage(@Nonnull Player player, @Nonnull String key, boolean addPrefix) { + String prefix = addPrefix ? getPrefix() : ""; + String message = ChatColors.color(prefix + getMessage(player, key)); + + BaseComponent[] components = TextComponent.fromLegacyText(message); + player.spigot().sendMessage(ChatMessageType.ACTION_BAR, components); + } + @Override public void sendMessage(CommandSender sender, String key) { sendMessage(sender, key, true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index 74c51bbe4..f4171ad92 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -619,6 +619,8 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { new ButcherAndroidListener(this); new NetworkListener(this, networkManager); new HopperListener(this); + new TalismanListener(this); + new SoulboundListener(this); // Bees were added in 1.15 if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { @@ -640,15 +642,6 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { bowListener.register(this); backpackListener.register(this); - // Toggleable Listeners for performance reasons - if (config.getBoolean("items.talismans")) { - new TalismanListener(this); - } - - if (config.getBoolean("items.soulbound")) { - new SoulboundListener(this); - } - // Handle Slimefun Guide being given on Join new SlimefunGuideListener(this, config.getBoolean("guide.receive-on-first-join")); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java index 203ee5b74..a66ba616e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java @@ -113,10 +113,6 @@ public class Talisman extends SlimefunItem { return effects; } - protected String getMessageSuffix() { - return suffix; - } - protected boolean isEventCancelled() { return cancel; } @@ -147,10 +143,6 @@ public class Talisman extends SlimefunItem { } } - private static boolean hasMessage(@Nonnull Talisman talisman) { - return talisman.getMessageSuffix() != null; - } - @ParametersAreNonnullByDefault public static boolean checkFor(Event e, SlimefunItemStack stack) { return checkFor(e, stack.getItem()); @@ -202,7 +194,23 @@ public class Talisman extends SlimefunItem { consumeItem(inv, talisman, talismanItem); applyTalismanEffects(p, talisman); cancelEvent(e, talisman); - sendMessage(p, talisman); + talisman.sendMessage(p); + } + + @ParametersAreNonnullByDefault + private static void consumeItem(Inventory inv, Talisman talisman, ItemStack talismanItem) { + if (talisman.isConsumable()) { + ItemStack[] contents = inv.getContents(); + + for (int i = 0; i < contents.length; i++) { + ItemStack item = contents[i]; + + if (SlimefunUtils.isItemSimilar(item, talismanItem, true, false)) { + ItemUtils.consumeItem(item, false); + return; + } + } + } } @ParametersAreNonnullByDefault @@ -219,29 +227,37 @@ public class Talisman extends SlimefunItem { } } - @ParametersAreNonnullByDefault - private static void sendMessage(Player p, Talisman talisman) { - if (hasMessage(talisman)) { - SlimefunPlugin.getLocalization().sendMessage(p, "messages.talisman." + talisman.getMessageSuffix(), true); - } + /** + * This returns whether the {@link Talisman} is silent. + * A silent {@link Talisman} will not send a message to a {@link Player} + * when activated. + * + * @return Whether this {@link Talisman} is silent + */ + public boolean isSilent() { + return getMessageSuffix() == null; + } + + @Nullable + protected final String getMessageSuffix() { + return suffix; } @ParametersAreNonnullByDefault - private static void consumeItem(Inventory inv, Talisman talisman, ItemStack talismanItem) { - if (talisman.isConsumable()) { - ItemStack[] contents = inv.getContents(); - for (int i = 0; i < contents.length; i++) { - ItemStack item = contents[i]; + private void sendMessage(Player p) { + if (!isSilent()) { + String messageKey = "messages.talisman." + getMessageSuffix(); - if (SlimefunUtils.isItemSimilar(item, talismanItem, true, false)) { - ItemUtils.consumeItem(item, false); - return; - } + if (SlimefunPlugin.getRegistry().useActionbarForTalismans()) { + SlimefunPlugin.getLocalization().sendActionbarMessage(p, messageKey, false); + } else { + SlimefunPlugin.getLocalization().sendMessage(p, messageKey, true); } } } - private static Player getPlayerByEventType(Event e) { + @Nullable + private static Player getPlayerByEventType(@Nonnull Event e) { if (e instanceof EntityDeathEvent) { return ((EntityDeathEvent) e).getEntity().getKiller(); } else if (e instanceof BlockBreakEvent) { @@ -259,7 +275,7 @@ public class Talisman extends SlimefunItem { return null; } - private static boolean pass(Player p, SlimefunItem talisman) { + private static boolean pass(@Nonnull Player p, @Nonnull SlimefunItem talisman) { for (PotionEffect effect : ((Talisman) talisman).getEffects()) { if (effect != null && p.hasPotionEffect(effect.getType())) { return false; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 84aff21b3..a0f9cd53a 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -38,9 +38,8 @@ networks: enable-visualizer: true delete-excess-items: false -items: - talismans: true - soulbound: true +talismans: + use-actionbar: true metrics: auto-update: true From a031585b5ada54fedf14996aa5979391751fb677 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Fri, 29 Jan 2021 12:09:24 +0800 Subject: [PATCH 079/144] fix: thank you idea --- .../listeners/TalismanListener.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 66aa9ed25..e73ae37d3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -10,7 +10,14 @@ import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.*; +import org.bukkit.entity.AbstractArrow; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.ChestedHorse; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Trident; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -32,7 +39,11 @@ import org.bukkit.util.Vector; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Random; import java.util.concurrent.ThreadLocalRandom; public class TalismanListener implements Listener { From 29b368f6484a842ce9571e8356c3ebef5d8daf5f Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Fri, 29 Jan 2021 12:13:24 +0800 Subject: [PATCH 080/144] fix: shadow name --- .../slimefun4/implementation/listeners/TalismanListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 50c6836be..6a5a04292 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -250,9 +250,9 @@ public class TalismanListener implements Listener { // Wizard Talisman if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, SlimefunItems.TALISMAN_WIZARD)) { - for (Enchantment enchantment : enchantments.keySet()) { + for (Enchantment enchant : enchantments.keySet()) { if (random.nextInt(100) < 40) { - e.getEnchantsToAdd().put(enchantment, random.nextInt(3) + 1); + e.getEnchantsToAdd().put(enchant, random.nextInt(3) + 1); } } From 38d959d44cdd7adce2ec824bcf0c729c05c4185e Mon Sep 17 00:00:00 2001 From: nahkd123 Date: Fri, 29 Jan 2021 08:20:40 +0000 Subject: [PATCH 081/144] Translate messages_vi.yml via GitLocalize --- src/main/resources/languages/messages_vi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/languages/messages_vi.yml b/src/main/resources/languages/messages_vi.yml index a889cff2d..5090176cc 100644 --- a/src/main/resources/languages/messages_vi.yml +++ b/src/main/resources/languages/messages_vi.yml @@ -26,8 +26,8 @@ commands: not-rechargeable: Vật phẩm này không thể sạc được! timings: description: Độ trễ của slimefun và addon của nó - verbose-player: "&4Cờ dài này không thể sử dụng bới Người chơi!" please-wait: "&eVui lòng đợi một chút... Kết quả chuẩn bị đến!" + verbose-player: "&4Cờ dài này không thể sử dụng bới Người chơi!" unknown-flag: "&4Không rõ cờ: &c%flag%" guide: search: From 5ba1eaadff4da0f8c0729d8737309f5a74f309c2 Mon Sep 17 00:00:00 2001 From: Just Mango Date: Fri, 29 Jan 2021 08:20:41 +0000 Subject: [PATCH 082/144] Translate messages_vi.yml via GitLocalize --- src/main/resources/languages/messages_vi.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/languages/messages_vi.yml b/src/main/resources/languages/messages_vi.yml index 5090176cc..f78002beb 100644 --- a/src/main/resources/languages/messages_vi.yml +++ b/src/main/resources/languages/messages_vi.yml @@ -138,6 +138,7 @@ messages: wizard: "&a&oBùa hộ mệnh của bạn đã cho bạn một Cấp độ may mắn tốt hơn nhưng cũng có thể hạ thấp một số Cấp độ phù phép khác" caveman: "&a&oBùa ma thuật của bạn cho bạn hiệu ứng Đào nhanh" + wise: "&a&oBùa ma thuật đã nhân đôi số kinh nghiệm của bạn" soulbound-rune: fail: "&cBạn chỉ có thể liên kết một vật phẩm với linh hồn của bạn trong cùng một thời điểm." @@ -375,3 +376,5 @@ cauldron: no-discoloring: "&4Bạn không thể đổi màu giáp của Slimefun" miner: no-ores: "&eXin lỗi, tôi không thể tìm bất kì Khoáng sản nào xung quanh!" +placeholderapi: + profile-loading: Đang tải... From a7bf430183350eb258ab81a1e7e0aa19ce5ea32a Mon Sep 17 00:00:00 2001 From: Just Mango Date: Fri, 29 Jan 2021 08:20:43 +0000 Subject: [PATCH 083/144] Translate researches_vi.yml via GitLocalize --- src/main/resources/languages/researches_vi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/languages/researches_vi.yml b/src/main/resources/languages/researches_vi.yml index e6259c773..c920b3499 100644 --- a/src/main/resources/languages/researches_vi.yml +++ b/src/main/resources/languages/researches_vi.yml @@ -248,3 +248,5 @@ slimefun: elytra_cap: Mũ lượn energy_connectors: Đầu nối bee_armor: Giáp ong + wise_talisman: Bùa ma thuật của sự Tinh Khôn + book_binder: Sách phù phép Ràng Buộc From fed59258920a0fcda0b6263e5d78c16b4b333f4c Mon Sep 17 00:00:00 2001 From: Jiejue233 Date: Fri, 29 Jan 2021 08:22:15 +0000 Subject: [PATCH 084/144] Translate researches_zh-CN.yml via GitLocalize --- src/main/resources/languages/researches_zh-CN.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_zh-CN.yml b/src/main/resources/languages/researches_zh-CN.yml index 12899cf16..302ba9d67 100644 --- a/src/main/resources/languages/researches_zh-CN.yml +++ b/src/main/resources/languages/researches_zh-CN.yml @@ -249,3 +249,4 @@ slimefun: energy_connectors: 有线连接 bee_armor: 蜜蜂服 wise_talisman: 智者的护身符 + book_binder: 附魔融合 From 9e6c24a46a994174aed657068766ac4a11e726ce Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 29 Jan 2021 08:22:17 +0000 Subject: [PATCH 085/144] Translate messages_zh-CN.yml via GitLocalize --- src/main/resources/languages/messages_zh-CN.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/languages/messages_zh-CN.yml b/src/main/resources/languages/messages_zh-CN.yml index 3d8453412..08ef7fbee 100644 --- a/src/main/resources/languages/messages_zh-CN.yml +++ b/src/main/resources/languages/messages_zh-CN.yml @@ -319,6 +319,7 @@ languages: zh-CN: 简体中文 (中国) el: 希腊语 he: 希伯来语 + pt: 葡萄牙语 (葡萄牙) ar: 阿拉伯语 af: 南非语 da: 丹麦语 @@ -330,7 +331,6 @@ languages: fa: 波斯语 th: 泰语 ro: 罗马尼亚语 - pt: 葡萄牙语 (葡萄牙) pt-BR: 葡萄牙语 (巴西) bg: 保加利亚语 ko: 韩语 @@ -350,3 +350,5 @@ cauldron: no-discoloring: "&4你不能用炼药锅洗去 Slimefun 物品的颜色" miner: no-ores: "&e抱歉, 周围找不到矿石了!" +placeholderapi: + profile-loading: 加载中... From 6c41fabaca632c14d852be9f52bc06f015ca68ed Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 08:22:18 +0000 Subject: [PATCH 086/144] Translate messages_zh-CN.yml via GitLocalize From 24d0a87fe0f34dff1b3cd80f5440ec09c98104e5 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 09:23:47 +0100 Subject: [PATCH 087/144] [CI skip] Updated translators list --- .../slimefun4/core/services/localization/Translators.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java index 1861c7ed8..c5461e689 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java @@ -124,6 +124,7 @@ public class Translators { addTranslator("StarWishsama", "StarWish_Sama", SupportedLanguage.CHINESE_CHINA, false); addTranslator("Rothes", SupportedLanguage.CHINESE_CHINA, true); addTranslator("Chihsiao", SupportedLanguage.CHINESE_CHINA, true); + addTranslator("Jiejue233", SupportedLanguage.CHINESE_CHINA, true); // Translators - Chinese (Taiwan) addTranslator("BrineYT", "HeroBrineKing", SupportedLanguage.CHINESE_TAIWAN, true); From 107e9bb9a20af748c7849a333bbafe4991d5c94b Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 08:43:22 +0000 Subject: [PATCH 088/144] Translate messages_zh-TW.yml via GitLocalize From 76d4c1362dd1dfc6e6ffe4854c4f1fd6e846e4a6 Mon Sep 17 00:00:00 2001 From: HeroBrineKing Date: Fri, 29 Jan 2021 08:43:23 +0000 Subject: [PATCH 089/144] Translate messages_zh-TW.yml via GitLocalize --- src/main/resources/languages/messages_zh-TW.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/languages/messages_zh-TW.yml b/src/main/resources/languages/messages_zh-TW.yml index bf5967959..c3cdb0be1 100644 --- a/src/main/resources/languages/messages_zh-TW.yml +++ b/src/main/resources/languages/messages_zh-TW.yml @@ -350,3 +350,5 @@ cauldron: no-discoloring: "&4你不能把 Slimefun 裝備的顏色消除!" miner: no-ores: "&e附近沒礦了!" +placeholderapi: + profile-loading: 載入中…… From d1b907dc029a4847a45e55881147c985072ad003 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 10:51:04 +0000 Subject: [PATCH 090/144] Translate researches_de.yml via GitLocalize --- src/main/resources/languages/researches_de.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_de.yml b/src/main/resources/languages/researches_de.yml index e934cddbb..c8f40955e 100644 --- a/src/main/resources/languages/researches_de.yml +++ b/src/main/resources/languages/researches_de.yml @@ -249,3 +249,4 @@ slimefun: energy_connectors: Kupferkabel bee_armor: Bienen-Rüstung wise_talisman: Stein der Weisen + book_binder: Verzaubertes Bücherbinden From f207601244ceaa8d209d8b76fca1c6c78adca5b5 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 10:51:06 +0000 Subject: [PATCH 091/144] Translate messages_de.yml via GitLocalize --- src/main/resources/languages/messages_de.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/languages/messages_de.yml b/src/main/resources/languages/messages_de.yml index 6853972c2..86aaf9a9c 100644 --- a/src/main/resources/languages/messages_de.yml +++ b/src/main/resources/languages/messages_de.yml @@ -342,7 +342,6 @@ languages: zh-CN: Chinesisch (China) el: Griechisch he: Hebräisch - pt: Portugiesisch (Portugal) pt-BR: Portugiesisch (Brasilien) ar: Arabisch af: Afrikaans @@ -355,6 +354,7 @@ languages: fa: Persisch th: Thailändisch ro: Rumänisch + pt: Portugiesisch (Portugal) bg: Bulgarisch ko: Koreanisch tr: Türkisch @@ -373,3 +373,5 @@ cauldron: no-discoloring: "&4Du kannst Slimefun-Rüstung nicht entfärben" miner: no-ores: "&eIch konnte leider keine Erze in der Nähe finden!" +placeholderapi: + profile-loading: Lade... From a80269b7d90e26e631a6ce68c67637541c9b7f1d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 12:19:40 +0100 Subject: [PATCH 092/144] [CI skip] Formatting --- .../networks/cargo/AbstractItemNetwork.java | 16 +-- .../core/networks/cargo/CargoNet.java | 62 +++++----- .../core/networks/cargo/CargoUtils.java | 26 ++--- .../core/networks/energy/EnergyNet.java | 46 ++++---- .../core/services/BlockDataService.java | 46 ++++---- .../items/androids/ButcherAndroid.java | 28 ++--- .../items/androids/FarmerAndroid.java | 32 ++--- .../items/androids/ProgrammableAndroid.java | 110 +++++++++--------- .../items/electric/gadgets/MultiTool.java | 16 +-- .../items/electric/reactors/Reactor.java | 36 +++--- .../multiblocks/miner/IndustrialMiner.java | 30 ++--- .../items/weapons/SwordOfBeheading.java | 62 +++++----- .../implementation/resources/OilResource.java | 86 +++++++------- .../resources/SaltResource.java | 48 ++++---- .../Inventory/Item/CustomItemSerializer.java | 78 ++++++------- .../Slimefun/api/BlockStorage.java | 3 +- .../testing/tests/utils/TestChargeUtils.java | 10 +- 17 files changed, 368 insertions(+), 367 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java index 210125e80..3216b0bd5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java @@ -115,14 +115,14 @@ abstract class AbstractItemNetwork extends Network { if (menu != null) { switch (request.getDirection()) { - case INSERT: - distributeInsertionRequest(inventories, request, menu, iterator, destinations); - break; - case WITHDRAW: - collectExtractionRequest(inventories, request, menu, iterator, providers); - break; - default: - break; + case INSERT: + distributeInsertionRequest(inventories, request, menu, iterator, destinations); + break; + case WITHDRAW: + collectExtractionRequest(inventories, request, menu, iterator, providers); + break; + default: + break; } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java index 9efb04778..debf7618f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java @@ -92,19 +92,19 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner { } switch (id) { - case "CARGO_MANAGER": - return NetworkComponent.REGULATOR; - case "CARGO_NODE": - return NetworkComponent.CONNECTOR; - case "CARGO_NODE_INPUT": - case "CARGO_NODE_OUTPUT": - case "CARGO_NODE_OUTPUT_ADVANCED": - case "CT_IMPORT_BUS": - case "CT_EXPORT_BUS": - case "CHEST_TERMINAL": - return NetworkComponent.TERMINUS; - default: - return null; + case "CARGO_MANAGER": + return NetworkComponent.REGULATOR; + case "CARGO_NODE": + return NetworkComponent.CONNECTOR; + case "CARGO_NODE_INPUT": + case "CARGO_NODE_OUTPUT": + case "CARGO_NODE_OUTPUT_ADVANCED": + case "CT_IMPORT_BUS": + case "CT_EXPORT_BUS": + case "CHEST_TERMINAL": + return NetworkComponent.TERMINUS; + default: + return null; } } @@ -123,24 +123,24 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner { if (to == NetworkComponent.TERMINUS) { String id = BlockStorage.checkID(l); switch (id) { - case "CARGO_NODE_INPUT": - inputNodes.add(l); - break; - case "CARGO_NODE_OUTPUT": - case "CARGO_NODE_OUTPUT_ADVANCED": - outputNodes.add(l); - break; - case "CHEST_TERMINAL": - terminals.add(l); - break; - case "CT_IMPORT_BUS": - imports.add(l); - break; - case "CT_EXPORT_BUS": - exports.add(l); - break; - default: - break; + case "CARGO_NODE_INPUT": + inputNodes.add(l); + break; + case "CARGO_NODE_OUTPUT": + case "CARGO_NODE_OUTPUT_ADVANCED": + outputNodes.add(l); + break; + case "CHEST_TERMINAL": + terminals.add(l); + break; + case "CT_IMPORT_BUS": + imports.add(l); + break; + case "CT_EXPORT_BUS": + exports.add(l); + break; + default: + break; } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java index 69f993a0c..2740f5b8e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java @@ -68,19 +68,19 @@ final class CargoUtils { Material type = block.getType(); switch (type) { - case CHEST: - case TRAPPED_CHEST: - case FURNACE: - case DISPENSER: - case DROPPER: - case HOPPER: - case BREWING_STAND: - case BARREL: - case BLAST_FURNACE: - case SMOKER: - return true; - default: - return SlimefunTag.SHULKER_BOXES.isTagged(type); + case CHEST: + case TRAPPED_CHEST: + case FURNACE: + case DISPENSER: + case DROPPER: + case HOPPER: + case BREWING_STAND: + case BARREL: + case BLAST_FURNACE: + case SMOKER: + return true; + default: + return SlimefunTag.SHULKER_BOXES.isTagged(type); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java index 0be2f59db..d91e4c2b6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java @@ -75,14 +75,14 @@ public class EnergyNet extends Network implements HologramOwner { return null; } else { switch (component.getEnergyComponentType()) { - case CONNECTOR: - case CAPACITOR: - return NetworkComponent.CONNECTOR; - case CONSUMER: - case GENERATOR: - return NetworkComponent.TERMINUS; - default: - return null; + case CONNECTOR: + case CAPACITOR: + return NetworkComponent.CONNECTOR; + case CONSUMER: + case GENERATOR: + return NetworkComponent.TERMINUS; + default: + return null; } } } @@ -98,21 +98,21 @@ public class EnergyNet extends Network implements HologramOwner { if (component != null) { switch (component.getEnergyComponentType()) { - case CAPACITOR: - capacitors.put(l, component); - break; - case CONSUMER: - consumers.put(l, component); - break; - case GENERATOR: - if (component instanceof EnergyNetProvider) { - generators.put(l, (EnergyNetProvider) component); - } else if (component instanceof SlimefunItem) { - ((SlimefunItem) component).warn("This Item is marked as a GENERATOR but does not implement the interface EnergyNetProvider!"); - } - break; - default: - break; + case CAPACITOR: + capacitors.put(l, component); + break; + case CONSUMER: + consumers.put(l, component); + break; + case GENERATOR: + if (component instanceof EnergyNetProvider) { + generators.put(l, (EnergyNetProvider) component); + } else if (component instanceof SlimefunItem) { + ((SlimefunItem) component).warn("This Item is marked as a GENERATOR but does not implement the interface EnergyNetProvider!"); + } + break; + default: + break; } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java index c525d312e..462ec8f04 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java @@ -138,29 +138,29 @@ public class BlockDataService implements Keyed { } switch (type) { - case PLAYER_HEAD: - case PLAYER_WALL_HEAD: - case CHEST: - case DISPENSER: - case BREWING_STAND: - case DROPPER: - case FURNACE: - case BLAST_FURNACE: - case HOPPER: - case LECTERN: - case JUKEBOX: - case ENDER_CHEST: - case ENCHANTING_TABLE: - case DAYLIGHT_DETECTOR: - case SMOKER: - case BARREL: - case SPAWNER: - case BEACON: - // All of the above Materials are Tile Entities - return true; - default: - // Otherwise we assume they're not Tile Entities - return false; + case PLAYER_HEAD: + case PLAYER_WALL_HEAD: + case CHEST: + case DISPENSER: + case BREWING_STAND: + case DROPPER: + case FURNACE: + case BLAST_FURNACE: + case HOPPER: + case LECTERN: + case JUKEBOX: + case ENDER_CHEST: + case ENCHANTING_TABLE: + case DAYLIGHT_DETECTOR: + case SMOKER: + case BARREL: + case SPAWNER: + case BEACON: + // All of the above Materials are Tile Entities + return true; + default: + // Otherwise we assume they're not Tile Entities + return false; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java index 51c458d5a..77bb55601 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java @@ -38,20 +38,20 @@ public class ButcherAndroid extends ProgrammableAndroid { boolean attack = false; switch (face) { - case NORTH: - attack = n.getLocation().getZ() < b.getZ(); - break; - case EAST: - attack = n.getLocation().getX() > b.getX(); - break; - case SOUTH: - attack = n.getLocation().getZ() > b.getZ(); - break; - case WEST: - attack = n.getLocation().getX() < b.getX(); - break; - default: - break; + case NORTH: + attack = n.getLocation().getZ() < b.getZ(); + break; + case EAST: + attack = n.getLocation().getX() > b.getX(); + break; + case SOUTH: + attack = n.getLocation().getZ() > b.getZ(); + break; + case WEST: + attack = n.getLocation().getX() < b.getX(); + break; + default: + break; } if (attack) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java index 44948ab4b..1bafdcd3f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java @@ -64,22 +64,22 @@ public class FarmerAndroid extends ProgrammableAndroid { Random random = ThreadLocalRandom.current(); switch (crop) { - case WHEAT: - return new ItemStack(Material.WHEAT, random.nextInt(2) + 1); - case POTATOES: - return new ItemStack(Material.POTATO, random.nextInt(3) + 1); - case CARROTS: - return new ItemStack(Material.CARROT, random.nextInt(3) + 1); - case BEETROOTS: - return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1); - case COCOA: - return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1); - case NETHER_WART: - return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1); - case SWEET_BERRY_BUSH: - return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1); - default: - return null; + case WHEAT: + return new ItemStack(Material.WHEAT, random.nextInt(2) + 1); + case POTATOES: + return new ItemStack(Material.POTATO, random.nextInt(3) + 1); + case CARROTS: + return new ItemStack(Material.CARROT, random.nextInt(3) + 1); + case BEETROOTS: + return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1); + case COCOA: + return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1); + case NETHER_WART: + return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1); + case SWEET_BERRY_BUSH: + return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1); + default: + return null; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java index 525739b61..c98ad0817 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java @@ -194,14 +194,14 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock, */ public AndroidFuelSource getFuelSource() { switch (getTier()) { - case 1: - return AndroidFuelSource.SOLID; - case 2: - return AndroidFuelSource.LIQUID; - case 3: - return AndroidFuelSource.NUCLEAR; - default: - throw new IllegalStateException("Cannot convert the following Android tier to a fuel type: " + getTier()); + case 1: + return AndroidFuelSource.SOLID; + case 2: + return AndroidFuelSource.LIQUID; + case 3: + return AndroidFuelSource.NUCLEAR; + default: + throw new IllegalStateException("Cannot convert the following Android tier to a fuel type: " + getTier()); } } @@ -564,38 +564,38 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock, private void registerDefaultFuelTypes() { switch (getFuelSource()) { - case SOLID: - registerFuelType(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK))); - registerFuelType(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD))); - registerFuelType(new MachineFuel(70, new ItemStack(Material.DRIED_KELP_BLOCK))); + case SOLID: + registerFuelType(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK))); + registerFuelType(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD))); + registerFuelType(new MachineFuel(70, new ItemStack(Material.DRIED_KELP_BLOCK))); - // Coal & Charcoal - registerFuelType(new MachineFuel(8, new ItemStack(Material.COAL))); - registerFuelType(new MachineFuel(8, new ItemStack(Material.CHARCOAL))); + // Coal & Charcoal + registerFuelType(new MachineFuel(8, new ItemStack(Material.COAL))); + registerFuelType(new MachineFuel(8, new ItemStack(Material.CHARCOAL))); - // Logs - for (Material mat : Tag.LOGS.getValues()) { - registerFuelType(new MachineFuel(2, new ItemStack(mat))); - } + // Logs + for (Material mat : Tag.LOGS.getValues()) { + registerFuelType(new MachineFuel(2, new ItemStack(mat))); + } - // Wooden Planks - for (Material mat : Tag.PLANKS.getValues()) { - registerFuelType(new MachineFuel(1, new ItemStack(mat))); - } + // Wooden Planks + for (Material mat : Tag.PLANKS.getValues()) { + registerFuelType(new MachineFuel(1, new ItemStack(mat))); + } - break; - case LIQUID: - registerFuelType(new MachineFuel(100, new ItemStack(Material.LAVA_BUCKET))); - registerFuelType(new MachineFuel(200, SlimefunItems.OIL_BUCKET)); - registerFuelType(new MachineFuel(500, SlimefunItems.FUEL_BUCKET)); - break; - case NUCLEAR: - registerFuelType(new MachineFuel(2500, SlimefunItems.URANIUM)); - registerFuelType(new MachineFuel(1200, SlimefunItems.NEPTUNIUM)); - registerFuelType(new MachineFuel(3000, SlimefunItems.BOOSTED_URANIUM)); - break; - default: - throw new IllegalStateException("Unhandled Fuel Source: " + getFuelSource()); + break; + case LIQUID: + registerFuelType(new MachineFuel(100, new ItemStack(Material.LAVA_BUCKET))); + registerFuelType(new MachineFuel(200, SlimefunItems.OIL_BUCKET)); + registerFuelType(new MachineFuel(500, SlimefunItems.FUEL_BUCKET)); + break; + case NUCLEAR: + registerFuelType(new MachineFuel(2500, SlimefunItems.URANIUM)); + registerFuelType(new MachineFuel(1200, SlimefunItems.NEPTUNIUM)); + registerFuelType(new MachineFuel(3000, SlimefunItems.BOOSTED_URANIUM)); + break; + default: + throw new IllegalStateException("Unhandled Fuel Source: " + getFuelSource()); } } @@ -685,26 +685,26 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock, BlockFace face = rotationData == null ? BlockFace.NORTH : BlockFace.valueOf(rotationData); switch (instruction) { - case START: - case WAIT: - // We are "waiting" here, so we only move a step forward - BlockStorage.addBlockInfo(b, "index", String.valueOf(index)); - break; - case REPEAT: - // "repeat" just means, we reset our index - BlockStorage.addBlockInfo(b, "index", String.valueOf(0)); - break; - case CHOP_TREE: - // We only move to the next step if we finished chopping wood - if (chopTree(b, inv, face)) { + case START: + case WAIT: + // We are "waiting" here, so we only move a step forward BlockStorage.addBlockInfo(b, "index", String.valueOf(index)); - } - break; - default: - // We set the index here in advance to fix moving android issues - BlockStorage.addBlockInfo(b, "index", String.valueOf(index)); - instruction.execute(this, b, inv, face); - break; + break; + case REPEAT: + // "repeat" just means, we reset our index + BlockStorage.addBlockInfo(b, "index", String.valueOf(0)); + break; + case CHOP_TREE: + // We only move to the next step if we finished chopping wood + if (chopTree(b, inv, face)) { + BlockStorage.addBlockInfo(b, "index", String.valueOf(index)); + } + break; + default: + // We set the index here in advance to fix moving android issues + BlockStorage.addBlockInfo(b, "index", String.valueOf(index)); + instruction.execute(this, b, inv, face); + break; } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java index 4e0e59903..4494fb95c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/gadgets/MultiTool.java @@ -110,14 +110,14 @@ public class MultiTool extends SlimefunItem implements Rechargeable { return (e, item, offhand) -> { // Fixes #2217 - Prevent them from being used to shear entities switch (e.getRightClicked().getType()) { - case MUSHROOM_COW: - case SHEEP: - case SNOWMAN: - SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears"); - e.setCancelled(true); - break; - default: - break; + case MUSHROOM_COW: + case SHEEP: + case SNOWMAN: + SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears"); + e.setCancelled(true); + break; + default: + break; } }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/Reactor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/Reactor.java index 012a8ead2..b4bd009db 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/Reactor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/Reactor.java @@ -128,24 +128,24 @@ public abstract class Reactor extends AbstractEnergyProvider implements Hologram ReactorMode mode = getReactorMode(b.getLocation()); switch (mode) { - case GENERATOR: - menu.replaceExistingItem(4, new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&7Focus: &eElectricity", "", "&6Your Reactor will focus on Power Generation", "&6If your Energy Network doesn't need Power", "&6it will not produce any either", "", "&7\u21E8 Click to change the Focus to &eProduction")); - menu.addMenuClickHandler(4, (p, slot, item, action) -> { - BlockStorage.addBlockInfo(b, MODE, ReactorMode.PRODUCTION.toString()); - updateInventory(menu, b); - return false; - }); - break; - case PRODUCTION: - menu.replaceExistingItem(4, new CustomItem(SlimefunItems.PLUTONIUM, "&7Focus: &eProduction", "", "&6Your Reactor will focus on producing goods", "&6If your Energy Network doesn't need Power", "&6it will continue to run and simply will", "&6not generate any Power in the mean time", "", "&7\u21E8 Click to change the Focus to &ePower Generation")); - menu.addMenuClickHandler(4, (p, slot, item, action) -> { - BlockStorage.addBlockInfo(b, MODE, ReactorMode.GENERATOR.toString()); - updateInventory(menu, b); - return false; - }); - break; - default: - break; + case GENERATOR: + menu.replaceExistingItem(4, new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&7Focus: &eElectricity", "", "&6Your Reactor will focus on Power Generation", "&6If your Energy Network doesn't need Power", "&6it will not produce any either", "", "&7\u21E8 Click to change the Focus to &eProduction")); + menu.addMenuClickHandler(4, (p, slot, item, action) -> { + BlockStorage.addBlockInfo(b, MODE, ReactorMode.PRODUCTION.toString()); + updateInventory(menu, b); + return false; + }); + break; + case PRODUCTION: + menu.replaceExistingItem(4, new CustomItem(SlimefunItems.PLUTONIUM, "&7Focus: &eProduction", "", "&6Your Reactor will focus on producing goods", "&6If your Energy Network doesn't need Power", "&6it will continue to run and simply will", "&6not generate any Power in the mean time", "", "&7\u21E8 Click to change the Focus to &ePower Generation")); + menu.addMenuClickHandler(4, (p, slot, item, action) -> { + BlockStorage.addBlockInfo(b, MODE, ReactorMode.GENERATOR.toString()); + updateInventory(menu, b); + return false; + }); + break; + default: + break; } BlockMenu port = getAccessPort(b.getLocation()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java index 157b26954..06ec908ed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java @@ -120,21 +120,21 @@ public class IndustrialMiner extends MultiBlockMachine { Random random = ThreadLocalRandom.current(); switch (ore) { - case COAL_ORE: - return new ItemStack(Material.COAL); - case DIAMOND_ORE: - return new ItemStack(Material.DIAMOND); - case EMERALD_ORE: - return new ItemStack(Material.EMERALD); - case NETHER_QUARTZ_ORE: - return new ItemStack(Material.QUARTZ); - case REDSTONE_ORE: - return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2)); - case LAPIS_ORE: - return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); - default: - // This includes Iron and Gold ore (and Ancient Debris) - return new ItemStack(ore); + case COAL_ORE: + return new ItemStack(Material.COAL); + case DIAMOND_ORE: + return new ItemStack(Material.DIAMOND); + case EMERALD_ORE: + return new ItemStack(Material.EMERALD); + case NETHER_QUARTZ_ORE: + return new ItemStack(Material.QUARTZ); + case REDSTONE_ORE: + return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2)); + case LAPIS_ORE: + return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); + default: + // This includes Iron and Gold ore (and Ancient Debris) + return new ItemStack(ore); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java index aee48bdf8..b93704cb9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java @@ -56,39 +56,39 @@ public class SwordOfBeheading extends SimpleSlimefunItem { Random random = ThreadLocalRandom.current(); switch (e.getEntityType()) { - case ZOMBIE: - if (random.nextInt(100) < chanceZombie.getValue()) { - e.getDrops().add(new ItemStack(Material.ZOMBIE_HEAD)); - } - break; - case SKELETON: - if (random.nextInt(100) < chanceSkeleton.getValue()) { - e.getDrops().add(new ItemStack(Material.SKELETON_SKULL)); - } - break; - case CREEPER: - if (random.nextInt(100) < chanceCreeper.getValue()) { - e.getDrops().add(new ItemStack(Material.CREEPER_HEAD)); - } - break; - case WITHER_SKELETON: - if (random.nextInt(100) < chanceWitherSkeleton.getValue()) { - e.getDrops().add(new ItemStack(Material.WITHER_SKELETON_SKULL)); - } - break; - case PLAYER: - if (random.nextInt(100) < chancePlayer.getValue()) { - ItemStack skull = new ItemStack(Material.PLAYER_HEAD); + case ZOMBIE: + if (random.nextInt(100) < chanceZombie.getValue()) { + e.getDrops().add(new ItemStack(Material.ZOMBIE_HEAD)); + } + break; + case SKELETON: + if (random.nextInt(100) < chanceSkeleton.getValue()) { + e.getDrops().add(new ItemStack(Material.SKELETON_SKULL)); + } + break; + case CREEPER: + if (random.nextInt(100) < chanceCreeper.getValue()) { + e.getDrops().add(new ItemStack(Material.CREEPER_HEAD)); + } + break; + case WITHER_SKELETON: + if (random.nextInt(100) < chanceWitherSkeleton.getValue()) { + e.getDrops().add(new ItemStack(Material.WITHER_SKELETON_SKULL)); + } + break; + case PLAYER: + if (random.nextInt(100) < chancePlayer.getValue()) { + ItemStack skull = new ItemStack(Material.PLAYER_HEAD); - ItemMeta meta = skull.getItemMeta(); - ((SkullMeta) meta).setOwningPlayer((Player) e.getEntity()); - skull.setItemMeta(meta); + ItemMeta meta = skull.getItemMeta(); + ((SkullMeta) meta).setOwningPlayer((Player) e.getEntity()); + skull.setItemMeta(meta); - e.getDrops().add(skull); - } - break; - default: - break; + e.getDrops().add(skull); + } + break; + default: + break; } }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/OilResource.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/OilResource.java index c45cc768d..e73b3cfe6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/OilResource.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/OilResource.java @@ -32,56 +32,56 @@ class OilResource extends SlimefunResource { } switch (biome) { - case SNOWY_BEACH: - case STONE_SHORE: - case BEACH: - return 6; + case SNOWY_BEACH: + case STONE_SHORE: + case BEACH: + return 6; - case DESERT: - case DESERT_HILLS: - case DESERT_LAKES: - return 45; + case DESERT: + case DESERT_HILLS: + case DESERT_LAKES: + return 45; - case MOUNTAINS: - case GRAVELLY_MOUNTAINS: - case MOUNTAIN_EDGE: - case RIVER: - return 17; + case MOUNTAINS: + case GRAVELLY_MOUNTAINS: + case MOUNTAIN_EDGE: + case RIVER: + return 17; - case SNOWY_MOUNTAINS: - case SNOWY_TUNDRA: - case ICE_SPIKES: - case FROZEN_OCEAN: - case FROZEN_RIVER: - return 14; + case SNOWY_MOUNTAINS: + case SNOWY_TUNDRA: + case ICE_SPIKES: + case FROZEN_OCEAN: + case FROZEN_RIVER: + return 14; - case BADLANDS: - case BADLANDS_PLATEAU: - case WOODED_BADLANDS_PLATEAU: - case ERODED_BADLANDS: - case MODIFIED_BADLANDS_PLATEAU: - case MODIFIED_WOODED_BADLANDS_PLATEAU: - case MUSHROOM_FIELDS: - case MUSHROOM_FIELD_SHORE: - return 24; + case BADLANDS: + case BADLANDS_PLATEAU: + case WOODED_BADLANDS_PLATEAU: + case ERODED_BADLANDS: + case MODIFIED_BADLANDS_PLATEAU: + case MODIFIED_WOODED_BADLANDS_PLATEAU: + case MUSHROOM_FIELDS: + case MUSHROOM_FIELD_SHORE: + return 24; - case DEEP_OCEAN: - case OCEAN: - case COLD_OCEAN: - case DEEP_COLD_OCEAN: - case DEEP_FROZEN_OCEAN: - case DEEP_LUKEWARM_OCEAN: - case DEEP_WARM_OCEAN: - case LUKEWARM_OCEAN: - case WARM_OCEAN: - return 62; + case DEEP_OCEAN: + case OCEAN: + case COLD_OCEAN: + case DEEP_COLD_OCEAN: + case DEEP_FROZEN_OCEAN: + case DEEP_LUKEWARM_OCEAN: + case DEEP_WARM_OCEAN: + case LUKEWARM_OCEAN: + case WARM_OCEAN: + return 62; - case SWAMP: - case SWAMP_HILLS: - return 20; + case SWAMP: + case SWAMP_HILLS: + return 20; - default: - return 10; + default: + return 10; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/SaltResource.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/SaltResource.java index 532bfa339..f6c14c79d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/SaltResource.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/resources/SaltResource.java @@ -26,33 +26,33 @@ class SaltResource extends SlimefunResource { } switch (biome) { - case SNOWY_BEACH: - case STONE_SHORE: - case BEACH: - case DESERT_LAKES: - case RIVER: - case ICE_SPIKES: - case FROZEN_RIVER: - return 40; + case SNOWY_BEACH: + case STONE_SHORE: + case BEACH: + case DESERT_LAKES: + case RIVER: + case ICE_SPIKES: + case FROZEN_RIVER: + return 40; - case DEEP_OCEAN: - case OCEAN: - case COLD_OCEAN: - case DEEP_COLD_OCEAN: - case DEEP_FROZEN_OCEAN: - case DEEP_LUKEWARM_OCEAN: - case DEEP_WARM_OCEAN: - case FROZEN_OCEAN: - case LUKEWARM_OCEAN: - case WARM_OCEAN: - return 60; + case DEEP_OCEAN: + case OCEAN: + case COLD_OCEAN: + case DEEP_COLD_OCEAN: + case DEEP_FROZEN_OCEAN: + case DEEP_LUKEWARM_OCEAN: + case DEEP_WARM_OCEAN: + case FROZEN_OCEAN: + case LUKEWARM_OCEAN: + case WARM_OCEAN: + return 60; - case SWAMP: - case SWAMP_HILLS: - return 20; + case SWAMP: + case SWAMP_HILLS: + return 20; - default: - return 6; + default: + return 6; } } diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/Item/CustomItemSerializer.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/Item/CustomItemSerializer.java index d28037ba3..6c6b7860f 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/Item/CustomItemSerializer.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/Item/CustomItemSerializer.java @@ -59,49 +59,49 @@ public class CustomItemSerializer { builder.append(flag.toString() + "="); switch (flag) { - case AMOUNT: { - builder.append(item.getAmount()); - break; - } - case DATA: { - builder.append((int) item.getData().getData()); - break; - } - case DURABILITY: { - builder.append((int) item.getDurability()); - break; - } - case ENCHANTMENTS: - for (Enchantment enchantment : Enchantment.values()) { - if (item.getEnchantments().containsKey(enchantment)) { - builder.append(enchantment.getName() + ":" + item.getEnchantmentLevel(enchantment)); - } else { - builder.append(enchantment.getName() + ":0"); + case AMOUNT: { + builder.append(item.getAmount()); + break; + } + case DATA: { + builder.append((int) item.getData().getData()); + break; + } + case DURABILITY: { + builder.append((int) item.getDurability()); + break; + } + case ENCHANTMENTS: + for (Enchantment enchantment : Enchantment.values()) { + if (item.getEnchantments().containsKey(enchantment)) { + builder.append(enchantment.getName() + ":" + item.getEnchantmentLevel(enchantment)); + } else { + builder.append(enchantment.getName() + ":0"); + } } + break; + case ITEMMETA_DISPLAY_NAME: { + if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) { + builder.append(item.getItemMeta().getDisplayName().replaceAll("\\u00a7", "&")); + } else { + builder.append("NONE"); + } + break; } - break; - case ITEMMETA_DISPLAY_NAME: { - if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) { - builder.append(item.getItemMeta().getDisplayName().replaceAll("\\u00a7", "&")); - } else { - builder.append("NONE"); + case ITEMMETA_LORE: { + if (item.hasItemMeta() && item.getItemMeta().hasLore()) { + builder.append(item.getItemMeta().getLore().toString().replaceAll("\\u00a7", "&")); + } else { + builder.append("NONE"); + } + break; } - break; - } - case ITEMMETA_LORE: { - if (item.hasItemMeta() && item.getItemMeta().hasLore()) { - builder.append(item.getItemMeta().getLore().toString().replaceAll("\\u00a7", "&")); - } else { - builder.append("NONE"); + case MATERIAL: { + builder.append(item.getType().toString()); + break; } - break; - } - case MATERIAL: { - builder.append(item.getType().toString()); - break; - } - default: - break; + default: + break; } i++; diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java index c04900fa7..92148998c 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java @@ -378,7 +378,8 @@ public class BlockStorage { * This will return an {@link ImmutableMap} of the underline {@code Map} of * this worlds {@link BlockStorage}. If there is no registered world then this will return null. * - * @param world The world of which to fetch the data from. + * @param world + * The world of which to fetch the data from. * @return An {@link ImmutableMap} of the raw data or null if the world isn't registered. */ @Nullable diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestChargeUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestChargeUtils.java index bf2b4aa09..4a52485c6 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestChargeUtils.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestChargeUtils.java @@ -1,12 +1,7 @@ package io.github.thebusybiscuit.slimefun4.testing.tests.utils; -import java.util.Arrays; import java.util.Collections; -import be.seeseemelk.mockbukkit.MockBukkit; -import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.utils.ChargeUtils; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -17,6 +12,11 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import be.seeseemelk.mockbukkit.MockBukkit; +import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.utils.ChargeUtils; + class TestChargeUtils { @BeforeAll From c523fc279fa3ab1c4395dcd4c4ffccd042d5ed07 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Jan 2021 16:34:32 +0100 Subject: [PATCH 093/144] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da11eed9..4af3562a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ * Fixed #2760 * Fixed #2771 * Fixed placeholders that did not get loaded yet not having a label +* Fixed #2679 ## Release Candidate 19 (11 Jan 2021) From 5aaed5d814a29eaa19cc5e639680d86dbc552df9 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 30 Jan 2021 13:14:27 +0100 Subject: [PATCH 094/144] [CI skip] Updated changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4af3562a6..e99d20f7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Table of contents +- [Release Candidate 21 (TBD)](#release-candidate-21-tbd) - [Release Candidate 20 (30 Jan 2021)](#release-candidate-20-30-jan-2021) - [Release Candidate 19 (11 Jan 2021)](#release-candidate-19-11-jan-2021) - [Release Candidate 18 (03 Dec 2020)](#release-candidate-18-03-dec-2020) @@ -20,6 +21,14 @@ - [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019) - [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019) +## Release Candidate 21 (TBD) + +#### Additions + +#### Changes + +#### Fixes + ## Release Candidate 20 (30 Jan 2021) #### Additions From dbe127a1d18ed4042745579b86fd292d34b0e440 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 30 Jan 2021 21:07:27 +0000 Subject: [PATCH 095/144] Translate messages_fr.yml via GitLocalize --- src/main/resources/languages/messages_fr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/languages/messages_fr.yml b/src/main/resources/languages/messages_fr.yml index a3d15040a..a1539a655 100644 --- a/src/main/resources/languages/messages_fr.yml +++ b/src/main/resources/languages/messages_fr.yml @@ -4,7 +4,6 @@ commands: cheat: Vous permet de vous donnez des objets give: Donne à quelqu'un des objets Slimefun guide: Vous donne un guide Slimefun - timings: Informations sur la latence de votre serveur teleporter: Affiche les waypoints d'un autre joueur versions: Affiche toutes les extensions installées search: Recherche dans votre guide le terme donné @@ -25,6 +24,7 @@ commands: description: Charge l'objet que vous avez en main charge-success: L'objet a été chargé ! not-rechargeable: Cet objet ne peut pas être chargé ! + timings: Informations sur la latence de votre serveur guide: search: message: "&bQue souhaitez-vous rechercher?" @@ -193,9 +193,9 @@ messages: invalid-amount: "&4%amount% &cn'est pas un montant valide: il doit être supérieur à 0!" invalid-research: "&4%research% &cn'est pas une recherche valide!" - mode-change: 'Vous avez changé votre &b%device% en mode : &9%mode%' bee-suit-slow-fall: "&eVos ailes d'abeille vous aideront à revenir au sol lentement et en toute sécurité" + mode-change: 'Vous avez changé votre &b%device% en mode : &9%mode%' machines: pattern-not-found: "&eDésolé, je ne reconnais pas cette recette. Veuillez disposer les objets correctement dans le distributeur." From d6ae3ac81d817734924b650a0765037ef4c92b10 Mon Sep 17 00:00:00 2001 From: Maxime Date: Sat, 30 Jan 2021 21:07:28 +0000 Subject: [PATCH 096/144] Translate messages_fr.yml via GitLocalize --- src/main/resources/languages/messages_fr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/resources/languages/messages_fr.yml b/src/main/resources/languages/messages_fr.yml index a1539a655..2665639b1 100644 --- a/src/main/resources/languages/messages_fr.yml +++ b/src/main/resources/languages/messages_fr.yml @@ -24,7 +24,11 @@ commands: description: Charge l'objet que vous avez en main charge-success: L'objet a été chargé ! not-rechargeable: Cet objet ne peut pas être chargé ! - timings: Informations sur la latence de votre serveur + timings: + description: Timings pour Slimefun et ses addons + please-wait: "&eAttendez s'il vous plaît, les résultats arrivent !" + verbose-player: "&4Ce flag ne peux pas être utiliser par un joueur!" + unknown-flag: "&4Flag inconnu: &c%flag%" guide: search: message: "&bQue souhaitez-vous rechercher?" From 704e100e07f8b8ef83bea5f6ce9e89ef36688df8 Mon Sep 17 00:00:00 2001 From: amarcais53 Date: Sat, 30 Jan 2021 21:07:29 +0000 Subject: [PATCH 097/144] Translate messages_fr.yml via GitLocalize --- src/main/resources/languages/messages_fr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/messages_fr.yml b/src/main/resources/languages/messages_fr.yml index 2665639b1..f7c71ae96 100644 --- a/src/main/resources/languages/messages_fr.yml +++ b/src/main/resources/languages/messages_fr.yml @@ -138,6 +138,7 @@ messages: wizard: "&a&oVotre talisman vous a donné un meilleur niveau de Fortune mais a peut-être diminué plusieurs autres enchantements" caveman: "&a&oVotre Talisman vous a donné Célérité" + wise: "&a&oVotre talisman a doublé votre XP" soulbound-rune: fail: "&cVous pouvez lier un seul objet à la fois à votre âme" success: "&aVous avez réussi à lier cet objet à votre âme! Vous le garderez quand From c78092bb85435478d16191ec37103c316143c50f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 31 Jan 2021 00:27:14 +0100 Subject: [PATCH 098/144] [CI skip] Updated translators list --- .../slimefun4/core/services/localization/Translators.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java index c5461e689..d3a6e64bc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java @@ -38,6 +38,7 @@ public class Translators { addTranslator("NinoFutur", SupportedLanguage.FRENCH, true); addTranslator("TheRetix", SupportedLanguage.FRENCH, true); addTranslator("Aeris1One", SupportedLanguage.FRENCH, true); + addTranslator("Aomitsu", SupportedLanguage.FRENCH, true); // Translators - Italian addTranslator("xXDOTTORXx", SupportedLanguage.ITALIAN, true); From dabc8bbbc0ea01691de60ce0cded3164dfff3b79 Mon Sep 17 00:00:00 2001 From: PaladinBear Date: Sun, 31 Jan 2021 07:52:58 +0000 Subject: [PATCH 099/144] Translate messages_he.yml via GitLocalize --- src/main/resources/languages/messages_he.yml | 400 ++++++++++--------- 1 file changed, 202 insertions(+), 198 deletions(-) diff --git a/src/main/resources/languages/messages_he.yml b/src/main/resources/languages/messages_he.yml index 3e26c0d63..170137953 100644 --- a/src/main/resources/languages/messages_he.yml +++ b/src/main/resources/languages/messages_he.yml @@ -1,11 +1,18 @@ --- commands: help: הצגת מסך עזרה - teleporter: ראה נקודות ציון של שחקנים אחרים - search: חפש במדריך את המונח הנתון cheat: מאפשר לזמן פריטים ברמאות give: נותן למישהו פירטי סליים פאן guide: תן לעצמך מדריך סליים פאן + teleporter: ראה נקודות ציון של שחקנים אחרים + versions: הצגת תוספים מותקנים + search: חפש במדריך את המונח הנתון + open_guide: פתח את המדריך בלי להשתמש בספר + stats: מציג כמה נתונים סטטיסטיים על שחקן + research: + description: 'בטל נעילה /מחקרים עבור שחקן זה ' + reset: "&c איפס את הידע של %שחקן% זה" + reset-target: "&cהידע שלך אופס " backpack: description: אחזר עותק של גיבוי קיים invalid-id: " המספר המזהה חייב להיות מספר לא שלילי!&4" @@ -21,46 +28,15 @@ commands: please-wait: "&e !אנא המתן שנייה ... התוצאות מגיעות" verbose-player: "&4 האיתות המילולי אינו יכול להיות בשימוש על ידי שחקן!" unknown-flag: "&4איתות לא ידוע: &c%flag%" - versions: הצגת תוספים מותקנים - open_guide: פתח את המדריך בלי להשתמש בספר - stats: מציג כמה נתונים סטטיסטיים על שחקן - research: - description: 'בטל נעילה /מחקרים עבור שחקן זה ' - reset: "&c איפס את הידע של %שחקן% זה" - reset-target: "&cהידע שלך אופס " guide: - title: - main: סליים פאן מדריך - credits: סליים פאן4 תורמים - wiki: סליים פאן4 ויקי - addons: 'תוספות לסליים פאן ' - versions: גרסאות מותקנות - settings: 'הגדרות & מידע ' - languages: בחר את השפה המועדפת עליך - bugs: דיווחי שגיאות - source: קוד מקור - back: - guide: חזור למדריך סליים פאן - title: חזור - settings: חזור ללוח ההגדרות - tooltips: - wiki: ראה פריט זה באתר הרשימי של סליים פאן ויקי - recipes: - climbing-pick: משטחים שאפשר לטפס עליהם - machine: מתכונים שנעשו במכונה זו - miner: משאבים שתוכלו להשיג אצל כורה זה - generator: סוגי דלק זמינים - gold-pan: משאבים שתוכלו להשיג - open-category: לחץ לפתיחה - versions-notice: אלה חשובים מאוד כשמדווחים על באגים! - work-in-progress: תכונה זו עדיין לא הושלמה במלואה! + search: + message: מה תרצה לחפש? + name: "&7חפש...." + tooltip: "&b לחץ לחפש פריט" + inventory: "%item% מחפש עבור: " + cheat: + no-multiblocks: "&4 אתה לא יכול לרמות בריבוי מבנים אתה חייב לבנות אותם!" languages: - change: לחץ כדי לבחור שפה חדשה - description: - - "&7כעת יש לך אפשרות לשנות" - - "&7השפה שבה סליים פאן" - - "&7יוצג בפניך. פריטים" - - "&7לא ניתן לתרגם לעת עתה." updated: "&a :השפה שלך הוגדרה בהצלחה ל &b%lang%" translations: name: "&aIs משהו חסר?" @@ -68,13 +44,23 @@ guide: select: 'לחץ כדי לבחור שפה זאת ' select-default: לחץ לבחירת שפת ברירת המחדל selected-language: 'נבחר כעת:' - credits: - open: לחץ כדי לראות את התורמים שלנו + change: לחץ כדי לבחור שפה חדשה description: - - "&7 סליים פאן הוא פרויקט קוד פתוח " - - "&7ומתוחזק על ידי קהילה גדולה של אנשים." - - "&7על &e%contributors% &7אנשים עבדו" - - "&7.סליים פאן לאורך כל השנים האלה " + - "&7כעת יש לך אפשרות לשנות" + - "&7השפה שבה סליים פאן" + - "&7יוצג בפניך. פריטים" + - "&7לא ניתן לתרגם לעת עתה." + title: + main: סליים פאן מדריך + settings: 'הגדרות & מידע ' + languages: בחר את השפה המועדפת עליך + credits: סליים פאן4 תורמים + wiki: סליים פאן4 ויקי + addons: 'תוספות לסליים פאן ' + bugs: דיווחי שגיאות + source: קוד מקור + versions: גרסאות מותקנות + credits: commit: להתחייב commits: מתחייב roles: @@ -83,32 +69,60 @@ guide: resourcepack: "&c אמן חבילת משאבים" translator: "&9מתרגם" profile-link: "לחץ כדי לבקר את הפרופיל שלהם \nב -GitHub" - search: - message: &b מה תרצה לחפש? - name: "&7חפש...." - tooltip: "&b לחץ לחפש פריט" - inventory: "%item% מחפש עבור: " - cheat: - no-multiblocks: "&4 אתה לא יכול לרמות בריבוי מבנים אתה חייב לבנות אותם!" + open: לחץ כדי לראות את התורמים שלנו + description: + - "&7 סליים פאן הוא פרויקט קוד פתוח " + - "&7ומתוחזק על ידי קהילה גדולה של אנשים." + - "&7על &e%contributors% &7אנשים עבדו" + - "&7.סליים פאן לאורך כל השנים האלה " pages: previous: עמוד קודם next: עמוד הבא + tooltips: + open-category: לחץ לפתיחה + versions-notice: אלה חשובים מאוד כשמדווחים על באגים! + wiki: ראה פריט זה באתר הרשימי של סליים פאן ויקי + recipes: + machine: מתכונים שנעשו במכונה זו + miner: משאבים שתוכלו להשיג אצל כורה זה + generator: סוגי דלק זמינים + gold-pan: משאבים שתוכלו להשיג + climbing-pick: משטחים שאפשר לטפס עליהם + back: + title: חזור + guide: חזור למדריך סליים פאן + settings: חזור ללוח ההגדרות locked: נעול locked-category: - כדי לבטל את הנעילה של קטגוריה זו - 'צריך לפתוח את כל הפריטים מה ' - הקטגוריות הבאות + work-in-progress: תכונה זו עדיין לא הושלמה במלואה! messages: + not-researched: "&4אין לך מספיק ידע להבין זאת " not-enough-xp: "&4אין לך מספיק נקודות ניסיון\nכדי לפתוח את זה " + unlocked: "&b אתה פתחת %research% " + only-players: "&4 פקודה זו מיועדת רק לשחקנים" + unknown-player: "&4 :שחקן לא מוכר &c%player%" + no-permission: "&4 אין לך את ההרשאה הנדרשת לעשות זאת" + usage: "&4 שימוש: &c %שימוש%" + not-online: "&4 %שחקן%cis לא ברשת!" + given-item: '&b ניתן לך סכום &a %amount% &7"%item%7' + give-item: "&b %ניתן לך %amount% &a %item%" + give-research: '&b נתת %player% את המח"%research%&7"' + hungry: "&cאתה רעב מדיי כדי לעשות את זה!" + disabled-in-world: "&4 פריט זה הושבת בעולם זה" + disabled-item: "&4 פריט זה הושבת איך בכלל השגת את זה ?" + no-tome-yourself: "&c אינך יכול להשתמש ב- 4 כרך של מידע צמך...." + multimeter: "&bStored Energy: &3%stored% &b/ &3%capacity%" talisman: - angel: "&a&o הקמע שלך הציל אותך מלקבל נזק נפילה" - fire: "&a&oהקמע שלך הציל אותך מלהישרף למוות" - caveman: "&a&oהקמע שלך נתן לך מהירות" anvil: "&a&o הקמע שלך הציל את הכלי שלך מלהישבר" miner: "&a&o הקמע שלך בכפיל את הפריטים הנופלים" hunter: "&a&o הקמע שלך בכפיל את הפריטים הנופלים" lava: "&a&oהקמע שלך הציל אותך מלהישרף למוות" water: "&a&oהקמע שלך הציל אותך מלטבוע " + angel: "&a&o הקמע שלך הציל אותך מלקבל נזק נפילה" + fire: "&a&oהקמע שלך הציל אותך מלהישרף למוות" magician: "&a%o הקמע שלך העניק לך כישוף נוסף" traveller: "&a&o הקמע שלך נתן לך דחיפת מהירות" warrior: "&a&oהקמע שלך שיפר את כוחך לזמן מה" @@ -116,54 +130,8 @@ messages: whirlwind: "&a&o הקמע שלך שיקף את הטיל" wizard: "&a&o הקמע שלך העניק לך רמת הון טובה יותר אבל אולי גם הוריד כמה רמות הקסם אחרות" - fortune-cookie: - - "&7 עזור לי, אני כלוא במפעל לעוגיות " - - "&7אתה תמות מחר על ידי.... קריפר " - - "&7 בשלב מסוים בחיים שלך משהו רע יקרה!!!" - - "&7בשבוע הבא תבחין שזה לא העולם האמיתי, אתה נמצא במשחק מחשב" - - "עוגיה זו תהיה טעימה תוך כמה שניות &7" - - '&7 המילה האחרונה שתשמע תהיה "להשמיד !!!"' - - "&7מה שלא תעשה אל תחבק קריפר ניסיתי. זה מרגיש טוב,אבל לא שווה את זה" - - "&7התשובה היא 42" - - "&7 וולשי ביום ירחיקו את הצרות." - - "&7 לעולם אל תחפור ישר למטה!" - - "&7זו רק שריטה!" - - "&7תמיד תסתכל על הצד הטוב שבחיים" - - "&7זה היה למעשה ביסקוויט ולא עוגיה" - - "&7שלטי הניאון דולקים" - piglin-barter: &4 אתה לא יכול לסחור עם חזירונים באמצעות חפצי סליים פאן - enchantment-rune: - fail: "&cאת לא יכול להחליף עם חזירונים חפצים של סליים פאן." - no-enchantment: "&cלא נמצא שום קסם ישים לפריט הזה." - success: "&aהחלת בהצלחה קסם אקראי החל על פריט זה." - tape-measure: - no-anchor: "&c אתה צריך להגדיר עוגן לפני שתוכל להתחיל למדוד!" - wrong-world: "!&cנראה שהעוגן שלך נמצא בעולם אחר" - distance: "&7המדידה נלקחה &eDistance: %distance%." - anchor-set: "&aהעוגן הוגדר בהצלחה:&e %anchor%" - multi-tool: - mode-change: "&b%device% &9: המצב השתנה ל: %mode%" - not-shears: "&c מולטי טול לא יכול לשמש כמזמרה!" - climbing-pick: - dual-wielding: "&4אתה צריך להחזיק מכושי טיפוס בשתי !הידיים כדי להשתמש בהם" - wrong-material: "&cאתה לא יכול לטפס על המשטח הזה. עיין במדריך סליים פאן למידע - נוסף!" - bee-suit-slow-fall: "&eכנפי הדבורה שלך יעזרו לך להגיע לקרקע בצורה איטית ובטוחה" - not-researched: "&4אין לך מספיק ידע להבין זאת " - unlocked: "&b אתה פתחת %research% " - only-players: "&4 פקודה זו מיועדת רק לשחקנים" - unknown-player: "&4 :שחקן לא מוכר &c%player%" - no-permission: "&4 אין לך את ההרשאה הנדרשת לעשות זאת" - usage: "&4 שימוש: &c %שימוש%" - not-online: "&4 %שחקן%cis לא ברשת!" - given-item: "&b ניתן לך סכום &a %amount% &7\"%item%7" - give-item: '&b %ניתן לך %amount% &a %item%' - give-research: "&b נתת %player% את המח\"%research%&7\"" - hungry: "&cאתה רעב מדיי כדי לעשות את זה!" - disabled-in-world: "&4 פריט זה הושבת בעולם זה" - disabled-item: "&4 פריט זה הושבת איך בכלל השגת את זה ?" - no-tome-yourself: "&c אינך יכול להשתמש ב- 4 כרך של מידע צמך...." - multimeter: '&bStored Energy: &3%stored% &b/ &3%capacity%' + caveman: "&a&oהקמע שלך נתן לך מהירות" + wise: "&a&oהקמע שלך הכפיל את ירידת נקודות הניסיון שלך" soulbound-rune: fail: "&c אתה יכול לקשור פריט אחד בלבד לנשמתך בכל פעם." success: "&a אתה קושרת פריט זה בהצלחה לנשמתך! אתה תשמור עליו כשתמות." @@ -182,87 +150,43 @@ messages: ברזל!" link-prompt: "&e לחץ כאן:" diet-cookie: "&eאתה מתחיל להרגיש מרחף...." + fortune-cookie: + - "&7 עזור לי, אני כלוא במפעל לעוגיות " + - "&7אתה תמות מחר על ידי.... קריפר " + - "&7 בשלב מסוים בחיים שלך משהו רע יקרה!!!" + - "&7בשבוע הבא תבחין שזה לא העולם האמיתי, אתה נמצא במשחק מחשב" + - עוגיה זו תהיה טעימה תוך כמה שניות &7 + - '&7 המילה האחרונה שתשמע תהיה "להשמיד !!!"' + - "&7מה שלא תעשה אל תחבק קריפר ניסיתי. זה מרגיש טוב,אבל לא שווה את זה" + - "&7התשובה היא 42" + - "&7 וולשי ביום ירחיקו את הצרות." + - "&7 לעולם אל תחפור ישר למטה!" + - "&7זו רק שריטה!" + - "&7תמיד תסתכל על הצד הטוב שבחיים" + - "&7זה היה למעשה ביסקוויט ולא עוגיה" + - "&7שלטי הניאון דולקים" + piglin-barter: אתה לא יכול לסחור עם חזירונים באמצעות חפצי סליים פאן + enchantment-rune: + fail: "&cאת לא יכול להחליף עם חזירונים חפצים של סליים פאן." + no-enchantment: "&cלא נמצא שום קסם ישים לפריט הזה." + success: "&aהחלת בהצלחה קסם אקראי החל על פריט זה." + tape-measure: + no-anchor: "&c אתה צריך להגדיר עוגן לפני שתוכל להתחיל למדוד!" + wrong-world: "!&cנראה שהעוגן שלך נמצא בעולם אחר" + distance: "&7המדידה נלקחה &eDistance: %distance%." + anchor-set: "&aהעוגן הוגדר בהצלחה:&e %anchor%" + multi-tool: + mode-change: "&b%device% &9: המצב השתנה ל: %mode%" + not-shears: "&c מולטי טול לא יכול לשמש כמזמרה!" + climbing-pick: + dual-wielding: "&4אתה צריך להחזיק מכושי טיפוס בשתי !הידיים כדי להשתמש בהם" + wrong-material: "&cאתה לא יכול לטפס על המשטח הזה. עיין במדריך סליים פאן למידע + נוסף!" invalid-item: "&4%item% &cאינו פריט בר תוקף!" invalid-amount: "&4%amount% &cאינו כמות ברת תוקף : המספר חייב להיות גדול מאפס!" invalid-research: "&4%research% &cאינו מחקר בר תוקף!" -anvil: - not-working: "&4אתה לא יכול להשתמש בפרטי סליים פאן בתוך סדן" - mcmmo-salvaging: "&4אתה לא יכול להציל (לתקן) חפצי סליים פאן" -workbench: - not-enhanced: "&4 אתה לא יכול להשתמש בפרטי סליים פאן על שולחן עבודה רגיל" -gps: - geo: - scan-required: |- - &4-סורק גאולוגי נדרש! - &c סרוק את הנתח הזה באמצעות סורק !גאולוגי-קודם - waypoint: - duplicate: "&4כבר יצרת נקודת ציון בשם: &f%waypoint%" - new: "&eהקלד שם לנקודת הדרך החדשה שלך בצ'אט. (קודי צבע נתמכים!)" - added: "&a נוסף בהצלחה נקודת דרך חדשה" - max: "&4 הגעת לכמות הנקודות הדרך המרבית" - deathpoint: |- - &4נקודת מוות - &7%date% - insufficient-complexity: - - "&4אין מספיק מורכבות ברשת ה GPS: &c%complexity%" - - "&4a) אין לך הגדרות רשת GPS עדיין" - - "&4b) הגדרות ה GPS שלך לא מספיק מורכבות" -languages: - zh-CN: "(מנדרינית(סין" - tl: טגלית - default: שרת ברירת מחדל - en: אנגלית - de: 'גרמנית ' - fr: צרפתית - it: איטלקית - es: ספרדית - pl: פולנית - sv: שוודית - nl: הולנדית - cs: צ'כית - hu: הונגרית - lv: לטבית - ru: רוסית - sk: סלובקית - zh-TW: "(סינית (טייוואן" - vi: וייטנאמי - id: אינדונזית - el: יווני - he: עברית - ar: ערבית - af: אפריקנית - da: דנית - fi: פינית - uk: אוקראינית - ms: מלאית - 'no': נורווגית - ja: יפנית - fa: פרסית - th: תאילנדי - ro: רומנית - pt: "(פורטוגזית (פורטוגל" - pt-BR: "(פורטוגזית (ברזיל" - bg: בולגרית - ko: קוריאנית - tr: טורקי - hr: קרואטית - mk: מקדונית - sr: סרבית - be: בלארוסית + bee-suit-slow-fall: "&eכנפי הדבורה שלך יעזרו לך להגיע לקרקע בצורה איטית ובטוחה" machines: - GPS_CONTROL_PANEL: - title: לוח בקרה - ג'י פי אס - transmitters: סקירה משדר - waypoints: סקירת נקודות דרך - INDUSTRIAL_MINER: - no-fuel: &c לכורה התעשייתית שלך אזל הדלק! שים את הדלק שלך בתיבה מעל. - piston-facing: "&cהכורה התעשייתי שלך דורש בוכנות מופנות כלפי מעלה!" - piston-space: "&cלשתי הבוכנות צריך להיות בלוק מעליהן!" - destroyed: "&cנראה שכורה התעשייתי שלך הושמד." - already-running: "&cהכורה התעשייתית הזה עדיין פועל." - full-chest: "&cהתיבה של הכורה התעשייתי שלך מלאה!" - no-permission: נראה שאין לך אישור להפעיל כאן כורה תעשייתי!&4 - finished: "&eהכורה התעשייתי שלך סיים את !%ores% ore(s)!עבודתו! הוא חצב" pattern-not-found: "&e סליחה לא יכולתי \n .לזהות את המתכון \nאנא הכנס את \nהפריטים בדפוס הנכון לתוך המתקן " unknown-material: "&e סליחה, לא יכולתי לזהות את הפריט במתקן שלי. אנא הכנס משהו שאני @@ -273,7 +197,8 @@ machines: in-use: "&c המלאי של בלוק זה נפתח כרגע על ידי שחקן אחר." ignition-chamber-no-flint: "&c תא הצתה חסר צור ופלדה." ANCIENT_ALTAR: - not-enough-pedestals: "&4 המזבח אני מוקף בכמות המתאימה של כינים &c(%pedestals% /\n8( " + not-enough-pedestals: "&4 המזבח אני מוקף בכמות המתאימה של כינים &c(%pedestals% + /\n8( " unknown-catalyst: "&4 זרז לא ידוע! &c השתמש במתכון הנכון במקום זאת!" unknown-recipe: "&4 מתכון לא ידוע! &cהשתמש במתכון הנכון במקום!" ANCIENT_PEDESTAL: @@ -301,17 +226,50 @@ machines: time: זמן משוער CARGO_NODES: must-be-placed: "&4חייב להיות מונח על תיבה או מכונה!" -brewing_stand: - not-working: "&4אתה לא יכול לשים חפצי סליים פאן במבשלה!" -villagers: - no-trading: "&4אתה לא יכול להחליף עם ויליג'רים חפצי סליים פאן!" -cartography_table: - not-working: "&4אתה לא יכול להשתמש בחפצי סליים פאן בשולחן קרטוגרפיה!" -cauldron: - no-discoloring: "&4אתה לא יכול לשנות את הצבע של שריון סליים פאן" + GPS_CONTROL_PANEL: + title: לוח בקרה - ג'י פי אס + transmitters: סקירה משדר + waypoints: סקירת נקודות דרך + INDUSTRIAL_MINER: + no-fuel: לכורה התעשייתית שלך אזל הדלק! שים את הדלק שלך בתיבה מעל. + piston-facing: "&cהכורה התעשייתי שלך דורש בוכנות מופנות כלפי מעלה!" + piston-space: "&cלשתי הבוכנות צריך להיות בלוק מעליהן!" + destroyed: "&cנראה שכורה התעשייתי שלך הושמד." + already-running: "&cהכורה התעשייתית הזה עדיין פועל." + full-chest: "&cהתיבה של הכורה התעשייתי שלך מלאה!" + no-permission: נראה שאין לך אישור להפעיל כאן כורה תעשייתי!&4 + finished: "&eהכורה התעשייתי שלך סיים את !%ores% ore(s)!עבודתו! הוא חצב" +anvil: + not-working: "&4אתה לא יכול להשתמש בפרטי סליים פאן בתוך סדן" + mcmmo-salvaging: "&4אתה לא יכול להציל (לתקן) חפצי סליים פאן" +backpack: + already-open: "&cסליחה התרמיל הזה פתוח במקום אחר " + no-stack: "&cאתה לא יכול לערום תרמילים" +workbench: + not-enhanced: "&4 אתה לא יכול להשתמש בפרטי סליים פאן על שולחן עבודה רגיל" +gps: + deathpoint: |- + &4נקודת מוות + &7%date% + waypoint: + new: "&eהקלד שם לנקודת הדרך החדשה שלך בצ'אט. (קודי צבע נתמכים!)" + added: "&a נוסף בהצלחה נקודת דרך חדשה" + max: "&4 הגעת לכמות הנקודות הדרך המרבית" + duplicate: "&4כבר יצרת נקודת ציון בשם: &f%waypoint%" + insufficient-complexity: + - "&4אין מספיק מורכבות ברשת ה GPS: &c%complexity%" + - "&4a) אין לך הגדרות רשת GPS עדיין" + - "&4b) הגדרות ה GPS שלך לא מספיק מורכבות" + geo: + scan-required: |- + &4-סורק גאולוגי נדרש! + &c סרוק את הנתח הזה באמצעות סורק !גאולוגי-קודם +inventory: + no-access: "&4אין לך גישה לבלוק הזה" android: + started: "&7 האנדרואיד שלך ממשיך את תסריט" + stopped: "&7 האנדרואיד שלך \nעצר את התסריט " scripts: - too-long: "&c!התסריט ארוך מכדי לערוך" already-uploaded: "&4 התסריט הזה כבר הועלה." instructions: START: "&2 התחל תסריט" @@ -350,10 +308,56 @@ android: own: "&4אתה לא יכול לדרג את התסריט שלך עצמך!" already: "&4אתה כבר השארת דירוג לתסריט זה!" editor: עורך תסריט - started: "&7 האנדרואיד שלך ממשיך את תסריט" - stopped: "&7 האנדרואיד שלך \nעצר את התסריט " -backpack: - already-open: "&cסליחה התרמיל הזה פתוח במקום אחר " - no-stack: "&cאתה לא יכול לערום תרמילים" -inventory: - no-access: "&4אין לך גישה לבלוק הזה" + too-long: "&c!התסריט ארוך מכדי לערוך" +languages: + default: שרת ברירת מחדל + en: אנגלית + de: 'גרמנית ' + fr: צרפתית + it: איטלקית + es: ספרדית + pl: פולנית + sv: שוודית + nl: הולנדית + cs: צ'כית + hu: הונגרית + lv: לטבית + ru: רוסית + sk: סלובקית + zh-TW: "(מנדרינית (טייוואן" + vi: וייטנאמי + id: אינדונזית + zh-CN: "(מנדרינית(סין" + el: יווני + he: עברית + ar: ערבית + af: אפריקנית + da: דנית + fi: פינית + uk: אוקראינית + ms: מלאית + 'no': נורווגית + ja: יפנית + fa: פרסית + th: תאילנדי + ro: רומנית + pt: "(פורטוגזית (פורטוגל" + pt-BR: "(פורטוגזית (ברזיל" + bg: בולגרית + ko: קוריאנית + tr: טורקי + hr: קרואטית + mk: מקדונית + sr: סרבית + be: בלארוסית + tl: טגלית +brewing_stand: + not-working: "&4אתה לא יכול לשים חפצי סליים פאן במבשלה!" +villagers: + no-trading: "&4אתה לא יכול להחליף עם ויליג'רים חפצי סליים פאן!" +cartography_table: + not-working: "&4אתה לא יכול להשתמש בחפצי סליים פאן בשולחן קרטוגרפיה!" +cauldron: + no-discoloring: "&4אתה לא יכול לשנות את הצבע של שריון סליים פאן" +placeholderapi: + profile-loading: בטעינה... From 6f8134a8008f99e68163892e70b11806bc4393d9 Mon Sep 17 00:00:00 2001 From: PaladinBear Date: Sun, 31 Jan 2021 07:52:59 +0000 Subject: [PATCH 100/144] Translate researches_he.yml via GitLocalize --- .../resources/languages/researches_he.yml | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/resources/languages/researches_he.yml b/src/main/resources/languages/researches_he.yml index d355acc5e..0e1872d80 100644 --- a/src/main/resources/languages/researches_he.yml +++ b/src/main/resources/languages/researches_he.yml @@ -3,29 +3,18 @@ slimefun: walking_sticks: מקלות הליכה portable_crafter: שולחן מלאכה נייד fortune_cookie: עוגיית מזל - ender_armor: שריון אנדר - magic_eye_of_ender: עין אנדר קסומה - magic_sugar: סוכר קסום - slime_armor: שריון רפש - sword_of_beheading: חרב העריפות - parachute: מצנח - bronze: יצירת ברונזה - reinforced_alloy: סגסוגת מחוזקת - magic_workbench: שולחן מלאכה קסום - wind_staff: מטה רוח - gold_carats: זהב טהור - fire_staff: מטה אש - first_aid: עזרה ראשונה - water_staff: מטה מים - farmer_shoes: נעלי איכר - backpacks: תיקי גב portable_dustbin: פח אשפה נייד meat_jerky: בשר מלוח armor_forge: יצירת שריון glowstone_armor: שריון גלוסטון lumps: גושים וקסמים ender_backpack: תיק גב אנדר + ender_armor: שריון אנדר + magic_eye_of_ender: עין אנדר קסומה + magic_sugar: סוכר קסום monster_jerky: בשר מפלצת מלוח + slime_armor: שריון רפש + sword_of_beheading: חרב העריפות basic_circuit_board: לוח מגעים בסיסי advanced_circuit_board: לוח מגעים מתקדם smeltery: תנור התכה @@ -34,6 +23,7 @@ slimefun: battery: הסוללה הראשונה שלך steel_plate: ציפוי פלדה steel_thruster: דוחף פלדה + parachute: מצנח grappling_hook: וו אחיזה jetpacks: תרמיל רחיפה multitools: רב כלים @@ -45,6 +35,7 @@ slimefun: magical_book_cover: כריכת ספרים קסומה slimefun_metals: מתכות חדשות ore_crusher: הכפלת עפרת + bronze: יצירת ברונזה alloys: סגסוגות מתקדמות compressor_and_carbon: יצירת פחמן gilded_iron_armor: שריון ברזל מוזהב @@ -53,10 +44,15 @@ slimefun: synthetic_sapphire: ספיר סינטטי damascus_steel: פלדת דמשק damascus_steel_armor: שריון פלדת דמשק + reinforced_alloy: סגסוגת מחוזקת carbonado: יהלומים שחורים + magic_workbench: שולחן מלאכה קסום + wind_staff: מטה רוח reinforced_armor: שריון מחוזק ore_washer: שוטף עופרת + gold_carats: זהב טהור silicon: עמק הסיליקון + fire_staff: מטה אש smelters_pickaxe: מכוש התכה common_talisman: קמע נפוץ anvil_talisman: קמע הסדן @@ -82,6 +78,7 @@ slimefun: crushed_ore: טיהור עפרת redstone_alloy: סגסוגת רדסטון carbonado_tools: מכונות ברמה עליונה + first_aid: עזרה ראשונה gold_armor: שריון מבריק night_vision_googles: משקפי ראיית לילה pickaxe_of_containment: מקוש הכלה @@ -89,12 +86,15 @@ slimefun: table_saw: מסור שולחני slime_steel_armor: שריון פלדה רזה blade_of_vampires: להב הערפדים + water_staff: מטה מים 24k_gold_block: עיר מוזהבת composter: עפר קומפוסטציה + farmer_shoes: נעלי איכר explosive_tools: כלי נפץ automated_panning_machine: מסננת אוטומטית boots_of_the_stomper: מגפי הרוקע pickaxe_of_the_seeker: מכוש המחפש + backpacks: תיקי גב woven_backpack: תיק גב ארוג crucible: כור היתוך gilded_backpack: תיק גב מוזהב @@ -133,6 +133,7 @@ slimefun: wither_proof_obsidian: בזלת עמידה לוויד'ר ancient_runes: רונות אלמנטריות special_runes: רונות סגולות + infernal_bonemeal: אינפרנל בואונמיל rainbow_blocks: בלוקים צבעוניים infused_hopper: משפך חדור wither_proof_glass: זכוכית עמידה לוויד'ר @@ -247,4 +248,5 @@ slimefun: elytra_cap: גלגל שיניים מרסק energy_connectors: חיבור קווי bee_armor: שריון דבורים - infernal_bonemeal: אינפרנל בואונמיל + wise_talisman: קמע של החכמה + book_binder: כריכת ספר קסום From fe42f6fa9f17789ee0d568a0e189f4eae0383491 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 1 Feb 2021 10:47:31 +0100 Subject: [PATCH 101/144] Nether Wart Blocks can be turned into Nether Warts using a Grind Stone --- CHANGELOG.md | 1 + .../implementation/SlimefunPlugin.java | 10 ++++++--- .../items/multiblocks/GrindStone.java | 5 +++++ .../listeners/TalismanListener.java | 18 +++++++-------- .../slimefun4/utils/ColoredMaterial.java | 22 +++++++++++++++++++ 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e99d20f7b..4284a3bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ ## Release Candidate 21 (TBD) #### Additions +* Nether Wart Blocks can now be turned into Nether Warts using a Grind Stone #### Changes diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index 74c51bbe4..c6a4c799e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -137,8 +137,8 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { private boolean isNewlyInstalled = false; private final SlimefunRegistry registry = new SlimefunRegistry(); - private final TickerTask ticker = new TickerTask(); private final SlimefunCommand command = new SlimefunCommand(this); + private final TickerTask ticker = new TickerTask(); // Services - Systems that fulfill certain tasks, treat them as a black box private final CustomItemDataService itemDataService = new CustomItemDataService(this, "slimefun_item"); @@ -362,8 +362,12 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { Bukkit.getScheduler().cancelTasks(this); // Finishes all started movements/removals of block data - ticker.halt(); - ticker.run(); + try { + ticker.halt(); + ticker.run(); + } catch (Exception x) { + getLogger().log(Level.SEVERE, x, () -> "Something went wrong while disabling the ticker task for Slimefun v" + getDescription().getVersion()); + } // Kill our Profiler Threads profiler.kill(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java index 3c1533a98..54d28c391 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.stream.Collectors; import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Material; import org.bukkit.Sound; @@ -27,6 +28,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; public class GrindStone extends MultiBlockMachine { + @ParametersAreNonnullByDefault public GrindStone(Category category, SlimefunItemStack item) { super(category, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); } @@ -71,6 +73,9 @@ public class GrindStone extends MultiBlockMachine { recipes.add(new ItemStack(Material.PRISMARINE)); recipes.add(new ItemStack(Material.PRISMARINE_SHARD, 4)); + + recipes.add(new ItemStack(Material.NETHER_WART_BLOCK)); + recipes.add(new ItemStack(Material.NETHER_WART, 9)); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index efab110ef..1a5ae752c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -237,15 +237,15 @@ public class TalismanListener implements Listener { TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet()); if (enchantment != null && Talisman.checkFor(e, SlimefunItems.TALISMAN_MAGICIAN)) { - /* - * Fix #2679 - * By default, the Bukkit API doesn't allow us to give enchantment books extra enchantments. - */ - if (talisman.isEnchantmentBookAllowed() && e.getItem().getType() == Material.BOOK) { - e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); - } else { - enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); - } + /* + * Fix #2679 + * By default, the Bukkit API doesn't allow us to give enchantment books extra enchantments. + */ + if (talisman.isEnchantmentBookAllowed() && e.getItem().getType() == Material.BOOK) { + e.getItem().addUnsafeEnchantment(enchantment.getEnchantment(), enchantment.getLevel()); + } else { + enchantments.put(enchantment.getEnchantment(), enchantment.getLevel()); + } } // Wizard Talisman diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java index fb791fda3..4f6826508 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java @@ -47,6 +47,28 @@ public enum ColoredMaterial { Material.BLACK_WOOL }), + /** + * This {@link List} contains all carpet colors ordered by their appearance ingame. + */ + CARPET(new Material[] { + Material.WHITE_CARPET, + Material.ORANGE_CARPET, + Material.MAGENTA_CARPET, + Material.LIGHT_BLUE_CARPET, + Material.YELLOW_CARPET, + Material.LIME_CARPET, + Material.PINK_CARPET, + Material.GRAY_CARPET, + Material.LIGHT_GRAY_CARPET, + Material.CYAN_CARPET, + Material.PURPLE_CARPET, + Material.BLUE_CARPET, + Material.BROWN_CARPET, + Material.GREEN_CARPET, + Material.RED_CARPET, + Material.BLACK_CARPET + }), + /** * This {@link List} contains all stained glass colors ordered by their appearance ingame. */ From e11929b5873ade4e0687e276429ebcd8939f8247 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Mon, 1 Feb 2021 16:07:06 +0000 Subject: [PATCH 102/144] Add java ver and hover to versions subcommand --- .../commands/subcommands/VersionsCommand.java | 82 ++++++++++++++----- 1 file changed, 63 insertions(+), 19 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index 6a21e4ef9..a392f4556 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -3,13 +3,17 @@ package io.github.thebusybiscuit.slimefun4.core.commands.subcommands; import java.util.Collection; import javax.annotation.Nonnull; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.hover.content.Text; +import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.plugin.Plugin; -import io.github.thebusybiscuit.cscorelib2.chat.ChatColors; import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand; import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; @@ -28,35 +32,75 @@ class VersionsCommand extends SubCommand { // so we will just fix this inconsistency for them :) String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName(); - sender.sendMessage(ChatColor.GRAY + "This Server uses the following setup of Slimefun:"); - sender.sendMessage(ChatColors.color("&a" + serverSoftware + " &2" + Bukkit.getVersion())); - sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion())); + ComponentBuilder builder = new ComponentBuilder(); + builder.append("This Server uses the following setup of Slimefun:\n").color(ChatColor.GRAY) + .append(serverSoftware).color(ChatColor.GREEN).append(" " + Bukkit.getVersion() + '\n').color(ChatColor.DARK_GREEN) + .append("Slimefun").color(ChatColor.GREEN).append(" v" + SlimefunPlugin.getVersion() + '\n').color(ChatColor.DARK_GREEN); if (SlimefunPlugin.getMetricsService().getVersion() != null) { - sender.sendMessage(ChatColors.color("&aMetrics build: &2#" + SlimefunPlugin.getMetricsService().getVersion())); + builder.append("Metrics build: ").color(ChatColor.GREEN) + .append("#" + SlimefunPlugin.getMetricsService().getVersion() + '\n').color(ChatColor.DARK_GREEN); } + addJavaVersion(builder); + if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { - sender.sendMessage(ChatColor.RED + "Backwards compatibility enabled!"); + builder.append("Backwards compatibility enabled!\n").color(ChatColor.RED); } - sender.sendMessage(""); + builder.append("\n"); - Collection addons = SlimefunPlugin.getInstalledAddons(); - sender.sendMessage(ChatColors.color("&7Installed Addons: &8(" + addons.size() + ")")); + addPluginVersions(builder); - for (Plugin plugin : addons) { - String version = plugin.getDescription().getVersion(); - - if (Bukkit.getPluginManager().isPluginEnabled(plugin)) { - sender.sendMessage(ChatColor.GREEN + " " + plugin.getName() + ChatColor.DARK_GREEN + " v" + version); - } else { - sender.sendMessage(ChatColor.RED + " " + plugin.getName() + ChatColor.DARK_RED + " v" + version); - } - } + System.out.println(ComponentSerializer.toString(builder.create())); + sender.spigot().sendMessage(builder.create()); } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true); } } + private void addJavaVersion(@Nonnull ComponentBuilder builder) { + String javaVer = System.getProperty("java.version"); + if (javaVer.startsWith("1.")) { + javaVer = javaVer.substring(2); + } + if (javaVer.indexOf('.') != -1) { // If it's like 11.0.1.3 or 8.0_275 + javaVer = javaVer.substring(0, javaVer.indexOf('.')); + } + int ver = Integer.parseInt(javaVer); + + if (ver < 11) { + builder.append("Java " + ver).color(ChatColor.RED) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( + "You should be using at least Java 11! Paper will be dropping support for before Java 11 starting at MC 1.17" + ))) + .append("\n") + .event((HoverEvent) null); + } else { + builder.append("Java " + ver + "\n").color(ChatColor.GREEN); + } + } + + private void addPluginVersions(@Nonnull ComponentBuilder builder) { + Collection addons = SlimefunPlugin.getInstalledAddons(); + builder.append("Installed Addons: ").color(ChatColor.GRAY) + .append("(" + addons.size() + ")").color(ChatColor.DARK_GRAY); + + for (Plugin plugin : addons) { + String version = plugin.getDescription().getVersion(); + + if (Bukkit.getPluginManager().isPluginEnabled(plugin)) { + builder.append("\n " + plugin.getName()).color(ChatColor.GREEN) + .append(" v" + version).color(ChatColor.DARK_GREEN); + } else { + HoverEvent hover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new Text("Plugin is disabled. Check the console for an error and report on their issue tracker.")); + + // We need to reset the hover event or it's added to all components + builder.append("\n " + plugin.getName()).color(ChatColor.RED).event(hover) + .append(" v" + version).color(ChatColor.DARK_RED) + .append("").event((HoverEvent) null); + } + } + } } From d41f276543f2ef5c1279beeb916571d404bdf2d3 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Mon, 1 Feb 2021 17:14:21 +0000 Subject: [PATCH 103/144] Lots more hover and click! --- .../commands/subcommands/VersionsCommand.java | 55 +++++++++++++++---- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index a392f4556..565a36ecf 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -4,7 +4,10 @@ import java.util.Collection; import javax.annotation.Nonnull; +import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; +import me.mrCookieSlime.Slimefun.api.Slimefun; import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.hover.content.Text; @@ -45,14 +48,19 @@ class VersionsCommand extends SubCommand { addJavaVersion(builder); if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { - builder.append("Backwards compatibility enabled!\n").color(ChatColor.RED); + HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( + "Backwards compatibility has a negative impact on performance!\n" + + "We recommend you to disable this setting unless your server still" + + "has legacy Slimefun items (from before summer 2019) in circulation." + )); + + builder.append("Backwards compatibility enabled!\n").color(ChatColor.RED).event(hoverEvent); } - builder.append("\n"); + builder.append("\n").event((HoverEvent) null); addPluginVersions(builder); - System.out.println(ComponentSerializer.toString(builder.create())); sender.spigot().sendMessage(builder.create()); } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true); @@ -64,7 +72,9 @@ class VersionsCommand extends SubCommand { if (javaVer.startsWith("1.")) { javaVer = javaVer.substring(2); } - if (javaVer.indexOf('.') != -1) { // If it's like 11.0.1.3 or 8.0_275 + + // If it's like 11.0.1.3 or 8.0_275 + if (javaVer.indexOf('.') != -1) { javaVer = javaVer.substring(0, javaVer.indexOf('.')); } int ver = Integer.parseInt(javaVer); @@ -90,16 +100,41 @@ class VersionsCommand extends SubCommand { String version = plugin.getDescription().getVersion(); if (Bukkit.getPluginManager().isPluginEnabled(plugin)) { - builder.append("\n " + plugin.getName()).color(ChatColor.GREEN) - .append(" v" + version).color(ChatColor.DARK_GREEN); + HoverEvent hoverEvent; + ClickEvent clickEvent = null; + if (plugin instanceof SlimefunAddon) { + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( + "Author: " + String.join(", ", plugin.getDescription().getAuthors()) + + "\nClick to open the Bug Tracker" + )); + clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, ((SlimefunAddon) plugin).getBugTrackerURL()); + } else { + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( + "Author: " + String.join(", ", plugin.getDescription().getAuthors()) + )); + } + + builder.append("\n " + plugin.getName()).color(ChatColor.GREEN).event(hoverEvent).event(clickEvent) + .append(" v" + version).color(ChatColor.DARK_GREEN) + .append("").event((ClickEvent) null).event((HoverEvent) null); } else { - HoverEvent hover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new Text("Plugin is disabled. Check the console for an error and report on their issue tracker.")); + HoverEvent hoverEvent; + ClickEvent clickEvent = null; + if (plugin instanceof SlimefunAddon) { + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new Text("Plugin is disabled. Check the console for an error. Click here to report on their issue tracker")); + if (((SlimefunAddon) plugin).getBugTrackerURL() != null) { + clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, ((SlimefunAddon) plugin).getBugTrackerURL()); + } + } else { + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new Text("Plugin is disabled. Check the console for an error and report on their issue tracker.")); + } // We need to reset the hover event or it's added to all components - builder.append("\n " + plugin.getName()).color(ChatColor.RED).event(hover) + builder.append("\n " + plugin.getName()).color(ChatColor.RED).event(hoverEvent).event(clickEvent) .append(" v" + version).color(ChatColor.DARK_RED) - .append("").event((HoverEvent) null); + .append("").event((ClickEvent) null).event((HoverEvent) null); } } } From e99a39d2ab05d6ca1bdf8039e3704cbfbd24d815 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 2 Feb 2021 09:39:22 +0100 Subject: [PATCH 104/144] Fixes #2794 --- CHANGELOG.md | 1 + .../implementation/listeners/AncientAltarListener.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4284a3bbb..1cfd8731a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ #### Changes #### Fixes +* Fixed #2794 ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 646ed0476..35be10253 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -248,7 +248,7 @@ public class AncientAltarListener implements Listener { } } - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent e) { if (altarItem == null || altarItem.isDisabled()) { return; From 6d89d38c3a6c5b2c8a38e7baeaec577652c69452 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 2 Feb 2021 10:05:08 +0100 Subject: [PATCH 105/144] Fixes #2793 --- CHANGELOG.md | 1 + .../items/androids/WoodcutterAndroid.java | 97 ++++++++++++++++++- .../slimefun4/utils/tags/SlimefunTag.java | 6 ++ src/main/resources/tags/fungus_soil.json | 17 ++++ 4 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/tags/fungus_soil.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cfd8731a..5dd14aa67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ #### Fixes * Fixed #2794 +* Fixed #2793 ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java index 2d79132b2..b6c532e37 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java @@ -1,8 +1,11 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.androids; import java.util.List; -import java.util.Optional; import java.util.UUID; +import java.util.function.Predicate; + +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Bukkit; import org.bukkit.Effect; @@ -14,9 +17,10 @@ import org.bukkit.block.BlockFace; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.blocks.Vein; -import io.github.thebusybiscuit.cscorelib2.materials.MaterialConverter; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.api.BlockStorage; @@ -59,6 +63,7 @@ public class WoodcutterAndroid extends ProgrammableAndroid { return true; } + @ParametersAreNonnullByDefault private void breakLog(Block log, Block android, BlockMenu menu, BlockFace face) { ItemStack drop = new ItemStack(log.getType()); @@ -67,13 +72,95 @@ public class WoodcutterAndroid extends ProgrammableAndroid { log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType()); if (log.getY() == android.getRelative(face).getY()) { - Optional sapling = MaterialConverter.getSaplingFromLog(log.getType()); - - sapling.ifPresent(log::setType); + replant(log); } else { log.setType(Material.AIR); } } } + private void replant(@Nonnull Block block) { + Material logType = block.getType(); + Material saplingType = null; + Predicate soilRequirement = null; + + switch (logType) { + case OAK_LOG: + case OAK_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_OAK_WOOD: + saplingType = Material.OAK_SAPLING; + soilRequirement = SlimefunTag.DIRT_VARIANTS::isTagged; + break; + case BIRCH_LOG: + case BIRCH_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + saplingType = Material.BIRCH_SAPLING; + soilRequirement = SlimefunTag.DIRT_VARIANTS::isTagged; + break; + case JUNGLE_LOG: + case JUNGLE_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_JUNGLE_WOOD: + saplingType = Material.JUNGLE_SAPLING; + soilRequirement = SlimefunTag.DIRT_VARIANTS::isTagged; + break; + case SPRUCE_LOG: + case SPRUCE_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRIPPED_SPRUCE_WOOD: + saplingType = Material.SPRUCE_SAPLING; + soilRequirement = SlimefunTag.DIRT_VARIANTS::isTagged; + break; + case ACACIA_LOG: + case ACACIA_WOOD: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: + saplingType = Material.ACACIA_SAPLING; + soilRequirement = SlimefunTag.DIRT_VARIANTS::isTagged; + break; + case DARK_OAK_LOG: + case DARK_OAK_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_DARK_OAK_WOOD: + saplingType = Material.DARK_OAK_SAPLING; + soilRequirement = SlimefunTag.DIRT_VARIANTS::isTagged; + break; + default: + break; + } + + if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { + switch (logType) { + case CRIMSON_STEM: + case CRIMSON_HYPHAE: + case STRIPPED_CRIMSON_STEM: + case STRIPPED_CRIMSON_HYPHAE: + saplingType = Material.CRIMSON_FUNGUS; + soilRequirement = SlimefunTag.FUNGUS_SOIL::isTagged; + break; + case WARPED_STEM: + case WARPED_HYPHAE: + case STRIPPED_WARPED_STEM: + case STRIPPED_WARPED_HYPHAE: + saplingType = Material.WARPED_FUNGUS; + soilRequirement = SlimefunTag.FUNGUS_SOIL::isTagged; + break; + default: + break; + } + } + + if (saplingType != null && soilRequirement != null) { + if (soilRequirement.test(block.getRelative(BlockFace.DOWN).getType())) { + // Replant the block + block.setType(saplingType); + } else { + // Simply drop the sapling if the soil does not fit + block.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(saplingType)); + } + } + } + } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java index 855485681..d6893e361 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java @@ -120,6 +120,12 @@ public enum SlimefunTag implements Tag { */ DIRT_VARIANTS, + /** + * All soil blocks for a fungus to grow on. + * This includes all dirt variants, nylium and soul soil. + */ + FUNGUS_SOIL, + /** * All variants of concrete powder. * Can you believe there is no tag for this already? diff --git a/src/main/resources/tags/fungus_soil.json b/src/main/resources/tags/fungus_soil.json new file mode 100644 index 000000000..b943c9e59 --- /dev/null +++ b/src/main/resources/tags/fungus_soil.json @@ -0,0 +1,17 @@ +{ + "values" : [ + "#slimefun:dirt_variants", + { + "id" : "minecraft:soul_soil", + "required" : false + }, + { + "id" : "minecraft:crimson_nylium", + "required" : false + }, + { + "id" : "minecraft:warped_nylium", + "required" : false + } + ] +} From 498050dc81d27a03d9b9c15eb7062de655d811e2 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 2 Feb 2021 11:51:56 +0000 Subject: [PATCH 106/144] Apply suggestions from code review Co-authored-by: TheBusyBiscuit --- .../core/commands/subcommands/VersionsCommand.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index 565a36ecf..ab9112983 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -5,13 +5,11 @@ import java.util.Collection; import javax.annotation.Nonnull; import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; -import me.mrCookieSlime.Slimefun.api.Slimefun; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.hover.content.Text; -import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; @@ -104,13 +102,13 @@ class VersionsCommand extends SubCommand { ClickEvent clickEvent = null; if (plugin instanceof SlimefunAddon) { hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "Author: " + String.join(", ", plugin.getDescription().getAuthors()) + "Author(s): " + String.join(", ", plugin.getDescription().getAuthors()) + "\nClick to open the Bug Tracker" )); clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, ((SlimefunAddon) plugin).getBugTrackerURL()); } else { hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "Author: " + String.join(", ", plugin.getDescription().getAuthors()) + "Author(s): " + String.join(", ", plugin.getDescription().getAuthors()) )); } From baf3bd0dfbd2f706574e5817b8cb47dcdcd0c45b Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 2 Feb 2021 13:09:26 +0100 Subject: [PATCH 107/144] [CI skip] Updated workflow --- .github/workflows/closed-issues-reason.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/closed-issues-reason.yml b/.github/workflows/closed-issues-reason.yml index 262b9c54b..f20726e9e 100644 --- a/.github/workflows/closed-issues-reason.yml +++ b/.github/workflows/closed-issues-reason.yml @@ -6,8 +6,11 @@ on: jobs: comment: + + name: Comment on Issue runs-on: ubuntu-latest if: contains(github.event.issue.labels.*.name, '🐞 Bug Report') + steps: - name: Query recent commits uses: TheBusyBiscuit/recently-closed-issues@1.1.0 @@ -44,8 +47,8 @@ jobs: * [ ] Your issue has already been reported before, it is a duplicate. Check the other issues first before posting! * [ ] You posted an error without using pastebin. Please always post errors via pastebin otherwise they become nearly unreadable. * [ ] You seem to be reporting multiple bugs at once. Please make a separate issue for each bug you encountered, so we can properly handle them individually. - * [ ] Your issue has already been fixed in a later version of Slimefun or CS-CoreLib, you should update. - * [ ] You are using an outdated and unsupported version of Slimefun / CS-CoreLib, again, you should update. + * [ ] Your issue has already been fixed in a later version of Slimefun, you should update. + * [ ] You are using an outdated and unsupported version of Slimefun, again, you should update. * [ ] You are using an unofficially modified build of Slimefun. We only support official versions of Slimefun - for obvious reasons. * [ ] You are using an unsupported version of Minecraft. We only provide support for the Minecraft versions Slimefun was developed for, older versions are not supported anymore. * [ ] You are using a \"stable\" version of Slimefun (prefixed with \"RC - \"), your issue may have been fixed in a development build, so we only accept bug reports from those. From 636d44cfb8d28b777bdfb24742916905fe9d0c07 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Tue, 2 Feb 2021 12:25:43 +0000 Subject: [PATCH 108/144] oops forgot 1 space --- .../slimefun4/core/commands/subcommands/VersionsCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index ab9112983..4cd82755c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -48,7 +48,7 @@ class VersionsCommand extends SubCommand { if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( "Backwards compatibility has a negative impact on performance!\n" - + "We recommend you to disable this setting unless your server still" + + "We recommend you to disable this setting unless your server still " + "has legacy Slimefun items (from before summer 2019) in circulation." )); From fe2e5c1444a5eefc46ac1926af65e8191cabde28 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 2 Feb 2021 18:34:05 +0100 Subject: [PATCH 109/144] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc7a47475..feab973f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ #### Additions * Nether Wart Blocks can now be turned into Nether Warts using a Grind Stone +* Added an option to allow Talismans to send their notifications via the Actionbar +* /sf versions now shows the Java version and some useful tooltips #### Changes @@ -41,7 +43,6 @@ * Added Talisman of the Wise * Added Book Binder * Added Tier 3 Electric Ore Grinder -* Added an option to allow Talismans to send their notifications via the Actionbar #### Changes * Massive performance improvements to holograms/armorstands From d37c7b41e1f38ebb48d2545ed318e2789c881b4b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 3 Feb 2021 23:26:42 +0000 Subject: [PATCH 110/144] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.174 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8bd654cfd..d2b5be0b9 100644 --- a/pom.xml +++ b/pom.xml @@ -387,7 +387,7 @@ com.gmail.nossr50.mcMMO mcMMO - 2.1.173 + 2.1.174 provided From c747e86ae5f540da19d199b494ad3cfcf3a6436c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 4 Feb 2021 00:42:18 +0100 Subject: [PATCH 111/144] [CI skip] Update renovate config --- .github/renovate.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index c74f8617a..f45d8f110 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,8 +1,5 @@ { "extends": [ "config:base" - ], - "labels": [ - "🚨 Dependency Update" ] } From a9f74ed28dfc2a27764a2f1787fb769305198693 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 4 Feb 2021 00:50:31 +0100 Subject: [PATCH 112/144] [CI skip] Added renovate branch rule --- .github/workflows/pr-labels.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 43608e463..e997e9586 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -10,7 +10,7 @@ jobs: name: Pull Request Labels runs-on: ubuntu-latest - if: github.repository == 'Slimefun/Slimefun4' && github.actor != 'gitlocalize-app[bot]' && github.actor != 'renovate[bot]' + if: github.repository == 'Slimefun/Slimefun4' && github.actor != 'gitlocalize-app[bot]' steps: - uses: WalshyDev/pr-labels@v1.1 @@ -18,6 +18,7 @@ jobs: name: Apply labels based on branch with: token: "${{ secrets.ACCESS_TOKEN }}" + renovate: '🚨 Dependency Update' feature: '🎈 Feature' fix: '✨ Fix' chore: '🧹 Chores' From 51f1b673266461c4ca39eedb4fd86ec4f4784e90 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 4 Feb 2021 00:51:19 +0100 Subject: [PATCH 113/144] [CI skip] Updated names --- .github/workflows/pr-labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index e997e9586..5c08b2e06 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -26,7 +26,7 @@ jobs: api: '🔧 API' - uses: thollander/actions-comment-pull-request@1.0.1 - name: Comment the applied label + name: Leave a comment about the applied label if: ${{ steps.labeller.outputs.applied != 0 }} with: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} @@ -35,7 +35,7 @@ jobs: Thank you for contributing to this project! ❤️ - uses: thollander/actions-comment-pull-request@1.0.1 - name: Comment the applied label + name: Leave a comment about our branch naming convention if: ${{ steps.labeller.outputs.applied == 0 }} with: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} From 4b4ef00ecbb72e06fe7da809cf2b366f3295856b Mon Sep 17 00:00:00 2001 From: Renzotom Date: Thu, 4 Feb 2021 19:07:41 +0000 Subject: [PATCH 114/144] Translate researches_cs.yml via GitLocalize --- .../resources/languages/researches_cs.yml | 403 +++++++++--------- 1 file changed, 207 insertions(+), 196 deletions(-) diff --git a/src/main/resources/languages/researches_cs.yml b/src/main/resources/languages/researches_cs.yml index 98beb4b7a..8fb26e5f4 100644 --- a/src/main/resources/languages/researches_cs.yml +++ b/src/main/resources/languages/researches_cs.yml @@ -1,232 +1,243 @@ --- slimefun: walking_sticks: Vycházkové hole + portable_crafter: Přenosný pracovní stůl + fortune_cookie: Sušenka štěstí + portable_dustbin: Přenosný koš meat_jerky: Sušené maso - armor_forge: Crafťák brnění + armor_forge: Kovadlina na brnění + glowstone_armor: Světlitové brnění + lumps: Kousky a magie + ender_backpack: Enderitový batoh + ender_armor: Enderitové Brnění + magic_eye_of_ender: Magické endové oko + magic_sugar: Magický cukr monster_jerky: Sušené maso z monstra - steel: Ocelová doba - jetpacks: Jetpacks - multitools: Víceúčelové nástroje - synthetic_sapphire: Syntetické Safíry - damascus_steel_armor: Brnění z Damašské Oceli - portable_crafter: Přenosný Crafťák - fortune_cookie: Sušenka Štěstí - portable_dustbin: Přenosný Koš - glowstone_armor: Světlitové Brnění - lumps: Kousky a Magie - ender_backpack: Ender Batoh - ender_armor: Ender Brnění - magic_eye_of_ender: Magické Oko Endu - magic_sugar: Magický Cukr - slime_armor: Slizové Brnění - sword_of_beheading: Meč na Sekání Hlav - basic_circuit_board: Základní Deska - advanced_circuit_board: Pokročilá Deska + slime_armor: Brnění ze slizu + sword_of_beheading: Meč na sekání hlav + basic_circuit_board: Základní deska + advanced_circuit_board: Pokročilá deska s obvody smeltery: Tavírna - misc_power_items: Důležité itemy související s elekronikou + steel: Doba ocelová + misc_power_items: Důležité předměty související s elekronikou battery: Tvoje první baterie - steel_plate: Ocelové Plátování - steel_thruster: Ocelová Tryska + steel_plate: Ocelový plát + steel_thruster: Ocelová tryska parachute: Padák - grappling_hook: Záchytný Hák - solar_panel_and_helmet: Solární Energie - elemental_staff: Hůlky Elementů - grind_stone: Kámen na Broušení - cactus_armor: Kaktusový Oblek - gold_pan: Zlatá Pánev - magical_book_cover: Magická Knižní Vazba - slimefun_metals: Nové Kovy - ore_crusher: Dvojnásobení Rud + grappling_hook: Vystřelující hák + jetpacks: Raketový batoh + multitools: Víceúčelové nástroje + solar_panel_and_helmet: Solární energie + elemental_staff: Elementární hůlky + grind_stone: Brusný kámen + cactus_armor: Oblek z kaktusu + gold_pan: Rýžovací miska + magical_book_cover: Magické vázání knihy + slimefun_metals: Nové kovy + ore_crusher: Zdvojování rud bronze: Vytvoření Bronzu - alloys: Pokročíle Slitiny + alloys: Pokročilé slitiny compressor_and_carbon: Vytvoření Karbonu - gilded_iron_armor: Pozlacené Železné Brnění - synthetic_diamond: Syntetické Diamanty - pressure_chamber: Tlaková Komora - damascus_steel: Damašská Ocel - reinforced_alloy: Zesílená Slitina - carbonado: Černé Diamanty - magic_workbench: Magický Pracovní Stůl - wind_staff: Větrná Hůl - reinforced_armor: Zesílené Brnění - ore_washer: Čištič Rud - gold_carats: Čisté Zlato - silicon: Silicon Valley - fire_staff: Ohnivá Hůl - smelters_pickaxe: Hutní Krumpáč - common_talisman: Běžný Talisman - anvil_talisman: Talisman Kovadliny - miner_talisman: Talisman Horníka - hunter_talisman: Talisman Lovce - lava_talisman: Talisman Chodce po Lávě - water_talisman: Talisman Dýchače Vody - angel_talisman: Talisman Anděla - fire_talisman: Talisman Požárníka - lava_crystal: Ohnivá Situace - magician_talisman: Talisman Kouzelníka - traveller_talisman: Talisman Cestovatele - warrior_talisman: Talisman Bojovníka - knight_talisman: Talisman Rytíře - gilded_iron: Lesklé Železo - synthetic_emerald: Falešný Drahokam - chainmail_armor: Řetězová Zbroj - whirlwind_talisman: Talisman Vichřice - wizard_talisman: Talisman Čaroděje - lumber_axe: Dřevorubecká Sekera - hazmat_suit: Hazmat Oblek + gilded_iron_armor: Pozlacené železné brnění + synthetic_diamond: Syntetické diamanty + pressure_chamber: Tlaková komora + synthetic_sapphire: Syntetické safíry + damascus_steel: Damašková ocel + damascus_steel_armor: Brnění z damaškové ocely + reinforced_alloy: Zpevněná slitina + carbonado: Černé diamanty + magic_workbench: Magický pracovní stůl + wind_staff: Větrná hůl + reinforced_armor: Zpěvněné brnění + ore_washer: Čištič rud + gold_carats: Čisté zlato + silicon: Křemíkové údolí + fire_staff: Ohnivá hůl + smelters_pickaxe: Hutní krumpáč + common_talisman: Běžný talisman + anvil_talisman: Talisman kovadliny + miner_talisman: Talisman horníka + hunter_talisman: Talisman lovce + lava_talisman: Talisman chodce po lávě + water_talisman: Talisman dýchání pod vodou + angel_talisman: Talisman anděla + fire_talisman: Talisman hasiče + lava_crystal: Ohnivá situace + magician_talisman: Talisman kouzelníka + traveller_talisman: Talisman cestovatele + warrior_talisman: Talisman bojovníka + knight_talisman: Talisman rytíře + gilded_iron: Lesklé železo + synthetic_emerald: Falešný drahokam + chainmail_armor: Kroužková zbroj + whirlwind_talisman: Talisman vichřice + wizard_talisman: Talisman čaroděje + lumber_axe: Dřevorubecká sekera + hazmat_suit: Hazmat oblek uranium: Radioaktivní - crushed_ore: Čištění rud - redstone_alloy: Ruditové Slitiny - carbonado_tools: Nejlepší Stroje - first_aid: První Pomoc - gold_armor: Lesklé Brnění - night_vision_googles: Brýle Nočního Vidění - pickaxe_of_containment: Krumpáč Zadržení - hercules_pickaxe: Herkulesův Krumpáč - table_saw: Stolní Pila - slime_steel_armor: Slizově-Ocelové Brnění - blade_of_vampires: Čepel Vampírů - water_staff: Vodní Hůl - 24k_gold_block: Zlaté Město - composter: Kompostování Hlíny - farmer_shoes: Boty Farmáře - explosive_tools: Výbušné Nastroje - automated_panning_machine: Automatická Zlatá Pánev - boots_of_the_stomper: Boty Dupače - pickaxe_of_the_seeker: Krumpáč Hledače + crushed_ore: Očišťování rud + redstone_alloy: Ruditové slitiny + carbonado_tools: Nejlepší stroje + first_aid: První pomoc + gold_armor: Lesklé brnění + night_vision_googles: Brýle pro noční vidění + pickaxe_of_containment: Krumpáč zadržení + hercules_pickaxe: Herkulesův krumpáč + table_saw: Stolní pila + slime_steel_armor: Brnění ze slizu a oceli + blade_of_vampires: Čepel vampírů + water_staff: Vodní hůl + 24k_gold_block: Zlaté město + composter: Kompostování hlíny + farmer_shoes: Boty farmáře + explosive_tools: Výbušné nástroje + automated_panning_machine: Automatická rýžovací miska + boots_of_the_stomper: Boty dupače + pickaxe_of_the_seeker: Krumpáč hledače backpacks: Batohy - woven_backpack: Tkaný Batoh + woven_backpack: Tkaný batoh crucible: Kotel - gilded_backpack: Vázaný Batoh + gilded_backpack: Vázaný batoh armored_jetpack: Trysky s Brněním - ender_talismans: Ender Talismany + ender_talismans: Enderitové talismany nickel_and_cobalt: Ještě více rud magnet: Magnetické kovy - infused_magnet: Infuzovaný Magnet + infused_magnet: Naplněný magnet cobalt_pickaxe: Urychlený Krumpáč - essence_of_afterlife: Necromancie - bound_backpack: Duší-vázané Ůložistě + essence_of_afterlife: Černá magie + bound_backpack: Uložiště spoutané duší jetboots: Tryskové Boty armored_jetboots: Obrněné Tryskové Boty - seismic_axe: Seizmická Sekera + seismic_axe: Seizmická sekera pickaxe_of_vein_mining: Krumpáč Těžení Nalezišť - bound_weapons: Duší-vázané Zbraně - bound_tools: Duší-vázané Nástroje - bound_armor: Duší-vázané Brnění - juicer: Výborné Pití - repaired_spawner: Opravování Spawnerů - enhanced_furnace: Vylepšená Pec - more_enhanced_furnaces: Lepší Pece - high_tier_enhanced_furnaces: Nejlepší Pece + bound_weapons: Zbraně spoutané duší + bound_tools: Nástroje spoutané duší + bound_armor: Brnění spoutané duší + juicer: Výborné pití + repaired_spawner: Opravování líhní + enhanced_furnace: Vylepšená pec + more_enhanced_furnaces: Lepší pece + high_tier_enhanced_furnaces: Nejlepší pece reinforced_furnace: Vyztužená Pec carbonado_furnace: Carbonado Lemováná Pec electric_motor: Zahřívání block_placer: Pokládač Bloků - scroll_of_dimensional_teleposition: Otáčení věcí kolem + scroll_of_dimensional_teleposition: Otáčí věcí kolem special_bows: Robin Hood - tome_of_knowledge_sharing: Dělení z přátely - flask_of_knowledge: XP Úložistě - hardened_glass: Odoláválí Výbuchům - golden_apple_juice: Zlatý Lektrvar - cooler: Přenášení Nápojů + tome_of_knowledge_sharing: Dělení s přáteli + flask_of_knowledge: XP uložistě + hardened_glass: Odolávání výbuchům + golden_apple_juice: Zlatý lektvar + cooler: Přenašeč nápojů ancient_altar: Starověký Oltář wither_proof_obsidian: Obsidian co vydrží Withera - ancient_runes: Elementální Rudy - special_runes: Purple Rudy - infernal_bonemeal: Pekelný Bonemeal - rainbow_blocks: duhové Bloky - infused_hopper: Vylepšený Hopper + ancient_runes: Elementální rudy + special_runes: Fialové rudy + infernal_bonemeal: Pekelná kostní moučka + rainbow_blocks: Duhové bloky + infused_hopper: Vylepšená násypka wither_proof_glass: Sklo co vydrží Withera - duct_tape: Lepící Páska + duct_tape: Lepící páska plastic_sheet: Plast - android_memory_core: Memory Core + android_memory_core: Paměťové jádro oil: Olej fuel: Palivo hologram_projector: Hologramy - capacitors: Tier 1 Kondenzátory - high_tier_capacitors: Tier 2 Kondenzátory - solar_generators: Solární Elektrárna - electric_furnaces: Elektrická Pec - electric_ore_grinding: Drcení a Broušení - heated_pressure_chamber: Vyhřívaná Tlaková Komora - coal_generator: Uhelná Elektrárna - bio_reactor: Bio-Reactor - auto_enchanting: Automatická Enchantování and Oddělávání Enchantů - auto_anvil: Automatická Kovadlina - multimeter: Měření Energie - gps_setup: Základní GPS Nastavení + capacitors: Kondenzátory 1. stupně + high_tier_capacitors: Kondenzátory 2. stupně + solar_generators: Solární elektrárna + electric_furnaces: Elektrická pec + electric_ore_grinding: Drcení a broušení + heated_pressure_chamber: Vytápěná tlaková komora + coal_generator: Uhelná elektrárna + bio_reactor: Bio reaktor + auto_enchanting: Automatické očarovávání a odčarovávání + auto_anvil: Automatická kovadlina + multimeter: Měření energie + gps_setup: Základní GPS nastavení gps_emergency_transmitter: GPS Nouzový Cestovní Bod - programmable_androids: Programovatelní Androidi - android_interfaces: Androidové Rozhraní - geo_scanner: GEO-Skeny - combustion_reactor: Spalovací Reactor - teleporter: Teleportovač - Základní Komponenty - teleporter_activation_plates: Teleportovač - Aktivace - better_solar_generators: Vylepšené Solární Panely - better_gps_transmitters: Vylepšené Vysílače + programmable_androids: Programovatelné androidy + android_interfaces: Rozhraní androidu + geo_scanner: GEO snímače + combustion_reactor: Spalovací reaktor + teleporter: Základní komponenty pro teleportér + teleporter_activation_plates: Aktivace teleportéru + better_solar_generators: Vylepšené solární panely + better_gps_transmitters: Vylepšené vysílače elevator: Výtahy - energized_solar_generator: 24/7 Solární Energie - energized_gps_transmitter: Nejlepší Trasmitter - energy_regulator: Energické Sítě 101 - butcher_androids: Android - Řezník - organic_food: Organické Jídlo - auto_breeder: Automatické Krmení - advanced_android: Pokročilý Androidi - advanced_butcher_android: Pokročílý Androidi - Řezníci - advanced_fisherman_android: Pokročílý Androidi - Rybář - animal_growth_accelerator: Manipulase Růstu Zvýřat - xp_collector: Zběrač XP - organic_fertilizer: Organické Hnojivo - crop_growth_accelerator: Zrychelní Růstu Plodin - better_crop_growth_accelerator: Vylepšené Zrychelní Růstu Plodin - reactor_essentials: Důležité Části Reaktoru - nuclear_reactor: Nuclearní Elektrárna - freezer: Pan Mražák - cargo_basics: Základy Carga - cargo_nodes: Nastavení Carga - electric_ingot_machines: Electrické Vyrábění Ingotů - high_tier_electric_ingot_machines: Super Rychlá Vyrábění Ingotů - automated_crafting_chamber: Automatické Crafťění - better_food_fabricator: Vylepšené Vyrábění Jídla - reactor_access_port: Interakce s Reactorem - fluid_pump: Pumpa - better_freezer: Vylepšený Mrazák - boosted_uranium: Nikdy Nekončící Kruh - trash_can: Odpatky - advanced_output_node: Vylepšený Výstupní Uzel - carbon_press: Uhlíkový Lis - electric_smeltery: Elektrická Huť - better_electric_furnace: Vylepšená Elektrická Pec - better_carbon_press: Vylepšený Uhlíkový Lis - empowered_android: Super-nabití Androidi - empowered_butcher_android: Super-nabití Androidi - Řezník - empowered_fisherman_android: Super-nabití Androidi - Rybář - high_tier_carbon_press: Ultimátní Uhlíkový Lis - wither_assembler: Automatický Zabíječ Wihera - better_heated_pressure_chamber: Vylepšená Vyhřívaná Tlaková Komora - elytra: Elytry - special_elytras: Speciální Elytry - electric_crucible: Elekryzovaný Kotel - better_electric_crucibles: Horké Kotly - advanced_electric_smeltery: Vylepšená Elekrická Huť - advanced_farmer_android: Vylepšení Androidi - Farmář - lava_generator: Generátor Energie z Lávy - nether_ice: Pekelná-Levodá Chladící Kapalina - nether_star_reactor: Nether Star Reactor - blistering_ingots: Žíravá Radioactivita - automatic_ignition_chamber: Automatická Zápalná Komora - output_chest: Základní výstup do truhly - copper_wire: Snížená Vodivost - radiant_backpack: Zářivý Batoh - auto_drier: Suchý Den - diet_cookie: Dientní Sušenka - storm_staff: Bouřková Hole - soulbound_rune: Duševně-vázaná Runa - geo_miner: GEO-Ťežič - lightning_rune: Runa Blesku - totem_of_undying: Totem Nesmrtelnosti + energized_solar_generator: Nezastavitelná solární energie + energized_gps_transmitter: Nejlepší vysílač + energy_regulator: Energické sítě 101 + butcher_androids: Řeznické androidy + organic_food: Organické jídlo + auto_breeder: Automatické krmení + advanced_android: Pokročilé androidy + advanced_butcher_android: Pokročilé řeznické androidy + advanced_fisherman_android: Pokročilé rybářské androidy + animal_growth_accelerator: Manipulace s růstem zvířat + xp_collector: Sběrač XP + organic_fertilizer: Organické hnojivo + crop_growth_accelerator: Urychlovač růstu plodin + better_crop_growth_accelerator: Vylepšený urychlovač růstu plodin + reactor_essentials: Důležité části reaktoru + nuclear_reactor: Jaderná elektrárna + freezer: Mrazák + cargo_basics: Základy nákladu + cargo_nodes: Nastavení nákladu + electric_ingot_machines: Elektrická výroba ingotů + high_tier_electric_ingot_machines: Super rychlá výroba ingotů + automated_crafting_chamber: Automatická výroba + better_food_fabricator: Vylepšená výroba jídla + reactor_access_port: Interakce s reaktorem + fluid_pump: Pumpa tekutin + better_freezer: Vylepšený mrazák + boosted_uranium: Nekonečný kruh + trash_can: Koš + advanced_output_node: Vylepšený výstupní uzel + carbon_press: Uhlíkový lis + electric_smeltery: Elektrická huť + better_electric_furnace: Vylepšená elektrická pec + better_carbon_press: Vylepšený uhlíkový lis + empowered_android: Super nabité androidy + empowered_butcher_android: Super nabité řeznické androidy + empowered_fisherman_android: Super nabité rybářské androidy + high_tier_carbon_press: Ultimátní uhlíkový lis + wither_assembler: Automatický zabiják withera + better_heated_pressure_chamber: Vylepšená vytápěná tlaková komora + elytra: Krovky + special_elytras: Speciální krovky + electric_crucible: Elektrický kotel + better_electric_crucibles: Horké kotle + advanced_electric_smeltery: Vylepšená elektrická tavírna + advanced_farmer_android: Vylepšené farmářské androidy + lava_generator: Generátor energie z lávy + nether_ice: Netherová chladící kapalina + nether_star_reactor: Netherový hvězdný reaktor + blistering_ingots: Sžíravá radioaktivita + automatic_ignition_chamber: Automatická zápalná komora + output_chest: Výstupní truhla základního zařízení + copper_wire: Snížená vodivost + radiant_backpack: Zářivý batoh + auto_drier: Suchý den + diet_cookie: Dientní sušenka + storm_staff: Bouřková hole + soulbound_rune: Runa spoutaná duší + geo_miner: GEO horník + lightning_rune: Runa blesku + totem_of_undying: Totem nesmrtelnosti charging_bench: Nabíječka - nether_gold_pan: Pekelná Zlatá Pánev + nether_gold_pan: Netherová rýžovací miska electric_press: Electrický Lis - magnesium_generator: Energie z Magnézia - kelp_cookie: Chutná Řasa + magnesium_generator: Energie z magnézia + kelp_cookie: Chutná řasa + advanced_industrial_miner: Lepší těžení + magical_zombie_pills: Dezombifikace + enchantment_rune: Antická očarování + climbing_pick: Blokace nájezdníků + caveman_talisman: Talisman jeskynního člověka + even_higher_tier_capacitors: Kondenzátory 3. stupně + elytra_cap: Popraskané brnění + energy_connectors: Drátové připojení + bee_armor: Včelí zbroj + wise_talisman: Talisman moudrosti + book_binder: Vázání knihy očarování From 4c16273097be773145676b5fef6c6777217bac47 Mon Sep 17 00:00:00 2001 From: 100petr Date: Thu, 4 Feb 2021 19:07:42 +0000 Subject: [PATCH 115/144] Translate researches_cs.yml via GitLocalize --- .../resources/languages/researches_cs.yml | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/resources/languages/researches_cs.yml b/src/main/resources/languages/researches_cs.yml index 8fb26e5f4..bb33d6cad 100644 --- a/src/main/resources/languages/researches_cs.yml +++ b/src/main/resources/languages/researches_cs.yml @@ -35,9 +35,9 @@ slimefun: magical_book_cover: Magické vázání knihy slimefun_metals: Nové kovy ore_crusher: Zdvojování rud - bronze: Vytvoření Bronzu + bronze: Výroby bronzu alloys: Pokročilé slitiny - compressor_and_carbon: Vytvoření Karbonu + compressor_and_carbon: Výroby karbonu gilded_iron_armor: Pozlacené železné brnění synthetic_diamond: Syntetické diamanty pressure_chamber: Tlaková komora @@ -98,18 +98,18 @@ slimefun: woven_backpack: Tkaný batoh crucible: Kotel gilded_backpack: Vázaný batoh - armored_jetpack: Trysky s Brněním + armored_jetpack: Obrněný raketový batoh ender_talismans: Enderitové talismany nickel_and_cobalt: Ještě více rud magnet: Magnetické kovy infused_magnet: Naplněný magnet - cobalt_pickaxe: Urychlený Krumpáč + cobalt_pickaxe: Zrychlený krumpáč essence_of_afterlife: Černá magie bound_backpack: Uložiště spoutané duší - jetboots: Tryskové Boty - armored_jetboots: Obrněné Tryskové Boty + jetboots: Raketové boty + armored_jetboots: Obrněné raketové boty seismic_axe: Seizmická sekera - pickaxe_of_vein_mining: Krumpáč Těžení Nalezišť + pickaxe_of_vein_mining: Krumpáč těžby rud bound_weapons: Zbraně spoutané duší bound_tools: Nástroje spoutané duší bound_armor: Brnění spoutané duší @@ -118,10 +118,10 @@ slimefun: enhanced_furnace: Vylepšená pec more_enhanced_furnaces: Lepší pece high_tier_enhanced_furnaces: Nejlepší pece - reinforced_furnace: Vyztužená Pec - carbonado_furnace: Carbonado Lemováná Pec + reinforced_furnace: Zesílená pec + carbonado_furnace: Pec lemovaná černými diamanty electric_motor: Zahřívání - block_placer: Pokládač Bloků + block_placer: Pokládač bloků scroll_of_dimensional_teleposition: Otáčí věcí kolem special_bows: Robin Hood tome_of_knowledge_sharing: Dělení s přáteli @@ -129,14 +129,14 @@ slimefun: hardened_glass: Odolávání výbuchům golden_apple_juice: Zlatý lektvar cooler: Přenašeč nápojů - ancient_altar: Starověký Oltář - wither_proof_obsidian: Obsidian co vydrží Withera + ancient_altar: Starověký oltář + wither_proof_obsidian: Pevný obsidián proti witherovi ancient_runes: Elementální rudy special_runes: Fialové rudy infernal_bonemeal: Pekelná kostní moučka rainbow_blocks: Duhové bloky infused_hopper: Vylepšená násypka - wither_proof_glass: Sklo co vydrží Withera + wither_proof_glass: Pevné sklo proti witherovi duct_tape: Lepící páska plastic_sheet: Plast android_memory_core: Paměťové jádro @@ -155,7 +155,7 @@ slimefun: auto_anvil: Automatická kovadlina multimeter: Měření energie gps_setup: Základní GPS nastavení - gps_emergency_transmitter: GPS Nouzový Cestovní Bod + gps_emergency_transmitter: GPS nouzový záchytný bod programmable_androids: Programovatelné androidy android_interfaces: Rozhraní androidu geo_scanner: GEO snímače @@ -227,7 +227,7 @@ slimefun: totem_of_undying: Totem nesmrtelnosti charging_bench: Nabíječka nether_gold_pan: Netherová rýžovací miska - electric_press: Electrický Lis + electric_press: Elektrický lis magnesium_generator: Energie z magnézia kelp_cookie: Chutná řasa advanced_industrial_miner: Lepší těžení @@ -241,3 +241,10 @@ slimefun: bee_armor: Včelí zbroj wise_talisman: Talisman moudrosti book_binder: Vázání knihy očarování + makeshift_smeltery: Vylepšená tavírna + tree_growth_accelerator: Rychlejší stromy + lead_clothing: Olověné oblečení + tape_measure: Svinovací metr + iron_golem_assembler: Automatická farma na železné golemy + shulker_shell: Syntetičtí shulkeři + villager_rune: Obnova vesnických obchodů From 08942610af68de09e631910c8158a48eee2743b2 Mon Sep 17 00:00:00 2001 From: frfole Date: Thu, 4 Feb 2021 19:07:43 +0000 Subject: [PATCH 116/144] Translate researches_cs.yml via GitLocalize --- src/main/resources/languages/researches_cs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_cs.yml b/src/main/resources/languages/researches_cs.yml index bb33d6cad..9e0f5eed7 100644 --- a/src/main/resources/languages/researches_cs.yml +++ b/src/main/resources/languages/researches_cs.yml @@ -248,3 +248,4 @@ slimefun: iron_golem_assembler: Automatická farma na železné golemy shulker_shell: Syntetičtí shulkeři villager_rune: Obnova vesnických obchodů + industrial_miner: Průmyslové těžení From 405b553f0b97838a66fa1e7f6e70f2b95ae11c41 Mon Sep 17 00:00:00 2001 From: Jan Vrska Date: Thu, 4 Feb 2021 19:07:44 +0000 Subject: [PATCH 117/144] Translate researches_cs.yml via GitLocalize --- src/main/resources/languages/researches_cs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/languages/researches_cs.yml b/src/main/resources/languages/researches_cs.yml index 9e0f5eed7..3ab80b996 100644 --- a/src/main/resources/languages/researches_cs.yml +++ b/src/main/resources/languages/researches_cs.yml @@ -249,3 +249,4 @@ slimefun: shulker_shell: Syntetičtí shulkeři villager_rune: Obnova vesnických obchodů industrial_miner: Průmyslové těžení + auto_brewer: Průmyslový pivovar From c94add139be47b71249231f007dc98d8d59422d3 Mon Sep 17 00:00:00 2001 From: 100petr Date: Thu, 4 Feb 2021 19:07:45 +0000 Subject: [PATCH 118/144] Translate categories_cs.yml via GitLocalize --- .../resources/languages/categories_cs.yml | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/main/resources/languages/categories_cs.yml b/src/main/resources/languages/categories_cs.yml index 1facb887f..6a4ea3f5b 100644 --- a/src/main/resources/languages/categories_cs.yml +++ b/src/main/resources/languages/categories_cs.yml @@ -1,25 +1,26 @@ --- slimefun: - armor: Brnění - basic_machines: Základní stroje - birthday: TheBusyBiscuitovy narozeniny (26. Říjen) - cargo: Cargo systém - christmas: Vánoce (Prosinec) - easter: Velikonoce (Duben) - electricity: Energie a elektrika - ender_talismans: Ender Talismany (Tier II) - food: Jídlo - gps: GPS stroje - halloween: Halloween (31. Října) - items: Užitečné itemy - magical_armor: Magická zbroj - magical_gadgets: Magické pomůcky - magical_items: Magické itemy - resources: Materiály - talismans: Talismany (Tier I) - tech_misc: Technické komponenty - technical_gadgets: Technické pomůcky - tools: Nástroje weapons: Zbraně - misc: Smíšené položky - valentines_day: Svatého Valentýna (14. Února) + tools: Nástroje + items: Užitečné předměty + food: Jídlo + basic_machines: Základní stroje + electricity: Energie a elektrika + gps: GPS stroje + armor: Brnění + magical_items: Magické předměty + magical_gadgets: Magické pomůcky + misc: Smíšené předměty + technical_gadgets: Technické pomůcky + resources: Materiály + cargo: Cargo systém + tech_misc: Technické komponenty + magical_armor: Magická zbroj + talismans: Talismany (Tier I) + ender_talismans: Enderitové talismany (Tier II) + christmas: Vánoce (prosinec) + valentines_day: Svatého Valentýna (14. února) + easter: Velikonoce (duben) + birthday: TheBusyBiscuitovy narozeniny (26. říjen) + halloween: Halloween (31. října) + androids: Programovatelné androidy From bbce73ce76790fdf64d2122b8ec16606afc1406c Mon Sep 17 00:00:00 2001 From: jakmanda05 Date: Thu, 4 Feb 2021 19:07:47 +0000 Subject: [PATCH 119/144] Translate recipes_cs.yml via GitLocalize --- src/main/resources/languages/recipes_cs.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/resources/languages/recipes_cs.yml diff --git a/src/main/resources/languages/recipes_cs.yml b/src/main/resources/languages/recipes_cs.yml new file mode 100644 index 000000000..732b10a9a --- /dev/null +++ b/src/main/resources/languages/recipes_cs.yml @@ -0,0 +1,4 @@ +--- +slimefun: + multiblock: + name: Multiblock From e6a9511136777814aca24c29345f8e13b4eb210d Mon Sep 17 00:00:00 2001 From: 100petr Date: Thu, 4 Feb 2021 19:07:49 +0000 Subject: [PATCH 120/144] Translate recipes_cs.yml via GitLocalize --- src/main/resources/languages/recipes_cs.yml | 156 ++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/src/main/resources/languages/recipes_cs.yml b/src/main/resources/languages/recipes_cs.yml index 732b10a9a..e9d821fd7 100644 --- a/src/main/resources/languages/recipes_cs.yml +++ b/src/main/resources/languages/recipes_cs.yml @@ -2,3 +2,159 @@ slimefun: multiblock: name: Multiblock + lore: + '0': Postav ukázanou konstrukci, + '1': jak je ukázáno. Nevyrábí se. + enhanced_crafting_table: + name: Enhanced Crafting Table + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za pomocí Enhanced Crafting Table + '2': Normální pracovní stůl nebude stačit! + armor_forge: + name: Armor Forge + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Armor Forge + grind_stone: + name: Brusný kámen + lore: + '0': Vyrob tento předmět, jak je ukázáno, + smeltery: + name: Smeltery + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Smeltery + ore_crusher: + name: Ore Crusher + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Ore Crusher + mob_drop: + lore: + '0': Zabij tohle stvoření + '1': k získání tohoto předmětu + gold_pan: + name: Gold Pan + lore: + '0': Použij Gold Pan k + '1': získání tohoto předmětu + compressor: + name: Compressor + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Compressor + pressure_chamber: + name: Pressure Chamber + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Pressure Chamber + ore_washer: + name: Ore Washer + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Ore Washer + juicer: + name: Juicer + lore: + '0': Vyrob tento džus, jak je je ukázáno, + '1': za použití Juicer + magic_workbench: + name: Magic Workbench + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Magic Workbench + ancient_altar: + name: Ancient Altar + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Ancient Altar. + '2': Podívej se na Ancient Altar pro více informací + heated_pressure_chamber: + name: Heated Pressure Chamber + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Heated Pressure Chamber + food_fabricator: + name: Food Fabricator + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Food Fabricator + food_composter: + name: Food Composter + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Food Composter + freezer: + name: Freezer + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Freezer + geo_miner: + name: GEO Miner + lore: + '0': Tento předmět lze shromažďovat + '1': pomocí GEO Miner + nuclear_reactor: + name: Nuclear Reactor + lore: + '1': při provozování v Nuclear Reactor + oil_pump: + name: Oil Pump + lore: + '0': Tento předmět lze shromažďovat + '1': pomocí Oil Pump + pickaxe_of_containment: + name: Pickaxe of Containment + lore: + '1': těžbou líhně pomocí + '2': Pickaxe of Containment + refinery: + name: Refinery + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití Rafinery + barter_drop: + name: Piglin Bartering Drop + lore: + '0': Vyměňuj s pigliny zlaté + '1': ingoty k získání tohoto předmětu +minecraft: + shaped: + name: Recept na výrobu ve tvaru + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': v normálním pracovním stole + shapeless: + name: U receptu nezáleží na tvaru + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': v normálním pracovním stole + furnace: + lore: + '0': Roztav tento předmět v peci + '1': k vyrobení vysněného předmětu + blasting: + name: Recept na tavicí pec + lore: + '0': Roztav tento předmět v tavící peci + '1': k vyrobení vysněného předmětu + smoking: + name: Recept na troubu + lore: + '0': Upeč tenhle předmět v troubě + '1': k vyrobení vysněného předmětu + campfire: + lore: + '0': Upeč tenhle předmět v táboráku + '1': k vyrobení vysněného předmětu + stonecutting: + name: Recept na řezačku kamene + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití řezačky kamene + smithing: + name: 'Recept na kovářský stůl ' + lore: + '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití kovářského stolu From a2c3e24a95c25de2bbd82cfd1dd98675a6d4569e Mon Sep 17 00:00:00 2001 From: LirCZE Date: Thu, 4 Feb 2021 19:07:50 +0000 Subject: [PATCH 121/144] Translate recipes_cs.yml via GitLocalize --- src/main/resources/languages/recipes_cs.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/resources/languages/recipes_cs.yml b/src/main/resources/languages/recipes_cs.yml index e9d821fd7..48fac2597 100644 --- a/src/main/resources/languages/recipes_cs.yml +++ b/src/main/resources/languages/recipes_cs.yml @@ -20,6 +20,7 @@ slimefun: name: Brusný kámen lore: '0': Vyrob tento předmět, jak je ukázáno, + '1': za použití brusného kamene smeltery: name: Smeltery lore: @@ -34,6 +35,7 @@ slimefun: lore: '0': Zabij tohle stvoření '1': k získání tohoto předmětu + name: Mob Drop gold_pan: name: Gold Pan lore: @@ -99,6 +101,7 @@ slimefun: name: Nuclear Reactor lore: '1': při provozování v Nuclear Reactor + '0': Tento předmět je vedlejší produkt oil_pump: name: Oil Pump lore: @@ -109,6 +112,7 @@ slimefun: lore: '1': těžbou líhně pomocí '2': Pickaxe of Containment + '0': Tento blok lze získat refinery: name: Refinery lore: @@ -125,15 +129,18 @@ minecraft: lore: '0': Vyrob tento předmět, jak je ukázáno, '1': v normálním pracovním stole + '2': Tvar je důležitý. shapeless: name: U receptu nezáleží na tvaru lore: '0': Vyrob tento předmět, jak je ukázáno, '1': v normálním pracovním stole + '2': Tento recept je beztvarý. furnace: lore: '0': Roztav tento předmět v peci '1': k vyrobení vysněného předmětu + name: Recept na pec blasting: name: Recept na tavicí pec lore: @@ -148,6 +155,7 @@ minecraft: lore: '0': Upeč tenhle předmět v táboráku '1': k vyrobení vysněného předmětu + name: Recept na táborák stonecutting: name: Recept na řezačku kamene lore: From 80b49c264f2dce55311cd68f5322b95b794bcd78 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 4 Feb 2021 20:12:47 +0100 Subject: [PATCH 122/144] Update Translators.java --- .../slimefun4/core/services/localization/Translators.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java index d3a6e64bc..aa54d7e49 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java @@ -90,6 +90,9 @@ public class Translators { addTranslator("MrFriggo", SupportedLanguage.CZECH, true); addTranslator("100petr", SupportedLanguage.CZECH, true); addTranslator("frfole", SupportedLanguage.CZECH, true); + addTranslator("bobhenl", SupportedLanguage.CZECH, true); + addTranslator("janvrska", SupportedLanguage.CZECH, true); + addTranslator("LirCZE", SupportedLanguage.CZECH, true); // Translators - Russian addTranslator("SoSeDiK", SupportedLanguage.RUSSIAN, false); From c01a3c461cf64877f2396f054971996ab298fb30 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 4 Feb 2021 20:50:48 +0000 Subject: [PATCH 123/144] Update dependency com.github.seeseemelk:MockBukkit-v1.16 to v0.24.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d2b5be0b9..77950b56a 100644 --- a/pom.xml +++ b/pom.xml @@ -321,7 +321,7 @@ com.github.seeseemelk MockBukkit-v1.16 - 0.22.1 + 0.24.0 test From d7aa2893b0bfbd67f49aba855c43027d3e605246 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 4 Feb 2021 20:50:54 +0000 Subject: [PATCH 124/144] Update dependency org.junit.jupiter:junit-jupiter to v5.7.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d2b5be0b9..6bfbbffcf 100644 --- a/pom.xml +++ b/pom.xml @@ -315,7 +315,7 @@ org.junit.jupiter junit-jupiter - 5.7.0 + 5.7.1 test From 9f2d2ddd45055286dfb3e9e4fbe46199bd77d588 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 5 Feb 2021 00:12:19 +0100 Subject: [PATCH 125/144] [CI skip] Re-enable MockBukkit-blocked test --- .../testing/tests/researches/TestResearchUnlocking.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java index 6a715312f..ac539f4fc 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java @@ -54,7 +54,6 @@ class TestResearchUnlocking { @ParameterizedTest @DisplayName("Test Unlocking Researches") - @Disabled(value = "Blocked by a concurrency issue in MockBukkit") @ValueSource(booleans = { true, false }) void testUnlock(boolean instant) throws InterruptedException { SlimefunPlugin.getRegistry().setResearchingEnabled(true); From 155b2fc637d48bc1bdf3198c2f7d5037262714d8 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 5 Feb 2021 14:12:17 +0100 Subject: [PATCH 126/144] Some small visual changes --- .../slimefun4/core/SlimefunRegistry.java | 2 +- .../commands/subcommands/VersionsCommand.java | 171 ++++++++++++------ 2 files changed, 120 insertions(+), 53 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java index a12e4b00c..f41116cd6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java @@ -356,7 +356,7 @@ public final class SlimefunRegistry { public boolean logDuplicateBlockEntries() { return logDuplicateBlockEntries; } - + public boolean useActionbarForTalismans() { return talismanActionBarMessages; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index 4cd82755c..63d9f13e9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -4,22 +4,29 @@ import java.util.Collection; import javax.annotation.Nonnull; -import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.hover.content.Text; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.plugin.Plugin; +import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand; import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.papermc.lib.PaperLib; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.hover.content.Text; +/** + * This is our class for the /sf versions subcommand. + * + * @author TheBusyBiscuit + * @author Walshy + * + */ class VersionsCommand extends SubCommand { VersionsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) { @@ -29,34 +36,50 @@ class VersionsCommand extends SubCommand { @Override public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { if (sender.hasPermission("slimefun.command.versions") || sender instanceof ConsoleCommandSender) { - // After all these years... Spigot still displays as "CraftBukkit" - // so we will just fix this inconsistency for them :) + /* + * After all these years... Spigot still displays as "CraftBukkit". + * so we will just fix this inconsistency for them :) + */ String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName(); - ComponentBuilder builder = new ComponentBuilder(); - builder.append("This Server uses the following setup of Slimefun:\n").color(ChatColor.GRAY) - .append(serverSoftware).color(ChatColor.GREEN).append(" " + Bukkit.getVersion() + '\n').color(ChatColor.DARK_GREEN) - .append("Slimefun").color(ChatColor.GREEN).append(" v" + SlimefunPlugin.getVersion() + '\n').color(ChatColor.DARK_GREEN); + + // @formatter:off + builder.append("This Server uses the following setup of Slimefun:\n") + .color(ChatColor.GRAY) + .append(serverSoftware) + .color(ChatColor.GREEN) + .append(" " + Bukkit.getVersion() + '\n') + .color(ChatColor.DARK_GREEN) + .append("Slimefun ") + .color(ChatColor.GREEN) + .append(SlimefunPlugin.getVersion() + '\n') + .color(ChatColor.DARK_GREEN); + // @formatter:on if (SlimefunPlugin.getMetricsService().getVersion() != null) { - builder.append("Metrics build: ").color(ChatColor.GREEN) - .append("#" + SlimefunPlugin.getMetricsService().getVersion() + '\n').color(ChatColor.DARK_GREEN); + // @formatter:off + builder.append("Metrics-Module ") + .color(ChatColor.GREEN) + .append("#" + SlimefunPlugin.getMetricsService().getVersion() + '\n') + .color(ChatColor.DARK_GREEN); + // @formatter:on } addJavaVersion(builder); if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { + // @formatter:off HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "Backwards compatibility has a negative impact on performance!\n" - + "We recommend you to disable this setting unless your server still " - + "has legacy Slimefun items (from before summer 2019) in circulation." + "Backwards compatibility has a negative impact on performance!\n" + + "We recommend you to disable this setting unless your server still " + + "has legacy Slimefun items (from before summer 2019) in circulation." )); + // @formatter:on - builder.append("Backwards compatibility enabled!\n").color(ChatColor.RED).event(hoverEvent); + builder.append("\nBackwards compatibility enabled!\n").color(ChatColor.RED).event(hoverEvent); } builder.append("\n").event((HoverEvent) null); - addPluginVersions(builder); sender.spigot().sendMessage(builder.create()); @@ -67,6 +90,7 @@ class VersionsCommand extends SubCommand { private void addJavaVersion(@Nonnull ComponentBuilder builder) { String javaVer = System.getProperty("java.version"); + if (javaVer.startsWith("1.")) { javaVer = javaVer.substring(2); } @@ -75,65 +99,108 @@ class VersionsCommand extends SubCommand { if (javaVer.indexOf('.') != -1) { javaVer = javaVer.substring(0, javaVer.indexOf('.')); } - int ver = Integer.parseInt(javaVer); - if (ver < 11) { - builder.append("Java " + ver).color(ChatColor.RED) + int version = Integer.parseInt(javaVer); + + if (version < 11) { + // @formatter:off + builder.append("Java " + version).color(ChatColor.RED) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "You should be using at least Java 11! Paper will be dropping support for before Java 11 starting at MC 1.17" + "Your Java version is out of date!\n!" + + "You should use Java 11 or higher.\n" + + "Paper will be dropping support for older versions with the release of Minecraft 1.17." ))) .append("\n") .event((HoverEvent) null); + // @formatter:on } else { - builder.append("Java " + ver + "\n").color(ChatColor.GREEN); + builder.append("Java ").color(ChatColor.GREEN).append(version + "\n").color(ChatColor.DARK_GREEN); } } private void addPluginVersions(@Nonnull ComponentBuilder builder) { Collection addons = SlimefunPlugin.getInstalledAddons(); - builder.append("Installed Addons: ").color(ChatColor.GRAY) - .append("(" + addons.size() + ")").color(ChatColor.DARK_GRAY); + + if (addons.isEmpty()) { + builder.append("No Addons installed").color(ChatColor.GRAY).italic(true); + return; + } + + builder.append("Installed Addons: ").color(ChatColor.GRAY).append("(" + addons.size() + ")").color(ChatColor.DARK_GRAY); for (Plugin plugin : addons) { String version = plugin.getDescription().getVersion(); + HoverEvent hoverEvent = null; + ClickEvent clickEvent = null; + ChatColor primaryColor; + ChatColor secondaryColor; + if (Bukkit.getPluginManager().isPluginEnabled(plugin)) { - HoverEvent hoverEvent; - ClickEvent clickEvent = null; - if (plugin instanceof SlimefunAddon) { - hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "Author(s): " + String.join(", ", plugin.getDescription().getAuthors()) - + "\nClick to open the Bug Tracker" + primaryColor = ChatColor.GREEN; + secondaryColor = ChatColor.DARK_GREEN; + String authors = String.join(", ", plugin.getDescription().getAuthors()); + + if (plugin instanceof SlimefunAddon && ((SlimefunAddon) plugin).getBugTrackerURL() != null) { + // @formatter:off + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(new ComponentBuilder() + .append("Author(s): ") + .append(authors) + .color(ChatColor.YELLOW) + .append("\n> Click here to go to their issues tracker") + .color(ChatColor.GOLD) + .create() )); + // @formatter:on + clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, ((SlimefunAddon) plugin).getBugTrackerURL()); } else { - hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "Author(s): " + String.join(", ", plugin.getDescription().getAuthors()) + // @formatter:off + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(new ComponentBuilder() + .append("Author(s): ") + .append(authors) + .color(ChatColor.YELLOW) + .create() )); + // @formatter:on } - - builder.append("\n " + plugin.getName()).color(ChatColor.GREEN).event(hoverEvent).event(clickEvent) - .append(" v" + version).color(ChatColor.DARK_GREEN) - .append("").event((ClickEvent) null).event((HoverEvent) null); } else { - HoverEvent hoverEvent; - ClickEvent clickEvent = null; - if (plugin instanceof SlimefunAddon) { - hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new Text("Plugin is disabled. Check the console for an error. Click here to report on their issue tracker")); - if (((SlimefunAddon) plugin).getBugTrackerURL() != null) { - clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, ((SlimefunAddon) plugin).getBugTrackerURL()); + primaryColor = ChatColor.RED; + secondaryColor = ChatColor.DARK_RED; + + if (plugin instanceof SlimefunAddon && ((SlimefunAddon) plugin).getBugTrackerURL() != null) { + // @formatter:off + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(new ComponentBuilder() + .append("This plugin is disabled.\nCheck the console for an error message.") + .color(ChatColor.RED) + .append("\n> Click here to report on their issues tracker") + .color(ChatColor.DARK_RED) + .create() + )); + // @formatter:on + + SlimefunAddon addon = (SlimefunAddon) plugin; + + if (addon.getBugTrackerURL() != null) { + clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, addon.getBugTrackerURL()); } } else { - hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new Text("Plugin is disabled. Check the console for an error and report on their issue tracker.")); + hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Plugin is disabled. Check the console for an error and report on their issues tracker.")); } - - // We need to reset the hover event or it's added to all components - builder.append("\n " + plugin.getName()).color(ChatColor.RED).event(hoverEvent).event(clickEvent) - .append(" v" + version).color(ChatColor.DARK_RED) - .append("").event((ClickEvent) null).event((HoverEvent) null); } + + // @formatter:off + // We need to reset the hover event or it's added to all components + builder.append("\n " + plugin.getName()) + .color(primaryColor) + .event(hoverEvent) + .event(clickEvent) + .append(" v" + version) + .color(secondaryColor) + .append("") + .event((ClickEvent) null) + .event((HoverEvent) null); + // @formatter:on } } } From 8526cf679fa3a1a359f3a756ed13bfbc9633b3f2 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 5 Feb 2021 14:12:47 +0100 Subject: [PATCH 127/144] Small visual changes From dec868284de25b965bad480724a750f3c03cc7fe Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 6 Feb 2021 11:11:58 +0100 Subject: [PATCH 128/144] Updated dependencies --- pom.xml | 2 +- .../Objects/SlimefunItem/interfaces/InventoryBlock.java | 2 +- .../testing/tests/researches/TestResearchUnlocking.java | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a58d15f64..fc14fbaef 100644 --- a/pom.xml +++ b/pom.xml @@ -343,7 +343,7 @@ com.github.TheBusyBiscuit CS-CoreLib2 - 0.29.6 + 0.30.0 compile diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java index b09f898e8..47868aac4 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java @@ -60,7 +60,7 @@ public interface InventoryBlock { @Override public boolean canOpen(Block b, Player p) { - return p.hasPermission("slimefun.inventory.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES) && Slimefun.hasUnlocked(p, item, false)); + return p.hasPermission("slimefun.inventory.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK) && Slimefun.hasUnlocked(p, item, false)); } }; } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java index ac539f4fc..9f4f88bac 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearchUnlocking.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; From 47743b632effd0266cc4a3bb4e6bc2dc95bf3e7c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 6 Feb 2021 11:18:09 +0100 Subject: [PATCH 129/144] Fixed an exception when disabled in an invalid environment. --- CHANGELOG.md | 1 + .../core/services/BackupService.java | 59 +++++++++++-------- .../core/services/MinecraftRecipeService.java | 39 ++++++++++++ 3 files changed, 76 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index feab973f6..e68c14c93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ #### Fixes * Fixed #2794 * Fixed #2793 +* Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java index cacc4f411..a4827a419 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java @@ -29,38 +29,51 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; */ public class BackupService implements Runnable { + /** + * The maximum amount of backups to maintain + */ private static final int MAX_BACKUPS = 20; + /** + * Our {@link DateTimeFormatter} for formatting file names. + */ private final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm", Locale.ROOT); + + /** + * The directory in which to create the backups + */ private final File directory = new File("data-storage/Slimefun/block-backups"); @Override public void run() { - List backups = Arrays.asList(directory.listFiles()); + // Make sure that the directory exists. + if (directory.exists()) { + List backups = Arrays.asList(directory.listFiles()); - if (backups.size() > MAX_BACKUPS) { - try { - purgeBackups(backups); - } catch (IOException e) { - SlimefunPlugin.logger().log(Level.WARNING, "Could not delete an old backup", e); - } - } - - File file = new File(directory, format.format(LocalDateTime.now()) + ".zip"); - - if (!file.exists()) { - try { - if (file.createNewFile()) { - try (ZipOutputStream output = new ZipOutputStream(new FileOutputStream(file))) { - createBackup(output); - } - - SlimefunPlugin.logger().log(Level.INFO, "Backed up Slimefun data to: {0}", file.getName()); - } else { - SlimefunPlugin.logger().log(Level.WARNING, "Could not create backup-file: {0}", file.getName()); + if (backups.size() > MAX_BACKUPS) { + try { + purgeBackups(backups); + } catch (IOException e) { + SlimefunPlugin.logger().log(Level.WARNING, "Could not delete an old backup", e); + } + } + + File file = new File(directory, format.format(LocalDateTime.now()) + ".zip"); + + if (!file.exists()) { + try { + if (file.createNewFile()) { + try (ZipOutputStream output = new ZipOutputStream(new FileOutputStream(file))) { + createBackup(output); + } + + SlimefunPlugin.logger().log(Level.INFO, "Backed up Slimefun data to: {0}", file.getName()); + } else { + SlimefunPlugin.logger().log(Level.WARNING, "Could not create backup-file: {0}", file.getName()); + } + } catch (IOException x) { + SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "An Exception occurred while creating a backup for Slimefun " + SlimefunPlugin.getVersion()); } - } catch (IOException x) { - SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "An Error occurred while creating a backup for Slimefun " + SlimefunPlugin.getVersion()); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java index 694f1b352..ccc8785ab 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java @@ -1,6 +1,7 @@ package io.github.thebusybiscuit.slimefun4.core.services; import java.util.Collection; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Optional; @@ -10,6 +11,9 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; import org.bukkit.Server; import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.ItemStack; @@ -34,9 +38,19 @@ import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunG */ public class MinecraftRecipeService { + /** + * Our {@link Plugin} instance + */ private final Plugin plugin; + + /** + * The subscriber list for the {@link RecipeSnapshot}. + */ private final List> subscriptions = new LinkedList<>(); + /** + * Our {@link RecipeSnapshot} - The centerpiece of this class. + */ private RecipeSnapshot snapshot; /** @@ -115,6 +129,7 @@ public class MinecraftRecipeService { * * @param recipe * The {@link Recipe} to get the shape from + * * @return An Array of {@link RecipeChoice} representing the shape of this {@link Recipe} */ @Nonnull @@ -149,6 +164,7 @@ public class MinecraftRecipeService { * * @param item * The {@link ItemStack} for which to get the recipes + * * @return An array of {@link Recipe Recipes} to craft the given {@link ItemStack} */ @Nonnull @@ -160,4 +176,27 @@ public class MinecraftRecipeService { } } + /** + * This returns the corresponding {@link Keyed} {@link Recipe} for the given {@link NamespacedKey}. + * If no {@link Recipe} was found, null will be returned. + * This is a significantly faster method over {@link Bukkit#getRecipe(NamespacedKey)} since we + * operate on a cached {@link HashMap} + * + * @param key + * The {@link NamespacedKey} + * + * @return The corresponding {@link Recipe} or null + */ + @Nullable + public Recipe getRecipe(@Nonnull NamespacedKey key) { + Validate.notNull(key, "The NamespacedKey should not be null"); + + if (snapshot != null) { + // We operate on a cached HashMap which is much faster than Bukkit's method. + return snapshot.getRecipe(key); + } else { + return Bukkit.getRecipe(key); + } + } + } From aeef442935f5322ef2903087f24ef1cc62fd09f2 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 6 Feb 2021 15:03:51 +0000 Subject: [PATCH 130/144] Update dependency com.konghq:unirest-java to v3.11.11 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fc14fbaef..99c6c429d 100644 --- a/pom.xml +++ b/pom.xml @@ -355,7 +355,7 @@ com.konghq unirest-java - 3.11.10 + 3.11.11 compile From 7ddd0469eb7662f02a4802643bbf680f5cc9bd24 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 6 Feb 2021 19:32:41 +0100 Subject: [PATCH 131/144] Deprecated Automated Crafting Chamber (soon to be replaced) --- CHANGELOG.md | 1 + .../slimefun4/implementation/SlimefunItems.java | 2 ++ .../electric/machines/AutomatedCraftingChamber.java | 10 ++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e68c14c93..1820d6132 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ * /sf versions now shows the Java version and some useful tooltips #### Changes +* Deprecated Automatic Crafting Chamber #### Fixes * Fixed #2794 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 84d183605..a9ee7b170 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -841,7 +841,9 @@ public final class SlimefunItems { public static final SlimefunItemStack ELECTRIC_INGOT_FACTORY_2 = new SlimefunItemStack("ELECTRIC_INGOT_FACTORY_2", Material.RED_TERRACOTTA, "&cElectric Ingot Factory &7(&eII&7)", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.speed(2), LoreBuilder.powerPerSecond(14)); public static final SlimefunItemStack ELECTRIC_INGOT_FACTORY_3 = new SlimefunItemStack("ELECTRIC_INGOT_FACTORY_3", Material.RED_TERRACOTTA, "&cElectric Ingot Factory &7(&eIII&7)", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.speed(8), LoreBuilder.powerPerSecond(40)); + @Deprecated public static final SlimefunItemStack AUTOMATED_CRAFTING_CHAMBER = new SlimefunItemStack("AUTOMATED_CRAFTING_CHAMBER", Material.CRAFTING_TABLE, "&6Automated Crafting Chamber", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &e\u26A1 &710 J/Item"); + public static final SlimefunItemStack FLUID_PUMP = new SlimefunItemStack("FLUID_PUMP", Material.BLUE_TERRACOTTA, "&9Fluid Pump", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &e\u26A1 &732 J/Block"); public static final SlimefunItemStack CHARGING_BENCH = new SlimefunItemStack("CHARGING_BENCH", Material.CRAFTING_TABLE, "&6Charging Bench", "", "&fCharges Items such as Jetpacks", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.powerBuffer(128), "&8\u21E8 &e\u26A1 &7Energy Loss: &c50%"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutomatedCraftingChamber.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutomatedCraftingChamber.java index 93031d45c..69295f738 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutomatedCraftingChamber.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutomatedCraftingChamber.java @@ -7,6 +7,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -57,10 +60,11 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem implements I private final Map craftingRecipes = new HashMap<>(); + @ParametersAreNonnullByDefault public AutomatedCraftingChamber(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(category, item, recipeType, recipe); - new BlockMenuPreset(getId(), "&6Automated Crafting Chamber") { + new BlockMenuPreset(getId(), "&4Deprecated item. Do not use.") { @Override public void init() { @@ -94,6 +98,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem implements I @Override public boolean canOpen(Block b, Player p) { + p.sendMessage(ChatColor.DARK_RED + "This item has been deprecated. It will be removed soon!"); return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK); } @@ -145,6 +150,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem implements I @Override public void onPlayerPlace(BlockPlaceEvent e) { + e.getPlayer().sendMessage(ChatColor.DARK_RED + "This item has been deprecated. It will be removed soon!"); BlockStorage.addBlockInfo(e.getBlock(), "enabled", String.valueOf(false)); } @@ -308,4 +314,4 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem implements I craftingRecipes.put(builder.toString(), RecipeType.getRecipeOutputList(machine, inputs)); } } -} +} \ No newline at end of file From 9e83b4af00074be3612bdb5ffe323263c3688106 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 6 Feb 2021 20:23:32 +0100 Subject: [PATCH 132/144] Fixes #2809 --- CHANGELOG.md | 1 + .../implementation/listeners/MultiBlockListener.java | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1820d6132..6322122d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ #### Fixes * Fixed #2794 * Fixed #2793 +* Fixed #2809 * Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java index d684a274b..0d40e4e3e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java @@ -62,8 +62,13 @@ public class MultiBlockListener implements Listener { e.setCancelled(true); MultiBlock mb = multiblocks.getLast(); - mb.getSlimefunItem().callItemHandler(MultiBlockInteractionHandler.class, handler -> handler.onInteract(p, mb, b)); - Bukkit.getPluginManager().callEvent(new MultiBlockInteractEvent(p, mb, b, e.getBlockFace())); + MultiBlockInteractEvent event = new MultiBlockInteractEvent(p, mb, b, e.getBlockFace()); + Bukkit.getPluginManager().callEvent(event); + + // Fixes #2809 + if (!event.isCancelled()) { + mb.getSlimefunItem().callItemHandler(MultiBlockInteractionHandler.class, handler -> handler.onInteract(p, mb, b)); + } } } From e47d0171ccd2a210d652e8c082e8630ea1c85e70 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 7 Feb 2021 12:30:55 +0100 Subject: [PATCH 133/144] Fixes #2810 --- CHANGELOG.md | 1 + .../core/categories/LockedCategory.java | 3 ++- .../guide/SurvivalSlimefunGuide.java | 2 +- .../Slimefun/Objects/Category.java | 3 +-- .../Objects/SlimefunItem/SlimefunItem.java | 20 +++++++++++++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6322122d5..527b51960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ * Fixed #2794 * Fixed #2793 * Fixed #2809 +* Fixed #2810 * Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java index 98dfa4a69..d5334e011 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java @@ -157,7 +157,8 @@ public class LockedCategory extends Category { for (Category category : parents) { for (SlimefunItem item : category.getItems()) { - if (!item.canUse(p, false)) { + // Check if the Player has researched every item (if the item is enabled) + if (!item.isDisabledIn(p.getWorld()) && item.hasResearch() && !profile.hasUnlocked(item.getResearch())) { return false; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java index c59c7dfb9..0a1f20420 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java @@ -266,7 +266,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { SlimefunItem sfitem = category.getItems().get(target); - if (Slimefun.isEnabled(p, sfitem, false)) { + if (!sfitem.isDisabledIn(p.getWorld())) { displaySlimefunItem(menu, category, p, profile, sfitem, page, index); index++; } diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java index cf95721f3..6bf1bf0a7 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java @@ -26,7 +26,6 @@ import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; -import me.mrCookieSlime.Slimefun.api.Slimefun; /** * Represents a category, which structure multiple {@link SlimefunItem} in the {@link SlimefunGuide}. @@ -258,7 +257,7 @@ public class Category implements Keyed { */ public boolean isHidden(@Nonnull Player p) { for (SlimefunItem slimefunItem : getItems()) { - if (!slimefunItem.isHidden() && Slimefun.isEnabled(p, slimefunItem, false)) { + if (!slimefunItem.isHidden() && !slimefunItem.isDisabledIn(p.getWorld())) { return false; } } diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java index d205894db..d1c443496 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java @@ -380,6 +380,26 @@ public class SlimefunItem implements Placeable { return state != ItemState.ENABLED; } + /** + * This method returns whether this {@link SlimefunItem} is disabled + * for that specific {@link World}. + * Note that if the item is disabled globally, this method will still return false. + * + * @param world + * The {@link World} to check + * + * @return Whether this {@link SlimefunItem} is disabled in that world (or in general). + */ + public boolean isDisabledIn(@Nonnull World world) { + if (state == ItemState.UNREGISTERED) { + error("isDisabled(World) cannot be called before registering the item", new UnregisteredItemException(this)); + return false; + } + + // Check if the Item is disabled globally or in this specific world + return isDisabled() || !SlimefunPlugin.getWorldSettingsService().isEnabled(world, this); + } + /** * This method returns the {@link SlimefunAddon} that registered this * {@link SlimefunItem}. If this Item is from Slimefun itself, the current From d3f4ca47797e9ffd62edf8237164741b1bb85e1f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 7 Feb 2021 16:06:06 +0100 Subject: [PATCH 134/144] Proper error-handling for addon inventories --- .../SlimefunItemInteractListener.java | 41 ++++++++++--------- .../Objects/SlimefunItem/SlimefunItem.java | 1 - 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java index 0ac0e9f6a..d17fa55d4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java @@ -120,11 +120,10 @@ public class SlimefunItemInteractListener implements Listener { boolean interactable = sfItem.callItemHandler(BlockUseHandler.class, handler -> handler.onRightClick(event)); if (!interactable) { - String id = optional.get().getId(); Player p = event.getPlayer(); - if (BlockMenuPreset.isInventory(id)) { - openInventory(p, id, event.getInteractEvent().getClickedBlock(), event); + if (BlockMenuPreset.isInventory(sfItem.getId())) { + openInventory(p, sfItem, event.getInteractEvent().getClickedBlock(), event); return false; } } @@ -134,27 +133,31 @@ public class SlimefunItemInteractListener implements Listener { } @ParametersAreNonnullByDefault - private void openInventory(Player p, String id, Block clickedBlock, PlayerRightClickEvent event) { - if (!p.isSneaking() || event.getItem().getType() == Material.AIR) { - event.getInteractEvent().setCancelled(true); + private void openInventory(Player p, SlimefunItem item, Block clickedBlock, PlayerRightClickEvent event) { + try { + if (!p.isSneaking() || event.getItem().getType() == Material.AIR) { + event.getInteractEvent().setCancelled(true); - if (BlockStorage.hasUniversalInventory(id)) { - UniversalBlockMenu menu = BlockStorage.getUniversalInventory(id); + if (BlockStorage.hasUniversalInventory(item.getId())) { + UniversalBlockMenu menu = BlockStorage.getUniversalInventory(item.getId()); - if (menu.canOpen(clickedBlock, p)) { - menu.open(p); - } else { - SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); - } - } else if (BlockStorage.getStorage(clickedBlock.getWorld()).hasInventory(clickedBlock.getLocation())) { - BlockMenu menu = BlockStorage.getInventory(clickedBlock.getLocation()); + if (menu.canOpen(clickedBlock, p)) { + menu.open(p); + } else { + SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); + } + } else if (BlockStorage.getStorage(clickedBlock.getWorld()).hasInventory(clickedBlock.getLocation())) { + BlockMenu menu = BlockStorage.getInventory(clickedBlock.getLocation()); - if (menu.canOpen(clickedBlock, p)) { - menu.open(p); - } else { - SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); + if (menu.canOpen(clickedBlock, p)) { + menu.open(p); + } else { + SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); + } } } + } catch (Exception | LinkageError x) { + item.error("An Exception was caught while trying to open the Inventory", x); } } diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java index d1c443496..28ff901c0 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java @@ -1019,7 +1019,6 @@ public class SlimefunItem implements Placeable { */ public void error(@Nonnull String message, @Nonnull Throwable throwable) { Validate.notNull(addon, "Cannot send an error for an unregistered item!"); - addon.getLogger().log(Level.SEVERE, "Item \"{0}\" from {1} v{2} has caused an Error!", new Object[] { id, addon.getName(), addon.getPluginVersion() }); if (addon.getBugTrackerURL() != null) { From b2241239188442ae0dec7d0c2ba49754fc455cff Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 7 Feb 2021 18:26:08 +0100 Subject: [PATCH 135/144] Fixes #2804 --- CHANGELOG.md | 1 + .../implementation/items/tools/GoldPan.java | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 527b51960..fb99aaf7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ * Fixed #2793 * Fixed #2809 * Fixed #2810 +* Fixed #2804 * Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java index 16848bbd7..c2cada5b9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java @@ -96,10 +96,6 @@ public class GoldPan extends SimpleSlimefunItem implements Recip for (GoldPanDrop setting : drops) { randomizer.add(setting.getOutput(), setting.getValue()); } - - if (randomizer.sumWeights() < 100) { - randomizer.add(new ItemStack(Material.AIR), 100 - randomizer.sumWeights()); - } } /** @@ -110,7 +106,10 @@ public class GoldPan extends SimpleSlimefunItem implements Recip */ @Nonnull public ItemStack getRandomOutput() { - return randomizer.getRandom(); + ItemStack item = randomizer.getRandom(); + + // Fixes #2804 + return item != null ? item : new ItemStack(Material.AIR); } @Override @@ -126,12 +125,14 @@ public class GoldPan extends SimpleSlimefunItem implements Recip if (block.isPresent()) { Block b = block.get(); + // Check the clicked block type and for protections if (b.getType() == getTargetMaterial() && SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), b.getLocation(), ProtectableAction.BREAK_BLOCK)) { ItemStack output = getRandomOutput(); b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); b.setType(Material.AIR); + // Make sure that the randomly selected item is not air if (output.getType() != Material.AIR) { b.getWorld().dropItemNaturally(b.getLocation(), output.clone()); } @@ -148,6 +149,7 @@ public class GoldPan extends SimpleSlimefunItem implements Recip * * @return the {@link EntityInteractHandler} of this {@link SlimefunItem} */ + @Nonnull public EntityInteractHandler onEntityInteract() { return (e, item, offHand) -> { if (!(e.getRightClicked() instanceof ItemFrame)) { From 520208d35343295eea530086817aad84ff95eec3 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 8 Feb 2021 19:53:01 +0100 Subject: [PATCH 136/144] [CI skip] Added compatibility label --- .github/workflows/pr-labels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 5c08b2e06..85f81e547 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -24,6 +24,7 @@ jobs: chore: '🧹 Chores' performance: '💡 Performance Optimization' api: '🔧 API' + compatibility: '🤝 Compatibility' - uses: thollander/actions-comment-pull-request@1.0.1 name: Leave a comment about the applied label @@ -49,6 +50,7 @@ jobs: `chore/**` | 🧹 Chores `api/**` | 🔧 API `performance/**` | 💡 Performance Optimization + `compatibility/**` | 🤝 Compatibility
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 From b0355d18140eb868ae946f37f8c95e8f7767e5b5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 8 Feb 2021 21:36:51 +0000 Subject: [PATCH 137/144] Update dependency com.github.LoneDev6:itemsadder-api to v2.1.35 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 99c6c429d..7915fa728 100644 --- a/pom.xml +++ b/pom.xml @@ -436,7 +436,7 @@ com.github.LoneDev6 itemsadder-api - 2.1.25 + 2.1.35 provided From e2f3944d66949d766f9bc883e78c3579c261a8ad Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 9 Feb 2021 17:08:49 +0100 Subject: [PATCH 138/144] Fixes #2817 --- CHANGELOG.md | 1 + .../items/blocks/BlockPlacer.java | 131 +++++++++++------- 2 files changed, 80 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb99aaf7d..84befbac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ * Fixed #2809 * Fixed #2810 * Fixed #2804 +* Fixed #2817 * Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/BlockPlacer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/BlockPlacer.java index f5800321d..ea384e019 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/BlockPlacer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/BlockPlacer.java @@ -3,6 +3,9 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.blocks; import java.util.List; import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; + import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; @@ -13,10 +16,10 @@ import org.bukkit.block.Block; import org.bukkit.block.Dispenser; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.api.events.BlockPlacerPlaceEvent; import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; @@ -47,15 +50,17 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; */ public class BlockPlacer extends SlimefunItem { - private final ItemSetting> blacklist = new MaterialTagSetting("unplaceable-blocks", SlimefunTag.UNBREAKABLE_MATERIALS); + private final ItemSetting> unplaceableBlocks = new MaterialTagSetting("unplaceable-blocks", SlimefunTag.UNBREAKABLE_MATERIALS); + @ParametersAreNonnullByDefault public BlockPlacer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(category, item, recipeType, recipe); - addItemSetting(blacklist); + addItemSetting(unplaceableBlocks); addItemHandler(onPlace(), onBlockDispense()); } + @Nonnull private BlockPlaceHandler onPlace() { return new BlockPlaceHandler(false) { @@ -69,6 +74,7 @@ public class BlockPlacer extends SlimefunItem { }; } + @Nonnull private BlockDispenseHandler onBlockDispense() { return (e, dispenser, facedBlock, machine) -> { if (!hasPermission(dispenser, facedBlock)) { @@ -79,7 +85,7 @@ public class BlockPlacer extends SlimefunItem { Material material = e.getItem().getType(); if (SlimefunTag.SHULKER_BOXES.isTagged(material)) { - /** + /* * Since vanilla Dispensers can already place Shulker boxes, * we simply fallback to the vanilla behaviour. */ @@ -89,7 +95,7 @@ public class BlockPlacer extends SlimefunItem { e.setCancelled(true); if (!material.isBlock() || SlimefunTag.BLOCK_PLACER_IGNORED_MATERIALS.isTagged(material)) { - /** + /* * Some materials cannot be reliably placed, like beds, * it would look kinda wonky, so we just ignore these altogether. * The event has already been cancelled too, so they won't drop. @@ -97,7 +103,7 @@ public class BlockPlacer extends SlimefunItem { return; } - if (facedBlock.isEmpty() && !isBlacklisted(material) && dispenser.getInventory().getViewers().isEmpty()) { + if (facedBlock.isEmpty() && isAllowed(material) && dispenser.getInventory().getViewers().isEmpty()) { SlimefunItem item = SlimefunItem.getByItem(e.getItem()); if (item != null) { @@ -123,11 +129,12 @@ public class BlockPlacer extends SlimefunItem { * * @return Whether this action is permitted or not */ + @ParametersAreNonnullByDefault private boolean hasPermission(Dispenser dispenser, Block target) { String owner = BlockStorage.getLocationInfo(dispenser.getLocation(), "owner"); if (owner == null) { - /** + /* * If no owner was set, then we will fallback to the previous behaviour: * Allowing block placers to bypass protection, newly placed Block placers * will respect protection plugins. @@ -135,20 +142,30 @@ public class BlockPlacer extends SlimefunItem { return true; } + // Get the corresponding OfflinePlayer OfflinePlayer player = Bukkit.getOfflinePlayer(UUID.fromString(owner)); return SlimefunPlugin.getProtectionManager().hasPermission(player, target, ProtectableAction.PLACE_BLOCK); } - private boolean isBlacklisted(Material type) { - for (String blockType : blacklist.getValue()) { + /** + * This checks if the given {@link Material} is allowed to be placed. + * + * @param type + * The {@link Material} to check + * + * @return Whether placing this {@link Material} is allowed + */ + private boolean isAllowed(@Nonnull Material type) { + for (String blockType : unplaceableBlocks.getValue()) { if (type.toString().equals(blockType)) { - return true; + return false; } } - return false; + return true; } + @ParametersAreNonnullByDefault private void placeSlimefunBlock(SlimefunItem sfItem, ItemStack item, Block block, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, block); Bukkit.getPluginManager().callEvent(e); @@ -156,68 +173,78 @@ public class BlockPlacer extends SlimefunItem { if (!e.isCancelled()) { boolean hasItemHandler = sfItem.callItemHandler(BlockPlaceHandler.class, handler -> { if (handler.isBlockPlacerAllowed()) { - block.setType(item.getType()); - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); + schedulePlacement(block, dispenser.getInventory(), item, () -> { + block.setType(item.getType()); + BlockStorage.store(block, sfItem.getId()); - BlockStorage.store(block, sfItem.getId()); - handler.onBlockPlacerPlace(e); - - if (dispenser.getInventory().containsAtLeast(item, 2)) { - dispenser.getInventory().removeItem(new CustomItem(item, 1)); - } else { - SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); - } + handler.onBlockPlacerPlace(e); + }); } }); if (!hasItemHandler) { - block.setType(item.getType()); - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); - - BlockStorage.store(block, sfItem.getId()); - - if (dispenser.getInventory().containsAtLeast(item, 2)) { - dispenser.getInventory().removeItem(new CustomItem(item, 1)); - } else { - SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); - } + schedulePlacement(block, dispenser.getInventory(), item, () -> { + block.setType(item.getType()); + BlockStorage.store(block, sfItem.getId()); + }); } } } + @ParametersAreNonnullByDefault private void placeBlock(ItemStack item, Block facedBlock, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, facedBlock); Bukkit.getPluginManager().callEvent(e); if (!e.isCancelled()) { - facedBlock.setType(item.getType()); + schedulePlacement(facedBlock, dispenser.getInventory(), item, () -> { + facedBlock.setType(item.getType()); - if (item.hasItemMeta()) { - ItemMeta meta = item.getItemMeta(); + if (item.hasItemMeta()) { + ItemMeta meta = item.getItemMeta(); - if (meta.hasDisplayName()) { - BlockStateSnapshotResult blockState = PaperLib.getBlockState(facedBlock, false); + if (meta.hasDisplayName()) { + BlockStateSnapshotResult blockState = PaperLib.getBlockState(facedBlock, false); - if ((blockState.getState() instanceof Nameable)) { - Nameable nameable = ((Nameable) blockState.getState()); - nameable.setCustomName(meta.getDisplayName()); + if ((blockState.getState() instanceof Nameable)) { + Nameable nameable = ((Nameable) blockState.getState()); + nameable.setCustomName(meta.getDisplayName()); - if (blockState.isSnapshot()) { - // Update block state after changing name - blockState.getState().update(true, false); + if (blockState.isSnapshot()) { + // Update block state after changing name + blockState.getState().update(true, false); + } } } + } - - } - - facedBlock.getWorld().playEffect(facedBlock.getLocation(), Effect.STEP_SOUND, item.getType()); - - if (dispenser.getInventory().containsAtLeast(item, 2)) { - dispenser.getInventory().removeItem(new CustomItem(item, 1)); - } else { - SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); - } + }); } } + + @ParametersAreNonnullByDefault + private void schedulePlacement(Block b, Inventory inv, ItemStack item, Runnable runnable) { + // We need to delay this due to Dispenser-Inventory synchronization issues in Spigot. + SlimefunPlugin.runSync(() -> { + // Make sure the Block has not been occupied yet + if (b.isEmpty()) { + // Only remove 1 item. + ItemStack removedItem = item.clone(); + removedItem.setAmount(1); + + // Play particles + b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, item.getType()); + + // Make sure the item was actually removed (fixes #2817) + + try { + if (inv.removeItem(removedItem).isEmpty()) { + runnable.run(); + } + } catch (Exception x) { + error("An Exception was thrown while a BlockPlacer was performing its action", x); + } + } + }, 2L); + } } From 854c3335e9d7f276f88e4757828bde1003050280 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Wed, 10 Feb 2021 18:33:34 +0100 Subject: [PATCH 139/144] Fixes #2818 --- CHANGELOG.md | 4 +- .../implementation/SlimefunPlugin.java | 18 +++- .../items/magical/talismans/Talisman.java | 84 ++++++++++++------ .../listeners/TalismanListener.java | 87 +++++++++++-------- .../slimefun4/utils/tags/SlimefunTag.java | 16 +++- .../tags/miner_talisman_triggers.json | 9 ++ 6 files changed, 153 insertions(+), 65 deletions(-) create mode 100644 src/main/resources/tags/miner_talisman_triggers.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 84befbac6..65659030b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,10 +35,12 @@ * Fixed #2794 * Fixed #2793 * Fixed #2809 +* Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment * Fixed #2810 * Fixed #2804 * Fixed #2817 -* Fixed a small exception which gets thrown when Slimefun is disabled due to an invalid environment +* Fixed exceptions with inventories not being printed using the logger of the addon that caused it +* Fixed #2818 ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index 22afeab24..1f6e88ea8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -131,11 +131,23 @@ import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu; */ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { + /** + * Our static instance of {@link SlimefunPlugin}. + * Make sure to clean this up in {@link #onDisable()} ! + */ private static SlimefunPlugin instance; + /** + * Keep track of which {@link MinecraftVersion} we are on. + */ private MinecraftVersion minecraftVersion = MinecraftVersion.UNKNOWN; + + /** + * Keep track of whether this is a fresh install or a regular boot up. + */ private boolean isNewlyInstalled = false; + // Various things we need private final SlimefunRegistry registry = new SlimefunRegistry(); private final SlimefunCommand command = new SlimefunCommand(this); private final TickerTask ticker = new TickerTask(); @@ -154,10 +166,12 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { private final MinecraftRecipeService recipeService = new MinecraftRecipeService(this); private final HologramsService hologramsService = new HologramsService(this); + // Some other things we need private final IntegrationsManager integrations = new IntegrationsManager(this); private final SlimefunProfiler profiler = new SlimefunProfiler(); private final GPSNetwork gpsNetwork = new GPSNetwork(this); + // Even more things we need private NetworkManager networkManager; private LocalizationService local; @@ -234,6 +248,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { private void onPluginStart() { long timestamp = System.nanoTime(); + // Check if Paper (<3) is installed if (PaperLib.isPaper()) { getLogger().log(Level.INFO, "Paper was detected! Performance optimizations have been applied."); } else { @@ -259,6 +274,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { int networkSize = config.getInt("networks.max-size"); + // Make sure that the network size is a valid input if (networkSize < 1) { getLogger().log(Level.WARNING, "Your 'networks.max-size' setting is misconfigured! It must be at least 1, it was set to: {0}", networkSize); networkSize = 1; @@ -660,7 +676,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { * This (re)loads every {@link SlimefunTag}. */ private void loadTags() { - for (SlimefunTag tag : SlimefunTag.valuesCache) { + for (SlimefunTag tag : SlimefunTag.values()) { try { // Only reload "empty" (or unloaded) Tags if (tag.isEmpty()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java index 60097f43a..8c9f34f6f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java @@ -9,6 +9,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.NamespacedKey; import org.bukkit.entity.Player; @@ -143,23 +144,35 @@ public class Talisman extends SlimefunItem { } @ParametersAreNonnullByDefault - public static boolean checkFor(Event e, SlimefunItemStack stack) { - return checkFor(e, stack.getItem()); + public static boolean trigger(Event e, SlimefunItemStack stack) { + return trigger(e, stack.getItem(), true); } @ParametersAreNonnullByDefault - public static boolean checkFor(Event e, SlimefunItem item) { + public static boolean trigger(Event e, SlimefunItemStack stack, boolean sendMessage) { + return trigger(e, stack.getItem(), sendMessage); + } + + @ParametersAreNonnullByDefault + public static boolean trigger(Event e, SlimefunItem item) { + return trigger(e, item, true); + } + + @ParametersAreNonnullByDefault + public static boolean trigger(Event e, SlimefunItem item, boolean sendMessage) { if (!(item instanceof Talisman)) { return false; } Talisman talisman = (Talisman) item; + if (ThreadLocalRandom.current().nextInt(100) > talisman.getChance()) { return false; } Player p = getPlayerByEventType(e); - if (p == null || !pass(p, talisman)) { + + if (p == null || !talisman.canEffectsBeApplied(p)) { return false; } @@ -167,7 +180,7 @@ public class Talisman extends SlimefunItem { if (SlimefunUtils.containsSimilarItem(p.getInventory(), talismanItem, true)) { if (talisman.canUse(p, true)) { - activateTalisman(e, p, p.getInventory(), talisman, talismanItem); + activateTalisman(e, p, p.getInventory(), talisman, talismanItem, sendMessage); return true; } else { return false; @@ -177,7 +190,7 @@ public class Talisman extends SlimefunItem { if (SlimefunUtils.containsSimilarItem(p.getEnderChest(), enderTalisman, true)) { if (talisman.canUse(p, true)) { - activateTalisman(e, p, p.getEnderChest(), talisman, enderTalisman); + activateTalisman(e, p, p.getEnderChest(), talisman, enderTalisman, sendMessage); return true; } else { return false; @@ -189,11 +202,14 @@ public class Talisman extends SlimefunItem { } @ParametersAreNonnullByDefault - private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman, ItemStack talismanItem) { + private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman, ItemStack talismanItem, boolean sendMessage) { consumeItem(inv, talisman, talismanItem); applyTalismanEffects(p, talisman); cancelEvent(e, talisman); - talisman.sendMessage(p); + + if (sendMessage) { + talisman.sendMessage(p); + } } @ParametersAreNonnullByDefault @@ -242,19 +258,45 @@ public class Talisman extends SlimefunItem { return suffix; } - @ParametersAreNonnullByDefault - private void sendMessage(Player p) { - if (!isSilent()) { - String messageKey = "messages.talisman." + getMessageSuffix(); + /** + * This method sends the given {@link Player} the message of this {@link Talisman}. + * Dependent on the selected config setting, the message will be sent via the actionbar + * or in the chat window. + * + * @param p + * The {@link Player} who shall receive the message + */ + public void sendMessage(@Nonnull Player p) { + Validate.notNull(p, "The Player must not be null."); - if (SlimefunPlugin.getRegistry().useActionbarForTalismans()) { - SlimefunPlugin.getLocalization().sendActionbarMessage(p, messageKey, false); - } else { - SlimefunPlugin.getLocalization().sendMessage(p, messageKey, true); + // Check if this Talisman has a message + if (!isSilent()) { + try { + String messageKey = "messages.talisman." + getMessageSuffix(); + + if (SlimefunPlugin.getRegistry().useActionbarForTalismans()) { + // Use the actionbar + SlimefunPlugin.getLocalization().sendActionbarMessage(p, messageKey, false); + } else { + // Send the message via chat + SlimefunPlugin.getLocalization().sendMessage(p, messageKey, true); + } + } catch (Exception x) { + error("An Exception was thrown while trying to send a Talisman message", x); } } } + private boolean canEffectsBeApplied(@Nonnull Player p) { + for (PotionEffect effect : getEffects()) { + if (effect != null && p.hasPotionEffect(effect.getType())) { + return false; + } + } + + return true; + } + @Nullable private static Player getPlayerByEventType(@Nonnull Event e) { if (e instanceof EntityDeathEvent) { @@ -274,14 +316,4 @@ public class Talisman extends SlimefunItem { return null; } - private static boolean pass(@Nonnull Player p, @Nonnull SlimefunItem talisman) { - for (PotionEffect effect : ((Talisman) talisman).getEffects()) { - if (effect != null && p.hasPotionEffect(effect.getType())) { - return false; - } - } - - return true; - } - } \ No newline at end of file diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 1a5ae752c..ce21c0f35 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -1,12 +1,15 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; -import io.github.thebusybiscuit.cscorelib2.item.CustomItem; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.MagicianTalisman; -import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; -import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; -import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; + +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -38,14 +41,13 @@ import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.util.Vector; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.concurrent.ThreadLocalRandom; +import io.github.thebusybiscuit.cscorelib2.item.CustomItem; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; +import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.MagicianTalisman; +import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; +import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchantment; +import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; public class TalismanListener implements Listener { @@ -59,24 +61,24 @@ public class TalismanListener implements Listener { public void onDamageGet(EntityDamageEvent e) { if (e.getEntity() instanceof Player) { if (e.getCause() == DamageCause.LAVA) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_LAVA); + Talisman.trigger(e, SlimefunItems.TALISMAN_LAVA); } if (e.getCause() == DamageCause.DROWNING) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_WATER); + Talisman.trigger(e, SlimefunItems.TALISMAN_WATER); } if (e.getCause() == DamageCause.FALL) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_ANGEL); + Talisman.trigger(e, SlimefunItems.TALISMAN_ANGEL); } if (e.getCause() == DamageCause.FIRE) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_FIRE); + Talisman.trigger(e, SlimefunItems.TALISMAN_FIRE); } if (e.getCause() == DamageCause.ENTITY_ATTACK) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_KNIGHT); - Talisman.checkFor(e, SlimefunItems.TALISMAN_WARRIOR); + Talisman.trigger(e, SlimefunItems.TALISMAN_KNIGHT); + Talisman.trigger(e, SlimefunItems.TALISMAN_WARRIOR); } if (e.getCause() == DamageCause.PROJECTILE && e instanceof EntityDamageByEntityEvent) { @@ -89,7 +91,7 @@ public class TalismanListener implements Listener { if (e.getDamager() instanceof Projectile && !(e.getDamager() instanceof Trident)) { Projectile projectile = (Projectile) e.getDamager(); - if (Talisman.checkFor(e, SlimefunItems.TALISMAN_WHIRLWIND)) { + if (Talisman.trigger(e, SlimefunItems.TALISMAN_WHIRLWIND)) { Player p = (Player) e.getEntity(); returnProjectile(p, projectile); } @@ -141,7 +143,7 @@ public class TalismanListener implements Listener { // We are also excluding entities which can pickup items, this is not perfect // but it at least prevents dupes by tossing items to zombies - if (!entity.getCanPickupItems() && Talisman.checkFor(e, SlimefunItems.TALISMAN_HUNTER)) { + if (!entity.getCanPickupItems() && Talisman.trigger(e, SlimefunItems.TALISMAN_HUNTER)) { Collection extraDrops = getExtraDrops(e.getEntity(), e.getDrops()); for (ItemStack drop : extraDrops) { @@ -190,7 +192,7 @@ public class TalismanListener implements Listener { @EventHandler public void onItemBreak(PlayerItemBreakEvent e) { - if (Talisman.checkFor(e, SlimefunItems.TALISMAN_ANVIL)) { + if (Talisman.trigger(e, SlimefunItems.TALISMAN_ANVIL)) { PlayerInventory inv = e.getPlayer().getInventory(); int slot = inv.getHeldItemSlot(); @@ -223,7 +225,7 @@ public class TalismanListener implements Listener { @EventHandler public void onSprint(PlayerToggleSprintEvent e) { if (e.isSprinting()) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_TRAVELLER); + Talisman.trigger(e, SlimefunItems.TALISMAN_TRAVELLER); } } @@ -236,7 +238,7 @@ public class TalismanListener implements Listener { MagicianTalisman talisman = (MagicianTalisman) SlimefunItems.TALISMAN_MAGICIAN.getItem(); TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet()); - if (enchantment != null && Talisman.checkFor(e, SlimefunItems.TALISMAN_MAGICIAN)) { + if (enchantment != null && Talisman.trigger(e, SlimefunItems.TALISMAN_MAGICIAN)) { /* * Fix #2679 * By default, the Bukkit API doesn't allow us to give enchantment books extra enchantments. @@ -249,7 +251,7 @@ public class TalismanListener implements Listener { } // Wizard Talisman - if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, SlimefunItems.TALISMAN_WIZARD)) { + if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.trigger(e, SlimefunItems.TALISMAN_WIZARD)) { // Randomly lower some enchantments for (Map.Entry entry : enchantments.entrySet()) { if (entry.getValue() > 1 && random.nextInt(100) < 40) { @@ -264,7 +266,8 @@ public class TalismanListener implements Listener { @EventHandler(ignoreCancelled = true) public void onExperienceReceive(PlayerExpChangeEvent e) { - if (e.getAmount() > 0 && Talisman.checkFor(e, SlimefunItems.TALISMAN_WISE)) { + // Check if the experience change was positive. + if (e.getAmount() > 0 && Talisman.trigger(e, SlimefunItems.TALISMAN_WISE)) { // Double-XP e.setAmount(e.getAmount() * 2); } @@ -272,21 +275,27 @@ public class TalismanListener implements Listener { @EventHandler(ignoreCancelled = true) public void onBlockDropItems(BlockDropItemEvent e) { - // We only want to double ores - Material type = e.getBlockState().getType(); - if (type.name().endsWith("_ORE")) { - ItemStack item = e.getPlayer().getInventory().getItemInMainHand(); + ItemStack item = e.getPlayer().getInventory().getItemInMainHand(); - if (item.getType() != Material.AIR && item.getAmount() > 0 && !item.containsEnchantment(Enchantment.SILK_TOUCH)) { + // We are going to ignore Silk Touch here + if (item.getType() != Material.AIR && item.getAmount() > 0 && !item.containsEnchantment(Enchantment.SILK_TOUCH)) { + Material type = e.getBlockState().getType(); + + // We only want to double ores + if (SlimefunTag.MINER_TALISMAN_TRIGGERS.isTagged(type)) { Collection drops = e.getItems(); - if (Talisman.checkFor(e, SlimefunItems.TALISMAN_MINER)) { + if (Talisman.trigger(e, SlimefunItems.TALISMAN_MINER, false)) { int dropAmount = getAmountWithFortune(type, item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)); + + // Keep track of whether we actually doubled the drops or not boolean doubledDrops = false; + // Loop through all dropped items for (Item drop : drops) { ItemStack droppedItem = drop.getItemStack(); + // We do not want to dupe blocks if (!droppedItem.getType().isBlock()) { int amount = Math.max(1, (dropAmount * 2) - droppedItem.getAmount()); e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), new CustomItem(droppedItem, amount)); @@ -294,8 +303,14 @@ public class TalismanListener implements Listener { } } + // Fixes #2077 if (doubledDrops) { - SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.talisman.miner", true); + Talisman talisman = SlimefunItems.TALISMAN_MINER.getItem(Talisman.class); + + // Fixes #2818 + if (talisman != null) { + talisman.sendMessage(e.getPlayer()); + } } } } @@ -305,7 +320,7 @@ public class TalismanListener implements Listener { @EventHandler public void onBlockBreak(BlockBreakEvent e) { if (SlimefunTag.CAVEMAN_TALISMAN_TRIGGERS.isTagged(e.getBlock().getType())) { - Talisman.checkFor(e, SlimefunItems.TALISMAN_CAVEMAN); + Talisman.trigger(e, SlimefunItems.TALISMAN_CAVEMAN); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java index d6893e361..14cf74b07 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java @@ -22,6 +22,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationExce import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.BlockPlacer; import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.CropGrowthAccelerator; +import io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman; import io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks.miner.IndustrialMiner; import io.github.thebusybiscuit.slimefun4.implementation.items.tools.ClimbingPick; import io.github.thebusybiscuit.slimefun4.implementation.items.tools.ExplosiveShovel; @@ -190,6 +191,11 @@ public enum SlimefunTag implements Tag { */ INDUSTRIAL_MINER_ORES, + /** + * All materials (ores) which can be doubled using a Miner {@link Talisman}. + */ + MINER_TALISMAN_TRIGGERS, + /** * All materials (crops) which the {@link CropGrowthAccelerator} will recognize. */ @@ -216,8 +222,16 @@ public enum SlimefunTag implements Tag { */ CAVEMAN_TALISMAN_TRIGGERS; + /** + * Lookup table for tag names. + */ private static final Map nameLookup = new HashMap<>(); - public static final SlimefunTag[] valuesCache = values(); + + /** + * Speed up lookups by caching the values instead of creating a new array + * on every method call. + */ + private static final SlimefunTag[] valuesCache = values(); static { for (SlimefunTag tag : valuesCache) { diff --git a/src/main/resources/tags/miner_talisman_triggers.json b/src/main/resources/tags/miner_talisman_triggers.json new file mode 100644 index 000000000..8dfd56669 --- /dev/null +++ b/src/main/resources/tags/miner_talisman_triggers.json @@ -0,0 +1,9 @@ +{ + "values" : [ + "#slimefun:fortune_compatible_ores", + { + "id" : "minecraft:gilded_blackstone", + "required" : false + } + ] +} From eebaa069c9118d8ad2f02c5f2ec6c3b36275a689 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 12 Feb 2021 16:08:55 +0000 Subject: [PATCH 140/144] Translate messages_bg.yml via GitLocalize --- src/main/resources/languages/messages_bg.yml | 69 ++++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/src/main/resources/languages/messages_bg.yml b/src/main/resources/languages/messages_bg.yml index 7da9bb3b5..bfa337459 100644 --- a/src/main/resources/languages/messages_bg.yml +++ b/src/main/resources/languages/messages_bg.yml @@ -4,7 +4,7 @@ commands: cheat: Позволява Ви да чийтвате Предмети give: Позволява Ви да давате на някого Slimefun Предмети guide: Дава ви Slimefun Ръководство - teleporter: Вижте пътни точки от други играчи + teleporter: Вижте пътни точки на други играчи versions: Лист с всички инсталирани Добавки search: Претърсва вашето Ръководство за даден термин / предмет open_guide: Отваря Ви Slimefun Ръководството без да използвате книгата @@ -48,10 +48,10 @@ guide: selected-language: 'Избран в момента:' change: Натисни, за да избереш нов език description: - - "&7Сега имаш опцията да промениш" - - "&7езика, на който е Slimefun" - - "&7той ще се промени само за теб. Предметите" - - "&7не могат да бъдат преведени за момента." + '0': "&7Сега имаш опцията да промениш" + '1': "&7езика, на който е Slimefun" + '2': "&7той ще се промени само за теб. Предметите" + '3': "&7не могат да бъдат преведени за момента." title: main: Slimefun Ръководство settings: Настройки & Информация @@ -73,10 +73,10 @@ guide: profile-link: Натиснете, за да видите техния профил в GitHub open: Натисни, за да видиш нашите контрибутори description: - - "&7Slimefun е проект с отворен код" - - "&7и е поддържан от голямо общество от хора." - - "&7Над &e%contributors% &7хора са работили върху" - - "&7Slimefun през всички тези години." + '0': "&7Slimefun е проект с отворен код" + '1': "&7и е поддържан от голямо общество от хора." + '2': "&7Над &e%contributors% &7хора са работили върху" + '3': "&7Slimefun през всички тези години." pages: previous: Предишна страница next: Следваща страница @@ -96,9 +96,9 @@ guide: settings: Върнете се обратно в Панела с Настройки(Settings Panel) locked: ЗАКЛЮЧЕНО locked-category: - - За да отключите тази категория - - ще трябва да отключите всички предмети от - - следните категории + '0': За да отключите тази категория + '1': ще трябва да отключите всички предмети от + '2': следните категории work-in-progress: Тази функция не е завършена все още! messages: not-researched: "&4Нямате достатъчно познания, за да разберете това" @@ -154,22 +154,22 @@ messages: link-prompt: "&eНатиснете тук:" diet-cookie: "&eЗапочнахте да се чувствате доста лекичък..." fortune-cookie: - - "&7Помогнете ми, аз съм затворен в Фабрика за Късметлийски Бисквитки!" - - "&7Утре Вие ще умрете... от Creeper" - - "&7В някакъв момент от живота Ви нещо лошо ще се случи!!!" - - "&7Следващата седмица ще забележите, че това не е реалния свят, а всъщност Вие - сте в компютърна игра" - - "&7Тази бисквитка ще стане вкусна в следващите няколко секунди" - - '&7Последната дума, която ще чуете ще бъде "УНИЩОЖЕТЕ!!!"' - - "&7Каквото и да правите никога, ама никога не прегръщайте Creeper... Аз опитах. - Доста добре е, но не си заслужава." - - "&742. Отговорът е 42." - - "&7Walshy веднъж на ден ще пази неприятностите далече." - - "&7Никога не копайте право надолу!" - - "&7Туй е само плътна рана!" - - "&7Винаги гледайте от към хубавата страна на живота!" - - "&7Това беше Бисквитка, а не Курабийка" - - "&7Неоновите табели светят!" + '0': "&7Помогнете ми, аз съм затворен в Фабрика за Късметлийски Бисквитки!" + '1': "&7Утре Вие ще умрете... от Creeper" + '2': "&7В някакъв момент от живота Ви нещо лошо ще се случи!!!" + '3': "&7Следващата седмица ще забележите, че това не е реалния свят, а всъщност + Вие сте в компютърна игра" + '4': "&7Тази бисквитка ще стане вкусна в следващите няколко секунди" + '5': '&7Последната дума, която ще чуете ще бъде "УНИЩОЖЕТЕ!!!"' + '6': "&7Каквото и да правите никога, ама никога не прегръщайте Creeper... Аз опитах. + Доста добре е, но не си заслужава." + '7': "&742. Отговорът е 42." + '8': "&7Walshy веднъж на ден ще пази неприятностите далече." + '9': "&7Никога не копайте право надолу!" + '10': "&7Туй е само плътна рана!" + '11': "&7Винаги гледайте от към хубавата страна на живота!" + '12': "&7Това беше Бисквитка, а не Курабийка" + '13': "&7Неоновите табели светят!" piglin-barter: "&4Не може да разменяте предмети с Пиглините използвайки предмети от Slimefun" enchantment-rune: @@ -269,9 +269,9 @@ gps: max: "&4Достигнахте максималната бройка локации" duplicate: "&4Вие вече сте създал локация на име: &f%waypoint%" insufficient-complexity: - - "&4Недостатъчна Сложност на GPS Мрежата: &c%complexity%" - - "&4a) Все още нямате направена GPS Мрежа" - - "&4b) Вашата GPS Мрежа не е достатъчно сложна" + '0': "&4Недостатъчна Сложност на GPS Мрежата: &c%complexity%" + '1': "&4a) Все още нямате направена GPS Мрежа" + '2': "&4b) Вашата GPS Мрежа не е достатъчно сложна" geo: scan-required: "&4GEO-Scan изискан! &cПърво сканирайте този чънк използвайки GEO-Scanner!" inventory: @@ -310,11 +310,10 @@ android: INTERFACE_ITEMS: "&9Изпратни съдаржанието на Инвентара към лицевия Интерфейс" INTERFACE_FUEL: "&cИзвадете Гориво от лицевия Интерфейс" enter-name: - - - - "&eМоля въведете име за скрипта си" + '1': "&eМоля въведете име за скрипта си" uploaded: - - "&bКачване..." - - "&aУспешно качихме твоя скрипт!" + '0': "&bКачване..." + '1': "&aУспешно качихме твоя скрипт!" rating: own: "&4Не може да оцените собствения си скрипт!" already: "&4Вие вече сте оставили рейтинг за този скрипт!" From 40754d7da0fafb93d5d5d7bf23f7e438d9434b92 Mon Sep 17 00:00:00 2001 From: peppower Date: Fri, 12 Feb 2021 17:33:32 +0000 Subject: [PATCH 141/144] Translate categories_nl.yml via GitLocalize --- src/main/resources/languages/categories_nl.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/languages/categories_nl.yml b/src/main/resources/languages/categories_nl.yml index eef15e6b7..54f830d80 100644 --- a/src/main/resources/languages/categories_nl.yml +++ b/src/main/resources/languages/categories_nl.yml @@ -2,7 +2,7 @@ slimefun: weapons: Wapens tools: Gereedschappen - items: Voorwerpen + items: Handige Voorwerpen food: Eten basic_machines: Standaard machines electricity: Energie en Elektriciteit @@ -13,7 +13,7 @@ slimefun: misc: Diverse Voorwerpen technical_gadgets: Technische Gadgets resources: Grondstoffen - cargo: Cargobehering + cargo: Opslagbehering tech_misc: Technische Componenten magical_armor: Magische Bescherming talismans: Amuletten (Niveau I) From ce643ad87f80303c2ce8f7c7b9ace190b9584481 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 12 Feb 2021 18:35:44 +0100 Subject: [PATCH 142/144] Update Translators.java --- .../slimefun4/core/services/localization/Translators.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java index aa54d7e49..d717f4027 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java @@ -114,6 +114,7 @@ public class Translators { addTranslator("milvantiou", SupportedLanguage.DUTCH, true); addTranslator("Sven313D", SupportedLanguage.DUTCH, true); addTranslator("TypischTeun", SupportedLanguage.DUTCH, true); + addTranslator("peppower", SupportedLanguage.DUTCH, true); // Translators - Danish addTranslator("Mini-kun", SupportedLanguage.DANISH, true); From c27eb2959a95457a93c860cd58afa6e9018461dc Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 12 Feb 2021 20:09:19 +0100 Subject: [PATCH 143/144] [CI skip] Manually update dutch translations... --- src/main/resources/languages/messages_nl.yml | 143 ++++++++++++++----- 1 file changed, 111 insertions(+), 32 deletions(-) diff --git a/src/main/resources/languages/messages_nl.yml b/src/main/resources/languages/messages_nl.yml index 199735711..5297d9a27 100644 --- a/src/main/resources/languages/messages_nl.yml +++ b/src/main/resources/languages/messages_nl.yml @@ -4,7 +4,6 @@ commands: cheat: Geeft je toestemming om gratis spullen in het spel te brengen give: Geef iemand een aantal Slimefun spullen guide: Geef jezelf een Slimefun Handboek - timings: Laat informatie over de server's prestaties zien teleporter: Bekijk de opgeslagen locaties van andere spelers versions: Laat een lijst met alle geïnstalleerde uitbreidingen zien search: Doorzoek de Slimefun handleiding voor een bepaald trefwoord @@ -15,6 +14,18 @@ commands: description: Ontgrendel of herstart Slimefun kennissen van een speler reset: "&cJe hebt %player%'s Slimefun kennis herstart" reset-target: "&cJe Slimefun kennis is herstart" + backpack: + description: Krijg een kopie van een al bestaande rugzak + invalid-id: "&4Het id moet een positieve nummer zijn!" + player-never-joined: "&4Er is geen speler met die naam gevonden!" + backpack-does-not-exist: "& 4De opgegeven rugzak bestaat niet!" + restored-backpack-given: "&aJouw rugzak is hersteld en is toegevoegd aan jouw + inventaris." + charge: + description: Laad het item wat je vasthoud op + charge-success: Item is opgeladen! + not-rechargeable: Dit item kan niet opgeladen worden! + timings: Laat informatie over de server's prestaties zien guide: search: message: "&bOp welk woord zou je willen zoeken?" @@ -22,8 +33,8 @@ guide: tooltip: "&bKlik om naar een item te zoeken" inventory: 'Zoeken naar: %item%' lore: - - "&bOp welk woord zou je willen zoeken?" - - "&7Type je zoekterm in het gespreksvenster" + '1': "&7Type je zoekterm in het gespreksvenster" + '0': "&bOp welk woord zou je willen zoeken?" cheat: no-multiblocks: "&4Je kan geen Slimefun machines in het spel brengen, je moet ze bouwen zoals aangegeven." @@ -34,7 +45,13 @@ guide: lore: Klik om een eigen vertaling toe the voegen select: Klik om deze taal te selecteren select-default: Klik om de standaard taal te selecteren - selected-language: 'Momenteel geselecteerd:' + selected-language: " Op dit moment geselecteerd:" + change: Klik om een nieuwe taal te kiezen + description: + '0': "&7Je hebt nu de mogelijkheid om de taal" + '1': "&7van Slimefun te veranderen" + '2': "&7aan jou wordt vertoond. Items" + '3': "&7kunnen momenteel niet vertaald worden." title: main: Slimefun Handboek settings: Instellingen & Informatie @@ -44,6 +61,7 @@ guide: addons: Uitbreidingen voor Slimefun4 bugs: Fouten rapporteren source: Source Code + versions: Geïnstalleerde versies credits: commit: Bijdrage commits: Bijdragen @@ -53,6 +71,12 @@ guide: resourcepack: "&cGrafische bundel Ontwikkelaar" translator: "&9Vertaler" profile-link: Klik om hun profielen op Github te bezoeken + open: Klik om onze bijdragers te zien + description: + '0': "&7Slimefun is een open-source project" + '1': "&7en wordt in stand gehouden door een grote gemeenschap van mensen." + '2': "&7Meer dan &e%contributors% &7mensen hebben hieraan" + '3': "&7al deze jaren gewerkt." pages: previous: Vorige bladzijde next: Volgende bladzijde @@ -65,15 +89,17 @@ guide: miner: Grondstoffen die je met deze Miner kunt verkrijgen generator: Beschikbare soorten brandstof gold-pan: Grondstoffen die je kunt verkrijgen + climbing-pick: Oppervlakken die je kunt beklimmen back: title: Terug guide: Ga terug naar de Slimefun Handleiding settings: Ga terug naar Instellingen locked: VERGRENDELD locked-category: - - Om deze categorie te ontgrendelen zul je - - alle items moeten ontgrendelen van de - - volgende categorieën + '0': Om deze categorie te ontgrendelen zul je + '1': alle items moeten ontgrendelen van de + '2': volgende categorieën + work-in-progress: Dit is nog niet helemaal klaar! messages: not-researched: "&4Je hebt niet genoeg Slimefun kennis om dit te begrijpen" not-enough-xp: "&4Je hebt niet genoeg XP om dit te ontgrendelen" @@ -83,12 +109,8 @@ messages: no-permission: "&4Je hebt geen toestemming om deze actie uit te voeren" usage: "&4Gebruik, zoals: &c%usage%" not-online: "&4%player% &cis niet online!" - invalid-item: "&4%item% &cis geen geldig voorwerp!" - invalid-amount: "&4%amount% &cis geen geldige hoeveelheid: het moet meer zijn - dan 0!" given-item: '&bJe hebt &a%amount% keer &7"%item%&7" ontvangen' give-item: '&bJe hebt %player% &a%amount% keer &7"%item%&7" gegeven' - invalid-research: "&4%research% &cis geen geldig Slimefun onderzoek" give-research: '&bJe hebt %player% de kennis over &7"%research%&7" gegeven' hungry: "&cJe hebt teveel honger om zoiets te doen!" disabled-in-world: "&4&lDit voorwerp is uitgeschakeld in deze wereld" @@ -110,6 +132,8 @@ messages: whirlwind: "&a&oJe Talisman heeft het projectiel weerkaatst" wizard: "&a&oJe Talisman heeft je een hoger level van geluk gegeven, maar heeft misschien ook de levels van andere betoveringen verlaagd" + caveman: "&a&oJe talisman gaf je haast" + wise: "&a&oJe Talisman heeft je verkregen experience punten verdubbeld" soulbound-rune: fail: "&cJe kan maar één voorwerp met je ziel verbinden op elk moment" success: "&aJe hebt dit voorwerp succesvol met je ziel verbonden! Het blijft bij @@ -129,19 +153,46 @@ messages: link-prompt: "&eKlik mij:" diet-cookie: "&eJe begint je zo ligt als een veertje te voelen..." fortune-cookie: - - "&7Hellup mij, ik zit vast in een gelukskoekjes-fabriek!" - - "&7Je overlijdt morgen... door een creeper..." - - "&7Ooit gaat er iets ergs gebeuren in je leven!!! Muhahaha" - - "&7Volgende week zal je eindelijk doorhebben dat dit niet de echte wereld is, - maar een simulatie" - - "&7Dit koekje gaat over een paar seconden heerlijk smaken" - - '&7De laatste woorden die je ooit zal horen zijn "Voor mij is deze wereld alleen - maar vals!"' - - "&7What je ook wilt worden, knuffels nooit een creeper... Ik heb het geprobeerd, - maar het is het echt niet waard" - - "&742. Het antwoord op alles is 42" - - "&7A Walshy, één dag houdt alle problemen weg" - - "&7Graaf nooit recht naar beneden!" + '0': "&7Hellup mij, ik zit vast in een gelukskoekjes-fabriek!" + '1': "&7Je overlijdt morgen... door een creeper..." + '2': "&7Ooit gaat er iets ergs gebeuren in je leven!!! Muhahaha" + '3': "&7Volgende week zal je eindelijk doorhebben dat dit niet de echte wereld + is, maar een simulatie" + '4': "&7Dit koekje gaat over een paar seconden heerlijk smaken" + '5': '&7De laatste woorden die je ooit zal horen zijn "Voor mij is deze wereld + alleen maar vals!"' + '6': "&7What je ook wilt worden, knuffels nooit een creeper... Ik heb het geprobeerd, + maar het is het echt niet waard" + '7': "&742. Het antwoord op alles is 42" + '8': "&7A Walshy, één dag houdt alle problemen weg" + '9': "&7Graaf nooit recht naar beneden!" + '10': "&7Het is slechts een vleeswonde!" + '11': "&7Kijk altijd naar de blije kant van je leven!" + '12': "&7Deze was eigenlijk een biscuitje en geen koekje" + '13': "&7Neon borden zijn LIT!" + piglin-barter: "&4Je kunt geen Slimefun spullen met piglins ruilen" + enchantment-rune: + fail: "&cJe kunt dit item niet betoveren." + no-enchantment: "&cKon geen mogelijke betoveringen vinden voor dit item." + success: "&aJe hebt succesvol een random betovering toegevoegd op dit item." + tape-measure: + no-anchor: "&cJe hebt nog een anker nodig voordat je kunt meten!" + wrong-world: "&cJe anker lijkt in een andere wereld te zitten!" + distance: "&7Afstand gemeten. &eAfstand: %distance%" + anchor-set: "&aHet is gelukt om het anker in te stellen:&e %anchor%" + multi-tool: + mode-change: "&b%device% mode veranderd naar: &9%mode%" + not-shears: "&cEen Mutli Tool kan niet gebruikt worden als een schaar!" + climbing-pick: + dual-wielding: "&4Je moet een klim-pickaxe in bijde handen hebben om hem te gebruiken!" + wrong-material: "&cJe kunt dit oppervlak niet beklimmen. Check je Slimefun Guide + voor meer info!" + invalid-item: "&4%item% &cis geen geldig voorwerp!" + invalid-amount: "&4%amount% &cis geen geldige hoeveelheid: het moet meer zijn dan + 0!" + invalid-research: "&4%research% &cis geen geldig Slimefun onderzoek" + bee-suit-slow-fall: "&eJe Bee Wings zullen je helpen om weer veilig op de grond + te komen" mode-change: "&b%device% mode is veranderd naar: &9%mode%" machines: pattern-not-found: "&eSorry, ik heb het recept niet herkend. Plaats astublieft de @@ -187,8 +238,20 @@ machines: title: GPS - Configuratiescherm transmitters: Transmitter-overzicht waypoints: Waypoint-overzicht + INDUSTRIAL_MINER: + no-fuel: "& cUw Industrial Miner heeft geen brandstof meer! Doe de brandstof in + de kist erboven." + piston-facing: "&cJe Industrial Miner moet de duwmachines naar boven hebben!" + piston-space: "&cDe twee duwmachines moeten een leeg blok boven hem hebben!" + destroyed: "&cJouw Industrial Miner lijkt vernietigt te zijn!" + already-running: "&cDeze Industrial Miner draait al!" + full-chest: "&cDe kist van je Industrial Miner is vol!" + no-permission: "&4Het lijkt er op dat je geen permissie hebt om een Industrial + Miner hier te laten werken!" + finished: "&eJe Industrial Miner is klaar! Het heeft in totaal %ores% grondstof(fen)! " anvil: not-working: "&4Je kan geen Slimefun voorwerpen gebruiken in een aambeeld!" + mcmmo-salvaging: "&4Je kunt geen Slimefun items afbreken!" backpack: already-open: "&cSorry, deze rugzak is al ergens anders geopend!" no-stack: "&cJe kan geen rugzakken stapelen" @@ -201,10 +264,11 @@ gps: &r(Kleurcodes zijn ondersteund)" added: "&aEen nieuw locatiepunt is succesvol toegevoegd" max: "&4Je hebt het maximum aantal locatiepunten bereikt" + duplicate: "&4Je hebt al een waypoint genaamd: &f%waypoint%" insufficient-complexity: - - "&4Er is te weinig GPS netwerk complexiteit: &c%complexity%" - - "&4a) Je hebt nog geen GPS netwerk opgezet" - - "&4b) Je GPS netwerk is niet complex genoeg" + '0': "&4Er is te weinig GPS netwerk complexiteit: &c%complexity%" + '1': "&4a) Je hebt nog geen GPS netwerk opgezet" + '2': "&4b) Je GPS netwerk is niet complex genoeg" geo: scan-required: "&4Een GEO-Scan is nodig! &cScan deze chunk eerst met behulp van een GEO-Scanner!" @@ -243,15 +307,15 @@ android: INTERFACE_ITEMS: "&9Geef inventaris aan de geconfronteerde interface" INTERFACE_FUEL: "&cOntvang brandstof van de geconfronteerde interface" enter-name: - - - - "&eType astublieft de gewenste naam in voor het script" + '1': "&eType astublieft de gewenste naam in voor het script" uploaded: - - "&bBezig met uploaden..." - - "&aHet script is succesvol geupload!" + '0': "&bBezig met uploaden..." + '1': "&aHet script is succesvol geupload!" rating: own: "&4Je kan je eigen script geen waardering geven!" already: "&4Je hebt aan een waardering achtergelaten voor dit script!" editor: Scripteditor + too-long: "&cDe code is te lang om te kunnen editen!" languages: default: Server-Standaard en: Engels @@ -284,10 +348,25 @@ languages: fa: Perzisch th: Thais ro: Roemeens - pt: Portugees (Portugal) + pt: Portugees (Portugal) pt-BR: Portugees (Brazilië) bg: Bulgaars ko: Koreaans tr: Turks + hr: Kroatisch + mk: Macedonisch + sr: Servisch + be: Wit-Russisch/Russisch + tl: Tagalog +brewing_stand: + not-working: "&4Je kunt geen Slimefun spullen in een brouwstandaard doen!" +villagers: + no-trading: "&4Je kunt geen Slimefun spullen met villagers ruilen!" +cartography_table: + not-working: "&4Je kunt Slimefun items niet in een cartografie tafel gebruiken!" +cauldron: + no-discoloring: "&4Je kunt de kleur van Slimefun Bescherming niet er af halen" +placeholderapi: + profile-loading: Aan het laden... miner: no-ores: "&eSorry, ik kon geen ertsen vinden dichtbij!" From c09773fcefff5ad7ef77f1ce6e7569e26352d25c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 13 Feb 2021 13:10:45 +0100 Subject: [PATCH 144/144] [CI skip] Manually sync czech translations --- src/main/resources/languages/messages_cs.yml | 270 ++++++++++--------- 1 file changed, 147 insertions(+), 123 deletions(-) diff --git a/src/main/resources/languages/messages_cs.yml b/src/main/resources/languages/messages_cs.yml index 89f93a40f..127b0d438 100644 --- a/src/main/resources/languages/messages_cs.yml +++ b/src/main/resources/languages/messages_cs.yml @@ -1,34 +1,38 @@ --- commands: help: Zobrazí tuto nápovědu - cheat: Umožňuje nacheatovat věci - give: Dejte někomu nějaké Slimefun věci - guide: Dá vám Slimefun příručku - timings: Lag-Info vašeho serveru - teleporter: "Zobrazí \nznačky \nostatních hráčů" - versions: Seznam všech nainstalovaných doplňků - search: Vyhledá ve vaší příručce daný příkaz + cheat: Umožní našvindlovat si věci + give: Dá hráči vybrané Slimefun předměty + guide: Dá Slimefun příručku + teleporter: Zobrazí záchytné body ostatních hráčů + versions: Zobrazí všechny nainstalované doplňky + search: Vyhledá v příručce daný předmět open_guide: Otevře Slimefun příručku bez použití knihy stats: Ukáže statistiky hráče research: - description: Odemkne/Resetuje výzkum daného hráče + description: Odemkne či resetuje výzkum daného hráče reset: "&cResetoval jsi výzkum hráče %player%" reset-target: "&cTvoje znalost byla resetována " backpack: description: Načíst kopii existujícího batohu invalid-id: "&4Id nesmí být záporné!" player-never-joined: "&4Hráče s tímto jménem nelze nalézt!" - backpack-does-not-exist: "&4Určený batoh neexistuje!" + backpack-does-not-exist: "&4Zadaný batoh neexistuje!" restored-backpack-given: "&aTvůj batoh byl obnoven a navrácen do tvého inventáře!" + charge: + description: Nabije předmět, který držíš + charge-success: Předmět byl nabit! + not-rechargeable: Tento předmět nelze nabít! + timings: Lag-Info vašeho serveru guide: search: message: "&bCo bys chtěl vyhledat?" name: "&7Hledat..." - tooltip: "&bKliknutím vyhledejte položku" + tooltip: "&bKlikni pro vyhledání předmětu" inventory: 'Hledání: %item%' lore: - - "&bCo bys chtěl vyhledat?" - - "&7Napiš do chatu co chceš vyhledat" + '1': "&7Napiš do chatu co chceš vyhledat" + '0': "&bCo bys chtěl vyhledat?" cheat: no-multiblocks: "&4Nemůžeš podvádět v multiblocích, musíš je postavit!" languages: @@ -41,157 +45,169 @@ guide: selected-language: 'Aktuálně vybráno:' change: Klikni pro výběr nového jazyka description: - - "&7Nyní máš možnost to změnit" - - "&7jazyk, ve kterém bude Slimefun" - - "&7bude ti představeno. Předměty" - - "&7nelze prozatím přeložit." + '0': "&7Nyní máš možnost změnit" + '1': "&7jazyk, ve kterém ti bude" + '2': "&7Slimefun prezentován. Předměty" + '3': "&7nelze prozatím přeložit." title: main: Slimefun příručka settings: Nastavení a informace - languages: Zvol tvůj preferovaný jazyk + languages: Zvol svůj preferovaný jazyk credits: Slimefun4 pomocníci wiki: Slimefun4 Wiki - addons: Addony pro Slimefun4 + addons: Doplňky pro Slimefun4 bugs: Nahlášení chyb source: Zdrojový kód versions: Nainstalovaná verze credits: + commit: Commit commits: Commits roles: developer: "&6Vývojář" wiki: "&3Wiki správce" - resourcepack: "&cTvůrce Resourcepacku" - translator: "&9Překladač" - profile-link: Klikni pro navštívení jejich profilu na GitHubu - open: Klikni pro zobrazení našich spoluúčastníků + resourcepack: "&cTvůrce modifikačního balíčku" + translator: "&9Překladatel" + profile-link: Klikni pro navštívení jeho profilu na GitHubu + open: Klikni pro zobrazení našich pomocníků description: - - "&7Slimefun je open-source projekt" - - "&7a udržován velkou komunitou lidí." - - "&Přes&e%contributors% &7lidí na tom pracovalo" - - "&7Slimefun za všechny ty roky." + '0': "&7Slimefun je open-source projekt" + '1': "&7udržován velkou komunitou lidí." + '2': "&7Na Slimefunu za všechny ty roky pracovalo" + '3': "&7přes &e%contributors% &7lidí." pages: previous: Předchozí strana next: Následující strana tooltips: open-category: Klikni pro otevření versions-notice: To jsou velmi důležité při hlášení chyb! - wiki: Zobrazit tento předmět na oficiální SlimeFun Wiki + wiki: Zobrazit tento předmět na oficiální Slimefun Wiki recipes: machine: Recepty vytvářené tímto strojem miner: Materiály, které můžeš získat tímto těžebním robotem generator: Dostupné typy paliv gold-pan: Materiály, které můžeš získat + climbing-pick: Povrchy, na které můžeš lézt back: title: Zpět - guide: Zpět do Slimefun Guide - settings: Zpět do Settings Panel + guide: Zpět do Slimefun příručky + settings: Zpět do panelu nastavení locked: ZAMČENO locked-category: - - Chcete-li odemknout tuto kategorii, budete - - 'je třeba odemknout všechny položky z ' - - následující kategorie + '0': Chceš-li odemknout tuto kategorii, + '1': je potřeba odemknout všechny předměty + '2': z předchozích kategorií work-in-progress: Tato funkce ještě není zcela dokončena! messages: not-researched: "&4Ještě jsi nepostoupil tak daleko, abys pochopil tuhle věc" - not-enough-xp: "&4Nemáš dostatek XP levelů na to, abys vyzkoumal tuhle věc" - unlocked: '&bMáš vyzkoumáno &7"%research%"' + not-enough-xp: "&4Nemáš dostatek XP úrovní na to, abys vyzkoumal tuhle věc" + unlocked: "&bMáš vyzkoumáno &7„%research%”" only-players: "&4Tenhle příkaz je jenom pro hráče" unknown-player: "&4Neznámý hráč: &c%player%" - no-permission: "&4Na tohle nemáš dostatečné povolení" + no-permission: "&4Na tohle nemáš dostatečné oprávnění" usage: "&4Použití: &c%usage%" not-online: "&4%player% &czrovna není připojen!" - invalid-item: "&4%item% &cnení platný item!" - invalid-amount: "&4%amount% &cnení platné číslo : musí být větší než 0!" - given-item: '&bDostal jsi &a%amount% &7"%item%&7"' - give-item: '&bDal jsi %player% &a%amount% &7"%item%&7"' - invalid-research: "&4%research% &cnení platný výzkum!" + given-item: "&bDostal jsi &a%amount% &7„%item%&7”" + give-item: "&bDal jsi %player% &a%amount% &7„%item%&7”" give-research: '&bUdělil jsi %player% výzkum &7"%research%&7"' hungry: "&cJsi moc hladový na to, abys to zvládl!" disabled-in-world: "&4&lTahle věc není v tomhle světě povolená" disabled-item: |- &4&lTahle věc není povolená! Jak jsi ji vůbec dostal? - no-tome-yourself: "&cNemůžeš použít svůj &4Tome of Knowledge &c..." + no-tome-yourself: "&cNemůžeš použít svůj &4Tome of Knowledge&c..." multimeter: "&bEnergie: &3%stored% &b/ &3%capacity%" talisman: anvil: "&a&oTvůj talisman zachránil tvůj nástroj od rozbití" - miner: "&a&oTvůj talisman zdvojnásobil tvoje dropy" - hunter: "&a&oTvůj talisman zdvojnásobil tvoje dropy" + miner: "&a&oTvůj talisman zdvojnásobil tvou kořist" + hunter: "&a&oTvůj talisman zdvojnásobil tvou kořist" lava: "&a&oTvůj talisman tě zachránil před uhořením" water: "&a&oTvůj talisman tě zachránil před utopením" angel: "&a&oTvůj talisman tě zachránil před poškození pádem" fire: "&a&oTvůj talisman tě zachránil před uhořením" - magician: "&a&oTvůj talisman ti dal přídavné enchanty" + magician: "&a&oTvůj talisman ti dal dodatečná očarování" traveller: "&a&oTvůj talisman ti dal rychlost" - warrior: "&a&oTvůj talisman ti dal efekt síly na nějakou tu chvíli" - knight: "&a&oTvůj talisman ti dal 5 vteřin regenerace" + warrior: "&a&oTvůj talisman ti dal na určitou chvilku efekt síly" + knight: "&a&oTvůj talisman ti dal 5 sekund regenerace" whirlwind: "&a&oTvůj talisman odrazil projektil" - wizard: "&a&oTvůj talisman ti dal větší level Štěstí, ale možná snížil level jiných - enchantů" + wizard: "&a&oTvůj talisman ti dal větší úroveň štěstí, ale možná snížil úroveň + jiných očarování" + caveman: "&a&oTvůj talisman ti dal spěch" + wise: "& a&aTvůj talisman zdvojnásobil zisk tvých zkušeností" soulbound-rune: - fail: "&cKe své duši můžeš přidat jen jeden předmět." - success: "&aÚspěšně jsi přidal tento item ke své duši. Pokud zemřeš, item ti zůstane." + fail: "&cSvou duši můžeš spoutat jen s jedním předmětem." + success: "&aÚspěšně jsi spoutal tento předmět se svou duši. Pokud zemřeš, předmět + ti zůstane." research: - start: "&7Antičtí duchové šeptají magické slova do tvého ucha..." + start: "&7Antičtí duchové šeptají magická slova do tvého ucha..." progress: "&7Začal jsi přemýšlet nad &b%research% &e(%progress%)" fire-extinguish: "&7Uhasil ses" cannot-place: "&cZde nemůžeš položit blok!" no-pvp: "&cZde nemůžeš bojovat s hráči!" radiation: "&4Byl jsi vystaven smrtelné radiaci! &cVyhoď radioaktivní předmět nebo - si obleč Hazmat oblek." - opening-guide: "&bOtevírání příručky, může to pár sekund trvat..." - opening-backpack: "&bOtevírání batohu, může to pár sekund trvat..." - no-iron-golem-heal: "&cTo není Iron Ingot! S tímto nemůžeš léčit Iron Golemy!" + si obleč hazmat oblek." + opening-guide: "&bOtevírá se příručka, může to pár sekund trvat..." + opening-backpack: "&bOtevírá se batoh, může to pár sekund trvat..." + no-iron-golem-heal: "&cTohle není železný ingot, a proto s ním nemůžeš léčit železné + golemy!" link-prompt: "&eKlikni zde:" - diet-cookie: "&eZačínáš se cítit velice lehký..." + diet-cookie: "&eZačínáš se cítit velice lehce..." fortune-cookie: - - "&7POMOOC!! Jsem uvězněn v továrně na sušenky štěstí!" - - "&7Zítra zemřeš... s láskou od pana Creepera" - - "&7V nějaké části tvého života se stane něco špatného!!!" - - "&7Příští týden si uvědomíš, že toto není reálný život, ale jsi v počítačové hře." - - "&7Sušenka ti bude za pár vteřin velice chutnat" - - '&7Poslední slovo, které uslyšíš bude "VYHUBIT!!!"' - - "&7Ať se stane cokoliv, nepokoušej se mazlit Creepera... Zkusil jsem to. Je to - dobrý pocit, ale nestojí to za to." - - "&742. Odpověď je 42." - - "&7Walshy udrží den problémy pryč." - - "&7Nikdy nekopej pod sebe!" - - "&7To je jen rána masa!" - - "&7Vždy se podívejte na světlou stránku života!" - - "&7Tohle byl vlastně Biscuit a ne Cookie" - - "&7Neonové cedule jsou LIT!" - piglin-barter: "&4Nemůžete měnit s pigliny Slimefun předměty" + '0': "&7POMOOC!! Jsem uvězněn v továrně na sušenky štěstí!" + '1': "&7Zítra zemřeš... s láskou od pana creepera" + '2': "&7V nějaké části tvého života se stane něco špatného!!!" + '3': "&7Příští týden si uvědomíš, že toto není reálný život, ale že jsi v počítačové + hře" + '4': "&7Sušenka ti bude za pár sekund velice chutnat" + '5': "&7Poslední slovo, které uslyšíš bude „VYHUBIT!!!”" + '6': "&7Ať se stane cokoliv, nepokoušej se mazlit creepera... Zkusil jsem to. + Je to dobrý pocit, ale nestojí to za to." + '7': "&742. Odpověď je 42." + '8': "&7Walshy udrží den problémy pryč." + '9': "&7Nikdy nekopej pod sebe!" + '10': "&7To je jen rána masa!" + '11': "&7Vždy se podívej na světlou stránku života!" + '12': "&7Tohle byl vlastně Biscuit, a ne Cookie" + '13': "&7Neonové cedule jsou LIT!" + piglin-barter: "&4S pigliny nemůžeš vyměňovat Slimefun předměty" enchantment-rune: - fail: "&cNemůžeš enchantovat tento předmět" - no-enchantment: "&cPro tento předmět nelze najít žádný vhodný enchant." - success: "&aÚspěšně jsi na tento předmět daů náhodný enchant." + fail: "&cNemůžeš očarovat tento předmět." + no-enchantment: "&cPro tento předmět nelze najít žádné vhodné očarování." + success: "&aÚspěšně jsi na tento předmět dal náhodné vhodné očarování." tape-measure: - no-anchor: "&cMusíš nastavit kotvu než začneš měřit! " + no-anchor: "&cPřed začátkem měření musíš nastavit kotvu! " wrong-world: "&cTvoje kotva je pravděpodobně v jiném světa!" distance: "&7Měření zahájeno. &eVzdálenost: %distance%" anchor-set: "&aÚspěšně nastavena kotva:&e %anchor%" multi-tool: mode-change: "&b%device% mód změněn na: &9%mode%" not-shears: "&cMulti Tool nemůže být použit jako nůžky!" + climbing-pick: + dual-wielding: "&4Musíš držet Climbing Picks v obou rukou pro jeho použití!" + wrong-material: "&cNa tento povrch nemůžeš vylézt. Zkontroluj Slimefun Guide, + kde najdeš další informace!" + invalid-item: "&4%item% &cnení platný předmět!" + invalid-amount: "&4%amount% &cnení platné číslo. Musí být větší než 0!" + invalid-research: "&4%research% &cnení platný výzkum!" + bee-suit-slow-fall: "&eTvé Bee Wings ti pomohou bezpečně a pomalu se vrátit na zem" mode-change: "&b%device% mód změněn na: &9%mode%" machines: - pattern-not-found: "&eOmlouvám se, ale nerozpoznal jsem tento recept. Dej do dispenseru + pattern-not-found: "&eBohužel se nepodařilo rozpoznat tento recept. Dej do dávkovače předměty tak, aby odpovídaly receptu." - unknown-material: "&eOmlouvám se, ale nepoznal jsem předmět v dispenseru. Dej tam - něco, co znám." - wrong-item: "&eOmlouvám se, ale nerozpoznal jsem předmět, se kterým jsi na mě kliknul. + unknown-material: "&eBohužel se nepodařilo rozpoznat tento předmět v dávkovači. + Dej tam něco správného." + wrong-item: "&eBohužel se nepodařilo rozpoznat předmět, se kterým jsi na mě kliknul. Zkontroluj recept a koukni se, jaké předměty můžeš použít." - full-inventory: "&eOmlouvám se, můj inventář je plný." - in-use: "&cInventář tohoto bloku je právě otevřen jiným hráčem" + full-inventory: "&eBohužel, můj inventář je plný." + in-use: "&cInventář tohoto bloku je právě otevřen jiným hráčem." ignition-chamber-no-flint: "&cIgnition Chamberu chybí křesadlo." ANCIENT_ALTAR: - not-enough-pedestals: "&4Altáři chybí podstavce &c(%pedestals% / 8)" + not-enough-pedestals: "&4Altar nemá dostatek Pedestal &c(%pedestals% / 8)" unknown-catalyst: "&4Neznámý katalyst. &cPoužij správný recept!" unknown-recipe: "&4Neznámý recept! &cPoužij správný recept!" ANCIENT_PEDESTAL: - obstructed: "&4Podstavce jsou zablokované! &cOdstraň cokoliv nad podstavcema!" + obstructed: "&4Pedestal je zablokován! &cOdstraň cokoliv nad ním!" HOLOGRAM_PROJECTOR: - enter-text: "&7Napiš do chatu zprávu, kterou chceš, aby Hologram ukazoval. &r(Barvy + enter-text: "&7Napiš do chatu zprávu, kterou chceš, aby hologram ukazoval. &r(Barvy jsou podporovány!)" inventory-title: Editor hologramu ELEVATOR: @@ -199,62 +215,63 @@ machines: pick-a-floor: "&3- Vyber si patro -" current-floor: "&eAktuální patro:" click-to-teleport: "&eKliknutím &7se teleportuješ na toto patro:" - enter-name: "&7Prosím, zadejte název podlaží do chatu. &r(Barvy jsou podporovány!)" - named: "&2Podlaží úspěšně pojmenováno na: &r%floor%" + enter-name: "&7Zadej název podlaží do chatu. &r(Barvy jsou podporovány!)" + named: "&2Podlaží úspěšně pojmenováno: &r%floor%" TELEPORTER: teleporting: "&3Teleportuji..." teleported: "&3Teleportace dokončena!" cancelled: "&4Teleportace zrušena!" invulnerability: "&b&lZískal jsi 30 sekund nezranitelnosti!" gui: - title: Vaše waypointy - tooltip: Klikněte pro teleportaci + title: Tvé záchytné body + tooltip: Klikni pro teleportaci time: Předpokládaný čas CARGO_NODES: must-be-placed: "&4Musí být umístěn na truhlu nebo stroj!" GPS_CONTROL_PANEL: title: GPS - Kontrolní panel transmitters: Přehled vysílačů - waypoints: Přehled waypointů + waypoints: Přehled záchytných bodů INDUSTRIAL_MINER: - no-fuel: "&cTvému průmyslovému horníku došlo palivo! Vložte palivo do bedny nad." + no-fuel: "&cTvému průmyslovému horníku došlo palivo! Vlož palivo do bedny nad." piston-facing: "&cTvůj průmyslový horník potřebuje píst směřující nahoru!" piston-space: "&cDva písty potřebují prázdný blok nad nimi!" - destroyed: "&cZdá se, váš průmysloví horník byl rozbit." + destroyed: "&cZdá se, že tvůj průmyslový horník byl zničen." already-running: "&cTento průmyslový horník již běží!" full-chest: "&cBedna vašeho průmyslového horníka je plná!" - no-permission: "&4Zdá se, nemáte oprávnění používat průmyslového horníka zde!" - finished: "&eVáš průmysloví horník dokončil práci! Získal %ores% hornin!" + no-permission: "&4Zdá se, že zde nemáš oprávnění používat průmyslového horníka!" + finished: "&eTvůj průmysloví horník dokončil práci! Získal %ores% rud!" anvil: not-working: "&4Předměty ze Slimefunu nelze použít v kovadlině!" + mcmmo-salvaging: "&4Nemůžeš zachránit Slimefun předměty!" backpack: - already-open: "&cOmlouváme se, tento batoh je otevřený již někde jinde!" - no-stack: "&cNemůžeš stackovat batohy" + already-open: "&cBohužel, tento batoh je již otevřený někde jinde!" + no-stack: "&cNemůžeš shromažďovat batohy" workbench: - not-enhanced: "&4Nemůžeš použít itemy ze Slimefunu v normální výrobě" + not-enhanced: "&4Nemůžeš použít předměty ze Slimefunu v normální pracovním stole" gps: deathpoint: "&4Bod úmrtí &7%date%" waypoint: - new: "&eProsím, zadejte název waypointu do chatu. &7(Barvy jsou podporovány!)" - added: "&aÚspěšně přidán nový waypoint" - max: "&4Dosáhl jsi maxima waypointů" - duplicate: "&4Již jsi vytvořil waypoint pojmenovaný: &f%waypoint%" + new: "&eZadej název záchytného bodu do chatu. &7(Barvy jsou podporovány!)" + added: "&aÚspěšně přidán nový záchytný bod" + max: "&4Dosáhl jsi maxima záchytných bodů" + duplicate: "&4Již jsi vytvořil záchytný bod pojmenovaný: &f%waypoint%" insufficient-complexity: - - "&4Nedostatečná komplexita GPS Networku: &c%complexity%" - - "&4a) Nemáš nastavený GPS Network" - - "&4b) TvůjGPS Network není dostatečně komplexní" + '0': "&4Nedostatečná komplexita GPS Networku: &c%complexity%" + '1': "&4a) Nemáš nastavený GPS Network" + '2': "&4b) Tvůj GPS Network není dostatečně komplexní" geo: - scan-required: "&4GEO-Scan je požadován! &cProzkoumejte tento chunk pomocí GEO-Scanneru!" + scan-required: "&4GEO-Scan je požadován! &cProzkoumej tento chunk pomocí GEO-Scanneru!" inventory: no-access: "&4Nemáš přístup k tomuto bloku" android: - started: "&7Tvůj Android právě začal používat jemu přidělený script" - stopped: "&7Tvůj Android pozastavil jemu přidělený script" + started: "&7Tvůj Android právě začal používat jemu přidělený skript" + stopped: "&7Tvůj Android pozastavil jemu přidělený skript" scripts: - already-uploaded: "&4Tento script byl již nahrán." + already-uploaded: "&4Tento skript již byl nahrán." instructions: - START: "&2Začít Script" - REPEAT: "&9Opakovat Script" + START: "&2Začít skript" + REPEAT: "&9Opakovat skript" WAIT: "&ePočkej 0.5s" GO_FORWARD: "&7Posuň se vpřed" GO_UP: "&7Posuň se nahoru" @@ -267,10 +284,10 @@ android: MOVE_AND_DIG_UP: "&bPosuň se a zároveň kopej nahoru" MOVE_AND_DIG_FORWARD: "&bPosuň se a zároveň kopej dopředu" MOVE_AND_DIG_DOWN: "&bPosuň se a zároveň kopej dolů" - ATTACK_MOBS_ANIMALS: "&4Útoč na &cnepřátelské moby a zvířata" - ATTACK_MOBS: "&4Útoč na &cnepřátelské moby" + ATTACK_MOBS_ANIMALS: "&4Útoč na &cnepřátelská stvoření a zvířata" + ATTACK_MOBS: "&4Útoč na &cnepřátelská stvoření" ATTACK_ANIMALS: "&4Útoč na &czvířata" - ATTACK_ANIMALS_ADULT: "&4Útoč na &czvířata&7[Dospělá]" + ATTACK_ANIMALS_ADULT: "&4Útoč na &czvířata &7[Dospělá]" CHOP_TREE: "&cPokácej a zasaď" CATCH_FISH: "&bRybař" FARM_FORWARD: "&bSkliď a zasaď" @@ -280,15 +297,15 @@ android: INTERFACE_ITEMS: "&9Přesuň obsah inventáře do rozhraní na přední straně" INTERFACE_FUEL: "&cVyndej palivo z rozhraní přední strany" enter-name: - - - - "&eProsíme, zadejte název vašeho scriptu" + '1': "&eZadej název tvého skriptu" uploaded: - - "&bNahrávání..." - - "&aTvůj script byl úspěšně nahrán!" + '0': "&bNahrávání..." + '1': "&aTvůj skript byl úspěšně nahrán!" rating: - own: "&4Nemůžeš hodnotit vlastní script!" - already: "&4K tomuto scriptu jsi již zanechal hlasování!" + own: "&4Nemůžeš hodnotit vlastní skript!" + already: "&4K tomuto skriptu jsi již zanechal hlasování!" editor: Editor skriptu + too-long: "&cSkript je příliš dlouhý na úpravu!" languages: default: Výchozí-serverový en: Angličtina @@ -298,7 +315,7 @@ languages: es: Španělština pl: Polština sv: Švédština - nl: Holandština + nl: Nizozemština cs: Čeština hu: Maďarština lv: Lotyština @@ -310,8 +327,6 @@ languages: zh-CN: Čínština (Čína) el: Řečtina he: Hebrejština - pt: Portugalština (Portugalsko) - pt-BR: Portugalština (Brazílie) ar: Arabština af: Afrikánština da: Dánština @@ -323,6 +338,8 @@ languages: fa: Perština th: Thajština ro: Rumunština + pt: Portugalština (Portugalsko) + pt-BR: Portugalština (Brazílie) bg: Bulharština ko: Korejština tr: Turečtina @@ -330,9 +347,16 @@ languages: mk: Makedonština sr: Srbština be: Běloruština + tl: 'Tagalština ' brewing_stand: not-working: "&4Nemůžeš používat Slimefun předměty ve varném stojanu!" villagers: - no-trading: "&4Nemůžeš měnit Slimefun předměty s vesničany!" + no-trading: "&4Nemůžeš vyměňovat Slimefun předměty s vesničany!" +cartography_table: + not-working: "&4Nemůžeš použít Slimefun předměty v kartografickém stole!" +cauldron: + no-discoloring: "&4Nemůžeš odebrat barvu ze Slimefun brnění" +placeholderapi: + profile-loading: Načítání... miner: no-ores: "&eOmlouvám se, nemohu najít rudy v okolí!"