Check for configurable grief types

Signed-off-by: Etzelia <etzelia@hotmail.com>
pull/2/head
Etzelia 2021-07-16 22:11:54 -05:00
parent bc339caad6
commit 0310f0f827
No known key found for this signature in database
GPG Key ID: 708511AE7ABC5314
3 changed files with 24 additions and 8 deletions

View File

@ -47,7 +47,7 @@
<dependency>
<groupId>xyz.etztech</groupId>
<artifactId>plugin-api</artifactId>
<version>1.0.8</version>
<version>1.0.7</version>
</dependency>
</dependencies>
@ -57,8 +57,8 @@
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>etztech-repo</id>
<url>https://repo.etztech.xyz/</url>
<id>canopy-repo</id>
<url>https://mvn.canopymc.net/</url>
</repository>
<repository>
<id>mvn-repo</id>

View File

@ -117,23 +117,34 @@ public class GriefAlertListener implements Listener {
@EventHandler
public void onBlockIgnite(BlockIgniteEvent event) {
if (event.getPlayer() != null &&
(event.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL ||
event.getCause() == BlockIgniteEvent.IgniteCause.FIREBALL)) {
if (
event.getPlayer() != null &&
this.plugin.getConfig().getStringList("grief.enabled").contains("ignition") &&
(
event.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL ||
event.getCause() == BlockIgniteEvent.IgniteCause.FIREBALL
)
) {
addAlert(event.getPlayer(), event.getBlock().getLocation(), Lang.IGNITE_ALERT);
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if(event.getBlockPlaced().getType() == Material.TNT) {
if(
this.plugin.getConfig().getStringList("grief.enabled").contains("tnt") &&
event.getBlockPlaced().getType() == Material.TNT
) {
addAlert(event.getPlayer(), event.getBlock().getLocation(), Lang.TNT_ALERT);
}
}
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
if(event.getBucket() == Material.LAVA_BUCKET) {
if(
this.plugin.getConfig().getStringList("grief.enabled").contains("lava") &&
event.getBucket() == Material.LAVA_BUCKET
) {
addAlert(event.getPlayer(), event.getBlock().getLocation(), Lang.LAVA_ALERT);
}
}

View File

@ -21,6 +21,11 @@ grief:
below_y: 255
# y level lower limit
above_y: 20
# enabled alert types (ignition, tnt, or lava)
enabled:
- ignition
- tnt
- lava
# OreAlert
ore: