Add Config To Disable Enderman Grief (#14)

Added default config value

Bumped version number

Add config for disabling enderman grief

Co-authored-by: Joey Hines <joey@ahines.net>
Reviewed-on: https://git.canopymc.net/Canopy/QoL/pulls/14
Reviewed-by: Etzelia <etzelia@hotmail.com>
Co-Authored-By: ZeroHD <joey@ahines.net>
Co-Committed-By: ZeroHD <joey@ahines.net>
pull/15/head
Joey Hines 2021-07-21 00:20:25 +00:00 committed by Etzelia
parent 2e72736571
commit fa2f79239e
4 changed files with 31 additions and 1 deletions

View File

@ -3,7 +3,7 @@
<groupId>xyz.etztech</groupId> <groupId>xyz.etztech</groupId>
<artifactId>QoL</artifactId> <artifactId>QoL</artifactId>
<!-- Version is used in plugin.yml --> <!-- Version is used in plugin.yml -->
<version>1.12</version> <version>1.13</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<!-- Plugin Information --> <!-- Plugin Information -->

View File

@ -104,6 +104,7 @@ public class QoL extends JavaPlugin {
new BlockIgniteListener(this); new BlockIgniteListener(this);
new CommandPreprocessListener(this); new CommandPreprocessListener(this);
new DeathListener(this); new DeathListener(this);
new EntityChangeBlockListener(this);
// Add commands // Add commands
new MainCommand(this); new MainCommand(this);

View File

@ -0,0 +1,26 @@
package xyz.etztech.qol.listeners;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import xyz.etztech.qol.QoL;
public class EntityChangeBlockListener implements Listener {
QoL plugin;
public EntityChangeBlockListener(QoL plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
if (e.getEntity().getType() == EntityType.ENDERMAN) {
if(plugin.getConfig().getBoolean("disable-mob-grief.enderman", false)){
e.setCancelled(true);
}
}
}
}

View File

@ -93,6 +93,9 @@ disable-fire:
ender_crystal: false ender_crystal: false
explosion: false explosion: false
disable-mob-grief:
enderman: false
# A list of commands to confirm before using if the user isn't in spectator mode # A list of commands to confirm before using if the user isn't in spectator mode
spec-confirm: spec-confirm:
- "tp" - "tp"