From bb348060ef377a7d2f9b68832b833b34446fc1be Mon Sep 17 00:00:00 2001 From: Alex4386 Date: Mon, 4 Nov 2024 00:21:45 +0900 Subject: [PATCH] fix: succession update is not applied accordingly --- .../plugin/typhon/volcano/commands/VolcanoCommand.java | 7 +++++++ .../typhon/volcano/succession/VolcanoSuccession.java | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/java/me/alex4386/plugin/typhon/volcano/commands/VolcanoCommand.java b/src/main/java/me/alex4386/plugin/typhon/volcano/commands/VolcanoCommand.java index 5dfee48..b01cb83 100644 --- a/src/main/java/me/alex4386/plugin/typhon/volcano/commands/VolcanoCommand.java +++ b/src/main/java/me/alex4386/plugin/typhon/volcano/commands/VolcanoCommand.java @@ -196,6 +196,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St break; } else { boolean state = Boolean.parseBoolean(args[2]); + if (args[2].equalsIgnoreCase("enable")) { + state = true; + } else if (args[2].equalsIgnoreCase("disable")) { + state = false; + } + this.volcano.succession.setEnabled(state); if (state) { @@ -204,6 +210,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St msg.info("Primary Succession has been disabled!"); } } + this.volcano.trySave(true); } else { msg.info( "Primary Succession: " diff --git a/src/main/java/me/alex4386/plugin/typhon/volcano/succession/VolcanoSuccession.java b/src/main/java/me/alex4386/plugin/typhon/volcano/succession/VolcanoSuccession.java index b0b0e3c..70dd3b5 100644 --- a/src/main/java/me/alex4386/plugin/typhon/volcano/succession/VolcanoSuccession.java +++ b/src/main/java/me/alex4386/plugin/typhon/volcano/succession/VolcanoSuccession.java @@ -191,6 +191,11 @@ public void runSuccession(Block block) { double heatValueThreshold = 0.7; if (targetBlock.getY() < block.getWorld().getSeaLevel() - 1) { + if (isDebug) this.volcano.logger.log( + VolcanoLogClass.SUCCESSION, + "Succession on block "+TyphonUtils.blockLocationTostring(block)+" / skipped due to sea level." + ); + return; } @@ -282,6 +287,10 @@ public void runSuccession(Block block) { if (rawHeatValue < 0.65) { double amount = 1 - Math.min(1, Math.max(0, (rawHeatValue - 0.5) / 0.15)); + if (isDebug) this.volcano.logger.log( + VolcanoLogClass.SUCCESSION, + "Succession on block "+TyphonUtils.blockLocationTostring(block)+" / amount: "+amount); + if (Math.random() < Math.pow(amount, 2)) { targetBlock.applyBoneMeal(BlockFace.UP); }