repair/salvage anvils will override vanilla functions of a block

This commit is contained in:
nossr50 2020-03-18 19:44:27 -07:00
parent 5bd45ae970
commit 42952dc420
2 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
Version 2.1.124
if Repair's anvil or Salvage's anvil are set to a vanilla block, that block will no longer provide its right-click vanilla function. You can use this to set the vanilla minecraft Anvil as the Anvil used for Repair.
Added Gold_Nugget to Mining's Bonus_Drops in config.yml (edit your config)
Added Piglin to experience.yml combat XP tables with a value of 2.0 (edit your config)
Added Hoglin to experience.yml combat XP tables with a value of 4.0 (edit your config)

View File

@ -41,6 +41,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.*;
import org.bukkit.entity.minecart.PoweredMinecart;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -596,6 +597,18 @@ public class PlayerListener implements Listener {
return;
}
//Cancel the event to prevent vanilla functionality
if(event.getClickedBlock() != null) {
if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(event.getClickedBlock().getType() == Repair.anvilMaterial || event.getClickedBlock().getType() == Salvage.anvilMaterial) {
if(event.useInteractedBlock() == Event.Result.ALLOW) {
event.setUseInteractedBlock(Event.Result.DENY);
}
}
}
}
if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
@ -646,6 +659,7 @@ public class PlayerListener implements Listener {
player.updateInventory();
}
}
}
/* BLAST MINING CHECK */
else if (miningManager.canDetonate()) {