mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-28 16:05:14 +01:00
Added support for KingdomsX
This commit is contained in:
parent
f99c6dbf62
commit
edfb1b40c7
@ -189,6 +189,12 @@
|
|||||||
<version>1.6.9.5-U0.5.13</version>
|
<version>1.6.9.5-U0.5.13</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.kingdoms</groupId>
|
||||||
|
<artifactId>kingdoms</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TownyAdvanced</groupId>
|
<groupId>com.github.TownyAdvanced</groupId>
|
||||||
<artifactId>Towny</artifactId>
|
<artifactId>Towny</artifactId>
|
||||||
|
@ -11,12 +11,16 @@ import java.util.Set;
|
|||||||
public class AnticheatManager {
|
public class AnticheatManager {
|
||||||
private static final Set<AnticheatWrapper> anticheats = new HashSet<>();
|
private static final Set<AnticheatWrapper> anticheats = new HashSet<>();
|
||||||
|
|
||||||
public static void registerAnticheat(AnticheatWrapper anticheat) {
|
public static boolean registerIfPresent(AnticheatWrapper anticheat) {
|
||||||
if(anticheat instanceof Listener) {
|
if(Bukkit.getPluginManager().isPluginEnabled(anticheat.getPluginName())) {
|
||||||
Bukkit.getPluginManager().registerEvents((Listener) anticheat, EcoEnchantsPlugin.getInstance());
|
if(anticheat instanceof Listener) {
|
||||||
}
|
Bukkit.getPluginManager().registerEvents((Listener) anticheat, EcoEnchantsPlugin.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
anticheats.add(anticheat);
|
anticheats.add(anticheat);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exemptPlayer(Player player) {
|
public static void exemptPlayer(Player player) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.willfp.ecoenchants.integrations.antigrief;
|
package com.willfp.ecoenchants.integrations.antigrief;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -11,8 +12,12 @@ import java.util.Set;
|
|||||||
public class AntigriefManager {
|
public class AntigriefManager {
|
||||||
private static final Set<AntigriefWrapper> antigriefs = new HashSet<>();
|
private static final Set<AntigriefWrapper> antigriefs = new HashSet<>();
|
||||||
|
|
||||||
public static void registerAntigrief(AntigriefWrapper antigrief) {
|
public static boolean registerIfPresent(AntigriefWrapper antigrief) {
|
||||||
antigriefs.add(antigrief);
|
if(Bukkit.getPluginManager().isPluginEnabled(antigrief.getPluginName())) {
|
||||||
|
antigriefs.add(antigrief);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.willfp.ecoenchants.integrations.antigrief.plugins;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.kingdoms.constants.kingdom.Kingdom;
|
||||||
|
import org.kingdoms.constants.land.Land;
|
||||||
|
import org.kingdoms.constants.player.KingdomPlayer;
|
||||||
|
import org.kingdoms.managers.PvPManager;
|
||||||
|
import org.kingdoms.managers.land.LandManager;
|
||||||
|
|
||||||
|
public final class AntigriefKingdomsX implements AntigriefWrapper {
|
||||||
|
private final LandManager landManager = new LandManager();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBreakBlock(Player player, Block block) {
|
||||||
|
BlockBreakEvent event = new BlockBreakEvent(block, player);
|
||||||
|
landManager.onBreak(event);
|
||||||
|
return !event.isCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCreateExplosion(Player player, Location location) {
|
||||||
|
Land land = Land.getLand(location);
|
||||||
|
if (land == null) return true;
|
||||||
|
if(!land.isClaimed()) return true;
|
||||||
|
|
||||||
|
Kingdom kingdom = land.getKingdom();
|
||||||
|
return kingdom.getKingdomMembers().contains(KingdomPlayer.getKingdomPlayer(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceBlock(Player player, Block block) {
|
||||||
|
Block placedOn = block.getRelative(0, -1, 0);
|
||||||
|
BlockPlaceEvent event = new BlockPlaceEvent(block, block.getState(), placedOn, player.getInventory().getItemInMainHand(), player, true, EquipmentSlot.HAND);
|
||||||
|
landManager.onPlace(event);
|
||||||
|
return !event.isCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInjure(Player player, LivingEntity victim) {
|
||||||
|
if(victim instanceof Player) {
|
||||||
|
return PvPManager.canFight(player, (Player) victim);
|
||||||
|
} else {
|
||||||
|
Land land = Land.getLand(victim.getLocation());
|
||||||
|
if (land == null) return true;
|
||||||
|
if(!land.isClaimed()) return true;
|
||||||
|
|
||||||
|
Kingdom kingdom = land.getKingdom();
|
||||||
|
return kingdom.getKingdomMembers().contains(KingdomPlayer.getKingdomPlayer(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "KingdomsX";
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,19 @@
|
|||||||
package com.willfp.ecoenchants.integrations.essentials;
|
package com.willfp.ecoenchants.integrations.essentials;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class EssentialsManager {
|
public class EssentialsManager {
|
||||||
private static final Set<EssentialsWrapper> registered = new HashSet<>();
|
private static final Set<EssentialsWrapper> registered = new HashSet<>();
|
||||||
|
|
||||||
public static void registerEssentials(EssentialsWrapper essentials) {
|
public static boolean registerIfPresent(EssentialsWrapper essentials) {
|
||||||
registered.add(essentials);
|
if(Bukkit.getPluginManager().isPluginEnabled(essentials.getPluginName())) {
|
||||||
|
registered.add(essentials);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerEnchantments() {
|
public static void registerEnchantments() {
|
||||||
|
@ -320,72 +320,67 @@ public class Loader {
|
|||||||
Logger.info("");
|
Logger.info("");
|
||||||
Logger.info("Loading Integrations...");
|
Logger.info("Loading Integrations...");
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) {
|
if(AntigriefManager.registerIfPresent(new AntigriefWorldGuard())) {
|
||||||
AntigriefManager.registerAntigrief(new AntigriefWorldGuard());
|
|
||||||
Logger.info("WorldGuard: §aENABLED");
|
Logger.info("WorldGuard: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("WorldGuard: §9DISABLED");
|
Logger.info("WorldGuard: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("GriefPrevention")) {
|
if(AntigriefManager.registerIfPresent(new AntigriefFactionsUUID())) {
|
||||||
AntigriefManager.registerAntigrief(new AntigriefGriefPrevention());
|
|
||||||
Logger.info("GriefPrevention: §aENABLED");
|
|
||||||
} else {
|
|
||||||
Logger.info("GriefPrevention: §9DISABLED");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("FactionsUUID")) {
|
|
||||||
AntigriefManager.registerAntigrief(new AntigriefFactionsUUID());
|
|
||||||
Logger.info("FactionsUUID: §aENABLED");
|
Logger.info("FactionsUUID: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("FactionsUUID: §9DISABLED");
|
Logger.info("FactionsUUID: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("Towny")) {
|
if(AntigriefManager.registerIfPresent(new AntigriefGriefPrevention())) {
|
||||||
AntigriefManager.registerAntigrief(new AntigriefTowny());
|
Logger.info("GriefPrevention: §aENABLED");
|
||||||
Logger.info("Towny: §aENABLED");
|
|
||||||
} else {
|
} else {
|
||||||
Logger.info("Towny: §9DISABLED");
|
Logger.info("GriefPrevention: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("Lands")) {
|
if(AntigriefManager.registerIfPresent(new AntigriefKingdomsX())) {
|
||||||
AntigriefManager.registerAntigrief(new AntigriefLands());
|
Logger.info("KingdomsX: §aENABLED");
|
||||||
|
} else {
|
||||||
|
Logger.info("KingdomsX: §9DISABLED");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(AntigriefManager.registerIfPresent(new AntigriefLands())) {
|
||||||
Logger.info("Lands: §aENABLED");
|
Logger.info("Lands: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("Lands: §9DISABLED");
|
Logger.info("Lands: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
|
if(AntigriefManager.registerIfPresent(new AntigriefTowny())) {
|
||||||
EssentialsManager.registerEssentials(new IntegrationEssentials());
|
Logger.info("Towny: §aENABLED");
|
||||||
|
} else {
|
||||||
|
Logger.info("Towny: §9DISABLED");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(EssentialsManager.registerIfPresent(new IntegrationEssentials())) {
|
||||||
Logger.info("Essentials: §aENABLED");
|
Logger.info("Essentials: §aENABLED");
|
||||||
EssentialsManager.registerEnchantments();
|
|
||||||
} else {
|
} else {
|
||||||
Logger.info("Essentials: §9DISABLED");
|
Logger.info("Essentials: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("AAC")) {
|
if(AnticheatManager.registerIfPresent(new AnticheatAAC())) {
|
||||||
AnticheatManager.registerAnticheat(new AnticheatAAC());
|
|
||||||
Logger.info("AAC: §aENABLED");
|
Logger.info("AAC: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("AAC: §9DISABLED");
|
Logger.info("AAC: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("Matrix")) {
|
if(AnticheatManager.registerIfPresent(new AnticheatMatrix())) {
|
||||||
AnticheatManager.registerAnticheat(new AnticheatMatrix());
|
|
||||||
Logger.info("Matrix: §aENABLED");
|
Logger.info("Matrix: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("Matrix: §9DISABLED");
|
Logger.info("Matrix: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
if(AnticheatManager.registerIfPresent(new AnticheatNCP())) {
|
||||||
AnticheatManager.registerAnticheat(new AnticheatNCP());
|
|
||||||
Logger.info("NCP: §aENABLED");
|
Logger.info("NCP: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("NCP: §9DISABLED");
|
Logger.info("NCP: §9DISABLED");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("Spartan")) {
|
if(AnticheatManager.registerIfPresent(new AnticheatSpartan())) {
|
||||||
AnticheatManager.registerAnticheat(new AnticheatSpartan());
|
|
||||||
Logger.info("Spartan: §aENABLED");
|
Logger.info("Spartan: §aENABLED");
|
||||||
} else {
|
} else {
|
||||||
Logger.info("Spartan: §9DISABLED");
|
Logger.info("Spartan: §9DISABLED");
|
||||||
|
@ -13,6 +13,7 @@ softdepend:
|
|||||||
- Towny
|
- Towny
|
||||||
- FactionsUUID
|
- FactionsUUID
|
||||||
- Lands
|
- Lands
|
||||||
|
- KingdomsX
|
||||||
- NoCheatPlus
|
- NoCheatPlus
|
||||||
- AAC
|
- AAC
|
||||||
- Matrix
|
- Matrix
|
||||||
|
BIN
lib/Kingdoms-1.9.2.jar
Normal file
BIN
lib/Kingdoms-1.9.2.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user