diff --git a/pom.xml b/pom.xml
index 56c33e60c..69e0c32dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -412,24 +412,6 @@
-
-
- com.trc202
- CombatTag
- 6.2.1-SNAPSHOT
- provided
-
-
- org.bukkit
- bukkit
-
-
- org.bukkit
- craftbukkit
-
-
-
-
de.luricos.bukkit
diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java
index d38fbf9b2..6be444cd6 100644
--- a/src/main/java/fr/xephi/authme/AuthMe.java
+++ b/src/main/java/fr/xephi/authme/AuthMe.java
@@ -16,7 +16,6 @@ import fr.xephi.authme.converter.ForceFlatToSqlite;
import fr.xephi.authme.datasource.*;
import fr.xephi.authme.listener.*;
import fr.xephi.authme.plugin.manager.BungeeCordMessage;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.plugin.manager.EssSpawn;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.settings.Messages;
@@ -24,6 +23,8 @@ import fr.xephi.authme.settings.OtherAccounts;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.Spawn;
import net.milkbowl.vault.permission.Permission;
+import net.minelink.ctplus.CombatTagPlus;
+
import org.apache.logging.log4j.LogManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -62,7 +63,6 @@ public class AuthMe extends JavaPlugin {
private Messages m;
public DataManager dataManager;
public DataSource database;
-
private JsonCache playerBackup;
public OtherAccounts otherAccounts;
public Permission permission;
@@ -70,7 +70,7 @@ public class AuthMe extends JavaPlugin {
public Location essentialsSpawn;
public MultiverseCore multiverse;
public LookupService lookupService;
- public boolean combatTag = false;
+ public CombatTagPlus combatTagPlus = null;
public boolean legacyChestShop = false;
public boolean antibotMod = false;
public boolean delayedAntiBot = true;
@@ -176,8 +176,8 @@ public class AuthMe extends JavaPlugin {
// Find Permissions
checkVault();
- // Check Combat Tag Version
- checkCombatTag();
+ // Check Combat Tag Plus Version
+ checkCombatTagPlus();
// Check Multiverse
checkMultiverse();
@@ -501,8 +501,17 @@ public class AuthMe extends JavaPlugin {
}
// Check the presence of CombatTag
- public void checkCombatTag() {
- this.combatTag = server.getPluginManager().isPluginEnabled("CombatTag");
+ public void checkCombatTagPlus() {
+ if (server.getPluginManager().isPluginEnabled("CombatTagPlus")) {
+ try {
+ combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus");
+ ConsoleLogger.info("Hooked correctly with CombatTagPlus");
+ } catch (Exception | NoClassDefFoundError ingnored) {
+ combatTagPlus = null;
+ }
+ } else {
+ combatTagPlus = null;
+ }
}
// Check if a player/command sender have a permission
@@ -526,7 +535,7 @@ public class AuthMe extends JavaPlugin {
// Save Player Data
public void savePlayer(Player player) {
- if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) {
+ if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player))) {
return;
}
String name = player.getName().toLowerCase();
diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java
index 21822566d..7ba328b60 100644
--- a/src/main/java/fr/xephi/authme/Utils.java
+++ b/src/main/java/fr/xephi/authme/Utils.java
@@ -215,7 +215,14 @@ public class Utils {
public boolean isNPC(final Entity player) {
try {
- return player.hasMetadata("NPC");
+ if (player.hasMetadata("NPC")) {
+ return true;
+ } else if(plugin.combatTagPlus != null
+ && player instanceof Player
+ && plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) {
+ return true;
+ }
+ return false;
} catch (Exception e) {
return false;
}
diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java
index eb9cf3ff6..026a9577a 100644
--- a/src/main/java/fr/xephi/authme/api/API.java
+++ b/src/main/java/fr/xephi/authme/api/API.java
@@ -12,7 +12,6 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Settings;
@@ -66,9 +65,7 @@ public class API {
*/
@Deprecated
public boolean isaNPC(Player player) {
- if (utils.isNPC(player))
- return true;
- return CombatTagComunicator.isNPC(player);
+ return utils.isNPC(player);
}
/**
@@ -78,9 +75,7 @@ public class API {
*/
@Deprecated
public boolean isNPC(Player player) {
- if (utils.isNPC(player))
- return true;
- return CombatTagComunicator.isNPC(player);
+ return utils.isNPC(player);
}
/**
diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java
index 41b955e6b..604d9d2d7 100644
--- a/src/main/java/fr/xephi/authme/api/NewAPI.java
+++ b/src/main/java/fr/xephi/authme/api/NewAPI.java
@@ -14,7 +14,6 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Settings;
@@ -71,7 +70,7 @@ public class NewAPI {
* @return true if player is a npc
*/
public boolean isNPC(Player player) {
- return utils.isNPC(player) || CombatTagComunicator.isNPC(player);
+ return utils.isNPC(player);
}
/**
diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java
index 96ff1c813..e1bfea52b 100644
--- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java
+++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java
@@ -3,7 +3,6 @@ package fr.xephi.authme.listener;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils;
import fr.xephi.authme.cache.auth.PlayerCache;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.settings.Settings;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -39,9 +38,6 @@ public class AuthMeEntityListener implements Listener {
Player player = (Player) entity;
String name = player.getName().toLowerCase();
- if (CombatTagComunicator.isNPC(player))
- return;
-
if (PlayerCache.getInstance().isAuthenticated(name)) {
return;
}
@@ -171,11 +167,7 @@ public class AuthMeEntityListener implements Listener {
Player player = (Player) event.getEntity();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
- return;
- }
-
- if (utils.isNPC(player))
+ if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player))
return;
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
@@ -199,11 +191,7 @@ public class AuthMeEntityListener implements Listener {
Player player = (Player) event.getEntity();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
- return;
- }
-
- if (utils.isNPC(player))
+ if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player))
return;
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java
index 4386664ed..93884b283 100644
--- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java
+++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java
@@ -8,7 +8,6 @@ import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
@@ -56,7 +55,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -90,7 +89,7 @@ public class AuthMePlayerListener implements Listener {
final Player player = event.getPlayer();
final String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -126,7 +125,7 @@ public class AuthMePlayerListener implements Listener {
final Player player = event.getPlayer();
final String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -162,7 +161,7 @@ public class AuthMePlayerListener implements Listener {
final Player player = event.getPlayer();
final String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -198,7 +197,7 @@ public class AuthMePlayerListener implements Listener {
final Player player = event.getPlayer();
final String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -234,7 +233,7 @@ public class AuthMePlayerListener implements Listener {
final Player player = event.getPlayer();
final String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name)) {
@@ -271,7 +270,7 @@ public class AuthMePlayerListener implements Listener {
final Player player = event.getPlayer();
final String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player))
+ if (utils.isUnrestricted(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -306,7 +305,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
+ if (utils.isNPC(player) || utils.isUnrestricted(player)) {
return;
}
@@ -424,7 +423,7 @@ public class AuthMePlayerListener implements Listener {
public void run() {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
- Utils.getInstance().addNormal(player, limbo.getGroup());
+ utils.addNormal(player, limbo.getGroup());
LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase());
}
}
@@ -441,7 +440,7 @@ public class AuthMePlayerListener implements Listener {
final String name = player.getName().toLowerCase();
boolean isAuthAvailable = plugin.database.isAuthAvailable(name);
- if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
+ if (utils.isNPC(player) || utils.isUnrestricted(player)) {
return;
}
@@ -605,7 +604,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
@@ -633,7 +632,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
@@ -664,7 +663,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
@@ -691,7 +690,7 @@ public class AuthMePlayerListener implements Listener {
return;
final Player player = (Player) event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
if (utils.isNPC(player))
@@ -729,7 +728,7 @@ public class AuthMePlayerListener implements Listener {
Player player = (Player) event.getWhoClicked();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
@@ -759,7 +758,7 @@ public class AuthMePlayerListener implements Listener {
Player player = (Player) damager;
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
@@ -787,7 +786,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
+ if (utils.isNPC(player) || utils.isUnrestricted(player)) {
return;
}
@@ -811,11 +810,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
- return;
- }
-
- if (utils.isNPC(player))
+ if (utils.isUnrestricted(player) || utils.isNPC(player))
return;
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
@@ -838,7 +833,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
@@ -861,7 +856,7 @@ public class AuthMePlayerListener implements Listener {
}
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player)) {
+ if (utils.isUnrestricted(player)) {
return;
}
if (PlayerCache.getInstance().isAuthenticated(name)) {
@@ -884,10 +879,7 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player))
- return;
-
- if (utils.isNPC(player))
+ if (utils.isUnrestricted(player) || utils.isNPC(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
@@ -919,10 +911,7 @@ public class AuthMePlayerListener implements Listener {
String name = player.getName().toLowerCase();
- if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player))
- return;
-
- if (utils.isNPC(player))
+ if (utils.isUnrestricted(player) || utils.isNPC(player))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java
index 184cf8342..8e7960210 100644
--- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java
+++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java
@@ -59,9 +59,9 @@ public class AuthMeServerListener implements Listener {
plugin.legacyChestShop = false;
ConsoleLogger.info("ChestShop has been disabled, unhook!");
}
- if (pluginName.equalsIgnoreCase("CombatTag")) {
- plugin.combatTag = false;
- ConsoleLogger.info("CombatTag has been disabled, unhook!");
+ if (pluginName.equalsIgnoreCase("CombatTagPlus")) {
+ plugin.combatTagPlus = null;
+ ConsoleLogger.info("CombatTagPlus has been disabled, unhook!");
}
if (pluginName.equalsIgnoreCase("Vault")) {
plugin.permission = null;
@@ -78,8 +78,8 @@ public class AuthMeServerListener implements Listener {
plugin.checkMultiverse();
if (pluginName.equalsIgnoreCase("ChestShop"))
plugin.checkChestShop();
- if (pluginName.equalsIgnoreCase("CombatTag"))
- plugin.checkCombatTag();
+ if (pluginName.equalsIgnoreCase("CombatTagPlus"))
+ plugin.checkCombatTagPlus();
if (pluginName.equalsIgnoreCase("Vault"))
plugin.checkVault();
}
diff --git a/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java b/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java
deleted file mode 100644
index a98df2071..000000000
--- a/src/main/java/fr/xephi/authme/plugin/manager/CombatTagComunicator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package fr.xephi.authme.plugin.manager;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-
-import com.trc202.CombatTag.CombatTag;
-import com.trc202.CombatTagApi.CombatTagApi;
-
-import fr.xephi.authme.AuthMe;
-import net.minelink.ctplus.CombatTagPlus;
-
-public abstract class CombatTagComunicator {
-
- public static CombatTagApi combatApi;
-
- /**
- * Returns if the entity is an NPC
- *
- * @param player
- * @return true if the player is an NPC
- */
- public static boolean isNPC(Entity player) {
- if (!AuthMe.getInstance().combatTag)
- return false;
- try {
- if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) {
- combatApi = new CombatTagApi((CombatTag) Bukkit.getServer().getPluginManager().getPlugin("CombatTag"));
- try {
- combatApi.getClass().getMethod("isNPC");
- } catch (Exception e) {
- return false;
- }
- return combatApi.isNPC(player);
- } else {
- Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("CombatTagPlus");
- return (plugin != null && plugin instanceof CombatTagPlus && player instanceof Player && ((CombatTagPlus) plugin).getNpcPlayerHelper().isNpc((Player) player));
- }
- } catch (ClassCastException ex) {
- return false;
- } catch (NullPointerException npe) {
- return false;
- } catch (NoClassDefFoundError ncdfe) {
- return false;
- }
- }
-
-}
diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java
index fda8c97cd..a9e7d603e 100644
--- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java
+++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java
@@ -27,7 +27,6 @@ import fr.xephi.authme.events.FirstSpawnTeleportEvent;
import fr.xephi.authme.events.ProtectInventoryEvent;
import fr.xephi.authme.events.SpawnTeleportEvent;
import fr.xephi.authme.listener.AuthMePlayerListener;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.Spawn;
@@ -58,7 +57,7 @@ public class AsyncronousJoin {
AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode());
BukkitScheduler sched = plugin.getServer().getScheduler();
- if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
+ if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) {
return;
}
diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java
index b6cca4300..9a05229a9 100644
--- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java
+++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java
@@ -15,7 +15,6 @@ import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.listener.AuthMePlayerListener;
-import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.settings.Settings;
public class AsyncronousQuit {
@@ -44,7 +43,7 @@ public class AsyncronousQuit {
public void process() {
if (player == null)
return;
- if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
+ if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) {
return;
}