[Feature] Add a blacklist for what dispensers can dispense to antibuild

This commit is contained in:
Iaccidentally 2013-04-16 17:01:01 -04:00
parent eeb31e054f
commit f6e2db1eda
4 changed files with 16 additions and 2 deletions

View File

@ -659,6 +659,9 @@ protect:
# Which blocks should not be pushed by pistons?
piston:
# Which blocks should not be dispensed by dispensers
dispenser:
############################################################
# +------------------------------------------------------+ #

View File

@ -11,7 +11,8 @@ public enum AntiBuildConfig
blacklist_placement("protect.blacklist.placement"),
blacklist_usage("protect.blacklist.usage"),
blacklist_break("protect.blacklist.break"),
blacklist_piston("protect.blacklist.piston");
blacklist_piston("protect.blacklist.piston"),
blacklist_dispenser("protect.blacklist.dispenser");
private final String configName;
private final String defValueString;
private final boolean defValueBoolean;

View File

@ -313,4 +313,14 @@ public class EssentialsAntiBuildListener implements Listener
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockDispense(final BlockDispenseEvent event)
{
final ItemStack item = event.getItem();
if (prot.checkProtectionItems(AntiBuildConfig.blacklist_dispenser, item.getTypeId()))
{
event.setCancelled(true);
}
}
}

View File

@ -5,5 +5,5 @@ main: com.earth2me.essentials.antibuild.EssentialsAntiBuild
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides build protection.
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Iaccidentally]
depend: [Essentials]