Surround with try/catch

This commit is contained in:
Xephi59 2015-06-29 02:51:39 +02:00
parent 487c91136c
commit 108bb5c357

View File

@ -1,13 +1,15 @@
package fr.xephi.authme.plugin.manager;
import com.trc202.CombatTag.CombatTag;
import com.trc202.CombatTagApi.CombatTagApi;
import net.minelink.ctplus.CombatTagPlus;
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;
public abstract class CombatTagComunicator {
public static CombatTagApi combatApi;
@ -28,6 +30,9 @@ public abstract class CombatTagComunicator {
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;
@ -36,10 +41,6 @@ public abstract class CombatTagComunicator {
} catch (NoClassDefFoundError ncdfe) {
return false;
}
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("CombatTagPlus");
return (plugin != null && plugin instanceof CombatTagPlus &&
player instanceof Player && ((CombatTagPlus) plugin).getNpcPlayerHelper().isNpc((Player) player));
}
}