stop dispensers being used for flint-andsteal, bonemeal etc etc

This commit is contained in:
NewGarbo 2016-01-25 17:46:39 +00:00
parent 18e892c4ec
commit e68dea65e1

View File

@ -6,6 +6,7 @@ import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -41,6 +42,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
@ -490,7 +492,27 @@ public class Gameplay extends MiniPlugin
event.setCancelled(true);
return;
}
}
@EventHandler
public void blockDispenser(BlockDispenseEvent event)
{
// Block bonemeal
if (event.getItem().getType() == Material.INK_SACK && ((Dye) event.getItem().getData()).getColor() == DyeColor.WHITE)
{
event.setCancelled(true);
}
// Block flint-and-steal
if (event.getItem().getType() == Material.FLINT_AND_STEEL)
{
event.setCancelled(true);
}
if (event.getItem().getType() == Material.FIREWORK_CHARGE)
{
event.setCancelled(true);
}
}
// @EventHandler(priority = EventPriority.LOWEST)