Fix clans water exploit and ruined pickaxe duping exploit

This commit is contained in:
AlexTheCoder 2016-09-18 21:31:35 -04:00 committed by Shaun Bennett
parent 0dca2e9d46
commit 2ac7f72327
2 changed files with 4 additions and 50 deletions

View File

@ -86,8 +86,6 @@ public class Gameplay extends MiniPlugin
private WeightSet<Boolean> _foodDecrease; // Weighted probability sets for
// food decrease event outcomes
private Map<Block, Long> _bucketWater = new HashMap<Block, Long>();
public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager)
{
super("PvP Gameplay", plugin);
@ -179,29 +177,6 @@ public class Gameplay extends MiniPlugin
}
}
}
@EventHandler
public void BucketEmpty(PlayerBucketEmptyEvent event)
{
event.setCancelled(true);
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
if (event.getBucket() == Material.WATER_BUCKET)
{
block.setTypeIdAndData(8, (byte) 1, true);
_blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte) 0, 1000);
_bucketWater.put(block, System.currentTimeMillis());
}
if (event.getBucket() == Material.LAVA_BUCKET)
{
block.setTypeIdAndData(10, (byte) 6, true);
_blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte) 0, 2000);
}
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
UtilInv.Update(event.getPlayer());
}
/**
* Decreases the hunger rate decrease speed by arbitrarily canceling a
@ -222,30 +197,6 @@ public class Gameplay extends MiniPlugin
}
}
@EventHandler
public void BucketFill(PlayerBucketFillEvent event)
{
event.setCancelled(true);
if (event.getItemStack().getType() == Material.WATER_BUCKET) if (!_bucketWater.containsKey(event.getBlockClicked())) event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET));
UtilInv.Update(event.getPlayer());
}
@EventHandler
public void BucketWaterExpire(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST) return;
HashSet<Block> remove = new HashSet<Block>();
for (Block cur : _bucketWater.keySet())
if (UtilTime.elapsed(_bucketWater.get(cur).longValue(), 2000)) remove.add(cur);
for (Block cur : remove)
_bucketWater.remove(cur);
}
@EventHandler(priority = EventPriority.LOWEST)
public void ObsidianCancel(BlockPlaceEvent event)
{

View File

@ -87,12 +87,15 @@ public class RunedPickaxe extends RareItem
if (territory != null && !territory.Owner.equals(playerClan))
return;
if (event.getBlock().getType() == Material.BEDROCK)
if (event.getBlock().getType() == Material.BEDROCK || event.getBlock().getType() == Material.BARRIER)
return;
if (ClansManager.getInstance().getNetherManager().getNetherWorld().equals(event.getBlock().getWorld()))
return;
if (ClansManager.getInstance().getBlockRestore().contains(event.getBlock()))
return;
if (!UtilTime.elapsed(pick._instamineEnabled, 12000))
{
event.getBlock().breakNaturally();