Closed bckd00r closed 2 years ago
If the hardness level is not set in the configuration file, it should not give miner fatigue at all.
This is not true as a default hardness value is set by ItemsAdder. The noteblock/mushroom blocks are too easy to break. Anyway I can make -1 a special value which disables the potion effect to be sent, but I'd need you to explain why you need this change: "it would be great if you could fix it because it's broken with my external plugins.." is very vague.
I want to distribute CustomBlocks to many parts of the server and I am trying to be perfect for this. There are many mistakes, but the important thing for me is that even if the feelings and hardness level are adjusted, sometimes when breaking with a wooden ax, it can get into a bug, the solution to this is to give the player constant miner fatigue and when breaking normal blocks to remove miner fatigue. it is very simple and useful.
@EventHandler(priority = EventPriority.HIGH)
public void slowBockDamageAbort(BlockDamageAbortEvent event) {
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(event.getBlock());
if (customBlock == null) {
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 999999999, -1, true, false), true);
event.getPlayer().sendMessage("block damage abort!");
}
}
@EventHandler(priority = EventPriority.HIGH)
public void slowBlockBreak(BlockBreakEvent event) {
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(event.getBlock());
if (customBlock == null) {
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 999999999, -1, true, false), true);
event.getPlayer().sendMessage("block damage abort!");
}
}
Here is a simple example of what I did (some bugs for now, but works perfectly, does exactly what I want)
All I need for this is hardness: disable
should not be -1
I know that you don't have much time for this plugin, but opening a new topic is very troublesome for me, you can add the following error to your business notes.
https://streamable.com/x4fnwf (I prevented this simple and not too difficult bug by coding a spigot plugin, but I respect the originality of the plugin and hope you can fix it when you're available.)
Thanks for considering my mistakes. <3
I managed to find the cause of the issues and fix it. In the next update you won't have the axes instabreak issue anymore.
Terms
Discord tag (optional)
if#7858
What happened?
I'm creating a new Custom Block, almost everything works fine, but I can't prevent miner fatigue when breaking the custom block. It's a bug I removed it from the config but it doesn't work looks like it needs a minor fix.
Steps to reproduce the issue
1.I created a custom block. 2.I set the config config properly. 3.I placed the block and broke it.
If the hardness level is not set in the configuration file, it should not give miner fatigue at all. A setting can be added for this in config.yml. (customblock_break_slown_potion_effect: true/false)
Server version
Current: git-Purpur-1613 (MC: 1.18.2)Previous: git-Purpur-1585 (MC: 1.18.2)
ItemsAdder Version
ProtocolLib Version
LoneLibs Version
LightAPI Version (optional)
No response
LibsDisguises Version (optional)
No response
FULL server log
no panel faults in sight.
Error (optional)
ItemsAdder config.yml
Problematic items yml configuration file (optional)
Other files, you can drag and drop them here to upload. (optional)
No response
Screenshots/Videos (you can drag and drop files or paste links)
thank you for taking the time to read this simple error, it would be great if you could fix it because it's broken with my external plugins..