Skip to content

Commit

Permalink
Add Authme Hook to Fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Techcable committed Nov 11, 2014
1 parent 3c01339 commit d9e356d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 124 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
<id>metrics-repo</id>
<url>http://repo.mcstats.org/content/repositories/public</url>
</repository>
<repository>
<id>authme-repo</id>
<url>http://repository-authme.forge.cloudbees.com/snapshot/</url>
</repository>
</repositories>
<dependencies>
<dependency>
Expand Down Expand Up @@ -67,6 +71,13 @@
<!-- Needed at compile time but not runtime -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.xephi.authme.AuthMe</groupId>
<artifactId>AuthMe</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>

<build>
Expand Down
123 changes: 0 additions & 123 deletions src/main/java/com/trc202/CombatTag/CombatTagIncompatibles.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.trc202.CombatTag.CombatTag;
import com.trc202.CombatTagEvents.NpcDespawnReason;

import techcable.minecraft.combattag.PluginCompatibility;
import techcable.minecraft.combattag.Utils;

public class NoPvpPlayerListener implements Listener {
Expand Down Expand Up @@ -66,7 +67,7 @@ public void onPlayerQuit(PlayerQuitEvent e) {
plugin.entityListener.onPlayerDeath(quitPlr);
return;
}
if (plugin.isInCombat(playerUUID)) {
if (plugin.isInCombat(playerUUID) && PluginCompatibility.isAuthenticated(quitPlr)) {
//Player has logged out before the pvp battle is considered over by the plugin
alertPlayers(quitPlr);
if (plugin.settings.isInstaKill()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package techcable.minecraft.combattag;

import org.bukkit.entity.Player;

import fr.xephi.authme.api.API;

import lombok.*;

@Getter
public class PluginCompatibility {
private PluginCompatibility() {}

public static boolean isAuthenticated(Player player) {
if (!hasAuthme()) return true;
return API.isAuthenticated(player);
}

public static boolean hasAuthme() {
try {
Class.forName("fr.xephi.authme.AuthMe");
} catch (ClassNotFoundException ex) {
return false;
}
return true;
}
}

0 comments on commit d9e356d

Please sign in to comment.