mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
[Feature] Add a blacklist for what dispensers can dispense to antibuild
This commit is contained in:
parent
eeb31e054f
commit
f6e2db1eda
@ -660,6 +660,9 @@ protect:
|
||||
# Which blocks should not be pushed by pistons?
|
||||
piston:
|
||||
|
||||
# Which blocks should not be dispensed by dispensers
|
||||
dispenser:
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Essentials Spawn / New Players | #
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user