diff --git a/.idea/dictionaries/Will.xml b/.idea/dictionaries/Will.xml
new file mode 100644
index 00000000..421ff979
--- /dev/null
+++ b/.idea/dictionaries/Will.xml
@@ -0,0 +1,7 @@
+
+
+
+ antigrief
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_willfp_ecoenchants_API_4_1_0_pre10.xml b/.idea/libraries/Maven__com_willfp_ecoenchants_API_4_1_0_pre11.xml
similarity index 61%
rename from .idea/libraries/Maven__com_willfp_ecoenchants_API_4_1_0_pre10.xml
rename to .idea/libraries/Maven__com_willfp_ecoenchants_API_4_1_0_pre11.xml
index c181fe13..0c23ee1f 100644
--- a/.idea/libraries/Maven__com_willfp_ecoenchants_API_4_1_0_pre10.xml
+++ b/.idea/libraries/Maven__com_willfp_ecoenchants_API_4_1_0_pre11.xml
@@ -1,13 +1,13 @@
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/API/pom.xml b/API/pom.xml
index e3f99265..79e09fa2 100644
--- a/API/pom.xml
+++ b/API/pom.xml
@@ -5,7 +5,7 @@
parent
com.willfp.ecoenchants
- 4.1.0-pre10
+ 4.1.0-pre11
../pom.xml
4.0.0
diff --git a/Plugin/plugin.iml b/Plugin/plugin.iml
index c8a2903f..215bc930 100644
--- a/Plugin/plugin.iml
+++ b/Plugin/plugin.iml
@@ -36,7 +36,7 @@
-
+
diff --git a/Plugin/pom.xml b/Plugin/pom.xml
index 9b5faa67..0960b655 100644
--- a/Plugin/pom.xml
+++ b/Plugin/pom.xml
@@ -7,7 +7,7 @@
parent
com.willfp.ecoenchants
- 4.1.0-pre10
+ 4.1.0-pre11
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/Main.java b/Plugin/src/main/java/com/willfp/ecoenchants/Main.java
index 16c62360..3504bc5a 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/Main.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/Main.java
@@ -30,31 +30,6 @@ public class Main extends JavaPlugin {
*/
public static String newVersion;
- /**
- * Has worldguard?
- */
- public static boolean hasWG;
-
- /**
- * Has GriefPrevention?
- */
- public static boolean hasGP;
-
- /**
- * Has FactionsUUID?
- */
- public static boolean hasFactionsUUID;
-
- /**
- * Has Towny?
- */
- public static boolean hasTowny;
-
- /**
- * Has Lands?
- */
- public static boolean hasLands;
-
/**
* Has AdvancedEnchantments?
*/
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java
index 7adc568f..874e8b1b 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.ItemDurability;
import org.bukkit.entity.Player;
@@ -40,7 +40,7 @@ public class Abrasion extends EcoEnchant {
Player player = (Player) event.getDamager();
Player victim = (Player) event.getEntity();
- if(!AntiGrief.canInjurePlayer(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java
index 83f77569..0e78863f 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java
@@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.Main;
-import com.willfp.ecoenchants.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.BlockBreak;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -39,7 +39,7 @@ public class BlastMining extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if(!AntigriefManager.canBreakBlock(player, block)) return;
if(player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) return;
@@ -60,7 +60,7 @@ public class BlastMining extends EcoEnchant {
if(block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) continue;
- if (!AntiGrief.canBreakBlock(player, block1)) continue;
+ if(!AntigriefManager.canBreakBlock(player, block1)) continue;
BlockBreak.breakBlock(player, block1);
if(!hasExploded) {
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java
index 007f329f..9f571722 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java
@@ -4,9 +4,10 @@ import com.willfp.ecoenchants.Main;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
+import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefGriefPrevention;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -39,9 +40,7 @@ public class Bleed extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java
index 8a799feb..aa3e5282 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java
@@ -4,9 +4,9 @@ import com.willfp.ecoenchants.Main;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
@@ -39,9 +39,7 @@ public class Cleave extends EcoEnchant {
if(victim.hasMetadata("cleaved"))
return;
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java
index eb0b3437..ffd1626d 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java
@@ -3,8 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
+import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefGriefPrevention;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -35,9 +36,7 @@ public class Deflection extends EcoEnchant {
if(!player.isBlocking()) return;
- if(victim instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
int level;
if (!HasEnchant.playerOffhand(player, this) && !HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java
index 497bc975..d43639c7 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java
@@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.Main;
-import com.willfp.ecoenchants.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.BlockBreak;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.SimplifyVector;
import org.bukkit.block.Block;
@@ -42,7 +42,7 @@ public class Drill extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if(!AntigriefManager.canBreakBlock(player, block)) return;
if(player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) return;
@@ -61,7 +61,7 @@ public class Drill extends EcoEnchant {
if(block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) continue;
- if (!AntiGrief.canBreakBlock(player, block1)) continue;
+ if(!AntigriefManager.canBreakBlock(player, block1)) continue;
BlockBreak.breakBlock(player, block1);
block1.removeMetadata("from-drill", Main.getInstance());
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java
index 9d4e1e9e..4ae363f6 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -36,9 +36,7 @@ public class Dullness extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java
index c844be80..3e2ab088 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Lightning;
import com.willfp.ecoenchants.util.Rand;
@@ -37,9 +37,7 @@ public class Electroshock extends EcoEnchant {
if(!player.isBlocking()) return;
- if(victim instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
int level;
if (!HasEnchant.playerOffhand(player, this) && !HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java
index dfbafbd9..a5dc43d5 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
import com.willfp.ecoenchants.nms.TridentStack;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
@@ -43,9 +43,7 @@ public class Extract extends EcoEnchant {
Trident trident = (Trident) event.getDamager();
ItemStack item = TridentStack.getTridentStack(trident);
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, (LivingEntity) event.getEntity())) return;
if (!HasEnchant.item(item, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java
index e3a70246..d1c24c36 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -36,9 +36,7 @@ public class Famine extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java
index e74ef27f..abf0ed60 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -38,9 +38,7 @@ public class Flinch extends EcoEnchant {
if(!player.isBlocking()) return;
- if(victim instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
int level;
if (!HasEnchant.playerOffhand(player, this) && !HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java
index 99cb3465..e06a33a2 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.LocationUtils;
import com.willfp.ecoenchants.util.Rand;
@@ -35,9 +35,7 @@ public class Fury extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java
index e0f9452b..524100f7 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -37,7 +37,7 @@ public class Grapple extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java
index 455bce08..ecad6ab4 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.ItemDurability;
import org.bukkit.Material;
@@ -38,7 +38,7 @@ public class GreenThumb extends EcoEnchant {
if (!HasEnchant.playerHeld(player, this)) return;
- if(!AntiGrief.canBreakBlock(player, event.getClickedBlock())) return;
+ if(!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) return;
if(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage"))
ItemDurability.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java
index 0523abe4..f9599506 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.ItemDurability;
import org.bukkit.entity.Player;
@@ -33,7 +33,7 @@ public class Grit extends EcoEnchant {
Player player = (Player) event.getEntity();
Player attacker = (Player) event.getDamager();
- if(!AntiGrief.canInjurePlayer(attacker, player)) return;
+ if(!AntigriefManager.canInjure(attacker, player)) return;
int totalGritPoints = HasEnchant.getArmorPoints(player, this, false);
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java
index 77bd596d..1291c84d 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
@@ -40,7 +40,7 @@ public class Hook extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java
index 4f63d07e..fbee81a4 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.Arrow;
@@ -39,9 +39,7 @@ public class IceShot extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, (Player) event.getEntity())) return;
if(event.isCancelled()) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java
index dc1c2473..2e58d768 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.Material;
@@ -49,7 +49,7 @@ public class Ignite extends EcoEnchant {
float power = (float) (0.5 + (level * 0.5));
- if (!AntiGrief.canBreakBlock(player, block))
+ if (!AntigriefManager.canBreakBlock(player, block))
return;
if (Rand.randFloat(0, 1) > level * 0.01 * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java
index 44b3b6d1..a0f87491 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.Player;
@@ -35,7 +35,7 @@ public class IllusionAspect extends EcoEnchant {
Player victim = (Player) event.getEntity();
- if(!AntiGrief.canInjurePlayer(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java
index 1558c50c..50e82e8f 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
import com.willfp.ecoenchants.queue.DropQueue;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
@@ -51,7 +51,7 @@ public class InfernalTouch extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if (!AntigriefManager.canBreakBlock(player, block)) return;
Collection drops = new ArrayList<>();
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java
index 6328e63c..3168a8ae 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java
@@ -1,6 +1,6 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
-import com.willfp.ecoenchants.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java
index cc899524..8fb89f55 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
@@ -35,9 +35,7 @@ public class Leeching extends EcoEnchant {
Player player = (Player) event.getDamager();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, (LivingEntity) event.getEntity())) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java
index d5800e28..eed7982e 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.Arrow;
@@ -39,9 +39,7 @@ public class Levitate extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if(event.isCancelled()) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java
index 19796603..d59668c8 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java
@@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.Main;
-import com.willfp.ecoenchants.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.BlockBreak;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.RecursiveBlock;
import org.bukkit.Bukkit;
@@ -45,7 +45,7 @@ public class Lumberjack extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if(!AntigriefManager.canBreakBlock(player, block)) return;
if(player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) return;
@@ -65,7 +65,7 @@ public class Lumberjack extends EcoEnchant {
for(Block treeBlock : treeBlocks) {
treeBlock.setMetadata("from-lumberjack", new FixedMetadataValue(Main.getInstance(), true));
- if(!AntiGrief.canBreakBlock(player, treeBlock)) continue;
+ if(!AntigriefManager.canBreakBlock(player, treeBlock)) continue;
BlockBreak.breakBlock(player, treeBlock);
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java
index 42c48207..706669bb 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/MagmaWalker.java
@@ -1,12 +1,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.Main;
-import com.willfp.ecoenchants.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.Circle;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Bukkit;
@@ -50,7 +50,7 @@ public class MagmaWalker extends EcoEnchant {
Block block = player.getWorld().getBlockAt(loc);
- if (!AntiGrief.canPlaceBlock(player, player.getWorld().getBlockAt(loc))) continue;
+ if (!AntigriefManager.canPlaceBlock(player, player.getWorld().getBlockAt(loc))) continue;
if(!block.getType().equals(Material.LAVA)) continue;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java
index 2ddc6014..e0a8ac7c 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.EqualIfOver;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.block.Block;
@@ -32,7 +32,7 @@ public class Oxygenate extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if (!AntigriefManager.canBreakBlock(player, block)) return;
if(player.getRemainingAir() == player.getMaximumAir()) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java
index 112ccbcd..d98d92fb 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Arrow;
@@ -39,9 +39,7 @@ public class Parasitic extends EcoEnchant {
Player player = (Player) ((Arrow) event.getDamager()).getShooter();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, (LivingEntity) event.getEntity())) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java
index 4847e5fc..87849289 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -36,7 +36,7 @@ public class Reel extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java
index fdc3ddfe..bb097fe9 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.Main;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -32,7 +32,7 @@ public class Replenish extends EcoEnchant {
if(!HasEnchant.playerHeld(player, this)) return;
- if(!AntiGrief.canBreakBlock(player, block)) return;
+ if(!AntigriefManager.canBreakBlock(player, block)) return;
if(event.isCancelled()) return;
if(!(block.getBlockData() instanceof Ageable)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java
index fce892b3..be754ca2 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -35,7 +35,7 @@ public class Spiked extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java
index e5878ef7..225b6151 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
import com.willfp.ecoenchants.queue.DropQueue;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.EqualIfOver;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
@@ -42,7 +42,7 @@ public class StoneSwitcher extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if (!AntigriefManager.canBreakBlock(player, block)) return;
int level = HasEnchant.getPlayerLevel(player, this);
double chance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level");
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java
index ec6fedbd..4270b3a1 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -36,9 +36,7 @@ public class StrayAspect extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java
index aff95a22..711ba4a5 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java
@@ -4,10 +4,10 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.events.entitydeathbyentity.EntityDeathByEntityEvent;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
import com.willfp.ecoenchants.nms.TridentStack;
import com.willfp.ecoenchants.queue.DropQueue;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.GameMode;
import org.bukkit.Material;
@@ -45,7 +45,7 @@ public class Telekinesis extends EcoEnchant {
Block block = event.getBlock();
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if (!AntigriefManager.canBreakBlock(player, block)) return;
List drops = new ArrayList<>();
event.getItems().forEach((item -> {
@@ -75,7 +75,7 @@ public class Telekinesis extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if (!AntigriefManager.canBreakBlock(player, block)) return;
if(block.getType().equals(Material.SPAWNER)) event.setExpToDrop(0);
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java
index 7b1d29af..32007a2e 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Lightning;
import com.willfp.ecoenchants.util.Rand;
@@ -36,7 +36,7 @@ public class Thor extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
+ if(!AntigriefManager.canInjure(player, (Player) event.getEntity())) return;
}
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java
index 62190d91..6350d1fc 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java
@@ -4,8 +4,8 @@ import com.willfp.ecoenchants.Main;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
@@ -39,7 +39,7 @@ public class Tornado extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java
index 4fec120d..15730a86 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -37,9 +37,7 @@ public class Toxic extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java
index 0c89d889..660090c7 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.LivingEntity;
@@ -37,9 +37,7 @@ public class VampireAspect extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java
index edb150f0..ddf11426 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java
@@ -1,13 +1,13 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.Main;
-import com.willfp.ecoenchants.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.BlockBreak;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.RecursiveBlock;
import org.bukkit.Bukkit;
@@ -45,7 +45,7 @@ public class Vein extends EcoEnchant {
if (event.isCancelled())
return;
- if (!AntiGrief.canBreakBlock(player, block)) return;
+ if(!AntigriefManager.canBreakBlock(player, block)) return;
if(player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) return;
@@ -65,7 +65,7 @@ public class Vein extends EcoEnchant {
for(Block veinBlock : blockSet) {
veinBlock.setMetadata("from-vein", new FixedMetadataValue(Main.getInstance(), true));
- if(!AntiGrief.canBreakBlock(player, veinBlock)) continue;
+ if(!AntigriefManager.canBreakBlock(player, veinBlock)) continue;
BlockBreak.breakBlock(player, veinBlock);
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java
index 2746ee1e..6d4f623d 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.Arrow;
@@ -38,9 +38,7 @@ public class Venom extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if(event.isCancelled()) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java
index 4e1b142b..1120380f 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java
@@ -4,8 +4,8 @@ import com.willfp.ecoenchants.Main;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
@@ -46,9 +46,7 @@ public class Weakening extends EcoEnchant {
event.setDamage(event.getDamage() * multiplier);
}
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java
index c1a74711..523a61b1 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Lightning;
import com.willfp.ecoenchants.util.Rand;
@@ -37,9 +37,7 @@ public class Zeus extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java
index 47d75aad..37e8b18a 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -37,7 +37,7 @@ public class Annihilate extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java
index d38f5036..0ceb25c8 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Lightning;
import com.willfp.ecoenchants.util.Rand;
@@ -35,9 +35,7 @@ public class Bolt extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java
index ee7d7425..06b91350 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java
@@ -4,9 +4,9 @@ import com.willfp.ecoenchants.Main;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
@@ -39,9 +39,7 @@ public class Carve extends EcoEnchant {
if(victim.hasMetadata("carved"))
return;
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java
index a7547acd..db9255cb 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.entity.Player;
@@ -38,7 +38,7 @@ public class Confusion extends EcoEnchant {
Player victim = (Player) event.getEntity();
- if(!AntiGrief.canInjurePlayer(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java
index b2050833..229387e0 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -24,7 +24,7 @@ public class Energizing extends EcoEnchant {
public void onEnergizingBreak(BlockBreakEvent event) {
if(event.isCancelled()) return;
Player player = event.getPlayer();
- if(!AntiGrief.canBreakBlock(player, event.getBlock())) return;
+ if(!AntigriefManager.canBreakBlock(player, event.getBlock())) return;
if(!HasEnchant.playerHeld(player, this)) return;
int level = HasEnchant.getPlayerLevel(player, this);
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java
index 253fc26f..92693f6c 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -35,7 +35,7 @@ public class Harpoon extends EcoEnchant {
if(victim.hasMetadata("NPC")) return;
- if(!AntiGrief.canInjureMob(player, victim)) return;
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java
index 30878c9b..c6ec7656 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
@@ -43,9 +43,9 @@ public class Instability extends EcoEnchant {
float power = (float) (0.5 + (level * 0.5));
- if (!AntiGrief.canCreateExplosion(player, event.getEntity().getLocation())) return;
+ if (!AntigriefManager.canCreateExplosion(player, event.getEntity().getLocation())) return;
if (breakblocks) {
- if (!AntiGrief.canBreakBlock(player, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation())))
+ if (!AntigriefManager.canBreakBlock(player, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation())))
return;
}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java
index ebebcfa3..f149ec63 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java
@@ -3,8 +3,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
@@ -36,7 +36,7 @@ public class LifeSteal extends EcoEnchant {
Player player = (Player) event.getDamager();
if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
+ if(!AntigriefManager.canInjure(player, (Player) event.getEntity())) return;
}
if (!HasEnchant.playerHeld(player, this)) return;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java
index f7ab2abe..996d335c 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java
@@ -2,8 +2,8 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -30,8 +30,6 @@ public class Soulbound extends EcoEnchant {
public void onSoulboundDeath(PlayerDeathEvent event) {
if(event.getKeepInventory()) return;
- if(AntiGrief.hasKeepInv(event.getEntity())) return;
-
Player player = event.getEntity();
List soulboundItems = new ArrayList<>(); // Stored as list to preserve duplicates
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java
index d10a4fbc..11f471ba 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java
@@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.nms.Cooldown;
import com.willfp.ecoenchants.nms.Target;
-import com.willfp.ecoenchants.util.AntiGrief;
import com.willfp.ecoenchants.util.HasEnchant;
import com.willfp.ecoenchants.util.Rand;
import org.bukkit.Location;
@@ -35,9 +35,7 @@ public class Volatile extends EcoEnchant {
LivingEntity victim = (LivingEntity) event.getEntity();
- if(event.getEntity() instanceof Player) {
- if(!AntiGrief.canInjurePlayer(player, (Player) event.getEntity())) return;
- }
+ if(!AntigriefManager.canInjure(player, victim)) return;
if (!HasEnchant.playerHeld(player, this)) return;
@@ -54,9 +52,9 @@ public class Volatile extends EcoEnchant {
float power = (float) (0.5 + (level * 0.5));
- if (!AntiGrief.canCreateExplosion(player, event.getEntity().getLocation())) return;
+ if (!AntigriefManager.canCreateExplosion(player, event.getEntity().getLocation())) return;
if (breakblocks) {
- if (!AntiGrief.canBreakBlock(player, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation())))
+ if (!AntigriefManager.canBreakBlock(player, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation())))
return;
}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/Integration.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/Integration.java
new file mode 100644
index 00000000..d053c8f9
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/Integration.java
@@ -0,0 +1,9 @@
+package com.willfp.ecoenchants.integrations;
+
+public interface Integration {
+ /**
+ * Get the name of integration
+ * @return The name
+ */
+ String getPluginName();
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/AnticheatManager.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java
similarity index 92%
rename from Plugin/src/main/java/com/willfp/ecoenchants/anticheat/AnticheatManager.java
rename to Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java
index 73dcc74b..954a4a37 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/AnticheatManager.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatManager.java
@@ -1,11 +1,10 @@
-package com.willfp.ecoenchants.anticheat;
+package com.willfp.ecoenchants.integrations.anticheat;
import com.willfp.ecoenchants.Main;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/AnticheatWrapper.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatWrapper.java
similarity index 62%
rename from Plugin/src/main/java/com/willfp/ecoenchants/anticheat/AnticheatWrapper.java
rename to Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatWrapper.java
index 2f09c805..4a12e40c 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/AnticheatWrapper.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/AnticheatWrapper.java
@@ -1,14 +1,9 @@
-package com.willfp.ecoenchants.anticheat;
+package com.willfp.ecoenchants.integrations.anticheat;
+import com.willfp.ecoenchants.integrations.Integration;
import org.bukkit.entity.Player;
-public interface AnticheatWrapper {
- /**
- * Get the name of anticheat
- * @return The name
- */
- String getPluginName();
-
+public interface AnticheatWrapper extends Integration {
/**
* Exempt a player from checks
* @param player The player to exempt
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatAAC.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatAAC.java
similarity index 87%
rename from Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatAAC.java
rename to Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatAAC.java
index df046f2b..9a170146 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatAAC.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatAAC.java
@@ -1,6 +1,6 @@
-package com.willfp.ecoenchants.anticheat.anticheats;
+package com.willfp.ecoenchants.integrations.anticheat.plugins;
-import com.willfp.ecoenchants.anticheat.AnticheatWrapper;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatWrapper;
import me.konsolas.aac.api.PlayerViolationEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatMatrix.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatMatrix.java
similarity index 87%
rename from Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatMatrix.java
rename to Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatMatrix.java
index fa026d4a..29375bb7 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatMatrix.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatMatrix.java
@@ -1,6 +1,6 @@
-package com.willfp.ecoenchants.anticheat.anticheats;
+package com.willfp.ecoenchants.integrations.anticheat.plugins;
-import com.willfp.ecoenchants.anticheat.AnticheatWrapper;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatWrapper;
import me.rerere.matrix.api.events.PlayerViolationEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatNCP.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatNCP.java
similarity index 87%
rename from Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatNCP.java
rename to Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatNCP.java
index 878b0c63..04aeb4a6 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatNCP.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatNCP.java
@@ -1,6 +1,6 @@
-package com.willfp.ecoenchants.anticheat.anticheats;
+package com.willfp.ecoenchants.integrations.anticheat.plugins;
-import com.willfp.ecoenchants.anticheat.AnticheatWrapper;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatWrapper;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import org.bukkit.entity.Player;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatSpartan.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatSpartan.java
similarity index 87%
rename from Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatSpartan.java
rename to Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatSpartan.java
index f21d03a9..cba1557e 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/anticheat/anticheats/AnticheatSpartan.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/anticheat/plugins/AnticheatSpartan.java
@@ -1,6 +1,6 @@
-package com.willfp.ecoenchants.anticheat.anticheats;
+package com.willfp.ecoenchants.integrations.anticheat.plugins;
-import com.willfp.ecoenchants.anticheat.AnticheatWrapper;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatWrapper;
import me.vagdedes.spartan.api.PlayerViolationEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/AntigriefManager.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/AntigriefManager.java
new file mode 100644
index 00000000..25077a08
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/AntigriefManager.java
@@ -0,0 +1,58 @@
+package com.willfp.ecoenchants.integrations.antigrief;
+
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class AntigriefManager {
+ private static final Set antigriefs = new HashSet<>();
+
+ public static void registerAntigrief(AntigriefWrapper antigrief) {
+ antigriefs.add(antigrief);
+ }
+
+ /**
+ * Can player break block
+ * @param player The player
+ * @param block The block
+ * @return If player can break block
+ */
+ public static boolean canBreakBlock(Player player, Block block) {
+ return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canBreakBlock(player, block));
+ }
+
+ /**
+ * Can player create explosion at location
+ * @param player The player
+ * @param location The location
+ * @return If player can create explosion
+ */
+ public static boolean canCreateExplosion(Player player, Location location) {
+ return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canCreateExplosion(player, location));
+ }
+
+ /**
+ * Can player place block
+ * @param player The player
+ * @param block The block
+ * @return If player can place block
+ */
+ public static boolean canPlaceBlock(Player player, Block block) {
+ return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPlaceBlock(player, block));
+ }
+
+ /**
+ * Can player injure living entity
+ * @param player The player
+ * @param victim The victim
+ * @return If player can injure
+ */
+ public static boolean canInjure(Player player, LivingEntity victim) {
+ return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canInjure(player, victim));
+ }
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/AntigriefWrapper.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/AntigriefWrapper.java
new file mode 100644
index 00000000..ee000b2f
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/AntigriefWrapper.java
@@ -0,0 +1,35 @@
+package com.willfp.ecoenchants.integrations.antigrief;
+
+import com.willfp.ecoenchants.integrations.Integration;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+public interface AntigriefWrapper extends Integration {
+ boolean canBreakBlock(Player player, Block block);
+
+ /**
+ * Can player create explosion at location
+ * @param player The player
+ * @param location The location
+ * @return If player can create explosion
+ */
+ boolean canCreateExplosion(Player player, Location location);
+
+ /**
+ * Can player place block
+ * @param player The player
+ * @param block The block
+ * @return If player can place block
+ */
+ boolean canPlaceBlock(Player player, Block block);
+
+ /**
+ * Can player injure living entity
+ * @param player The player
+ * @param victim The victim
+ * @return If player can injure
+ */
+ boolean canInjure(Player player, LivingEntity victim);
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefFactionsUUID.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefFactionsUUID.java
new file mode 100644
index 00000000..bd935dfa
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefFactionsUUID.java
@@ -0,0 +1,67 @@
+package com.willfp.ecoenchants.integrations.antigrief.plugins;
+
+import com.massivecraft.factions.*;
+import com.massivecraft.factions.perms.PermissibleAction;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+public class AntigriefFactionsUUID implements AntigriefWrapper {
+ @Override
+ public boolean canBreakBlock(Player player, Block block) {
+ FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
+ FLocation flocation = new FLocation(block.getLocation());
+ Faction faction = Board.getInstance().getFactionAt(flocation);
+
+ if (!faction.hasAccess(fplayer, PermissibleAction.DESTROY)) {
+ return fplayer.isAdminBypassing();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canCreateExplosion(Player player, Location location) {
+ FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
+ FLocation flocation = new FLocation(location);
+ Faction faction = Board.getInstance().getFactionAt(flocation);
+
+ return !faction.noExplosionsInTerritory();
+ }
+
+ @Override
+ public boolean canPlaceBlock(Player player, Block block) {
+ FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
+ FLocation flocation = new FLocation(block.getLocation());
+ Faction faction = Board.getInstance().getFactionAt(flocation);
+
+ if (!faction.hasAccess(fplayer, PermissibleAction.BUILD)) {
+ return fplayer.isAdminBypassing();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canInjure(Player player, LivingEntity victim) {
+ FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
+ FLocation flocation = new FLocation(victim.getLocation());
+ Faction faction = Board.getInstance().getFactionAt(flocation);
+
+ if(victim instanceof Player) {
+ if (faction.isPeaceful()) {
+ return fplayer.isAdminBypassing();
+ }
+ } else {
+ if (faction.hasAccess(fplayer, PermissibleAction.DESTROY)) {
+ return fplayer.isAdminBypassing();
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String getPluginName() {
+ return "FactionsUUID";
+ }
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefGriefPrevention.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefGriefPrevention.java
new file mode 100644
index 00000000..af178cd3
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefGriefPrevention.java
@@ -0,0 +1,57 @@
+package com.willfp.ecoenchants.integrations.antigrief.plugins;
+
+import com.comphenix.protocol.PacketType;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper;
+import me.ryanhamshire.GriefPrevention.Claim;
+import me.ryanhamshire.GriefPrevention.GriefPrevention;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+public class AntigriefGriefPrevention implements AntigriefWrapper {
+ @Override
+ public boolean canBreakBlock(Player player, Block block) {
+ Claim claim = GriefPrevention.instance.dataStore.getClaimAt(block.getLocation(), false, null);
+ if (claim != null) {
+ return claim.allowBreak(player, block.getType()) == null;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canCreateExplosion(Player player, Location location) {
+ Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, false, null);
+ if (claim != null) {
+ return claim.areExplosivesAllowed;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canPlaceBlock(Player player, Block block) {
+ Claim claim = GriefPrevention.instance.dataStore.getClaimAt(block.getLocation(), false, null);
+ if (claim != null) {
+ return claim.allowBuild(player, block.getType()) == null;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canInjure(Player player, LivingEntity victim) {
+ Claim claim = GriefPrevention.instance.dataStore.getClaimAt(victim.getLocation(), false, null);
+ if(victim instanceof Player) {
+ return claim == null;
+ } else {
+ if (claim != null) {
+ return claim.ownerID.equals(player.getUniqueId());
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public String getPluginName() {
+ return "GriefPrevention";
+ }
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java
new file mode 100644
index 00000000..136df768
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefLands.java
@@ -0,0 +1,64 @@
+package com.willfp.ecoenchants.integrations.antigrief.plugins;
+
+import com.willfp.ecoenchants.Main;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper;
+import me.angeschossen.lands.api.integration.LandsIntegration;
+import me.angeschossen.lands.api.land.Area;
+import me.angeschossen.lands.api.role.enums.RoleSetting;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+public class AntigriefLands implements AntigriefWrapper {
+ @Override
+ public boolean canBreakBlock(Player player, Block block) {
+ LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
+ Area area = landsIntegration.getAreaByLoc(block.getLocation());
+ if (area != null) {
+ return area.canSetting(player, RoleSetting.BLOCK_BREAK, false);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canCreateExplosion(Player player, Location location) {
+ LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
+ Area area = landsIntegration.getAreaByLoc(location);
+ if (area != null) {
+ return area.canSetting(player, RoleSetting.BLOCK_IGNITE, false);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canPlaceBlock(Player player, Block block) {
+ LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
+ Area area = landsIntegration.getAreaByLoc(block.getLocation());
+ if (area != null) {
+ return area.canSetting(player, RoleSetting.BLOCK_PLACE, false);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canInjure(Player player, LivingEntity victim) {
+ LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
+ Area area = landsIntegration.getAreaByLoc(victim.getLocation());
+ if(victim instanceof Player) {
+ if (area != null) {
+ return area.canSetting(player, RoleSetting.ATTACK_PLAYER, false);
+ }
+ } else {
+ if (area != null) {
+ return area.canSetting(player, RoleSetting.ATTACK_ANIMAL, false);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String getPluginName() {
+ return "Lands";
+ }
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefTowny.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefTowny.java
new file mode 100644
index 00000000..cc927b64
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefTowny.java
@@ -0,0 +1,50 @@
+package com.willfp.ecoenchants.integrations.antigrief.plugins;
+
+import com.palmergames.bukkit.towny.object.Town;
+import com.palmergames.bukkit.towny.object.TownyPermission;
+import com.palmergames.bukkit.towny.object.WorldCoord;
+import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+public class AntigriefTowny implements AntigriefWrapper {
+ @Override
+ public boolean canBreakBlock(Player player, Block block) {
+ return PlayerCacheUtil.getCachePermission(player, block.getLocation(), block.getType(), TownyPermission.ActionType.DESTROY);
+ }
+
+ @Override
+ public boolean canCreateExplosion(Player player, Location location) {
+ return PlayerCacheUtil.getCachePermission(player, location, Material.TNT, TownyPermission.ActionType.ITEM_USE);
+ }
+
+ @Override
+ public boolean canPlaceBlock(Player player, Block block) {
+ return PlayerCacheUtil.getCachePermission(player, block.getLocation(), block.getType(), TownyPermission.ActionType.BUILD);
+ }
+
+ @Override
+ public boolean canInjure(Player player, LivingEntity victim) {
+ if(victim instanceof Player) {
+ try {
+ Town town = WorldCoord.parseWorldCoord(victim.getLocation()).getTownBlock().getTown();
+ return town.isPVP();
+ } catch (Exception ignored) {}
+ } else {
+ try {
+ Town town = WorldCoord.parseWorldCoord(victim.getLocation()).getTownBlock().getTown();
+ return town.hasMobs();
+ } catch (Exception ignored) {}
+ }
+ return true;
+ }
+
+ @Override
+ public String getPluginName() {
+ return "Towny";
+ }
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefWorldGuard.java b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefWorldGuard.java
new file mode 100644
index 00000000..5bb69bc4
--- /dev/null
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/integrations/antigrief/plugins/AntigriefWorldGuard.java
@@ -0,0 +1,76 @@
+package com.willfp.ecoenchants.integrations.antigrief.plugins;
+
+import com.comphenix.protocol.PacketType;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldguard.LocalPlayer;
+import com.sk89q.worldguard.WorldGuard;
+import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
+import com.sk89q.worldguard.protection.flags.Flags;
+import com.sk89q.worldguard.protection.regions.RegionContainer;
+import com.sk89q.worldguard.protection.regions.RegionQuery;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+public class AntigriefWorldGuard implements AntigriefWrapper {
+ @Override
+ public boolean canBreakBlock(Player player, Block block) {
+ LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
+ RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
+ RegionQuery query = container.createQuery();
+
+ if (!query.testState(BukkitAdapter.adapt(block.getLocation()), localPlayer, Flags.BUILD)) {
+ return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(block.getWorld()));
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canCreateExplosion(Player player, Location location) {
+ LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
+ RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
+ RegionQuery query = container.createQuery();
+
+ if (!query.testState(BukkitAdapter.adapt(location), localPlayer, Flags.OTHER_EXPLOSION)) {
+ return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(location.getWorld()));
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canPlaceBlock(Player player, Block block) {
+ LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
+ RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
+ RegionQuery query = container.createQuery();
+
+ if (!query.testState(BukkitAdapter.adapt(block.getLocation()), localPlayer, Flags.BLOCK_PLACE)) {
+ return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(block.getWorld()));
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canInjure(Player player, LivingEntity victim) {
+ LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
+ RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
+ RegionQuery query = container.createQuery();
+
+ if(victim instanceof Player) {
+ if (!query.testState(BukkitAdapter.adapt(victim.getLocation()), localPlayer, Flags.PVP)) {
+ return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(player.getWorld()));
+ }
+ } else {
+ if (!query.testState(BukkitAdapter.adapt(victim.getLocation()), localPlayer, Flags.DAMAGE_ANIMALS)) {
+ return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(player.getWorld()));
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String getPluginName() {
+ return "WorldGuard";
+ }
+}
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java
index 1c1d6666..093fa8f4 100644
--- a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java
+++ b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java
@@ -2,8 +2,9 @@ package com.willfp.ecoenchants.loader;
import com.comphenix.protocol.ProtocolLibrary;
import com.willfp.ecoenchants.Main;
-import com.willfp.ecoenchants.anticheat.anticheats.AnticheatAAC;
-import com.willfp.ecoenchants.anticheat.anticheats.AnticheatMatrix;
+import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
+import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatAAC;
+import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatMatrix;
import com.willfp.ecoenchants.anvil.AnvilListeners;
import com.willfp.ecoenchants.bstats.Metrics;
import com.willfp.ecoenchants.commands.*;
@@ -17,6 +18,8 @@ import com.willfp.ecoenchants.events.entitydeathbyentity.EntityDeathByEntityList
import com.willfp.ecoenchants.events.naturalexpgainevent.NaturalExpGainListeners;
import com.willfp.ecoenchants.extensions.ExtensionManager;
import com.willfp.ecoenchants.grindstone.GrindstoneListeners;
+import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
+import com.willfp.ecoenchants.integrations.antigrief.plugins.*;
import com.willfp.ecoenchants.listeners.EnchantingListeners;
import com.willfp.ecoenchants.listeners.PlayerJoinListener;
import com.willfp.ecoenchants.listeners.VillagerListeners;
@@ -103,25 +106,40 @@ public class Loader {
Bukkit.getLogger().info("Loading Integrations...");
- Main.hasWG = Bukkit.getPluginManager().isPluginEnabled("WorldGuard");
- if(Main.hasWG) Bukkit.getLogger().info("WorldGuard: §aENABLED");
- else Bukkit.getLogger().info("WorldGuard: §9DISABLED");
+ if(Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) {
+ AntigriefManager.registerAntigrief(new AntigriefWorldGuard());
+ Bukkit.getLogger().info("WorldGuard: §aENABLED");
+ } else {
+ Bukkit.getLogger().info("WorldGuard: §9DISABLED");
+ }
- Main.hasGP = Bukkit.getPluginManager().isPluginEnabled("GriefPrevention");
- if(Main.hasGP) Bukkit.getLogger().info("GriefPrevention: §aENABLED");
- else Bukkit.getLogger().info("GriefPrevention: §9DISABLED");
+ if(Bukkit.getPluginManager().isPluginEnabled("GriefPrevention")) {
+ AntigriefManager.registerAntigrief(new AntigriefGriefPrevention());
+ Bukkit.getLogger().info("GriefPrevention: §aENABLED");
+ } else {
+ Bukkit.getLogger().info("GriefPrevention: §9DISABLED");
+ }
- Main.hasFactionsUUID = Bukkit.getPluginManager().isPluginEnabled("FactionsUUID");
- if(Main.hasFactionsUUID) Bukkit.getLogger().info("FactionsUUID: §aENABLED");
- else Bukkit.getLogger().info("FactionsUUID: §9DISABLED");
+ if(Bukkit.getPluginManager().isPluginEnabled("FactionsUUID")) {
+ AntigriefManager.registerAntigrief(new AntigriefFactionsUUID());
+ Bukkit.getLogger().info("FactionsUUID: §aENABLED");
+ } else {
+ Bukkit.getLogger().info("FactionsUUID: §9DISABLED");
+ }
- Main.hasTowny = Bukkit.getPluginManager().isPluginEnabled("Towny");
- if(Main.hasTowny) Bukkit.getLogger().info("Towny: §aENABLED");
- else Bukkit.getLogger().info("Towny: §9DISABLED");
+ if(Bukkit.getPluginManager().isPluginEnabled("Towny")) {
+ AntigriefManager.registerAntigrief(new AntigriefTowny());
+ Bukkit.getLogger().info("Towny: §aENABLED");
+ } else {
+ Bukkit.getLogger().info("Towny: §9DISABLED");
+ }
- Main.hasLands = Bukkit.getPluginManager().isPluginEnabled("Lands");
- if(Main.hasLands) Bukkit.getLogger().info("Lands: §aENABLED");
- else Bukkit.getLogger().info("Lands: §9DISABLED");
+ if(Bukkit.getPluginManager().isPluginEnabled("Lands")) {
+ AntigriefManager.registerAntigrief(new AntigriefLands());
+ Bukkit.getLogger().info("Lands: §aENABLED");
+ } else {
+ Bukkit.getLogger().info("Lands: §9DISABLED");
+ }
Main.hasAE = Bukkit.getPluginManager().isPluginEnabled("AdvancedEnchantments");
if(Main.hasAE) Bukkit.getLogger().info("AdvancedEnchantments: §aENABLED");
@@ -131,28 +149,28 @@ public class Loader {
Bukkit.getLogger().info("Loading Anticheat Integrations...");
if(Bukkit.getPluginManager().isPluginEnabled("AAC")) {
- com.willfp.ecoenchants.anticheat.AnticheatManager.registerAnticheat(new AnticheatAAC());
+ AnticheatManager.registerAnticheat(new AnticheatAAC());
Bukkit.getLogger().info("AAC: §aENABLED");
} else {
Bukkit.getLogger().info("AAC: §9DISABLED");
}
if(Bukkit.getPluginManager().isPluginEnabled("Matrix")) {
- com.willfp.ecoenchants.anticheat.AnticheatManager.registerAnticheat(new AnticheatMatrix());
+ AnticheatManager.registerAnticheat(new AnticheatMatrix());
Bukkit.getLogger().info("Matrix: §aENABLED");
} else {
Bukkit.getLogger().info("Matrix: §9DISABLED");
}
if(Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
- com.willfp.ecoenchants.anticheat.AnticheatManager.registerAnticheat(new AnticheatAAC());
+ AnticheatManager.registerAnticheat(new AnticheatAAC());
Bukkit.getLogger().info("NCP: §aENABLED");
} else {
Bukkit.getLogger().info("NCP: §9DISABLED");
}
if(Bukkit.getPluginManager().isPluginEnabled("Spartan")) {
- com.willfp.ecoenchants.anticheat.AnticheatManager.registerAnticheat(new AnticheatAAC());
+ AnticheatManager.registerAnticheat(new AnticheatAAC());
Bukkit.getLogger().info("Spartan: §aENABLED");
} else {
Bukkit.getLogger().info("Spartan: §9DISABLED");
diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/util/AntiGrief.java b/Plugin/src/main/java/com/willfp/ecoenchants/util/AntiGrief.java
deleted file mode 100644
index e12d4911..00000000
--- a/Plugin/src/main/java/com/willfp/ecoenchants/util/AntiGrief.java
+++ /dev/null
@@ -1,331 +0,0 @@
-package com.willfp.ecoenchants.util;
-
-import com.massivecraft.factions.*;
-import com.massivecraft.factions.perms.PermissibleAction;
-import com.palmergames.bukkit.towny.object.Town;
-import com.palmergames.bukkit.towny.object.TownyPermission;
-import com.palmergames.bukkit.towny.object.WorldCoord;
-import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
-import com.sk89q.worldedit.bukkit.BukkitAdapter;
-import com.sk89q.worldguard.LocalPlayer;
-import com.sk89q.worldguard.WorldGuard;
-import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
-import com.sk89q.worldguard.protection.flags.Flags;
-import com.sk89q.worldguard.protection.regions.RegionContainer;
-import com.sk89q.worldguard.protection.regions.RegionQuery;
-import com.willfp.ecoenchants.Main;
-import me.angeschossen.lands.api.integration.LandsIntegration;
-import me.angeschossen.lands.api.land.Area;
-import me.angeschossen.lands.api.role.enums.RoleSetting;
-import me.ryanhamshire.GriefPrevention.Claim;
-import me.ryanhamshire.GriefPrevention.GriefPrevention;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-
-/**
- * Class containing methods for compatibility with land management plugins
- */
-public class AntiGrief {
-
- /**
- * Can player break block
- * @param player The player
- * @param block The block
- * @return If player can break block
- */
- public static boolean canBreakBlock(Player player, Block block) {
- if (Main.hasWG) {
- LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
- RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
- RegionQuery query = container.createQuery();
- if (!query.testState(BukkitAdapter.adapt(block.getLocation()), localPlayer, Flags.BUILD)) {
- if (!WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(block.getWorld()))) {
- return false;
- }
- }
- }
-
- if (Main.hasGP) {
- Claim claim = GriefPrevention.instance.dataStore.getClaimAt(block.getLocation(), false, null);
- if (claim != null) {
- if (claim.allowBreak(player, block.getType()) != null) {
- return false;
- }
- }
- }
-
- if (Main.hasFactionsUUID) {
- FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
- FLocation flocation = new FLocation(block.getLocation());
- Faction faction = Board.getInstance().getFactionAt(flocation);
-
- if (!faction.hasAccess(fplayer, PermissibleAction.DESTROY)) {
- if (!fplayer.isAdminBypassing()) {
- return false;
- }
- }
- }
-
- if (Main.hasTowny) {
- if (!PlayerCacheUtil.getCachePermission(player, block.getLocation(), block.getType(), TownyPermission.ActionType.DESTROY)) {
- return false;
- }
- }
-
- if (Main.hasLands) {
- LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
- Area area = landsIntegration.getAreaByLoc(block.getLocation());
- if (area != null) {
- return area.canSetting(player, RoleSetting.BLOCK_BREAK, false);
- }
- }
-
-
- return true;
-
- }
-
- /**
- * Can player create explosion at location
- * @param player The player
- * @param location The location
- * @return If player can create explosion
- */
- public static boolean canCreateExplosion(Player player, Location location) {
- if (Main.hasWG) {
- LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
- RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
- RegionQuery query = container.createQuery();
-
- if (!query.testState(BukkitAdapter.adapt(location), localPlayer, Flags.OTHER_EXPLOSION)) {
- if (!WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(location.getWorld()))) {
- return false;
- }
- }
- }
-
- if (Main.hasGP) {
- Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, false, null);
- if (claim != null) {
- if (!claim.areExplosivesAllowed) {
- return false;
- }
- }
- }
-
- if (Main.hasFactionsUUID) {
- FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
- FLocation flocation = new FLocation(location);
- Faction faction = Board.getInstance().getFactionAt(flocation);
-
- if (faction.noExplosionsInTerritory()) {
- return false;
- }
- }
-
- if (Main.hasTowny) {
- if (!PlayerCacheUtil.getCachePermission(player, location, Material.TNT, TownyPermission.ActionType.ITEM_USE)) {
- return false;
- }
- }
-
- if (Main.hasLands) {
- LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
- Area area = landsIntegration.getAreaByLoc(location);
- if (area != null) {
- return area.canSetting(player, RoleSetting.BLOCK_IGNITE, false);
- }
- }
-
-
- return true;
- }
-
- /**
- * Can player place block
- * @param player The player
- * @param block The block
- * @return If player can place block
- */
- public static boolean canPlaceBlock(Player player, Block block) {
- if (Main.hasWG) {
- LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
- RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
- RegionQuery query = container.createQuery();
-
- if (!query.testState(BukkitAdapter.adapt(block.getLocation()), localPlayer, Flags.BLOCK_PLACE)) {
- if (!WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(block.getWorld()))) {
- return false;
- }
- }
- }
-
- if (Main.hasGP) {
- Claim claim = GriefPrevention.instance.dataStore.getClaimAt(block.getLocation(), false, null);
- if (claim != null) {
- if (claim.allowBuild(player, block.getType()) != null) {
- return false;
- }
- }
- }
-
- if (Main.hasFactionsUUID) {
- FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
- FLocation flocation = new FLocation(block.getLocation());
- Faction faction = Board.getInstance().getFactionAt(flocation);
-
- if (!faction.hasAccess(fplayer, PermissibleAction.BUILD)) {
- if (!fplayer.isAdminBypassing()) {
- return false;
- }
- }
- }
-
- if (Main.hasTowny) {
- if (!PlayerCacheUtil.getCachePermission(player, block.getLocation(), block.getType(), TownyPermission.ActionType.BUILD)) {
- return false;
- }
- }
-
- if (Main.hasLands) {
- LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
- Area area = landsIntegration.getAreaByLoc(block.getLocation());
- if (area != null) {
- return area.canSetting(player, RoleSetting.BLOCK_PLACE, false);
- }
- }
-
- return true;
-
- }
-
- /**
- * Can player injure other player
- * @param player The player
- * @param victim The victim
- * @return If player can injure player
- */
- public static boolean canInjurePlayer(Player player, Player victim) {
- if (Main.hasWG) {
- LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
- RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
- RegionQuery query = container.createQuery();
-
- if (!query.testState(BukkitAdapter.adapt(victim.getLocation()), localPlayer, Flags.PVP)) {
- if (!WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(player.getWorld()))) {
- return false;
- }
- }
- }
-
- if (Main.hasGP) {
- Claim claim = GriefPrevention.instance.dataStore.getClaimAt(victim.getLocation(), false, null);
- if (claim != null) {
- return false;
- }
- }
-
- if (Main.hasFactionsUUID) {
- FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
- FLocation flocation = new FLocation(victim.getLocation());
- Faction faction = Board.getInstance().getFactionAt(flocation);
-
- if (faction.isPeaceful()) {
- if (!fplayer.isAdminBypassing()) {
- return false;
- }
- }
- }
-
- if (Main.hasTowny) {
- try {
- Town town = WorldCoord.parseWorldCoord(victim.getLocation()).getTownBlock().getTown();
- if (!town.isPVP()) {
- return false;
- }
- } catch (Exception ignored) {}
- }
-
- if (Main.hasLands) {
- LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
- Area area = landsIntegration.getAreaByLoc(victim.getLocation());
- if (area != null) {
- return area.canSetting(player, RoleSetting.ATTACK_PLAYER, false);
- }
- }
-
- return true;
- }
-
- /**
- * Can player injure mob
- * @param player The player
- * @param victim The victim
- * @return If player can injure player
- */
- public static boolean canInjureMob(Player player, LivingEntity victim) {
- if (Main.hasWG) {
- LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
- RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
- RegionQuery query = container.createQuery();
-
- if (!query.testState(BukkitAdapter.adapt(victim.getLocation()), localPlayer, Flags.DAMAGE_ANIMALS)) {
- if (!WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(player.getWorld()))) {
- return false;
- }
- }
- }
-
- if (Main.hasGP) {
- Claim claim = GriefPrevention.instance.dataStore.getClaimAt(victim.getLocation(), false, null);
- if (claim != null) {
- if(!claim.ownerID.equals(player.getUniqueId())) {
- return false;
- }
- }
- }
-
- if (Main.hasFactionsUUID) {
- FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
- FLocation flocation = new FLocation(victim.getLocation());
- Faction faction = Board.getInstance().getFactionAt(flocation);
-
- if (faction.hasAccess(fplayer, PermissibleAction.DESTROY)) {
- if (!fplayer.isAdminBypassing()) {
- return false;
- }
- }
- }
-
- if (Main.hasTowny) {
- try {
- Town town = WorldCoord.parseWorldCoord(victim.getLocation()).getTownBlock().getTown();
- if (!town.hasMobs()) {
- return false;
- }
- } catch (Exception ignored) {}
- }
-
- if (Main.hasLands) {
- LandsIntegration landsIntegration = new LandsIntegration(Main.getInstance());
- Area area = landsIntegration.getAreaByLoc(victim.getLocation());
- if (area != null) {
- return area.canSetting(player, RoleSetting.ATTACK_ANIMAL, false);
- }
- }
-
- return true;
- }
-
- /**
- * Does player have keep inventory
- * @param player The player
- * @return If player has keep inventory
- */
- public static boolean hasKeepInv(Player player) {
- return false;
- }
-}
diff --git a/pom.xml b/pom.xml
index 538fc786..12abefb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.willfp.ecoenchants
parent
- 4.1.0-pre10
+ 4.1.0-pre11
pom
EcoEnchants Parent
diff --git a/v1_15_R1/pom.xml b/v1_15_R1/pom.xml
index 99ef019d..1a7def3c 100644
--- a/v1_15_R1/pom.xml
+++ b/v1_15_R1/pom.xml
@@ -5,7 +5,7 @@
parent
com.willfp.ecoenchants
- 4.1.0-pre10
+ 4.1.0-pre11
4.0.0
diff --git a/v1_15_R1/v1_15_R1.iml b/v1_15_R1/v1_15_R1.iml
index f8dbe24a..8495d8c9 100644
--- a/v1_15_R1/v1_15_R1.iml
+++ b/v1_15_R1/v1_15_R1.iml
@@ -21,7 +21,7 @@
-
+
diff --git a/v1_16_R1/pom.xml b/v1_16_R1/pom.xml
index 5b193acc..ed31ee4f 100644
--- a/v1_16_R1/pom.xml
+++ b/v1_16_R1/pom.xml
@@ -5,7 +5,7 @@
parent
com.willfp.ecoenchants
- 4.1.0-pre10
+ 4.1.0-pre11
4.0.0
diff --git a/v1_16_R1/v1_16_R1.iml b/v1_16_R1/v1_16_R1.iml
index 57a46856..f2c68337 100644
--- a/v1_16_R1/v1_16_R1.iml
+++ b/v1_16_R1/v1_16_R1.iml
@@ -21,7 +21,7 @@
-
+
diff --git a/v1_16_R2/pom.xml b/v1_16_R2/pom.xml
index b01070ae..209a9efd 100644
--- a/v1_16_R2/pom.xml
+++ b/v1_16_R2/pom.xml
@@ -5,7 +5,7 @@
parent
com.willfp.ecoenchants
- 4.1.0-pre10
+ 4.1.0-pre11
4.0.0
diff --git a/v1_16_R2/v1_16_R2.iml b/v1_16_R2/v1_16_R2.iml
index 61879a6b..210cbd1a 100644
--- a/v1_16_R2/v1_16_R2.iml
+++ b/v1_16_R2/v1_16_R2.iml
@@ -12,7 +12,7 @@
-
+