use of com.massivecraft.factions.FPlayers in project SilkSpawners by timbru31.
the class SilkSpawnersPlayerListener method checkIfFactionsPermitsBlockInteractions.
public boolean checkIfFactionsPermitsBlockInteractions(final Player player, final Block block) {
if (plugin.config.getBoolean("factionsSupport", false) && su.isPluginEnabled("Factions")) {
try {
final MPlayer mp = MPlayer.get(player);
final Faction blockFaction = BoardColl.get().getFactionAt(PS.valueOf(block.getLocation()));
if (!blockFaction.isNone() && !mp.isInOwnTerritory()) {
su.sendMessage(player, ChatColor.translateAlternateColorCodes('\u0026', plugin.localization.getString("changingDeniedFactions")));
return false;
}
} catch (@SuppressWarnings("unused") final NoClassDefFoundError e) {
// Try for legacy 1.6 factions, e.g. FactionsUUID
final FPlayers fPlayers = FPlayers.getInstance();
final FPlayer fPlayer = fPlayers.getByPlayer(player);
final Board board = Board.getInstance();
final com.massivecraft.factions.Faction blockFaction = board.getFactionAt(new FLocation(block.getLocation()));
if (!blockFaction.isWilderness() && !fPlayer.isInOwnTerritory()) {
su.sendMessage(player, ChatColor.translateAlternateColorCodes('\u0026', plugin.localization.getString("changingDeniedFactions")));
return false;
}
}
}
return true;
}