Clean up bucket fixing in clans

This commit is contained in:
AlexTheCoder 2016-10-06 01:27:32 -04:00 committed by Shaun Bennett
parent 2ac7f72327
commit 66dfe06b34

View File

@ -29,6 +29,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
@ -229,15 +230,18 @@ public class ClansGame extends MiniPlugin
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerFillBucket(PlayerInteractEvent event)
public void onPlayerFillBucket(PlayerBucketFillEvent event)
{
ItemStack itemInHand = event.getPlayer().getItemInHand();
if (UtilItem.matchesMaterial(itemInHand, Material.BUCKET) && UtilEvent.isAction(event, ActionType.R))
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot fill buckets!"));
_clans.runSyncLater(() ->
{
event.setCancelled(true);
}
event.getPlayer().updateInventory();
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
event.getPlayer().sendBlockChange(block.getLocation(), block.getType(), block.getData());
}, 1L);
}
@EventHandler