From e8680b22d8fc7de33cd479827ea150784ddebd9c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 4 Nov 2018 12:33:10 +0100 Subject: [PATCH] Bump version --- .../implementation/v6/EventListener.java | 16 ++++++++++++++++ pom.xml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/EventListener.java b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/EventListener.java index 04841da..7af62b1 100644 --- a/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/EventListener.java +++ b/implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/EventListener.java @@ -3,6 +3,7 @@ package org.codemc.worldguardwrapper.implementation.v6; import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent; import com.sk89q.worldguard.bukkit.event.entity.DamageEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent; +import com.sk89q.worldguard.protection.events.DisallowedPVPEvent; import lombok.NoArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -80,4 +81,19 @@ public class EventListener implements Listener { } } + @EventHandler + public void onDisallowedPVP(DisallowedPVPEvent worldGuardEvent) { + AbstractWrappedEvent event = new org.codemc.worldguardwrapper.event.DisallowedPVPEvent( + worldGuardEvent.getAttacker(), + worldGuardEvent.getDefender(), + worldGuardEvent.getCause()); + Bukkit.getServer().getPluginManager().callEvent(event); + + if (event.getResult() != Result.DEFAULT) { + // DEFAULT = Result probably has not been touched by the handler, + // so don't touch the original result either. + worldGuardEvent.setCancelled(event.getResult() == Result.DENY); + } + } + } diff --git a/pom.xml b/pom.xml index f37c2c1..d6b8fba 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.codemc.worldguardwrapper worldguardwrapper-parent - 1.0.2-SNAPSHOT + 1.0.3-SNAPSHOT pom