Search in sources :

Example 1 with FPlayers

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;
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) FPlayers(com.massivecraft.factions.FPlayers) Board(com.massivecraft.factions.Board) FLocation(com.massivecraft.factions.FLocation) MPlayer(com.massivecraft.factions.entity.MPlayer) Faction(com.massivecraft.factions.entity.Faction)

Aggregations

Board (com.massivecraft.factions.Board)1 FLocation (com.massivecraft.factions.FLocation)1 FPlayer (com.massivecraft.factions.FPlayer)1 FPlayers (com.massivecraft.factions.FPlayers)1 Faction (com.massivecraft.factions.entity.Faction)1 MPlayer (com.massivecraft.factions.entity.MPlayer)1