summaryrefslogtreecommitdiffstats
path: root/EssentialsAntiBuild/src
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-04-16 17:01:01 -0400
committerIaccidentally <coryhuckaby@gmail.com>2013-04-16 17:01:01 -0400
commitf6e2db1eda6ff101ae14c4c3f98d9dd37041c622 (patch)
tree4d864a5a5eafd20285a110c5a96a2649d7a431eb /EssentialsAntiBuild/src
parenteeb31e054f9d112c03fa391a19acbc954684c294 (diff)
downloadEssentials-f6e2db1eda6ff101ae14c4c3f98d9dd37041c622.tar
Essentials-f6e2db1eda6ff101ae14c4c3f98d9dd37041c622.tar.gz
Essentials-f6e2db1eda6ff101ae14c4c3f98d9dd37041c622.tar.lz
Essentials-f6e2db1eda6ff101ae14c4c3f98d9dd37041c622.tar.xz
Essentials-f6e2db1eda6ff101ae14c4c3f98d9dd37041c622.zip
[Feature] Add a blacklist for what dispensers can dispense to antibuild
Diffstat (limited to 'EssentialsAntiBuild/src')
-rw-r--r--EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java3
-rw-r--r--EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java10
-rw-r--r--EssentialsAntiBuild/src/plugin.yml2
3 files changed, 13 insertions, 2 deletions
diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java
index 1aa33d02a..f0cdfcef4 100644
--- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java
+++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java
@@ -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;
diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java
index 67995c955..e457f72f2 100644
--- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java
+++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java
@@ -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);
+ }
+ }
}
diff --git a/EssentialsAntiBuild/src/plugin.yml b/EssentialsAntiBuild/src/plugin.yml
index 8d7ffbc14..cfe6e6367 100644
--- a/EssentialsAntiBuild/src/plugin.yml
+++ b/EssentialsAntiBuild/src/plugin.yml
@@ -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]