Patch conflicts between Fields ore handling and PvP timer ore handling

This commit is contained in:
AlexTheCoder 2018-01-26 13:48:01 -05:00 committed by Alexander Meech
parent c265beddb1
commit 0bbb0257be
2 changed files with 9 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.clans.pvptimer;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
@ -210,7 +211,7 @@ public class PvPTimerManager extends MiniPlugin
}
@SuppressWarnings("deprecation")
public boolean handleMining(Player player, Block block, boolean playSound)
public boolean handleMining(Player player, Block block, boolean playSound, ItemStack overrideDrop, boolean setToAir)
{
if (!hasTimer(player))
{
@ -231,9 +232,12 @@ public class PvPTimerManager extends MiniPlugin
{
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.3, 0.5), item);
};
Collection<ItemStack> drops = block.getDrops(player.getItemInHand());
Collection<ItemStack> drops = overrideDrop != null ? Arrays.asList(overrideDrop) : block.getDrops(player.getItemInHand());
player.getInventory().addItem(converter.apply(drops)).forEach(dropper);
block.setType(Material.AIR);
if (setToAir)
{
block.setType(Material.AIR);
}
return true;
}
@ -330,7 +334,7 @@ public class PvPTimerManager extends MiniPlugin
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event)
{
if (handleMining(event.getPlayer(), event.getBlock(), true))
if (handleMining(event.getPlayer(), event.getBlock(), true, null, true))
{
event.setCancelled(true);
}

View File

@ -118,7 +118,7 @@ public class FieldOreData
return;
}
if (!Managers.get(PvPTimerManager.class).handleMining(player, block, false))
if (!Managers.get(PvPTimerManager.class).handleMining(player, block, false, stack, false))
{
Vector vec = UtilAlg.getTrajectory(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5), source).normalize();