Search in sources :

Example 1 with FLocation

use of com.massivecraft.factions.FLocation in project WildLoaders by BG-Software-LLC.

the class ClaimsProvider_FactionsUUID method hasClaimAccess.

@Override
public boolean hasClaimAccess(UUID player, Chunk chunk) {
    FPlayer fPlayer = FPlayers.getInstance().getById(player.toString());
    FLocation fLocation = new FLocation(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
    Faction faction = Board.getInstance().getFactionAt(fLocation);
    return !faction.isWilderness() && faction.getFPlayers().contains(fPlayer);
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) FLocation(com.massivecraft.factions.FLocation) Faction(com.massivecraft.factions.Faction)

Example 2 with FLocation

use of com.massivecraft.factions.FLocation 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

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